Suggestions on real-time video display with drawing
-
I wrote a VC++ 6.0 application few years back that we still use. Its basically a Dialog based application with a parent dialog and few child dialogs. Most of the child dialogs have something to do with drawing upon requests from parent dialog. The application itself is multi- threaded. Most of the drawing on some dialogs is done using gdiplus and for a couple using just MFC drawing functions. The only issue is have with this is that it flickers a bit and that flicker rate is different on different systems. We are now thinking of redeveloping the application on VS2010 as support for XP which supports VC++ 6.0 has ended and its getting harder and harder to get PCs with XP on them or even to install XP. I am looking at some best options to choose from to implement in VS2010 for real-time drawing without flicker issues while the core structure will be the same for most part. We will be sticking with dialog based application again as we don't see any real use for SDI or MDI based application in our case. The core of the program is dependent on frames captured from a scientific camera and do some analysis on that frame and do the following Draw the captured frame on a dialog and draw some graphics (squares/lines) on the same frame based on analysis 4 more dialogs (in which one will have plots in it) will draw/refresh with new analysis data for that frame. I am looking at few options like OpenCV (which we already use in other applications) Direct2D (my application doesn't involve any 3D graphics) GdiPlus (not sure if this works better on VS2010) Any suggestions? thanks
PKNT
-
I wrote a VC++ 6.0 application few years back that we still use. Its basically a Dialog based application with a parent dialog and few child dialogs. Most of the child dialogs have something to do with drawing upon requests from parent dialog. The application itself is multi- threaded. Most of the drawing on some dialogs is done using gdiplus and for a couple using just MFC drawing functions. The only issue is have with this is that it flickers a bit and that flicker rate is different on different systems. We are now thinking of redeveloping the application on VS2010 as support for XP which supports VC++ 6.0 has ended and its getting harder and harder to get PCs with XP on them or even to install XP. I am looking at some best options to choose from to implement in VS2010 for real-time drawing without flicker issues while the core structure will be the same for most part. We will be sticking with dialog based application again as we don't see any real use for SDI or MDI based application in our case. The core of the program is dependent on frames captured from a scientific camera and do some analysis on that frame and do the following Draw the captured frame on a dialog and draw some graphics (squares/lines) on the same frame based on analysis 4 more dialogs (in which one will have plots in it) will draw/refresh with new analysis data for that frame. I am looking at few options like OpenCV (which we already use in other applications) Direct2D (my application doesn't involve any 3D graphics) GdiPlus (not sure if this works better on VS2010) Any suggestions? thanks
PKNT
GDI+ works. I suppose flickering is an application problem (it is not a library fault). If you already know OpenCv then using it is an option (as far as I know is rather optimized). I would use Direct2D only if performance really matters, because (I suppose) the learning step could be heavy. On a completely different approach, I would also consider using
C#
instead ofC++
withMFC
. -
GDI+ works. I suppose flickering is an application problem (it is not a library fault). If you already know OpenCv then using it is an option (as far as I know is rather optimized). I would use Direct2D only if performance really matters, because (I suppose) the learning step could be heavy. On a completely different approach, I would also consider using
C#
instead ofC++
withMFC
.Thanks for your reply Pallini, I need to interface external hardware in this application that come with C++ api than C#, so I am a bit stuckw ith C++/MFC combo I guess. Basically I get a 512x512 8bit pixel data from a framegrabber which I need to display in realtime and even draw some graphics on this image as needed (mostly squares, dots and lines) based on a colorbar.
PKNT
-
Thanks for your reply Pallini, I need to interface external hardware in this application that come with C++ api than C#, so I am a bit stuckw ith C++/MFC combo I guess. Basically I get a 512x512 8bit pixel data from a framegrabber which I need to display in realtime and even draw some graphics on this image as needed (mostly squares, dots and lines) based on a colorbar.
PKNT
You need to double buffer the output. Create a bitmap in memory; copy from your frame to that bitmap, then draw your extra graphics on that bitmap. Then when it's done draw it to the screen in one blit. That's how you get rid of the flicker. Gdi+ will do it fine.