- 安装依赖库
# ant is needed. sudo apt -y install cmake ant # openjdk8
- 编译脚本
export BUILD_LIBS=${HOME}/lib-opencv export JAVA_HOME=${HOME}/jdk1.8.0_241 # after install ant, /bin/ant link is error. so fix it. # sudo ln -snf /usr/share/ant/bin/ant /bin/ant cd opencv-4.2.0 rm -rf build mkdir build cd build cmake \ -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=${BUILD_LIBS} \ .. make make install # make clean # rm -rf build
- 没有构建JAVA的提示
-- OpenCV modules: -- To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo stitching video videoio -- Disabled: world -- Disabled by dependency: - -- Unavailable: java js python2 python3 ts -- Applications: apps -- Documentation: NO -- Non-free algorithms: NO
上图输出,明确说明编译不包含java。那么是什么原因呢?因为不符合条件。底部有提示:
-- Java: export all functions -- ant: NO -- JNI: /home/quantum6/tio-software/jdk1.8.0_241/include /home/quantum6/tio-software/jdk1.8.0_241/include/linux /home/quantum6/tio-software/jdk1.8.0_241/include -- Java wrappers: YES -- Java tests: YES
也就是ant不对。哪里出错?向上检查输出,吾找到原因并解决了问题。具体参考:
https://blog.csdn.net/quantum7/article/details/104625736
- 构建JAVA的提示
-- OpenCV modules: -- To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc java ml objdetect photo stitching video videoio -- Disabled: world -- Disabled by dependency: - -- Unavailable: js python2 python3 ts -- Applications: apps -- Documentation: NO -- Non-free algorithms: NO
JAVA部分也对了:
-- Java: export all functions -- ant: /bin/ant (ver 1.10.5) -- JNI: /home/quantum6/tio-software/jdk1.8.0_241/include /home/quantum6/tio-software/jdk1.8.0_241/include/linux /home/quantum6/tio-software/jdk1.8.0_241/include -- Java wrappers: YES -- Java tests: YES