* * *

Author Topic: OpenCV with Lazarus  (Read 4456 times)

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 674
OpenCV with Lazarus
« on: March 07, 2016, 11:40:04 am »
hello,
here is a starting point to use opencv with Lazarus.
Not sure that works with all the functions of Opencv, but works with the lkdemo  ( video motion tracking)
OpenCV.pas needs to be checked because it is a version for 2.1 version of Opencv and i use it with version 3.0 of Opencv ( I have done some changes for that works).
OpenCV.pas needs some changes to work with Linux.
Lkdemo Lazarus project :
In attachment lkdemo project for Lazarus
 Download opencv 3.0 for windows from here
Extract the  dlls  \opencv-3.0.0.exe\opencv\build\x86\vc12\bin\*.dll (choose the right folder for your O.S ex : x86 -> 32 bits , vc12 -> visual c++ dlls  version 12)  from opencv-3.0.0.exe with 7z  in your project folder.
 you must change this line in unit1.pas -> choose a video file or capture from CAM
 
Code: Pascal  [Select]
  1.  //      capture := cvCaptureFromCAM(0);
  2.         capture := cvCaptureFromFile(PChar('f:\temp\videos\test.mp4'));

tested with Lazarus 1.6 Windows 32 bits and Opencv 3.0.

Thanks to Giandomenico   
Enjoy !
« Last Edit: March 07, 2016, 11:53:57 am by Jurassic Pork »

zbyna

  • New member
  • *
  • Posts: 46
Re: OpenCV with Lazarus
« Reply #1 on: April 18, 2016, 09:12:33 pm »

six1

  • New member
  • *
  • Posts: 42
Re: OpenCV with Lazarus
« Reply #2 on: January 09, 2018, 02:19:42 pm »
My small contribution (Face detect, working Sample!):
http://www.mediafire.com/file/3t2a024nacfwx0k/Laz_OpenCV_Face_Detect.zip

You have to download OpenCV 2.4.13.5 https://opencv.org/releases.html
Extract following Libs from opencv\build\x86\vc14\bin\ into Programs dir:

opencv_calib3d2413.dll
opencv_contrib2413.dll
opencv_core2413.dll
opencv_features2d2413.dll
opencv_highgui2413.dll
opencv_imgproc2413.dll
opencv_legacy2413.dll
opencv_nonfree2413.dll
opencv_objdetect2413.dll
opencv_photo2413.dll
opencv_video2413.dll

Have fun, Michael

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1181
Re: OpenCV with Lazarus
« Reply #3 on: January 19, 2018, 04:10:58 am »
Ooh.  OpenCV has been on my TODO list for a while.  Many thanks for posting this...
Lazarus Trunk/FPC Trunk on Linux & Windows [7, 8.1]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

six1

  • New member
  • *
  • Posts: 42
Re: OpenCV with Lazarus
« Reply #4 on: January 22, 2018, 02:05:23 pm »
Hi Mike,
it seems to be a long way...  ::)

Meanwhile i've modified Delphi components to work with Lazarus.

After many fixes and few improvements, most of it is working, but there are a few problems left to do...
(ocvView is now working after many hours of debuging, but videosource must be set at runtime! see LazSample in Samle folder on github)

look at github, for latest changes of my OpenCV Fork

https://github.com/six1/Laz_OpenCV_2


best, Michael
« Last Edit: January 22, 2018, 03:36:57 pm by six1 »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus