Lazarus

Programming => General => Topic started by: luis.j.gutierrez@inn2.cl on August 30, 2017, 05:51:12 pm

Title: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: luis.j.gutierrez@inn2.cl on August 30, 2017, 05:51:12 pm
Lazarus 1.7, FPC 3, OpenCV 3
I took a demo from the network that uses OpenCV to process images. But after fix some problems and pass the compilation, the linker send me this errors:

/usr/bin/ld: cannot find -lcxcore
/usr/bin/ld: cannot find -lcv
/usr/bin/ld: cannot find -lhighgui

Can provide me a tip to fix that error and run the demo?

Best regards
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: marcov on August 30, 2017, 06:15:12 pm
did you install the corresponding -dev(el) package?
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: Thaddy on August 30, 2017, 07:12:25 pm
sudo apt-get update && sudo apt-get install libopencv libopencv-dev
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: avra on August 31, 2017, 09:33:19 am
Maybe this might bring more light to the topic:
http://forum.lazarus.freepascal.org/index.php/topic,31851.msg204649.html#msg204649

In case of likely further problems with OpenCV3 you can switch to OpenCV2.
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: Thaddy on August 31, 2017, 11:49:05 am
Debian Jessie has correct versions. Raspbian has too.... There should not be any problems on a Raspbian Jessie install but you have to install at least the -dev package manually. (I use it myself). Note un-installing wolfram-engine and purge it can cause this problem. If that's the case just re-install opencv as per my suggestion.
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: kiyo on November 21, 2017, 05:51:38 pm
  I wrote opencv demo program for Raspbian STRETCH.
 Program version are follows:
 FPC         :3.0.0
 Lazarus   :1.6.2
 OpenCV   :3.1.1
 Raspbian :September 2017 STRETCH
 
 You have to build and install OpenCV 3.1.1 from source file.
 https://sourceforge.net/projects/opencvlibrary/files/opencv-unix/

 Please read attached readme.txt file for the other informations.
 - unit1.lfm           demo program
 - unit1.pas           demo program
 - raspiopencv.pas  opencv interface
 - raspiopencv.jpg  demo picture
 - readme.txt         explanation file
Regards,
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: dimonsky on July 01, 2018, 02:32:24 am
I took the source code from this example and try to run it on RaspberryPI3B, Jessie.
Compiles fine, but by running I got a problem:
Code: Pascal  [Select][+][-]
  1. haarxml:='/home/pi/Downloads/opencv-master/data/haarcascades/haarcascade_frontalface_default.xml';
  2.    
  3.     cvHCC :=cvLoad(PChar(haarxml));  
  4.  

The line with cvLoad(Pchar(xmlpath)) triggers an error
"Project project1 raises exception class 'External SIGABIT'
in file '../sysdeps/unix/sysv/linux/raise.c' at line 51"

WHy could this happen and how to fix this?

UPD:
fixed by replacing a path to
/home/pi/Downloads/opencv-master/data/haarcascades_cuda/haarcascade_frontalface_default.xml';
(I have no idea what is the difference between those two files).
Now everything is fine, thank you!
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: kiyo on July 02, 2018, 10:59:43 pm
The error occurs because the file structure of opencv3.4.1.zip was changed.
Please change a appropriate pathname which haarcascades file is located.
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: Bernt on March 16, 2019, 12:30:55 pm
I have exactly the same issue on "CameraCapture" button ...
The problem seams to be here : 
Code: Pascal  [Select][+][-]
  1. img1:=cvQueryFrame(camera);  

"img1" is nil...
Can you help me ?
Regards


My configuration : RPIB3, Stretch, Lazarus 1.6.2, OpenCV 3.4.1, correct path to xml files...
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: kiyo on March 17, 2019, 08:25:24 am
Please give me some more information.
What is your camera?
USB webcam? Or RaspberryPi CSI camera?
Did you confirm that the camera works with the other application software?
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: Bernt on March 26, 2019, 07:28:10 pm
Hi,
I confirm that i use the Raspi camera v2 on CSI port.
The camera work with other app software.
Thanks for reply

Regards
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: kiyo on March 29, 2019, 02:50:37 pm
In case of RaspberryPi camera , you need to add V4L2 driver.

https://www.raspberrypi.org/forums/viewtopic.php?t=126358 (https://www.raspberrypi.org/forums/viewtopic.php?t=126358)

Please search with the keyword "Raspberry" "V4L2" "opencv".


Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: Bernt on March 30, 2019, 04:54:27 pm
Hi,
With "sudo modprobe bcm2835-v4l2", it works perfectly.  :D
Big Thanks

Regards,
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: PeterBalch on June 09, 2019, 07:07:18 pm
I have Raspberry Pi 3B+, Lazarus 2.0.0, OpenCV 3.4.0, Pi Camera

I've got OpenCv and the camera working in Python. I can do face detection. Now I'd like to get it to work in Lazarus.

I downloaded OpenCV.pas from here

https://github.com/zbyna/opencv-lazarus/blob/master/OpenCV.pas

And tried to compile a "hello world" program that calls nothing in OpenCV but includes it in a "Uses" line to force it to compile.

There was a small problem with the undeclared CopyMemory procedure which I guess I've fixed.

It all compiles but won't link. It gives the error:

/usr/bin/ld: cannot find -lcv
/usr/bin/ld: cannot find -lhighgui

I tried the suggestion from 2017 of

sudo apt-get update && sudo apt-get install libopencv libopencv-dev

but it gives the error

Unable to locate package libopencv

Calling

sudo apt-get install libopencv-dev

seems to work OK but doesn't install cv and highgui

It doesn't fix the Lazarus linker error.

Any thoughts?

Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: Thaddy on June 09, 2019, 07:41:20 pm
Code: Bash  [Select][+][-]
  1. sudo su && apt-get update && apt-get dist-upgrade -y && apt-get install libopencv-dev
  2.  

Is enough. (tested!)
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: PeterBalch on June 12, 2019, 06:24:28 pm
Thanks. Unfortunately, that didn't fix the errors.

The command line you suggested didn't work. The "sudo su" part made me into a super-user but the subsequent commands didn't execute. So I did them individually:

sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install libopencv-dev

I presume that's right. I also tried it as a super-user. I don't understand why that's different from what I did before but I'm new to all this Linux magic incantation stuff.

I'd have expected the apt-get to install files called cv.o and highgui.o - isn't that what the linker is wanting? But searching the filing system found several copies of cv.h, cv.hpp, highgui.h and highgui.hpp. No .o files.

What could I try next?

Thank you for your help.

Peter

(Sorry for the slow reply. I'd expected the forum to email me when there was a post waiting for me. Perhaps I have my preferences set up wrongly.)

Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: Thaddy on June 12, 2019, 08:26:40 pm
I have no clue, because that works here... (written from a Raspberry Pi 3  O:-) )
We have to do this probably step by step. I have a lot of Pi's and this should work...  :'( :(
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: PeterBalch on June 14, 2019, 12:07:05 am
Linux assures me that I already have the latest versions of all the dev packages I try to install.

I presume that the install should have given me copies of
  highgui.so
  cv.so
or perhaps it's
  libhighgui.so
  libcv.so

Looking at the code in OpenCV.pas (line 125 approx), prehaps it should be
  libhighgui.so.2.1
  libcv.so.2.1

I don't have any of those files on my drive. Can I download them from somewhere?

I do have a copy of
  libopencv_highgui.so

Is this a problem of clashing version numbers?

Thank you.

Peter

(I have Raspberry Pi 3B+, Lazarus 2.0.0, OpenCV 3.4.0, Raspbian 9.9, Pi Camera)
Title: Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
Post by: PeterBalch on June 17, 2019, 01:08:13 pm
I finally worked out the answer. It was indeed to do with clashing versions. I'd had trouble finding an OpenCV.pas wrapper that worked with Pi rather than Windows or Mac.

I had been using

https://github.com/zbyna/opencv-lazarus/blob/master/OpenCV.pas

When I switched to

https://github.com/opencv/opencv

The problems went away.
TinyPortal © 2005-2018