Events


More Events...

 

Install OpenCV 4.1.1 on Raspberry Pi 4

 

The below is largely based upon this https://gist.github.com/willprice/abe456f5f74aa95d7e0bb81d5a710b60
The scripts work very well but you will need to update them to use opencv 4.1.1

 

I used the raspberry pi 4 with 4G of ram. It's a good idea to install heat sinks on the Pi as it will get hot during the install.

 

Imutils:

Once opencv is installed we need to install the imutils module. Use the command below to install it:

     sudo pip3 install imutils

Note we are doing this for python 3 thus the pip3.

 

ImportError: /usr/local/lib/libopencv_core.so.4.1: undefined symbol: __atomic_compare_exchange_8 Error:


If you run the test.py example and get the error above you need to edit the

/root/opencv/opencv-4.1.1/build/modules/python3/CMakeFiles/opencv_python3.dir/link.txt

file and change the first part from:

/usr/bin/c++ -fPIC -fsigned-char -W -Wall.

to

/usr/bin/c++ -fPIC  -latomic  -fsigned-char -W -Wall.

 

ie Add the -latomic term and then run make install again and all should be ok.

 

 

 

@mshabunin the cmake option helped to build opencv successfully. But when I'm using python to import opencv,.
I'm still getting more or less the same exception:.
    ImportError: /usr/local/lib/libopencv_core.so.4.1: undefined symbol: __atomic_compare_exchange_8
I had to add -latomic to modules/python3/CMakeFiles/opencv_python3.dir/link.txt to get the python import working
@jp9 I added it to:
    /root/opencv/opencv-4.1.1/build/modules/python3/CMakeFiles/opencv_python3.dir
I changed it to:
    /usr/bin/c++ -fPIC  -latomic  -fsigned-char -W -Wall.
from:
    /usr/bin/c++ -fPIC -fsigned-char -W -Wall.
THIS WORKED FINE.
Darknet
Trying Darknet with NNPACK to get better results.
See https://github.com/zxzhaixiang/darknet-nnpack