![]() | 1 | initial version |
Qt support isn't needed if you use MFC. To display a cv::Mat into MFC control you have 2 way.
try this:
const char * WIN_NAME_CV = "Histogram";
namedWindow(WIN_NAME_CV, CV_WINDOW_KEEPRATIO);
RECT rcDlg; //ScreenToClient
HWND myhWnd = GetDlgItem(IDC_HISTOGRAM)->GetSafeHwnd();
// Or if you have the object for your static control
//HWND myhWnd = m_HistogramControl.GetSafeHwnd();
::GetWindowRect(myhWnd, &rcDlg);
int winWidth = rcDlg.right - rcDlg.left;
int winHeight = rcDlg.bottom - rcDlg.top;
HWND hWnd = (HWND)cvGetWindowHandle(WIN_NAME_CV);
HWND hParent = ::GetParent(hWnd);
::SetParent(hWnd, myhWnd);
::ShowWindow(hParent, SW_HIDE);
cvResizeWindow(WIN_NAME_CV, winWidth, winHeight);
![]() | 2 | No.2 Revision |
Qt support isn't needed if you use MFC.
To display a cv::Mat into MFC control you have 2 way.way:
try this:this for 2nd way:
const char * WIN_NAME_CV = "Histogram";
namedWindow(WIN_NAME_CV, CV_WINDOW_KEEPRATIO);
RECT rcDlg; //ScreenToClient
rcDlg;
HWND myhWnd = GetDlgItem(IDC_HISTOGRAM)->GetSafeHwnd();
// Or if you have the object for your static control
//HWND myhWnd = m_HistogramControl.GetSafeHwnd();
::GetWindowRect(myhWnd, &rcDlg);
int winWidth = rcDlg.right - rcDlg.left;
int winHeight = rcDlg.bottom - rcDlg.top;
HWND hWnd = (HWND)cvGetWindowHandle(WIN_NAME_CV);
HWND hParent = ::GetParent(hWnd);
::SetParent(hWnd, myhWnd);
::ShowWindow(hParent, SW_HIDE);
cvResizeWindow(WIN_NAME_CV, winWidth, winHeight);