0

我的程序应该从第三方应用程序加载图片,将其显示在 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
}

我得到的结果是只显示最后一张图像,之前发生的一切都没有显示。

4

0 回答 0