justadudewhohacks / npm-opencv-build

A simple script to auto build recent OpenCV + contrib version via npm
43 stars 57 forks source link

Cleanup after build #7

Closed SkeLLLa closed 6 years ago

SkeLLLa commented 6 years ago

Hi. I've noticed that after building opencv directory with files have size ~1.6Gb. There are many files inside, including sources.

Is there any way to reduce it by removing unnecessary files after build which are not required to run opencv.

I've also complied opencv on my system (I use gentoo) and installed opencv size:

* media-libs/opencv-3.3.0-r2
         Total files : 378
         Total size  : 186.37 MiB

That's without contrib.

And with contrib and some other deps (-lib stands for compile without it):

contrib contrib_cvv contrib_hdf contrib_sfm eigen ffmpeg gflags glog jpeg opencl opengl openmp png python qt5 threads vaapi webp -contrib_xfeatures2d -cuda -debug -examples -gdal -gphoto2 -gstreamer -gtk -ieee1394 -ipp -java -jpeg2k -lapack -libav -openexr -pch -tesseract -testprograms -tiff -v4l -vtk -xine
media-libs/opencv-3.3.0-r2
         Total files : 657
         Total size  : 313.85 MiB
justadudewhohacks commented 6 years ago

For simplicity I would say, simply delete the sources and files you don't need manually after the build, if the size is really a concern for you.

SkeLLLa commented 6 years ago

@justadudewhohacks I've tried but seems it's not very easy. After deleting several folders that look like just sources and then face-recognition or opencv4nodejs refused to build or work. Now I'm trying also to build clean docker image with "external" opencv and dlib. Something like in https://github.com/justadudewhohacks/opencv4nodejs-docker-images but with dlib and based on Debian (that has less size than Ubuntu-based). But there are also some issues with dlib, because face-recognition fails to build without libx11-dev that requires a lot of deps.

justadudewhohacks commented 6 years ago

The only thing required after the build are the include, lib and bin folders in opencv-build/opencv/build/. Everything else could be deleted I think.

That's a different story for dlib-build as the source folder also servers as the include folder.