我的程序应该从第三方应用程序加载图片,将其显示在PictureBox中。然后通过一些图像处理算法修改图像,并在同一PictureBox中显示结果图像。然后从外部系统获取另一个图像,显示它,处理它,显示结果等等。所有这一切都应该导致用户看到图像,然后延迟几秒钟。
是否可以在Windows窗体中执行此操作(项目使用C ++ / CRL编写)?如果是这样,我该怎么做?
我到目前为止所做的代码看起来像这样(我只显示我认为与理解我想要实现的内容相关的代码块):
private: Bitmap^ image1;
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
//connecting to the third party application
PImage PI;
PI.EstablishConnection();
//setting image parameters
PI.setImageParameters(x, y, z, yaw, pitch, roll);
//retrieving image data
int W = PI.returnCols();
int H = PI.returnRows();
//updating Bitmap object as per image data
image1 = gcnew Bitmap (W, H);
//....
//function to modify the display and load the new image in pictureBox
ModifyDisplay (image1->Height, image1->Width, image1, PI);
pictureBox1->Image = image1;
//...
//process current image using some algorithms
//modify current image as per the processing and display it
ModifyDisplay (image1->Height, image1->Width, image1, PI);
pictureBox1->Image = image1;
//...fetch a new image
//function to modify the display and load the second image in pictureBox
ModifyDisplay (image1->Height, image1->Width, image1, PI);
pictureBox1->Image = image1;
//...
//process second image using some algorithms
//...and so on
}
我得到的结果是只显示最后一张图像,之前所有的图像都没有显示。