Skip to content
Advertisement

How can i make OpenCV work fully on Raspberry Pi 4 (Raspbian Buster)?

I have tried many days to install OpenCV on my Raspberry Pi 4 with Raspbian Buster but i couldn’t get it done. The installation in most cases worked but when importing or using cv2 methods like cv2.imshow(), errors come up (see below).

Did somebody get OpenCV working on a Raspberry Pi 4 or has an idea on how to get it working? Thank you in advance for your help :-)!


Error after installing OpenCV with pip:

JavaScript

I could not get this library “libImath-2_2.so.12” installed. The error persisted.


Error after installing OpenCV with conda:

JavaScript

I checked and the libraries libgtk2.0-dev and pkg-config were installed already. I don’t know how to “configure the script in function cvShowImage” in a way that would make it work.


Error after installing OpenCV by compiling it

I went through the compilation processes described in these two guides. These guides worked on my Raspberry Pi 3b, but not on my Raspberry Pi 4:

  1. https://www.pyimagesearch.com/2018/09/26/install-opencv-4-on-your-raspberry-pi/
  2. https://www.learnopencv.com/install-opencv-4-on-raspberry-pi/

I was able to finish the compilation with make, sudo make install etc. Afterwards though i now still have to link the openCV installation to my Python bindings. With the cmake command i set the following paths:

  • Python 3 Interpreter: /home/pi/miniconda3/bin/python3 (ver 3.5.6)
  • Python 3 Packages: lib/python3.5/dist-packages
  • Python (for build): /usr/bin/python2.7

How can I now access OpenCV, how can I link it to Python so that i can import it as cv2?

Thank you in advance for your help :-)!

Paul

Advertisement

Answer

With the help of @Ingo I was finally able to install OpenCV on Raspbian Buster with a solution so much more simple than expected:

Simply run sudo apt install python3-opencv and it will work and also create windows with cv2.imshow().

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement