Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to minimize OpenCv library size?

I'm looking to minimize the size of my android ndk built library.

I have started with the pre-built OpenCv libraries for Android and as of now the size of my lib is about 3MB. How can I minimize it's size?

I only need read/write files capability, png encode/decode, jpeg decoder and the typical image manipulation functions from OpenCv such as resize and cvtColor.

Any pointers greatly appreciated!

like image 651
Jona Avatar asked May 24 '12 22:05

Jona


1 Answers

You've probably moved on with your project by now, Jona, but others not using the cmake-gui may like a command-line example. i.e. if you didn't want the CCALIB module, you could build like this:

cmake -DBUILD_OPENCV_CCALIB=OFF [other cmake flags] ../

Manipulating build flags may not cover all the module exclusions you would like, however, it's probably a good place to start. To see the list of flag options, open CMakeLists.txt file (top of the opencv source directory).

Turning on/off flags also won't break your builds as much as manually commenting-out code.

like image 179
antonymott Avatar answered Sep 24 '22 07:09

antonymott