OpenCV and Xojo, or alternatives

I wrote this OpenCV port for Xojo 5 years ago. At that time, OpenCV was 32-bit and offered about 600 functions written in C and easily accessible with Xojo. OpenCV is now 64-bit and written mostly in C++. Many C functions are obsolete. Last week I looked into whether OpenCVX could be upgraded to 64-bit, but without success. Unfortunately I don’t have time to interface Xojo with a complex C++ library.
You can use this library Pandore: a library of image processing operators which is easily accessible from the command line. It is a series of simple chainable operators that can be called with Xojo. You can also use the OpenCV python version.

Hi François,

Thanks for chiming in. The issue with using Python or another command line application to do the work is that it starts to become a performance bottleneck, when you have very high resolution images, as we do. My preference would be to call into OpenCV directly from Xojo, and I think a lot of other folks would agree, though maybe they’re not aware of all the things it can do.

That being said - is there any interest on your part in reviving your Xojo-OpenCV project if there was a plain C API? The main issue as I see it is that OpenCVX was the glue between Xojo and OpenCV, but it was itself reliant on OpenCV’s now-deprecated C API. It would certainly be less work than starting from scratch. Different glue, pretty much.

I ask because the person who ported our frame grabber drivers from Windows to Mac has given me a pretty reasonable price on creating a plain C API for OpenCV directly. If we did this, we would make the C source code open source so that anyone could continue to update it in the future.

1 Like

Hi Perry
Good news if you found somebody to create a new glue for OpenCV. I’ll be very interested by this approach. My code is open-source and you can use it as you want. BTW have a look here: Image Processing with Red Language: Image Processing with Red Language. I wrote for Red language a pure fast and performant Red/System library for image processing.
Regards

1 Like

We finished testing some initial code this morning, and we’re pushing ahead to add more functions to our C-API for OpenCV 4.5.2 in the coming days.

The project will be called OpenCV-C, and you will be able to declare into most of the non-contrib OpenCV functions soon. This will be 64bit only.

I have begun replicating some of the work that was done in OpenCV-Xojo, to create Xojo modules that contain the OpenCV function calls. OpenCV has a lot of functionality, so this is a very big project. If anyone here is interested in helping out, let me know and we can coordinate. I have not done something like this before so I’m open to suggestions and assistance, particularly in regards to naming conventions within Xojo. The actual work looks to be fairly straightforward - there’s just a lot of it, and I want it to be consistent.

Once we’re done we’ll be making both the OpenCV-C and the OpenCV-C-Xojo projects open source, available for download on github. For the coming days, the github repo will remain private, but if you’re interested I can give you a sneak peek when the first substantial commits are in.

Just a teaser: I did some quick tests - a simple image resize of a 14192 x 10640 bmp to 640x480, in both Xojo and OpenCV:

  • 151ms: Graphics.DrawPicture()
  • 157ms: ScaleImageAndMaskMBS()
  • 151ms: ScaleImageMBS()
  • 18ms: CVresize()

OpenCV was 8x faster on the same PC. This is all CPU I believe, not GPU Accelerated (and even if it is using the GPU under the hood, the GPU in this machine is seriously no-frills, about 10 years old).

If you have any interest in testing this or helping out, send me a message!

5 Likes

Congratulations Perry :slight_smile:

1 Like