Dockerfile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Ubuntu20.04
  2. FROM ros:noetic
  3. RUN apt-get update
  4. RUN apt-get install -y iputils-ping unzip
  5. COPY ./setup.bash ./setup.bash
  6. RUN echo "source ./setup.bash" >> /root/.bashrc
  7. RUN echo "source /opt/ros/noetic/setup.bash" >> /root/.bashrc
  8. #RUN echo "Install OpenCV v4.2.0:" \
  9. # && set -x \
  10. # && apt-get update \
  11. # && apt-get install -y libopencv-dev python3-opencv \
  12. # && python3 -c "import cv2; print(cv2.__version__)"
  13. RUN echo "Install OpenCV v4.5.3 Dependencies:" \
  14. && set -x \
  15. && apt-get update \
  16. && apt-get install -y cmake build-essential pkg-config ant \
  17. && apt-get install -y libtiff5-dev libopenexr-dev libwebp-dev libpng-dev \
  18. && apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libavresample-dev libv4l-dev \
  19. && apt-get install -y libgtk-3-dev \
  20. && apt-get install -y libtesseract-dev \
  21. && apt-get install -y libhdf5-dev \
  22. && apt-get install -y libopenblas-dev libopenblas-base liblapacke-dev \
  23. && apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
  24. && apt-get install -y libtbb-dev \
  25. && apt-get install -y python-numpy \
  26. && echo "End."
  27. COPY ./download/opencv-v4.5.3.zip /opt/opencv-v4.5.3.zip
  28. COPY ./download/opencv-contrib-v4.5.3.zip /opt/opencv-contrib-v4.5.3.zip
  29. RUN echo "Install OpenCV v4.5.3:" \
  30. && set -x \
  31. && unzip -o /opt/opencv-v4.5.3.zip -d /opt/ \
  32. && rm -f /opt/opencv-v4.5.3.zip \
  33. && unzip -o /opt/opencv-contrib-v4.5.3.zip -d /opt/ \
  34. && rm -f /opt/opencv-contrib-v4.5.3.zip \
  35. && sed -i '56a\\ /usr/include/aarch64-linux-gnu' /opt/opencv/cmake/OpenCVFindOpenBLAS.cmake \
  36. && sed -i '73a\\ /usr/lib/aarch64-linux-gnu' /opt/opencv/cmake/OpenCVFindOpenBLAS.cmake \
  37. && cat /opt/opencv/cmake/OpenCVFindOpenBLAS.cmake \
  38. && cd /opt/opencv \
  39. && mkdir build \
  40. && cd build \
  41. && cmake -D CMAKE_BUILD_TYPE=RELEASE \
  42. -D CMAKE_INSTALL_PREFIX=/usr/local \
  43. -D WITH_CUDA=OFF \
  44. -D INSTALL_PYTHON_EXAMPLES=ON \
  45. -D INSTALL_C_EXAMPLES=OFF \
  46. -D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules \
  47. -D PYTHON_EXECUTABLE=/usr/bin/python \
  48. -D BUILD_opencv_python3=ON \
  49. -D PYTHON3_EXECUTABLE=/usr/bin/python3.6 \
  50. -D WITH_GSTREAMER=ON \
  51. -D WITH_TBB=ON \
  52. -D WITH_LIBV4L=ON .. \
  53. -D OPENCV_ENABLE_NONFREE=ON \
  54. -D WITH_PROTOBUF=ON \
  55. -D BUILD_EXAMPLES=ON .. \
  56. && make -j $(nproc) \
  57. && make install \
  58. && ldconfig \
  59. && echo "End."