Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2020-02

OpenCV

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Adriaan van Os

I looked around on the web for OpenCV Pascal bindings. What I found, seems to be based (mostly) on the OpenCV C interfaces, which covers only part of OpenCV.

Alternatives are:

1. Write flat C++ wrappers by hand ....

2. Hook into the Python wrapper/bindings generator ....

3. Use JNI to access the OpenCV Java interface ....

Has anybody looked into that ?

Regards,

Adriaan van Os

Michael Van Canneyt
to Adriaan van Os
Adriaan van Os wrote 14 lines
I looked around on the web for OpenCV Pascal bindings. What I found, seems to be based (mostly) on the OpenCV C interfaces, which covers only part of OpenCV. Alternatives are: 1. Write flat C++ wrappers by hand .... 2. Hook into the Python wrapper/bindings generator .... 3. Use JNI to access the OpenCV Java interface .... Has anybody looked into that ?

I have been looking for them myself, but didn't find anything complete.

Michael.

Sven Barth
to Adriaan van Os: I looked around on the web for OpenCV Pascal bindings. What I found, seems to be based…

Adriaan van Os schrieb am Do., 13. Feb. 2020, 14:26:

Show quoted text 15 lines
I looked around on the web for OpenCV Pascal bindings. What I found, seems to be based (mostly) on the OpenCV C interfaces, which covers only part of OpenCV. Alternatives are: 1. Write flat C++ wrappers by hand .... 2. Hook into the Python wrapper/bindings generator .... 3. Use JNI to access the OpenCV Java interface .... Has anybody looked into that ?

You could try to use this modified version of Swig which is supposed to support Delphi: https://github.com/FMXExpress/swig-delphi

I did not test it. I don't know whether the OpenCV code will work with SWIG (though there exists a OpenCV-SWIG project with Python modules, so maybe it does work), nor how good the generated Delphi code is. At the very least you'll have to adjust the generated code for FPC.

Regards,
Sven

Adriaan van Os
to Sven Barth

Sven,

You could try to use this modified version of Swig which is supposed to support Delphi:Â https://github.com/FMXExpress/swig-delphi

I played a bit with SWIG, but my impression is that it will take considerable time to get OpenCV to compile.

SWIG 4.0.1 did build out of the box on OSX, the Delphi version did not. Porting the Delpi changes to a newer version of SWIG will take time too. Is there any special reason why Delphi support is not accepted for the SWIG main code tree ?

It is strange that SWIG doesn't have a "neutral" C target language option: C++ wrappers for use as-if-by-C.

I will write the C++ wrappers by hand for a few OpenCV functions I need. And see from there.

Thanks for the replies.

Regards,

Adriaan van Os

Adriaan van Os
to Sven Barth: Adriaan van Os schrieb am Do., 13. Feb. 2020, 14:26: You could try to use this modified…
SWIG 4.0.1 did build out of the box on OSX, the Delphi version did not. Porting the Delpi changes to a newer version of SWIG will take time too. Is there any special reason why Delphi support is not accepted for the SWIG main code tree ?

I found <https://sourceforge.net/p/swig/mailman/message/22466974/>. It looks like tha patches for Delphi (and FPC) just needs some rework, to get included. Projects like these (swig-delphi) tend to die out, unless included in the main code tree.

Regards,

Adriaan van Os

Henry Vermaak
to Adriaan van Os: I looked around on the web for OpenCV Pascal bindings. What I found, seems to be based…
Adriaan van Os wrote 8 lines
I looked around on the web for OpenCV Pascal bindings. What I found, seems to be based (mostly) on the OpenCV C interfaces, which covers only part of OpenCV. Alternatives are: 8--- 2. Hook into the Python wrapper/bindings generator ....>

I think using the python/java generator is the only way to make anything that resembles a complete binding. As an intermediate step I hoped that the generated C bindings could be run through h2pas, but h2pas has never worked without manual tinkering for me. In the long run a class-based binding would be great to have. I've been meaning to look into this, but digging through thousands of lines of python is not my idea of fun.

Henry

Sven Barth
to Adriaan van Os: I found <https://sourceforge.net/p/swig/mailman/message/22466974/>. It looks like tha…

Adriaan van Os schrieb am Fr., 14. Feb. 2020, 12:22:

Show quoted text 12 lines
> SWIG 4.0.1 did build out of the box on OSX, the Delphi version did not. Porting the Delpi changes > to a newer version of SWIG will take time too. Is there any special reason why Delphi support is > not accepted for the SWIG main code tree ? I found <https://sourceforge.net/p/swig/mailman/message/22466974/>. It looks like tha patches for Delphi (and FPC) just needs some rework, to get included. Projects like these (swig-delphi) tend to die out, unless included in the main code tree.

You did look at the date right? They are many years older then the github fork I linked to so those will probably work even less.

I agree though that some it should become part of their upstream, but for that there first needs to be a working implementation. That is also probably the reason they don't have it yet: no version got far enough...

Regards,
Sven