注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 腾讯技术类笔试题
 帮助

bmp 到IplImage的转换


2008-07-07 15:15:44
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://juwen.blog.51cto.com/135311/86209
用上一篇的文章bmp=>iplimage的转换出来的图像单色,而且效果很差。我重新改了一下。其它部分以后更新。
原来方法:
IplImage * BmpTOIpl(int width,int height,unsigned char  *pBuffer)
{
    IPlImage 
*image =cvCreateImage(cvSize(width,height),8,1);
   image
->imageData=pBuffer;
   
return image;
}

更改之后方法:
IplImage * BmpTOIpl(int width,int height,unsigned char  *pBuffer)
{
   IplImage *image =new IplImage;
   cvInitImageHeader(image, cvSize(width,height), 8, 3,IPL_ORIGIN_BL, 4); //创建iplimage
 cvSetData(image, pBuffer, width*3); //copy数据
   return image;
}

本文出自 “jonsoft” 博客,请务必保留此出处http://juwen.blog.51cto.com/135311/86209





    文章评论
 
 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: