Using the Iplimage pointer data type in the old version requires manual allocation and release, which is more cumbersome.
This shortcoming is avoided by using the mat data structure directly in the new version.
No technical content, no more nonsense, just look at the comments in the code.
#include <stdio.h>/* Original version header file # include <opencv\cv.h> #include <opencv\cxcore.h> #include <opencv\ highgui.h>*///new Version (2.4.10) header file # include <opencv2\opencv.hpp> #include <opencv2\highgui\highgui.hpp># Include <opencv2\core\core.hpp>using namespace Cv;int main () {//new version OpenCV 2.4.10Mat imgsrc = Imread ("f:\\project\ \opencv_1\\1.jpg "), Namedwindow (" test "), Imshow (" test ", imgsrc); Waitkey ();/* Original version Opencviplimage *img = Cvloadimage (" F : \\project\\opencv_1\\1.jpg "); Cvnamedwindow (" Test ", cv_window_autosize); Cvshowimage (" Test ", IMG); cvwaitkey (0); Cvreleaseimage (&img); Cvdestroywindow ("Test");p rintf ("over!\n"); */return 0;}
"OpenCv" OpenCv a simple comparison between the original version and the new version (2.4.10)