Ask Your Question
4

openCV will drop C API support soon

asked 2013-07-25 11:33:49 -0600

stereomatching gravatar image

updated 2018-10-21 05:34:55 -0600

From the pdf of ICVS2013(http://opencv.org/icvs2013.html), it say openCV will drop C API support soon.Do anyone know the details?Drop C API support means they will not develop any new api for C or they will discards all of the C API in the future?

I am a fans of openCV2 and do not like C API of openCV1, too verbose and no performance gain by using it, if openCV will discards all of the C API, I would have more reasons to push my colleagues move to c++ API and increase the chances to say goodbye to C API.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
13

answered 2013-07-30 08:48:40 -0600

Kirill Kornyakov gravatar image

Let me also comment, since I'm the author of that provocative statement =)

Shervin is right, the C API is not developed for a long time. All the new stuff has the C++ API, and it is not backported to the C. So, C API becomes obsolete and causes pain in the neck, since it should be maintained. Thus, the decision is made to mark it as deprecated. But let me clarify the point:

  1. Actually C API will stay in the library, but it will not be available by default. It will be put into separate header files, that should be manually included by user. So, it would be possible to compile the legacy code, but you should add these compatibility includes manually.
  2. It is possible that OpenCV will generate compiler warnings in case you're using C API. These warnings will notify you that you're using deprecated API, and you should migrate to C++.
  3. At the same time in the long term C API may return to the OpenCV, so it can be used from the C code (e.g. low-level or embedded programming). But the plan is to autogenerate C wrappers for C++ code, as we do for Java and Python. This way C API will be always up-to-date, since it is generated from the C++ headers automatically. But this is a long-term dream, not for OpenCV 3.0, and if you want to work on that, please let us know (http://opencv.org/contribute.html).

Few words about the 3.0.

  1. In fact there are no radical plans for changing the C++ API in the 3.0. I mean there are some architectural changes (like moving stuff between modules), but the public API will remain almost the same. More classes will switch to cv::Algorithm, other changes in data structures are possible, but again, nothing radical! You'll be able to easily port your code from OpenCV 2.x to OpenCV 3.x, mostly by changing includes. This is important, since 2.x branch will not be supported, and we want everybody to use 3.x series.
  2. But there will be some changes, and you're right, the design purpose is: more consistent API, better modular structure. Yes, better performance, but this doesn't affect the public API much. But we'll see a new HAL module and significantly refactored CUDA and OpenCL modules. Finally, OpenCV is not going to be more template oriented, since this is bad for wrappers.

To summarize, 3.0 will not bring dramatical public API changes. It will simply implement the 2.x design concepts to the full degree. Our goal is to make the transition as smooth as it is possible. You will need to change a couple of includes, may be update some calls. But we'll use this possibility (major release) to break the compatibility in order to improve the structure and make the API more consistent.

edit flag offensive delete link more

Comments

1

Maybe this information can be sent out into the world through the opencv.org page :) Because a lot of people have no idea what this remark meant :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-30 08:54:23 -0600 )edit
1

Agree =) Actually there are a lot of information that should be shared with the community. Let us structure it a bit, and start sharing...

Kirill Kornyakov gravatar imageKirill Kornyakov ( 2013-07-30 10:30:09 -0600 )edit

Thanks, I think this message is worth to let the world know.Besides, any plans to provide better c++11 support?If generic algorithms are not available, then I have to craft one for myself, I pretty like the high level, generic multithread api like QtConcurrent, with the help of template and c++11 lambda, we could have some easier to use api(just my opinion). pseudo codes : http://pastebin.com/GwHa2KfT

stereomatching gravatar imagestereomatching ( 2013-08-03 09:22:53 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-07-25 11:33:49 -0600

Seen: 9,282 times

Last updated: Jul 30 '13