Ask Your Question
0

How do i use only certain modules in OpenCV?

asked 2020-05-12 16:52:36 -0600

CoilOS gravatar image

I just need the Core functionality and Image processing module in opencv, i don't want to waste space on all the other bloated functionality, i want to keep opencv memory usage at a minimum. I'm implementing my entire project in C++, so i'm focused on efficiency and memory.

I just want to use Gaussian blur, Blackhat, Canny, findContours, moments. That's it, for these i don't want to download the entirety of OpenCV.

Please help me

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-05-13 01:52:06 -0600

berak gravatar image

i don't want to download the entirety of OpenCV.

you have to. but you can discard the src tree and build folders after installing your locally build libs.

I just want to use Gaussian blur, Blackhat, Canny, findContours, moments.

so you need the core and imgproc modules at least (how would you obtain images ?). you can restrict the build to those:

cmake -DBUILD_LIST="core,imgproc"

and later, only link those libs to your program (do NOT use cmake or pkg-config, because they will drag in all there is)

g++ my.cpp -I/usr/local/include/opencv4  -lopencv_imgproc -lopencv_core -o myprog
edit flag offensive delete link more

Comments

1

I think he will need ImgCodecs, for loading..

LiorA gravatar imageLiorA ( 2020-05-13 05:31:16 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-05-12 16:52:36 -0600

Seen: 478 times

Last updated: May 13 '20