opencv-Win32下HBITMAP格式图像 Convert to为opencv下 IplImage
来源:互联网 发布:阿唯得旗舰店淘宝 编辑:程序博客网 时间:2024/06/05 19:57
- // hbitmap convert to IplImage
- IplImage* hBitmapToIpl(HBITMAP hBmp)
- {
- BITMAP bmp;
- GetObject(hBmp,sizeof(BITMAP),&bmp);
- // get channels which equal 1 2 3 or 4
- // bmBitsPixel :
- // Specifies the number of bits
- // required to indicate the color of a pixel.
- int nChannels = bmp.bmBitsPixel == 1 ? 1 : bmp.bmBitsPixel/8 ;
- // get depth color bitmap or grayscale
- int depth = bmp.bmBitsPixel == 1 ? IPL_DEPTH_1U : IPL_DEPTH_8U;
- // create header image
- IplImage* img = cvCreateImage(cvSize(bmp.bmWidth,bmp.bmHeight),depth,nChannels);
- // allocat memory for the pBuffer
- BYTE *pBuffer = new BYTE[bmp.bmHeight*bmp.bmWidth*nChannels];
- // copies the bitmap bits of a specified device-dependent bitmap into a buffer
- GetBitmapBits(hBmp,bmp.bmHeight*bmp.bmWidth*nChannels,pBuffer);
- // copy data to the imagedata
- memcpy(img->imageData,pBuffer,bmp.bmHeight*bmp.bmWidth*nChannels);
- delete pBuffer;
- // create the image
- IplImage *dst = cvCreateImage(cvGetSize(img),img->depth,3);
- // convert color
- cvCvtColor(img,dst,CV_BGRA2BGR);
- cvReleaseImage(&img);
- return dst;
- }
- opencv-Win32下HBITMAP格式图像 Convert to为opencv下 IplImage
- OpenCV在win32下不显示图像
- win32下handle转化为HBITMAP
- OPENCV下针对IplImage实现图像增强处理
- OPENCV下针对IplImage实现图像增强处理
- opencv中遍历图像(IplImage格式)
- 图像处理之 YUYV422 To OpenCV IplImage
- 图像处理之 YUYV422 To OpenCV IplImage
- How to convert an OpenCV IplImage to an SDL_Surface?
- opencv 图像显示IplImage
- Convert OpenCV (iplImage) to PyQt5 QImage/QPixmap in Python
- opencv MP4图像序列下采样 并将保存为avi格式
- 【OpenCV图像处理】IplImage转换灰度图像及Cvmat与IplImage格式之间的相互转换
- openCV--图像处理类IplImage
- opencv 表示图像的IplImage
- [OpenCV] cv::Mat to IplImage*
- 【opencv】【图像压缩】opencv下的DCT变换压缩图像
- opencv-IplImage结构图像画到HDC上
- 添加声音的代码
- 深入体会__cdecl与__stdcall
- win32下handle转化为HBITMAP
- opencv-IplImage结构图像画在hdc上
- 熊猫眼啦!头晕得写不鸟程序啦!来谈谈我已经过大半的大学生活吧
- opencv-Win32下HBITMAP格式图像 Convert to为opencv下 IplImage
- 设计网站需要思考的5个目标
- Java注解
- 这就叫重新来--1
- 关系型数据库完整性规则
- 新的一天开始了
- 最牛逼的PHP视频教程115网盘免费下载,嗷嗷给力
- 新人想说的一些话
- SQL导入/导出数据到excel