opencv-IplImage结构图像画到HDC上
2010-12-28 23:14
1071 查看
Code:
// draw image(IplImage) to hdc
void DrawPicToHDC(IplImage *img, UINT ID, HWND hwnd)
{
// mfc 方法
// HWND *pDC = GetDlgItem(ID)->GetDC();
// HDC hDC= pDC->GetSafeHdc();
// GetDlgItem(ID)->GetClientRect(&rect);
// CvvImage cimg;
// cimg.CopyOf(img);
// cimg.DrawToHDC(hDC,&rect);
// ReleaseDC(hDC);
// win32方法
// get the handle of static control id
HWND hID= GetDlgItem(hwnd, ID);
// get the hdc of the handle
HDC hDC = GetDC(hID);
// the rect struct
RECT rect;
// get the client of the handle set it in the rect
GetClientRect(hID,&rect);
// a class of image
CvvImage cimg;
// IplImage copy to CvvImage
cimg.CopyOf(img);
// show the IplImage to the hdc
cimg.DrawToHDC(hDC,&rect);
// release dc
ReleaseDC(hID, hDC);
}
// draw image(IplImage) to hdc
void DrawPicToHDC(IplImage *img, UINT ID, HWND hwnd)
{
// mfc 方法
// HWND *pDC = GetDlgItem(ID)->GetDC();
// HDC hDC= pDC->GetSafeHdc();
// GetDlgItem(ID)->GetClientRect(&rect);
// CvvImage cimg;
// cimg.CopyOf(img);
// cimg.DrawToHDC(hDC,&rect);
// ReleaseDC(hDC);
// win32方法
// get the handle of static control id
HWND hID= GetDlgItem(hwnd, ID);
// get the hdc of the handle
HDC hDC = GetDC(hID);
// the rect struct
RECT rect;
// get the client of the handle set it in the rect
GetClientRect(hID,&rect);
// a class of image
CvvImage cimg;
// IplImage copy to CvvImage
cimg.CopyOf(img);
// show the IplImage to the hdc
cimg.DrawToHDC(hDC,&rect);
// release dc
ReleaseDC(hID, hDC);
}
相关文章推荐
- opencv-IplImage结构图像画在hdc上
- OPENcv从相机采集图像数据-图像处理接口IPLIMAGE结构的指针
- OpenCV 中的图像结构IPLImage 和 Qt中QImage之间的转换源代码【z】
- OpenCV学习(八)之OpenCV中IplImage和CvMat图像数据结构
- 从摄像头获得图像的坐标原点是在左下角(OpenCV中IplImage结构中的origin成员)
- 从摄像头获得图像的坐标原点是在左下角(OpenCV中IplImage结构中的origin成员)
- OpenCV 中的图像结构IPLImage 和 Qt中QImage之间的转换源代码
- opencv图像处理1--IPlImage结构分析
- opencv图像处理1--IPlImage结构分析
- OpenCV 中的图像结构IPLImage 和 Qt中QImage之间的转换源代码
- OPENcv从相机采集图像数据-图像处理接口IPLIMAGE结构的指针
- openCV--图像处理类IplImage
- OpenCV获取图像的高和宽(Iplimage)
- opencv IplImage的数据结构
- Halcon Image与OpenCV IplImage图像数据相互转换
- OpenCV用GDI或者GDI+函数对IplImage图像处理
- OpenCV的IplImage图像格式
- 谈谈我对opencv中IplImage图像参数widthstep的理解
- 使用GDI+显示OpenCV中的图像IplImage
- opencv中图像数据结构总结