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:

    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.0.0/modules \
$ 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

$ locate 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="10 (buster)"
  • 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

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.