0

Need help with Open CV3 compile
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Need help with Open CV3 compile

by BillPretty on Wed Jun 02, 2021 6:27 pm

I need help compiling the latest version of OpenCV3.
I have downloaded and unpacked the source file but the following directions no longer work.

https://www.pyimagesearch.com/2015/02/2 ... i-2-and-b/

Has anyone had success installing CV3 on a Raspberry Pi 3 ?
I am running the latest version of the desktop.

BillPretty
 
Posts: 26
Joined: Sun Mar 07, 2021 2:44 pm

Re: Need help with Open CV3 compile

by mikeysklar on Fri Jun 04, 2021 11:18 am

@BillPretty,

Where does your compile bail out? Can you paste in the output in code brackets?

mikeysklar
 
Posts: 4981
Joined: Mon Aug 01, 2016 8:10 pm

Re: Need help with Open CV3 compile

by BillPretty on Fri Jun 04, 2021 12:43 pm

Thanks for the reply.
I never got as far as the compile step.
I downloaded and unzipped the latest version, but I can't get cmake to work.
The directory structure is different. The text file that cmake needs is in a directory called "src"
and I get an error message saying that I can't compile to the source directory. There is already a directory called "build" with files in it.

BillPretty
 
Posts: 26
Joined: Sun Mar 07, 2021 2:44 pm

Re: Need help with Open CV3 compile

by BillPretty on Fri Jun 04, 2021 3:02 pm

Hardware:
Raspberry Pi 3 B+ version V1.2
With convection cooled heat sink, a 5V 2.5A power supply and a 1024 swap file

opencv-4.5.2-dldt-2021.3-vc16-avx2.zip was unzipped to /home/pi

/home/pi/opencv/src/opencv: contains CMakeLists.txt
See Below:

# ----------------------------------------------------------------------------
# Root CMake file for OpenCV
#
# From the off-tree build directory, invoke:
# $ cmake <PATH_TO_OPENCV_ROOT>
#
# ----------------------------------------------------------------------------

The rest of the file is too big to post. I'm not sure what this instruction means.

BillPretty
 
Posts: 26
Joined: Sun Mar 07, 2021 2:44 pm

Re: Need help with Open CV3 compile

by BillPretty on Sat Jun 05, 2021 3:56 pm

I got cmake and make to run by executing:
from /home/pi: cmake ~/opencv/src/opencv
from /home/pi: make -j4

The compile takes several hours, even though I am using all 4 cores.
The CPU gets EXTREMELY hot and a heatsink is probably a requirement.

BillPretty
 
Posts: 26
Joined: Sun Mar 07, 2021 2:44 pm

Re: Need help with Open CV3 compile

by mikeysklar on Sun Jun 06, 2021 6:45 pm

Good to know. Sounds like a job for a Pi4 based system.

mikeysklar
 
Posts: 4981
Joined: Mon Aug 01, 2016 8:10 pm

Re: Need help with Open CV3 compile

by BillPretty on Sun Jun 06, 2021 10:31 pm

Yes a Pi 4 sounds like a good choice.
I have been trying for days to build the latest version from source.
At ~4hrs per build it can take days to trouble shoot.

For anyone trying to use opencv I would recommend the following:
sudo apt install python3-opencv

This installs a stable version 3.2 which works perfectly for me.

BillPretty
 
Posts: 26
Joined: Sun Mar 07, 2021 2:44 pm

Please be positive and constructive with your questions and comments.