Ask Your Question

Win32 GUI application using OpenCV lib

asked 2014-06-09 05:12:12 -0600

huongnhat gravatar image

Dear all, I'm building a media player app using Win32 GUI (The win32 application). I have stuck at displaying images / video on win32 (which considered easy when dealing with win32 console as we can use built-in function of OpenCV highgui). After days of searching google, I found that win32 accept bitmap image and using draw tool, device context to display image. So how do I use processed data in OpenCV (Mat, IplImage object) as input for win32 application? Please give me an example / instructions / link of how to do it. Thanks in advance.

edit retag flag offensive close merge delete


Can someone help me please. The image display by cvShowImage() or imshow() always create a new windows instead of old one. I tried getWindowName() of the old window, then pass to cvShowImage / imshow but it create a new one with same title. ZZ

huongnhat gravatar imagehuongnhat ( 2014-06-09 23:21:22 -0600 )edit

You can find information about drawing a cv::Mat to a MFC DC here: How-to-display-an-OpenCV-image-or-video-in-your-own-MFC-interface

pklab gravatar imagepklab ( 2015-05-06 13:33:07 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-06-10 07:03:03 -0600

You can find from this link a dialog based MFC application that applies a diversity of background substraction algorithms on video file. The same technique can be used with a Win32 application.

edit flag offensive delete link more


Thanks for your answer. But I want to build a win32 API based application, it will have openCV as a processor for images / video frames and the win32 will take the openCV's output as input and display it to the screen. Or some functions like cvShowImage() which can take a HWND as a parameter to specify which windows I want to display the images. I found one at opencv/sources/modules/highgui/src/window_win32 but I don't know how to include / call that function

huongnhat gravatar imagehuongnhat ( 2014-06-10 20:53:44 -0600 )edit

The technique used SW_HIDE flag left a blink window. How can I fix that?

huongnhat gravatar imagehuongnhat ( 2014-06-10 21:51:09 -0600 )edit

I understand what you wish to do and the technique from the sample can be used in a Win32 application to meet your need, I am sure for that. In case you have another solution, could you share your way?

tuannhtn gravatar imagetuannhtn ( 2014-06-11 00:05:30 -0600 )edit

I know it works but the call to cvNameWindow leaves a blink window (show a gray one and immediately disappear after that). How can I fix that?

huongnhat gravatar imagehuongnhat ( 2014-06-11 22:39:52 -0600 )edit

The call to function cvNameWindow is not the cause of the blink, but the statement: ::ShowWindow(hParent, SW_HIDE);. I do not know how to fix this and I think it does not matter as it appears only once. Or may be you want to give Qt framework a try.

tuannhtn gravatar imagetuannhtn ( 2014-06-12 04:55:56 -0600 )edit

Question Tools

1 follower


Asked: 2014-06-09 05:12:12 -0600

Seen: 3,058 times

Last updated: Jun 10 '14