Skip to content

Instantly share code, notes, and snippets.

@meisa233
Created July 19, 2023 07:38
Show Gist options
  • Save meisa233/d019971016ac091fc2bdece95989f16c to your computer and use it in GitHub Desktop.
Save meisa233/d019971016ac091fc2bdece95989f16c to your computer and use it in GitHub Desktop.
  1. Install dependency packages
sudo apt update
sudo apt install build-essential cmake pkg-config
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libgtk-3-dev
sudo apt-get install libatlas-base-dev gfortran
  1. Download opencv source code from https://opencv.org/releases/
  2. Git clone opencv_contrib
git clone https://github.com/opencv/opencv_contrib.git
  1. Compile
cd /opencv/root/folder
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D OPENCV_EXTRA_MODULES_PATH=/home/wlbtest/video-colorize/Deep-Exemplar-based-Video-Colorization/opencv_contrib/modules \
-D BUILD_opencv_python3=ON \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_FFMPEG=ON \
-D PYTHON_DEFAULT_EXECUTABLE="/usr/local/python3.6/bin/python3.6" \
-D PYTHON3_EXECUTABLE=$(which python) \
-D PYTHON3_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON3_INCLUDE_DIR2=$(python -c "from os.path import dirname; from distutils.sysconfig import get_config_h_filename; print(dirname(get_config_h_filename()))") \
-D PYTHON3_LIBRARY=/usr/local/python3.6/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a -D PYTHON3_NUMPY_INCLUDE_DIRS=$(python -c "import numpy; print(numpy.get_include())") \
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") ..
  1. Some error some errors such as
-- xfeatures2d/boostdesc: Downloading boostdesc_bgm.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i
-- xfeatures2d/boostdesc: Downloading boostdesc_bgm_bi.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_bi.i
-- Try 1 failed
CMake Warning at /home/wlbtest/video-colorize/Deep-Exemplar-based-Video-Colorization/opencv-4.8.0/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/boostdesc: Download failed: 28;"Timeout was reached"

  For details please refer to the download log file:

  
  /home/wlbtest/video-colorize/Deep-Exemplar-based-Video-Colorization/opencv-4.8.0/build/CMakeDownloadLog.txt

Download files and place them to /opencv/.cache/wechat_qrcode, /opencv/.cache/xfeatures2d
Rename them using format like "md5-name.suffix". For example, "238e2b2d6f3c18d6c3a30de0c31e23cf-detect.caffemodel".
Modify /opencv/wechat_qrcode/CMakeLists.txt and /opencv/xfeatures2d/CMakeLists.txt
Comment the lines about downloading

/opencv/wechat_qrcode/CMakeLists.txt

#foreach(model_name ${model_names})
#    foreach(model_type ${model_types})
#        ocv_download(FILENAME ${model_name}.${model_type}
#                        HASH ${hash_${model_name}_${model_type}}
#                        URL
#                        "${OPENCV_WECHAT_QRCODE_URL}"
#                        "$ENV{OPENCV_WECHAT_QRCODE_URL}"
#                        "https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/${wechat_qrcode_commit_hash}/"
#                        DESTINATION_DIR "${CMAKE_BINARY_DIR}/downloads/wechat_qrcode"
#                        ID "wechat_qrcode"
#                        RELATIVE_URL
#                        STATUS res)
#        if(NOT res)
#            message(WARNING "WeChatQRCode: Can't get ${model_name} ${model_type} file for wechat qrcode.")
#        endif()
#    endforeach()
#endforeach()

Anothe error

-- data: Downloading face_landmark_model.dat from https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat
-- Try 1 failed
CMake Warning at /home/wlbtest/video-colorize/Deep-Exemplar-based-Video-Colorization/opencv-4.8.0/cmake/OpenCVDownload.cmake:248 (message):
  data: Download failed: 28;"Timeout was reached"

  For details please refer to the download log file:

  
  /home/wlbtest/video-colorize/Deep-Exemplar-based-Video-Colorization/opencv-4.8.0/build/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /home/wlbtest/video-colorize/Deep-Exemplar-based-Video-Colorization/opencv_contrib/modules/face/CMakeLists.txt:13 (ocv_download)

Download https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat
Modify /opencv/modules/face/CMakeLists.txt

"file:///home/usrname/install/"# <-- your path that place face_landmark_model.dat
#"https://raw.githubusercontent.com/opencv/opencv_3rdparty/${__commit_hash}/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment