Ask Your Question
-1

OpenCV : Build with lesser features

asked 2014-02-04 18:53:12 -0600

dondan1976 gravatar image

Hello all,

I have a C++ app that uses OpenCV. Currently i am statically linking the OpenCV libs into my app. This is adding an extra overhead of 6+ MB.

Ideally i would like to remove some of the features that i am not using in OpenCV. The features am using are,

  1. Capture frames from Webcam.
  2. Face detection.
  3. Image formats (JPEG, PNG).
  4. Image rotation & resizing.

Is it possible to remove other features and trim down the libs?

My C++ app is developed in Visual Studio 2012.

Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-02-05 02:52:45 -0600

Yes it is possible, when building in visual studio, only define the static libs in linker options that are actually needed. Remove all the others. This way, the modules of openCV that are not used, will not be integrated into your software.. On the other hand, what is 6MB extra these days? I guess some basic libraries like core / highgui / imgproc / objectdetection will already do the trick for you.

edit flag offensive delete link more

Comments

I did a new build of OpenCV and just built seleted lib's and added them to the project. But still the size is the same. The lib's i added to project are:

libjasper.lib libjpeg.lib libpng.lib libtiff.lib zlib.lib opencv_core248.lib opencv_highgui248.lib opencv_imgproc248.lib opencv_objdetect248.lib opencv_photo248.lib opencv_video248.lib vfw32.lib

I am using Visual Studio 2012. Is there any project settings that needs to be changed?

For some reason, it still seems to link all the lib's. Even though the "staticlib" directory only contains the above mentioned lib's.

The reason why i want to keep the size small is because that way whenever i come up with an update for the customer, they don't have to download much from the server. This is a limitation.

dondan1976 gravatar imagedondan1976 ( 2014-02-05 10:18:51 -0600 )edit

If you did not link to libraries that need to be included, and they are not on your system, then you cannot have them added right? However, I do think that the largest part is the core library. Besides that you are using the most heavy libs i know like objectdetect and imgproc. Probably the difference with the others is not that large. Are you sure that 6MB is pure from OpenCV? 6MB isn't much to download these days I think ... most software updates range between 100MB - 1GB. I guess you are doing just fine.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-06 03:53:32 -0600 )edit

Question Tools

Stats

Asked: 2014-02-04 18:53:12 -0600

Seen: 173 times

Last updated: Feb 05 '14