How to add an OpenCV display window as a child of another window in Win32 C ++ applications?

I have a framegrabber (Silicon Software), and I was able to show captured images from a pointer in a memory buffer using OpenCV.

Now I want to create an application (Win32) and place the openCV window as a child window of the main application window. Does anyone have an idea?

+4
source share
3 answers

I found the answer, it was easy. Just a couple lines of code. here he is:

cv::namedWindow("test",cv::WINDOW_AUTOSIZE); hWnd2 = (HWND) cvGetWindowHandle("test"); hParent = ::GetParent(hWnd2); ::SetParent(hWnd2, hParent); ::ShowWindow(hParent, SW_HIDE); 
+3
source

if you want your own window to probably be better to skip all the highgui stuff, and do your own blitting as well.

look at src cvShowImage (), highgui / src / window_w32.cpp, l 1384 to see what they do here

+2
source

I don’t know exactly what you mean by a "child window", but you can capture pixel information from the IplImage OpenCV format and convert it to any format you need for your window.

0
source

All Articles