0

I am trying to install opencv 3.0.0 on my raspberry pi 2b but I keep running into erros... currently, it complains about the following missing header files when I run the following cmake command:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.0.0/modules \
    -D BUILD_EXAMPLES=ON ..
$ cat /home/pi/opencv-3.0.0/build/CMakeFiles/CMakeError.log | grep fatal
/home/pi/opencv-3.0.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: sys/videoio.h: No such file or directory
/home/pi/opencv-3.0.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: ffmpeg/avformat.h: No such file or directory

They do exist in my raspberry pi:

$ locate avformat.h
/home/pi/opencv-3.0.0/3rdparty/include/ffmpeg_/libavformat/avformat.h
/usr/include/arm-linux-gnueabihf/libavformat/avformat.h

$ locate videoio.h
/home/pi/opencv-3.0.0/modules/videoio/include/opencv2/videoio.hpp
/home/pi/opencv-3.0.0/modules/videoio/include/opencv2/videoio/videoio.hpp
/usr/include/sys/videoio.h

I tried to symlink them into /usr/include under their respective paths, but it didn't work...

Anything I am doing wrong?

Note I am trying to follow this guide for the installation

Edit OS release:

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
  • What operating system, what version do you use? Raspberry Pi OS Buster? – Ingo Oct 16 '20 at 19:20
  • @Ingo good question! yes, version 10 (buster). Added to original question – Tomer Amir Oct 17 '20 at 7:27
2

Seems you try to build OpenCV from source. If you do not need exactly opencv 3.0.0 there is no need to hassle with building from source. With Raspberry Pi OS Buster you can just install opencv 3.2.0 from its repository.

rpi ~$ sudo apt install python3-opencv

should do it. Look with

rpi ~$ apt list *opencv*

whatever else is available for OpenCV.

  • if I could only upvote and accept more than once! thanks @Ingo ! I was working on this for about 2 weeks! – Tomer Amir Oct 18 '20 at 12:59
  • p.s. it installed opencv 4.4 but this is actually better – Tomer Amir Oct 18 '20 at 13:00

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.