Ask Your Question
1

OpenCV Library File Size

asked 2018-01-14 11:47:35 -0600

Larry gravatar image

Is there a relatively easy way to reduce the size of static libraries built from OpenCV 3.4 source? I ran CMake on my Windows development system to create VS 2010 projects to build OpenCV static libraries, but some of the CUDA related libraries come out to large to be practical, and when I link those libraries into my own apps, they also come out enormous. The opencv_cudafilters340d.lib is about 405MB, and when I build a simple app which does a single CUDA filter operation, the built binary is also nearly half a GB. What can I do to reduce the file sizes without painstakingly editing large amounts of OpenCV source code?

Thank You

Larry

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2018-01-15 03:32:33 -0600

mshabunin gravatar image

updated 2018-01-15 03:37:59 -0600

Try to disable IPP (-DWITH_IPP=OFF) and limit used CUDA architectures (-DCUDA_ARCH_BIN=...?): IPP contains multiple optimized versions of same function for different platforms and, I guess, problem with CUDA can be similar. Probably you should specify CUDA_GENERATIONoption: https://github.com/opencv/opencv/blob...

Try to enable link time optimization, we've added ENABLE_LTO cmake option and it should be supported by VS (adds /GL compiler option), but we haven't tested it.

We have related advice, but it is mostly for Linux: https://github.com/opencv/opencv/wiki...

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-01-14 11:47:35 -0600

Seen: 4,009 times

Last updated: Jan 15 '18