shimat / opencvsharp

OpenCV wrapper for .NET
Apache License 2.0
5.44k stars 1.15k forks source link

Error in Creating OpenCVsharp docker image #1566

Open marcovnc opened 1 year ago

marcovnc commented 1 year ago

Summary of your issue

Hi, while trying to build docker image for arm architecture with the following dockerfile:

`FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim-arm64v8

ENV DEBIAN_FRONTEND=noninteractive ENV OPENCV_VERSION=4.5.3

WORKDIR /

Install opencv dependencies

RUN apt-get update && apt-get -y install --no-install-recommends \ apt-transport-https \ software-properties-common \ wget \ unzip \ ca-certificates \ build-essential \ cmake \ git \ libtbb-dev \ libatlas-base-dev \ libgtk2.0-dev \ libavcodec-dev \ libavformat-dev \ libswscale-dev \ libdc1394-22-dev \ libxine2-dev \ libv4l-dev \ libtheora-dev \ libvorbis-dev \ libxvidcore-dev \ libopencore-amrnb-dev \ libopencore-amrwb-dev \ libavresample-dev \ x264 \ libtesseract-dev \ libgdiplus \ && apt-get -y clean \ && rm -rf /var/lib/apt/lists/*

Setup opencv and opencv-contrib source

RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ unzip ${OPENCV_VERSION}.zip && \ rm ${OPENCV_VERSION}.zip && \ mv opencv-${OPENCV_VERSION} opencv && \ wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ unzip ${OPENCV_VERSION}.zip && \ rm ${OPENCV_VERSION}.zip && \ mv opencv_contrib-${OPENCV_VERSION} opencv_contrib

Build OpenCV

RUN cd opencv && mkdir build && cd build && \ cmake \ -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ -D CMAKE_BUILD_TYPE=RELEASE \ -D BUILD_SHARED_LIBS=OFF \ -D ENABLE_CXX11=ON \ -D BUILD_EXAMPLES=OFF \ -D BUILD_DOCS=OFF \ -D BUILD_PERF_TESTS=OFF \ -D BUILD_TESTS=OFF \ -D BUILD_JAVA=OFF \ -D BUILD_opencv_app=OFF \ -D BUILD_opencv_barcode=OFF \ -D BUILD_opencv_java_bindings_generator=OFF \ -D BUILD_opencv_js_bindings_generator=OFF \ -D BUILD_opencv_python_bindings_generator=OFF \ -D BUILD_opencv_python_tests=OFF \ -D BUILD_opencv_ts=OFF \ -D BUILD_opencv_js=OFF \ -D BUILD_opencv_bioinspired=OFF \ -D BUILD_opencv_ccalib=OFF \ -D BUILD_opencv_datasets=OFF \ -D BUILD_opencv_dnn_objdetect=OFF \ -D BUILD_opencv_dpm=OFF \ -D BUILD_opencv_fuzzy=OFF \ -D BUILD_opencv_gapi=OFF \ -D BUILD_opencv_intensity_transform=OFF \ -D BUILD_opencv_mcc=OFF \ -D BUILD_opencv_objc_bindings_generator=OFF \ -D BUILD_opencv_rapid=OFF \ -D BUILD_opencv_reg=OFF \ -D BUILD_opencv_stereo=OFF \ -D BUILD_opencv_structured_light=OFF \ -D BUILD_opencv_surface_matching=OFF \ -D BUILD_opencv_videostab=OFF \ -D BUILD_opencv_wechat_qrcode=ON \ -D WITH_GSTREAMER=OFF \ -D WITH_ADE=OFF \ -D OPENCV_ENABLE_NONFREE=ON \ .. && make -j$(nproc) && make install && ldconfig

Download OpenCvSharp

RUN git clone https://github.com/shimat/opencvsharp.git && cd opencvsharp

Install the Extern lib.

RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ cmake -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ make -j$(nproc) && make install && \ rm -rf /opencv && \ rm -rf /opencv_contrib && \ cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/`

I receive the following error when opencvsharp compiling reaches 26%:

'In file included from /opencvsharp/src/OpenCvSharpExtern/aruco.cpp:1: /opencvsharp/src/OpenCvSharpExtern/aruco.h: In function 'ExceptionStatus aruco_Dictionary_generateImageMarker(cv::aruco::Dictionary, int, int, cv::_OutputArray, int)': /opencvsharp/src/OpenCvSharpExtern/aruco.h:238:7: error: 'class cv::aruco::Dictionary' has no member named 'generateImageMarker' obj->generateImageMarker(id, sidePixels, *img, borderBits); ^~~~~~~

make[2]: [OpenCvSharpExtern/CMakeFiles/OpenCvSharpExtern.dir/build.make:63: OpenCvSharpExtern/CMakeFiles/OpenCvSharpExtern.dir/aruco.cpp.o] Error 1 make[2]: Waiting for unfinished jobs.... make[1]: [CMakeFiles/Makefile2:91: OpenCvSharpExtern/CMakeFiles/OpenCvSharpExtern.dir/all] Error 2 make: [Makefile:130: all] Error 2 .

OpenCV compiling process ends fine. This happens with different versions of OpenCV and both on X86 and ARM architectures.

What can I do to solve the issue?

Environment

ARM

What did you do when you faced the problem?

Docker image build

marcovnc commented 1 year ago

Solved using last openCV version: 4.7

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.