I have raspberry pi 3, I want to install OpenCV for python. while I was doing that according to the following steps... sudo apt-get update sudo apt-get upgrade sudo rpi-update sudo reboot sudo apt-get install build-essential git cmake pkg-config sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev sudo apt-get install libxvidcore-dev libx264-dev sudo apt-get install pkg-config sudo apt-get install libgtk2.0-dev sudo apt-get install libatlas-base-dev gfortran cd ~ git clone https://github.com/Itseez/opencv.git cd opencv git checkout 3.1.0 cd ~ git clone https://github.com/Itseez/opencv_contrib.git cd opencv_contrib git checkout 3.1.0 sudo apt-get install python3-dev wget https://bootstrap.pypa.io/get-pip.py sudo python3 get-pip.py pip3 install numpy cd ~/opencv mkdir build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_C_EXAMPLES=OFF \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ -D BUILD_EXAMPLES=ON .. make sudo make install sudo ldconfig at the line "git checkout 3.1.0" it gives me this error: pi@raspberrypi:~/opencv $ sudo git checkout 3.1.0 HEAD is now at 92387b1ef... Fix java version++ I am not sure if it means to update my java version... so what can I do? any help, please... Many thanks.

  • Doesn't Raspbian have a version of opencv in the repository? – joan May 3 '18 at 10:27

Actually, that's not an error message coming out of git. Given that you asked to checkout a tag, git is telling you that you checked out a given revision (not a branch) and though you didn't write it, it told you that you are working in detached HEAD, in other words, you are working without a branch... which is perfectly fine if all you want to do is checkout a given revision/tag (as in your case) and don't intend to do any changes on private branches of your own or push stuff into other repos. So it's perfectly fine, you can continue working on your flow of instructions.

PS And the messaje "fix java version"? That's the comment from the revision that you checked out. Try this: git show --summary 3.1.0

  • Exactly, that Fix java version++ is the commit message to which your HEAD is located now – Mattia Righetti Jun 24 '18 at 22:54

Make sure you have the default raspbian repositories addressed in your sources.list:

rpi ~$ cat /etc/apt/sources.list
deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

rpi ~$ cat /etc/apt/sources.list.d/raspi.list
deb http://archive.raspberrypi.org/debian/ stretch main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ stretch main ui

Then install OpenCV for python:

rpi ~$ sudo apt update
rpi ~$ sudo apt full-upgrade
rpi ~$ sudo apt install python-opencv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.