4

I have a framegrabber (Silicon Software ) and I managed to show the grabbed images from a pointer in 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. Anybody has any idea?

Flot2011
  • 4,601
  • 3
  • 44
  • 61
user261002
  • 2,182
  • 10
  • 46
  • 73

3 Answers3

3

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

cv::namedWindow("test",cv::WINDOW_AUTOSIZE);                        
hWnd2 = (HWND) cvGetWindowHandle("test"); 
hParent = ::GetParent(hWnd2);       
::SetParent(hWnd2, hParent); 
::ShowWindow(hParent, SW_HIDE);
Brent81
  • 1,152
  • 1
  • 13
  • 19
user261002
  • 2,182
  • 10
  • 46
  • 73
2

if you want your own window, it's probably better, to skip the whole highgui stuff, and do your own blitting as well.

have a look at the src of cvShowImage(), highgui/src/window_w32.cpp,l 1384, to see, what they're doing here

berak
  • 39,159
  • 9
  • 91
  • 89
0

Don't know exactly what you mean by "child window", but you could grab the pixel information from OpenCV's IplImage format and convert it to whatever format you need it for your window.

M Rajoy
  • 4,028
  • 14
  • 54
  • 111