Search code examples
c#imagewinformscamerapicturebox

Display raw image as video on winform (over 30fps)


I receive 30 raw images per second via USB. (real time camera iamge / but not webcam)

// raw image is Format32bppPArgb Bitmap

while ( true ) // Recevie Image loop Using Task
{
    ...
    picturebox1.Image = raw_image;
    // panel1.BackgroundImage = raw_image; // or using panel to display
    ...
}

I updated the image to make it look like an Video. When the image is 15fps, it's the program working properly. But 30fps, GUI is broken. The image area is refreshed smoothly and well. However, other components will not be updated if there is a change, causing problems. (such as radiobutton, panel, title bar, etc..) This seems to occur noticeably when the area of drawing the image is widened.

As a result of referring to other articles in stackoverflow, I was able to check some related information, but I couldn't solve it clearly using Winform. it seems that fast redrawing in this way is difficult through winform. (I don't know if I got it right.)

Are there any good ways or keywords to solve this problem? Thank you for reading it.


Solution

  • The default bitmap resizing was thought to be heavy. 'zoom mode' has been changed to 'none'. The image was resized to fit the panel size before making it into a bitmap. (this case, i use opencvsharp resize / image.ToBitmap() )

    The image was created and call invalidate(). Displayed through "Graphics.DrawImage" in the panel's "onpaint event". Now everything is working normally.