Ask Your Question
1

OpenCV modules 3rd-party dependencies

asked 2020-08-23 05:18:43 -0600

omeronce1994 gravatar image

updated 2020-08-24 01:12:01 -0600

berak gravatar image

Hello, I am relatively new to OpenCV (using 4.3.0) and i am trying to make a tiny version of it for and Android application, with only core, imgproc and imgcodecds module imported so that the library files will be as small as possible. I managed to include only the relevant modules, the problem is that it still relatively big, especially for x86 and x86_64 cpu architecture and i guess (if my guess is wrong then this post is totally irrelevant :0) it is because of 3rd party libraries that imported along with opencv modules. My question is how can discover which 3rd party libraries are used for each module? and how can i exclude unused 3rd party libraries to make the final .so file smaller?

edit retag flag offensive close merge delete

Comments

did you use build_sdk.py you can edit it and add & remove modules

sturkmen gravatar imagesturkmen ( 2020-08-23 08:04:47 -0600 )edit

Yes Thanks, i figured it out, the thing is i dont know how it is gonna affect the application. for example if I disable IPP, what is the effect on x86 users? will the performance be really bad for them?

omeronce1994 gravatar imageomeronce1994 ( 2020-08-23 08:12:22 -0600 )edit

it will be useful to others if you share your modified build_sdk.py part here.

sturkmen gravatar imagesturkmen ( 2020-08-23 08:38:00 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-08-26 18:10:12 -0600

you can find below a sample edit of build_sdk.py to produce a tiny libopencv_java4.so

--   OpenCV modules:
--     To be built:                 core imgcodecs imgproc java

here is the edit:

def build_library(self, abi, do_install):
    cmd = [self.cmake_path, "-GNinja"]
    cmake_vars = dict(
        CMAKE_TOOLCHAIN_FILE=self.get_toolchain_file(),
        INSTALL_CREATE_DISTRIB="ON",
        WITH_OPENCL="OFF",
        WITH_IPP=("ON" if abi.haveIPP() else "OFF"),
        WITH_TBB="ON",
        BUILD_opencv_flann="OFF",
        BUILD_opencv_dnn="OFF",
        BUILD_opencv_features2d="OFF",
        BUILD_opencv_photo="OFF",
        BUILD_opencv_objdetect="OFF",
        BUILD_opencv_ml="OFF",
        BUILD_opencv_video="OFF",
        BUILD_opencv_videoio="OFF",
        BUILD_opencv_highgui="OFF",
        BUILD_opencv_gapi="OFF",
        BUILD_PROTOBUFF="OFF",
        WITH_ADE="OFF",
        WITH_PROTOBUF="OFF",
        WITH_CAROTENE="OFF",
        WITH_TIFF="OFF",
        WITH_OPENEXR="OFF",
        WITH_OPENJPEG="OFF",
        WITH_WEBP="OFF",
        WITH_JASPER="OFF",
        WITH_IMGCODEC_HDR="OFF",
        WITH_IMGCODEC_PFM="OFF",
        WITH_IMGCODEC_PXM="OFF",
        WITH_IMGCODEC_SUNRASTER="OFF",
        WITH_QUIRC="OFF",
        BUILD_EXAMPLES="OFF",
        BUILD_TESTS="OFF",
        BUILD_PERF_TESTS="OFF",
        BUILD_DOCS="OFF",
        BUILD_ANDROID_EXAMPLES=("OFF" if self.no_samples_build else "ON"),
        INSTALL_ANDROID_EXAMPLES=("OFF" if self.no_samples_build else "ON"),
    )
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-08-23 05:18:43 -0600

Seen: 1,600 times

Last updated: Aug 26 '20