码迷,mamicode.com
首页 > 其他好文 > 详细

picture control +opencv打开摄像头(set parent方法)

时间:2017-03-06 22:05:30      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:window   static   idc   imshow   etc   name   大小   方法   ati   

在Oninit()

里添加

cv::namedWindow("view", cv::WINDOW_NORMAL);
	HWND hWnd = (HWND)cvGetWindowHandle("view");
	HWND hParent = ::GetParent(hWnd);
	::SetParent(hWnd, GetDlgItem(IDC_STATIC)->m_hWnd);
	::ShowWindow(hParent, SW_HIDE);
	cv::resizeWindow("view", 803, 617);//和我的picture control大小一致

在button里添加

cv::VideoCapture capture;
	cv::Mat myImagine;
	capture.open(0);
	CRect rect;
	GetDlgItem(IDC_STATIC)->GetClientRect(&rect);
	
	for (;;)
	{
		capture >> myImagine;
		cv::imshow("view", myImagine);
		cvWaitKey(10);
	}

  

picture control +opencv打开摄像头(set parent方法)

标签:window   static   idc   imshow   etc   name   大小   方法   ati   

原文地址:http://www.cnblogs.com/necp-zwl/p/6512130.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!