Opencv读取各种格式图片,在TBitmap上面重绘
2016-01-07 15:28
435 查看
//opencv读取图片 cv::Mat image; //const char *fileName = "HeadImage-UI/Photo-001.bmp"; const char *fileName = "HeadImage-UI/53d253192be47412.jpg!200x200.jpg"; image = cv::imread(fileName); //bitmap冲回image Graphics::TBitmap *bitmap = new Graphics::TBitmap; bitmap->PixelFormat = pf24bit; bitmap->Height = image.rows; bitmap->Width = image.cols; for(int y=0;y<bitmap->Height;y++) { uchar *ptr = image.ptr<uchar>(y); Byte *p=(Byte*)bitmap->ScanLine[y]; for(int x=0;x<bitmap->Width;x++) { p[0] = ptr[0]; p[1] = ptr[1]; p[2] = ptr[2]; p+=3; ptr+=3; } } Image1->Picture->Bitmap = bitmap;
相关文章推荐
- 基于Tomcat7、Java、WebSocket的服务器推送聊天室
- elasticsearch-hadoop使用示例
- Linux inode 索引节点已满导致服务无法开启的详细解决方法
- 17.shell脚本编程(2)
- linux各文件夹的作用
- CentOS 7 安装MySQL
- 网站优化的那些事
- 加密和解密基础知识、linux上的私有CA实现方法、学习总结
- 解决linux看温度是报错No sensors found问题
- 正篇 一. 开发前须知 1.2Android 关于项目架构的问题:(
- Linux Shell删除某一个目录下的所有文件夹(保留其他文件)
- Hadoop2.2.0已经遗弃的属性名称
- 那些年我们一起做过的shell面试题(二)
- ng-option 的两种写法
- Linux中的ps命令
- Linux集群系统Heartbeat
- auto_ptr、shared_ptr、weak_ptr、scoped_ptr用法小结
- Linux下chkconfig命令详解
- ceph对象存储(rgw)服务、高可用安装配置
- linux常用命令的英文单词缩写