您的位置:首页 > 其它

[转]CvvImage类以及在MFC中显示IplImage图像的方法

2010-11-29 09:48 357 查看
转自:http://blog.sina.com.cn/s/blog_532f5c210100gxrw.html

在MFC的View类中:

1 void CMyView::ShowIplImage(IplImage* img)
2 {
3 CDC* pDC = GetDC();
4 HDC hDC= pDC->GetSafeHdc(); CRect rect; rect.SetRect(0 , 0 , img->width , img->height); CvvImage cimg; cimg.CopyOf(img); cimg.DrawToHDC(hDC,&rect); ReleaseDC(pDC);
5 }

在Dialog中:

1 void Cdialog_iplImageDlg::DrawPicToHDC(IplImage* iplimg , UINT ID)
2 {
3 CDC *pDC = GetDlgItem(ID)->GetDC();
4 HDC hDC= pDC->GetSafeHdc();
5 CRect rect;
6 GetDlgItem(ID)->GetClientRect(&rect);
7 CvvImage cimg;
8 cimg.CopyOf(iplimg);
9 cimg.DrawToHDC(hDC,&rect);
10 ReleaseDC(pDC);
11 }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: