Recent

Author Topic: RaspBerry PI3 - Jessie - OpenCV 3 demo  (Read 8994 times)

luis.j.gutierrez@inn2.cl

  • Newbie
  • Posts: 1
RaspBerry PI3 - Jessie - OpenCV 3 demo
« 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

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #1 on: August 30, 2017, 06:15:12 pm »
did you install the corresponding -dev(el) package?

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #2 on: August 30, 2017, 07:12:25 pm »
sudo apt-get update && sudo apt-get install libopencv libopencv-dev
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #3 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.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #4 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.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

kiyo

  • Newbie
  • Posts: 6
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #5 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,

dimonsky

  • Newbie
  • Posts: 3
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #6 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!
« Last Edit: July 01, 2018, 02:49:36 am by dimonsky »

kiyo

  • Newbie
  • Posts: 6
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #7 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.

Bernt

  • Newbie
  • Posts: 6
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #8 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...

kiyo

  • Newbie
  • Posts: 6
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #9 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?

Bernt

  • Newbie
  • Posts: 6
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #10 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

kiyo

  • Newbie
  • Posts: 6
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #11 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

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



Bernt

  • Newbie
  • Posts: 6
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #12 on: March 30, 2019, 04:54:27 pm »
Hi,
With "sudo modprobe bcm2835-v4l2", it works perfectly.  :D
Big Thanks

Regards,

PeterBalch

  • New Member
  • *
  • Posts: 14
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #13 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?


Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: RaspBerry PI3 - Jessie - OpenCV 3 demo
« Reply #14 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!)
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018