Mat imread 与 IplImage cvLoadImage区别
来源:互联网 发布:tpo小站模考软件mac 编辑:程序博客网 时间:2024/05/20 05:58
Mat imread 与 IplImage cvLoadImage区别
原文地址 http://blog.163.com/yuyang_tech/blog/static/21605008320132510104620/
Q : I have two options to load images: 来源1
1- Mat and Imread
2- IplImage and CvLoadImage
Which one is better to use?
A : They are the two different interfaces (Mat
/imread
for C++ and Ipl... and Cv.. for C interface). The C++ interface is nicer, safer and easier to use. It automatically handles memory for you, and allows you to write less code for the same task. The OpenCV guys advocate for the usage of C++, unless some very specific project requirements force you to C.
Example (C++)
cv::Mat image = imread("path/to/myimage.jpg")if(image.empty()) return;cv::imshow("Image", image);cv::Mat bw = image > 128; // threshold imagecv::Mat crop = image(cv::Rect(0, 0, 100, 100)); // a 100px x 100px cropcrop= 0; // set image to 0cv::waitKey();
Note that if not stated otherwise, all matrix assignments reference the same data. In the example above, the crop matrix points to image, and setting it to zero will set that specific part of the image to 0.
To create a new copy of data, use Mat::copyTo, or Mat::clone();
And the C interface
IplImage* pImg = CvLoadImage("path/to/myimage.jpg");if(pImg == NULL) return;// ... big bloat to do the same operations with IplImage CvShowImage("Image", pImg);cvWaitKey();CvReleaseImage(&pImg); // Do not forget to release memory.
另:来源2
1.imread是C++接口,cvloadimage是c接口。2.imread的定义在highgui.hpp中,cvloadimage的定义在highgui-c.h中,而highgui.hpp和highgui-c.h都包含在highgui.h中,所以我们在写程序是只要包含了highgui.h,那么我们就可以用两个接口。
- Mat imread 与 IplImage cvLoadImage区别
- Mat imread 与 IplImage cvLoadImage区别
- Mat imread 与 IplImage cvLoadImage区别
- OpenCV中 IplImage 与 Mat的区别
- Mat、cvMat与IplImage
- opencv2.4.9+VS2013中imread和cvLoadimage的使用区别
- IMread和cvloadimage
- Mat CvMat IplImage 之间的区别与相互转换方法
- Mat与IplImage的转换
- OpenCV中 IplImage 与 Mat
- opencv Mat 与IplImage 转换
- Mat与IplImage相互转换
- OpenCV中 IplImage 与 Mat
- Mat与IplImage互相转换
- #include< > 和 #include” ” 的区别以及绝对地址引用\\以及cvLoadImage和imread
- Mat,CV::MAT,IplImage含义,区别及其转换
- Mat,CV::MAT,IplImage含义,区别及其转换
- 【OpenCV】cv::Mat与IplImage类型转换
- Mac如何显示隐藏的文件
- postgre 系统表对象说明
- android得到已安装和未安装apk的信息
- Hadoop生态系统介绍
- SQL"已更新或者删除的行值要么不能使该行成为唯一行,要么改变了多个行(X行)“解决办法
- Mat imread 与 IplImage cvLoadImage区别
- devise的使用
- Max Points on a Line
- Kinect开发笔记之八C#实现Kinect声音的追踪
- spring 集成hibernate和jdbcTemplate
- 第五周阅读程序
- LeetCode | Binary Search Tree Iterator
- iOS学习之WebView的使用
- 查看oracle数据库的连接数以及用户