Sunday, December 15, 2013

cv prefix of class and function in opencv like CvMat and Mat

Hi, if you are exploring the opencv library with cpp for the first time you may have noticed that certain function or classes start with Cv and some note. In fact opencv has two interfaces C and C++ therefore those classes of C interface start with Cv in opposite to the C++ interface.
e.g:

IplImage* img = cvLoadImage( argv[1] );
cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
cvShowImage( "Example1", img );
cvWaitKey(0);


vs

 image = imread("test.jpg");
 namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
 imshow( "Display Image", image );

 waitKey(0);


Definitely the following ultimate question will come which one to choose ? or at least which interface will make your miserable life easier given that either C or Cpp is already a problem compared to Java, Python, etc ... My sincere advice is that unless you have some requirement obligation (embedded system interfacing ...)it is better to use the C++ interface, given different flexibilities that it provides you in term of automatic memory allocation and even more ...


No comments:

Post a Comment