用opencv显示视频流,调用namedWindow时界面闪烁问题
mfc吧
全部回复
仅看楼主
level 1
EggLee_ 楼主
用opencv显示视频流,调用namedWindow时界面闪烁,查阅相关资料是因为调用namedWindow函数会创建父窗口和子窗口,再隐藏父窗口所致。求教各位大神怎样解决这一问题,万分感谢!
代码如下:
pWnd[3] = GetDlgItem(IDC_Sony);
pWnd[3]->SetWindowPos(NULL, 1 * nFullWidth / 1366, 6 * nFullHeight / 768, 1077 * nFullWidth / 1366, 600 * nFullHeight / 768, SWP_NOZORDER);
namedWindow("view_video_sony", WND_PROP_FULLSCREEN);
resizeWindow("view_video_sony", 1077 * nFullWidth / 1366, 600 * nFullHeight / 768);
hWnd = (HWND)cvGetWindowHandle("view_video_sony");
hParent = ::GetParent(hWnd);
::SetParent(hWnd, GetDlgItem(IDC_Sony)->m_hWnd);
::ShowWindow(hParent, SW_HIDE);
2020年11月09日 07点11分 1
level 2
cv::namedWindow("摄像头", cv::WINDOW_AUTOSIZE);
HWND hWnd = (HWND)cvGetWindowHandle("摄像头");
HWND hParent = ::GetParent(hWnd);
::SetParent(hWnd, GetDlgItem(IDC_STA_TakePhoto)->m_hWnd);
::ShowWindow(hParent, SW_HIDE);
CRect picRect;
GetDlgItem(IDC_STA_TakePhoto)->GetClientRect(picRect);
capture >> frame;
resize(frame, showFrame, cv::Size(picRect.Width(), picRect.Height()));
imshow("摄像头", showFrame);
把mat 显示到picture control控件
2020年12月24日 06点12分 2
1