Docker + Java + OpenCV,java.library.path中没有openc

我正在尝试生成具有以下特征的 docker 映像

  • 所以--> 免费:18.04

  • Java --> openjdk-11-jdk

  • OpenCV --> 3.4.2 版本

我能够成功生成图像,但 lib 文件夹中未生成 java342 文件,我收到此异常:java.library.path 中没有 opencv_java342

我使用以下命令作为入口点启动我的应用程序:

java -Djava.library.path=/var/lib/opencv-3.4.2/build/lib -jar Application.jar

Docker 文件


FROM ubuntu:18.04


RUN apt-get update

RUN apt-get install -y ant

RUN apt-get install -y openjdk-11-jdk

ARG JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

RUN echo $JAVA_HOME

RUN apt-get install -y wget

RUN apt-get install -y cmake

RUN apt-get install -y g++

RUN apt-get install -y unzip

RUN apt-get install -y vim

RUN java -version


RUN wget https://github.com/opencv/opencv/archive/3.4.2.zip

RUN unzip 3.4.2.zip -d /var/lib/

RUN mkdir /var/lib/opencv-3.4.2/build

WORKDIR /var/lib/opencv-3.4.2/build

RUN cmake -DBUILD_SHARED_LIBS=OFF ..

RUN make -j8

所以我想知道我是否在docker文件或openCV编译过程中遗漏了一些东西。

注意:如果我在本机计算机中执行相同的进程,一切都会按预期进行

有什么建议么?


30秒到达战场
浏览 288回答 3
3回答

慕标5832272

使用 Java 打开 CV 4.8此 Docker 文件下载源代码并在 Debian 容器中构建 OpenCV映像包含 Java Jar (opencv-480.jar) 和相应的共享库 (libopencv_java480.so)。Java <> OpenCV 互操作需要这些所有传递依赖的 .so 库都被复制到该opencvlibs目录中。如果您在 Debian Linux 上部署,请将 的内容复制opencvlibs到您的libs目录。Linux 将按照惯例找到它们使用Java运行:Jar 必须位于类路径上.so 必须通过指定java.library.pathDocker 文件:FROM debian:11 AS opencv-libs# Install minimal prerequisites (Ubuntu 18.04 as reference)# Build tools for OpenCV# libavcodec, libavformat, libswscale, libavutil, libswresample are needed by ffmpeg. See https://ffmpeg.org/about.htmlRUN apt update && \apt install \cmake build-essential g++ openjdk-17-jdk wget unzip ant python3 python3-numpy \libtbb-dev libeigen3-dev \libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libswresample-dev liblzma-dev \ffmpeg libpulse0 -y# Download and unpack OpenCV sources# Note that the Java jar version must match the version we build here - 4.8 at the momentRUN wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip && unzip opencv.zip# Create build directoryRUN mkdir -p build && cd build# Configure OpenCV. Turn off features we do not need to restrict size# See: https://docs.opencv.org/4.x/db/d05/tutorial_config_reference.html## CMAKE OUTPUT, MUST LOOK LIKE SHOWN BELOW:# Important things to note:# - Java/ant/JNI are enabled under Java:# - FFMPEG is enabled under Video I/O:## CMAKE OUTPUT ##################################################################################################################################11 28.73 --&nbsp; &nbsp;OpenCV modules:#11 28.74 --&nbsp; &nbsp; &nbsp;To be built:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;calib3d core features2d flann gapi imgcodecs imgproc java objdetect photo stitching video videoio#11 28.74 --&nbsp; &nbsp; &nbsp;Disabled:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dnn highgui ml world#11 28.74 --&nbsp; &nbsp; &nbsp;Disabled by dependency:&nbsp; &nbsp; &nbsp; -#11 28.74 --&nbsp; &nbsp; &nbsp;Unavailable:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;python2 python3 ts#11 28.74 --&nbsp; &nbsp; &nbsp;Applications:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -#11 28.74 --&nbsp; &nbsp; &nbsp;Documentation:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NO#11 28.74 --&nbsp; &nbsp; &nbsp;Non-free algorithms:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NO#11 28.74 --#11 28.74 --&nbsp; &nbsp;GUI:#11 28.74 --&nbsp; &nbsp; &nbsp;GTK+:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NO#11 28.74 --&nbsp; &nbsp; &nbsp;VTK support:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NO#11 28.74 --#11 28.74 --&nbsp; &nbsp;Media I/O:#11 28.74 --&nbsp; &nbsp; &nbsp;ZLib:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zlib (ver 1.2.13)#11 28.74 --&nbsp; &nbsp; &nbsp;JPEG:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; libjpeg-turbo (ver 2.1.3-62)#11 28.74 --&nbsp; &nbsp; &nbsp;WEBP:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; build (ver encoder: 0x020f)#11 28.74 --&nbsp; &nbsp; &nbsp;PNG:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;build (ver 1.6.37)#11 28.74 --&nbsp; &nbsp; &nbsp;TIFF:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; build (ver 42 - 4.2.0)#11 28.74 --&nbsp; &nbsp; &nbsp;JPEG 2000:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;build (ver 2.5.0)#11 28.74 --&nbsp; &nbsp; &nbsp;OpenEXR:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;build (ver 2.3.0)#11 28.75 --&nbsp; &nbsp; &nbsp;HDR:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YES#11 28.75 --&nbsp; &nbsp; &nbsp;SUNRASTER:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YES#11 28.75 --&nbsp; &nbsp; &nbsp;PXM:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YES#11 28.75 --&nbsp; &nbsp; &nbsp;PFM:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YES#11 28.75 --#11 28.75 --&nbsp; &nbsp;Video I/O:#11 28.75 --&nbsp; &nbsp; &nbsp;DC1394:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NO#11 28.75 --&nbsp; &nbsp; &nbsp;FFMPEG:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; YES#11 28.75 --&nbsp; &nbsp; &nbsp; &nbsp;avcodec:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YES (58.91.100)#11 28.75 --&nbsp; &nbsp; &nbsp; &nbsp;avformat:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; YES (58.45.100)#11 28.75 --&nbsp; &nbsp; &nbsp; &nbsp;avutil:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; YES (56.51.100)#11 28.75 --&nbsp; &nbsp; &nbsp; &nbsp;swscale:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YES (5.7.100)#11 28.75 --&nbsp; &nbsp; &nbsp; &nbsp;avresample:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NO#11 28.75 --#...#11 28.76 --&nbsp; &nbsp;Java:#11 28.76 --&nbsp; &nbsp; &nbsp;ant:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/usr/bin/ant (ver 1.10.9)#11 28.76 --&nbsp; &nbsp; &nbsp;Java:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NO#11 28.76 --&nbsp; &nbsp; &nbsp;JNI:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/usr/lib/jvm/java-17-openjdk-amd64/include /usr/lib/jvm/java-17-openjdk-amd64/include/linux /usr/lib/jvm/java-17-openjdk-amd64/include#11 28.76 --&nbsp; &nbsp; &nbsp;Java wrappers:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;YES (ANT)#11 28.76 --&nbsp; &nbsp; &nbsp;Java tests:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NO# ######################################################################################################################################################### OpenCV build needs JDKENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64RUN cmake -DWITH_GSTREAMER=OFF \-DBUILD_opencv_highgui=OFF \-DBUILD_opencv_dnn=OFF \-DBUILD_opencv_ml=OFF \-DBUILD_opencv_apps=OFF \-DBUILD_opencv_js=OFF \-DBUILD_opencv_ts=OFF \-DBUILD_opencv_viz=OFF \-DBUILD_opencv_lagacy=OFF \-DBUILD_opencv_androidcamera=OFF \-DBUILD_SHARED_LIBS=OFF \-DBUILD_PERF_TESTS=OFF \-DBUILD_TESTS=OFF \-DBUILD_opencv_python2=OFF&nbsp; \-DOPENCV_FFMPEG_SKIP_BUILD_CHECK=ON \-DWITH_V4L=OFF \-DWITH_FFMPEG=ON \-DBUILD_opencv_python3=OFF ../opencv-4.x# Build OpenCV Java shared libRUN make -j8FROM debian:11 AS opencvCOPY --from=opencv-libs /usr/bin/ffmpeg /usr/bin/ffmpeg# Big(ish) static lib from the OpenCV build. Contains all OpenCV deps.# OpenCV JNI layer needs this to workCOPY --from=opencv-libs /lib/libopencv_java480.so /opencvlibs/COPY --from=opencv-libs /bin/opencv-480.jar /opencvlibs/# These are all the shared libs needed by OpenCV - not available in the Distroless container# Copy all the /lib dir. Linux will pick up shared libs from /lib by default conventionCOPY --from=opencv-libs /lib/liblzma* \/lib/x86_64-linux-gnu/liblzma* \/lib/x86_64-linux-gnu/libbz2* \/lib/x86_64-linux-gnu/libgpg-error* \/lib/x86_64-linux-gnu/libselinux* \/lib/x86_64-linux-gnu/libcom_err* \/lib/x86_64-linux-gnu/libkeyutils* \/lib/x86_64-linux-gnu/libncursesw.so.6 \/lib/x86_64-linux-gnu/libtinfo.so.6 \/lib/x86_64-linux-gnu/libdbus-1.so.3 \/lib/x86_64-linux-gnu/libtirpc.so.3 \/usr/lib/x86_64-linux-gnu/libavcodec.so.58 \/usr/lib/x86_64-linux-gnu/libavutil.so.56 \/usr/lib/x86_64-linux-gnu/libswscale.so.5 \/usr/lib/x86_64-linux-gnu/libavformat.so.58 \/usr/lib/x86_64-linux-gnu/libswresample.so.3 \/usr/lib/x86_64-linux-gnu/libavdevice.so.58 \/usr/lib/x86_64-linux-gnu/libavfilter.so.7 \/usr/lib/x86_64-linux-gnu/libavresample.so.4 \/usr/lib/x86_64-linux-gnu/libpostproc.so.55 \/usr/lib/x86_64-linux-gnu/libraw1394.so.11 \/usr/lib/x86_64-linux-gnu/libavc1394.so.0 \/usr/lib/x86_64-linux-gnu/librom1394.so.0 \/usr/lib/x86_64-linux-gnu/libiec61883.so.0 \/usr/lib/x86_64-linux-gnu/libjack.so.0 \/usr/lib/x86_64-linux-gnu/libopenal.so.1 \/usr/lib/x86_64-linux-gnu/libcdio_paranoia.so.2 \/usr/lib/x86_64-linux-gnu/libcdio_cdda.so.2 \/usr/lib/x86_64-linux-gnu/libdc1394.so.25 \/usr/lib/x86_64-linux-gnu/libcaca.so.0 \/usr/lib/x86_64-linux-gnu/libpulse.so.0 \/usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-14.2.so \/usr/lib/x86_64-linux-gnu/libwrap.so.0 \/usr/lib/x86_64-linux-gnu/libsndfile.so.1 \/usr/lib/x86_64-linux-gnu/libasyncns.so.0 \/usr/lib/x86_64-linux-gnu/libwayland-server.so.0 \/usr/lib/x86_64-linux-gnu/libgfortran.so.5 \/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0 \/usr/lib/x86_64-linux-gnu/libpocketsphinx.so.3 \/usr/lib/x86_64-linux-gnu/libsphinxbase.so.3 \/usr/lib/x86_64-linux-gnu/libbs2b.so.0 \/usr/lib/x86_64-linux-gnu/liblilv-0.so.0 \/usr/lib/x86_64-linux-gnu/libquadmath.so.0 \/usr/lib/x86_64-linux-gnu/librubberband.so.2 \/usr/lib/x86_64-linux-gnu/libmysofa.so.1 \/usr/lib/x86_64-linux-gnu/libFLAC.so.8 \/usr/lib/x86_64-linux-gnu/libflite_cmu_us_awb.so.1 \/usr/lib/x86_64-linux-gnu/libflite_cmu_us_kal.so.1 \/usr/lib/x86_64-linux-gnu/libflite_cmu_us_kal16.so.1 \/usr/lib/x86_64-linux-gnu/libflite_cmu_us_rms.so.1 \/usr/lib/x86_64-linux-gnu/libflite_cmu_us_slt.so.1 \/usr/lib/x86_64-linux-gnu/libflite.so.1 \/usr/lib/x86_64-linux-gnu/libass.so.9 \/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0 \/usr/lib/x86_64-linux-gnu/libslang.so.2 \/usr/lib/x86_64-linux-gnu/libXss.so.1 \/usr/lib/x86_64-linux-gnu/libgbm.so.1 \/usr/lib/x86_64-linux-gnu/libwayland-egl.so.1 \/usr/lib/x86_64-linux-gnu/libwayland-cursor.so.0 \/usr/lib/x86_64-linux-gnu/libxkbcommon.so.0 \/usr/lib/x86_64-linux-gnu/libblas.so.3 \/usr/lib/x86_64-linux-gnu/liblapack.so.3 \/usr/lib/x86_64-linux-gnu/libserd-0.so.0 \/usr/lib/x86_64-linux-gnu/libsord-0.so.0 \/usr/lib/x86_64-linux-gnu/libsratom-0.so.0 \/usr/lib/x86_64-linux-gnu/libsamplerate.so.0 \/usr/lib/x86_64-linux-gnu/libfftw3.so.3 \/usr/lib/x86_64-linux-gnu/libflite_usenglish.so.1 \/usr/lib/x86_64-linux-gnu/libflite_cmulex.so.1 \/usr/lib/x86_64-linux-gnu/libflite_usenglish.so.1 \/usr/lib/x86_64-linux-gnu/libvidstab.so.1.1 \/usr/lib/x86_64-linux-gnu/libsndio.so.7.0 \/usr/lib/x86_64-linux-gnu/libcdio.so.19 \/usr/lib/x86_64-linux-gnu/libcdio.so.19 \/usr/lib/x86_64-linux-gnu/libdc1394.so.25 \/usr/lib/x86_64-linux-gnu/libaom* \/usr/lib/x86_64-linux-gnu/libbluray* \/usr/lib/x86_64-linux-gnu/libcairo.so.2 \/usr/lib/x86_64-linux-gnu/libcairo-gobject.so.2 \/usr/lib/x86_64-linux-gnu/libchromaprint* \/usr/lib/x86_64-linux-gnu/libcodec2* \/usr/lib/x86_64-linux-gnu/libdav1d.so.4 \/usr/lib/x86_64-linux-gnu/libdrm* \/usr/lib/x86_64-linux-gnu/libglib-2* \/usr/lib/x86_64-linux-gnu/libgme* \/usr/lib/x86_64-linux-gnu/libgobject-2* \/usr/lib/x86_64-linux-gnu/libgsm* \/usr/lib/x86_64-linux-gnu/libmfx* \/usr/lib/x86_64-linux-gnu/libmp3lame.so.0 \/usr/lib/x86_64-linux-gnu/libOpenCL* \/usr/lib/x86_64-linux-gnu/libopenjp2* \/usr/lib/x86_64-linux-gnu/libopenmpt.so.0 \/usr/lib/x86_64-linux-gnu/libopus* \/usr/lib/x86_64-linux-gnu/librabbitmq* \/usr/lib/x86_64-linux-gnu/librsvg-2.so.2 \/usr/lib/x86_64-linux-gnu/libshine* \/usr/lib/x86_64-linux-gnu/libsnappy* \/usr/lib/x86_64-linux-gnu/libsoxr* \/usr/lib/x86_64-linux-gnu/libspeex* \/usr/lib/x86_64-linux-gnu/libsrt-gnutls.so.1.4 \/usr/lib/x86_64-linux-gnu/libssh-gcrypt.so.4 \/usr/lib/x86_64-linux-gnu/libtheoradec* \/usr/lib/x86_64-linux-gnu/libtheoraenc.so.1 \/usr/lib/x86_64-linux-gnu/libtwolame* \/usr/lib/x86_64-linux-gnu/libva-drm* \/usr/lib/x86_64-linux-gnu/libva* \/usr/lib/x86_64-linux-gnu/libvdpau* \/usr/lib/x86_64-linux-gnu/libvorbis* \/usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 \/usr/lib/x86_64-linux-gnu/libvpx.so.6 \/usr/lib/x86_64-linux-gnu/libwavpack* \/usr/lib/x86_64-linux-gnu/libwebp.so.6 \/usr/lib/x86_64-linux-gnu/libwebpmux* \/usr/lib/x86_64-linux-gnu/libX11.so.6 \/usr/lib/x86_64-linux-gnu/ibx26460* \/usr/lib/x86_64-linux-gnu/libx26592* \/usr/lib/x86_64-linux-gnu/libxml2.so.2 \/usr/lib/x86_64-linux-gnu/libxvidcore.so.4 \/usr/lib/x86_64-linux-gnu/libzmq.so.5 \/usr/lib/x86_64-linux-gnu/libzvbi.so.0 \/usr/lib/x86_64-linux-gnu/libpangocairo-1.0* \/usr/lib/x86_64-linux-gnu/libxcb-shm* \/usr/lib/x86_64-linux-gnu/libxcb* \/usr/lib/x86_64-linux-gnu/libXrender* \/usr/lib/x86_64-linux-gnu/libffi* \/usr/lib/x86_64-linux-gnu/libpango-1.0* \/usr/lib/x86_64-linux-gnu/libpixman-1.so.0 \/usr/lib/x86_64-linux-gnu/libgdk_pixbuf* \/usr/lib/x86_64-linux-gnu/libgnutls.so.30 \/usr/lib/x86_64-linux-gnu/libx264* \/usr/lib/x86_64-linux-gnu/libx265* \/usr/lib/x86_64-linux-gnu/libogg* \/usr/lib/x86_64-linux-gnu/libnuma* \/usr/lib/x86_64-linux-gnu/libmpg123* \/usr/lib/x86_64-linux-gnu/libudfread* \/usr/lib/x86_64-linux-gnu/libsodium.so.23 \/usr/lib/x86_64-linux-gnu/libpgm-5.3* \/usr/lib/x86_64-linux-gnu/libnorm.so.1 \/usr/lib/x86_64-linux-gnu/libgomp.so.1 \/usr/lib/x86_64-linux-gnu/libXext* \/usr/lib/x86_64-linux-gnu/libicuuc.so.67 \/usr/lib/x86_64-linux-gnu/libp11-kit.so.0 \/usr/lib/x86_64-linux-gnu/libidn2* \/usr/lib/x86_64-linux-gnu/libunistring.so.2 \/usr/lib/x86_64-linux-gnu/libtasn1* \/usr/lib/x86_64-linux-gnu/libnettle.so.8 \/usr/lib/x86_64-linux-gnu/libhogweed.so.6 \/usr/lib/x86_64-linux-gnu/libgmp.so.10 \/usr/lib/x86_64-linux-gnu/libgcrypt.so.20 \/usr/lib/x86_64-linux-gnu/libgssapi_krb5* \/usr/lib/x86_64-linux-gnu/libbsd* \/usr/lib/x86_64-linux-gnu/libXfixes* \/usr/lib/x86_64-linux-gnu/libmount.so.1 \/usr/lib/x86_64-linux-gnu/libpangoft2-1.0* \/usr/lib/x86_64-linux-gnu/libfribidi* \/usr/lib/x86_64-linux-gnu/libthai* \/usr/lib/x86_64-linux-gnu/libXau* \/usr/lib/x86_64-linux-gnu/libXdmcp* \/usr/lib/x86_64-linux-gnu/libicudata.so.67 \/usr/lib/x86_64-linux-gnu/libkrb5.so.3 \/usr/lib/x86_64-linux-gnu/libkrb5support.so.0 \/usr/lib/x86_64-linux-gnu/libk5crypto* \/usr/lib/x86_64-linux-gnu/libmd* \/usr/lib/x86_64-linux-gnu/libblkid* \/usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 \/usr/lib/x86_64-linux-gnu/libdatrie* \/usr/lib/x86_64-linux-gnu/libasound.so.2 \/usr/lib/x86_64-linux-gnu/libGL.so.1 \/usr/lib/x86_64-linux-gnu/libXv.so.1 \/usr/lib/x86_64-linux-gnu/libGLdispatch.so.0 \/usr/lib/x86_64-linux-gnu/libGLX.so.0 \/usr/lib/x86_64-linux-gnu/libXcursor.so.1 \/usr/lib/x86_64-linux-gnu/libXinerama.so.1 \/usr/lib/x86_64-linux-gnu/libXi.so.6 \/usr/lib/x86_64-linux-gnu/libXrandr.so.2 \/usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 \/usr/lib/x86_64-linux-gnu/libwayland-client.so.0 \/usr/lib/x86_64-linux-gnu/libudev.so.1 \/usr/lib/x86_64-linux-gnu/libsystemd.so.0 \/usr/lib/x86_64-linux-gnu/libzstd.so.1 \/usr/lib/x86_64-linux-gnu/liblz4.so.1 \/usr/lib/x86_64-linux-gnu/libnsl.so.2 \/opencvlibs/ENTRYPOINT ["ls", "opencvlibs"]

桃花长相依

我遇到了类似的问题,我从您的帖子中注意到缺少两件事在 OpenCV 编译过程文件中,在“OpenCV 模块:要构建:”部分中,我没有看到 java.lang.&nbsp;根据官方文档java肯定是有的。检查 CMake 的输出并确保 java 是“待构建”模块之一。如果没有,您可能缺少依赖项。我在你的 Dockerfile 中没有看到 Python,但你需要它。这是官方文档中提到的要求。为了使用 Java 绑定构建 OpenCV,您需要安装 JDK(Java 开发工具包)(我们建议 Oracle/Sun JDK 6 或 7)、Apache Ant 和 Python v2.6 或更高版本。我用了这条线RUN&nbsp;apt-get&nbsp;install&nbsp;-y&nbsp;python3.8奇怪的是,当我添加 python 时,java 包含在“要构建的 OpenCV 模块”中

慕桂英4014372

将libopencv_java342.so文件从复制/usr/local/lib到/usr/lib。如果.so未生成文件,请尝试以下操作:cmake&nbsp;-D&nbsp;CMAKE_BUILD_TYPE=Release&nbsp;-D&nbsp;CMAKE_INSTALL_PREFIX=/usr&nbsp;..
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java