MMM-Face-Reco-DNN icon indicating copy to clipboard operation
MMM-Face-Reco-DNN copied to clipboard

Report: OpenCV 4.2.0 working and compile guide

Open HorstBaerbel opened this issue 4 years ago • 2 comments

I tried your module with OpenCV 4.2.0 from git and it works fine. Here's what I did to make it compile (rough draft of install script; might not work, but you get the idea):

#!/bin/bash
echo "Installing OpenCV 4.2.0 build dependencies..."
sudo apt --no-install-recommends install build-essential cmake git pkg-config -y
echo "Installing OpenCV 4.2.0 core dependencies..."
sudo apt --no-install-recommends install libgtk-3-dev libopenblas-dev liblapack-dev gfortran libatlas-base-dev libtbb2 libtbb-dev -y
echo "Installing OpenCV 4.2.0 image / video dependencies..."
sudo apt --no-install-recommends install libavcodec-dev libavformat-dev libswscale-dev libjpeg-dev libpng-dev libtiff-dev libv4l-dev -y
#echo "Installing OpenCV 4.2.0 python dependencies..."
#sudo apt --no-install-recommends install python-dev libpython-dev python-pip python-numpy python-setuptools python-wheel -y
echo "Installing OpenCV 4.2.0 python3 dependencies..."
sudo apt --no-install-recommends install python3-dev libpython3-dev python3-pip python3-numpy python3-setuptools python3-wheel -y
echo "Installing OpenCV 4.2.0 python3 packages..."
pip3 install setuptools
pip3 install dlib
pip3 install face_recognition
pip3 install imutils
cd ~
git clone --branch 4.2.0 --depth 1 https://github.com/opencv/opencv.git
cd opencv
mkdir build
cd build
echo "CMake'ing OpenCV 4.2.0..."
cmake -D OPENCV_ENABLE_NONFREE=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D PYTHON_DEFAULT_EXECUTABLE=$(which python3) -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
echo "Building OpenCV 4.2.0. This may take a while..."
CORES=$(grep -c '^processor' /proc/cpuinfo 2>/dev/null)
make -j $CORES
echo "Done."

HorstBaerbel avatar Jan 25 '20 22:01 HorstBaerbel

Hey thanks a lot for the script. I will retest it and will add a functional version to the repository.

nischi avatar Jan 27 '20 15:01 nischi

On my Raspberry Pi 3B+ with the latest Buster release (2020-12-02) I was able to install opencv (and successfully use with this module) directly using pip3:

pip3 install opencv-python==4.4.0.46

(I don't think the version specification is required)

stefan-sherwood avatar Dec 18 '20 00:12 stefan-sherwood

Is in version 2.0 and pipenv

nischi avatar Oct 01 '23 15:10 nischi