1,在MFC窗体中添加picture control控件,并添加对应的变量名
2,在窗体的初始化窗口中添加:
namedWindow("show", 0); HWND hWnd = (HWND)cvGetWindowHandle("show"); HWND hParent = ::GetParent(hWnd); ::SetParent(hWnd, GetDlgItem(IDC_STATIC)->m_hWnd); ::ShowWindow(hParent, SW_SHOW); GetDlgItem(IDC_STATIC_CV)->GetClientRect(&m_glb.rectD);
3,在需要显示窗口的地方添加:
cv::Mat m_dst; cv::resize(binaryDiffFrame, m_dst, cv::Size(rectD.Width(), rectD.Height())); imshow("view",m_dst); waitKey(2);
来源:https://www.zhihu.com/question/29611790/answer/45068617