I am going to use a code shared on GitHub on facial feature extraction. This code has OpenCV 2.4.7 and Python 2.7 dependencies. I tried OpenCV 3.4, but it didn't work. This code uses cv2.Boost() which is not found in OpenCV 3.4. Also, pypi only support OpenCV 3x. I couldn't install OpenCV 2.4.7 by pip install.
Please let me know how I can install OpenCV 2.4.7 for Python? I prefer to install it in a Conda virtual environment.
OS: Ubuntu 16; I can use Windows 10 too.
I think you could build the OpenCV from source, so you can choose the branch (version) you want to use:
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
cd ~
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 2.4
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local ..
make -j7
sudo make install
Good luck!
pip install opencv-python==2.4.7
For python3 try:
pip3 install opencv-python==2.4.7
However, before you install opencv, have numpy and matplotlib installed.
pip install numpy
pip install matplotlib
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.