ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Why opencv2 has two kinds of programming styles?

asked 2012-01-11 01:14:44 -0500

sam gravatar image

For example

  cv::imshow(WINDOW, cv_ptr->image);

and

  cvShowImage( "Image", pImg );

How to know which style should I use?

Thank you~

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

answered 2012-01-11 02:02:33 -0500

DimitriProsser gravatar image

updated 2012-01-11 02:53:27 -0500

The first is OpenCV in C++, the second is OpenCV in the basic C functions. The first example is calling the C++ version of OpenCv with namespaces and all of the functions included in the namespace. The second style is simply the OpenCV function in C. The C++ is just a wrapper for the C code, so you're essentially calling the same functions either way. Which you use is really up to you. I like the C functions better, mostly for the sake of simplicity and documentation.

edit flag offensive delete link more

Comments

The latter isn't a C macro; it's a C function. It's two kinds of programming styles because C and C++ are two different languages.
Mac gravatar image Mac  ( 2012-01-11 02:09:10 -0500 )edit

Question Tools

Stats

Asked: 2012-01-11 01:14:44 -0500

Seen: 322 times

Last updated: Jan 11 '12