Lazarus

Programming => General => Topic started by: del on September 19, 2019, 12:52:23 am

Title: A Way To Use Modern OpenCV?
Post by: del on September 19, 2019, 12:52:23 am
I've asked about OpenCV before. Specifically the latest C++ versions. Since then I've spent about 18 months programming with OpenCV in C++. However, Lazarus is head and shoulders above any other non-commercial IDE for Linux. So I'm always pulled back to Lazarus (and Pascal!) by something like a gravitational force.

So yesterday, I was thinking ...

If I'm understanding this correctly, I don't have to wait for somebody to develop OpenCV bindings for Free Pascal. I just write my own .dll's and / or .so's in C++ and manage the interfaces. And I still get to write the main app in Lazarus / FPC !!! It seems almost too good to be true! What am I missing? I've never done anything like this with Lazarus, but I've done something similar with Python "ctypes" and a .dll written in C.

I don't want you to spend a lot of time coaching the specifics, I should learn those on my own time. But I do want to know if it's as feasible as I seem to believe it is. Thanks in advance !! (I was gonna post this in "Graphics" but it's generic enough conceptually for general programming)

Title: Re: A Way To Use Modern OpenCV?
Post by: tr_escape on September 19, 2019, 07:02:12 am
You already explained your problem and your solving method :) so also there some workarounds on github:

https://github.com/zbyna/opencv-lazarus (https://github.com/zbyna/opencv-lazarus) last commit 2016

and

https://github.com/Laex/Delphi-OpenCV (https://github.com/Laex/Delphi-OpenCV)  last commit 2 days ago

If you wish you can create another one too.

If you need more about how to use and create a dll / so file lazarus/fpc's wikies will be help

https://wiki.freepascal.org/shared_library (https://wiki.freepascal.org/shared_library)

Title: Re: A Way To Use Modern OpenCV?
Post by: PascalDragon on September 19, 2019, 09:09:07 am
If I'm understanding this correctly, I don't have to wait for somebody to develop OpenCV bindings for Free Pascal. I just write my own .dll's and / or .so's in C++ and manage the interfaces. And I still get to write the main app in Lazarus / FPC !!! It seems almost too good to be true! What am I missing? I've never done anything like this with Lazarus, but I've done something similar with Python "ctypes" and a .dll written in C.

I don't want you to spend a lot of time coaching the specifics, I should learn those on my own time. But I do want to know if it's as feasible as I seem to believe it is. Thanks in advance !! (I was gonna post this in "Graphics" but it's generic enough conceptually for general programming)
That is indeed how bindings for C++ libraries are usually done: by flattening the interface. Qt4Pas works this way as well for example.
Title: Re: A Way To Use Modern OpenCV?
Post by: del on September 19, 2019, 06:42:42 pm
Cool - thanks for the replies. That's encouraging. I'll start poking around with it this weekend!   :)
TinyPortal © 2005-2018