Unfortunately, OpenCV is C++ and you can’t use it in Xojo. However…
While it is not yet done, we started work over a year ago to wrap OpenCV 4.5 in a plain-C library so that it could be used in Xojo. In fact, there actually two projects:
OpenCV-C (The C++ → C library; currently on Github but private since it’s not done)
Xojo-OpenCV-C (also private on github as it’s incomplete)
The Xojo project aims to make OpenCV-C functionality available as native Xojo code. But to be honest, development on this stalled last year. We got pretty far though and many functions work well. There are modifications to be made to OpenCV-C, however, and we haven’t had the time or budget to do so.
Here’s a screenshot of part of the work done so far on the Xojo project:
The aim is to eventually open source both projects but we wanted to get OpenCV-C a little more finalized first. If folks are willing to work on either or both projects, let me know. I have not managed an open source project before, which is why I’ve been a little hesitant to make these public until they’re more complete.
I am realizing that I won’t have time to actively manage a project, but if there’s interest within the Xojo community in either or both then it’s probably a good idea to move ahead with this, especially if someone else is willing to deal with the day to day of managing either or both of these codebases.
That’s a very good idea and I am quite excited by this.
I agree that Open-CV-C is the main goal.
Good luck to you and all the guys working on that project.
Thanks! We really need some help on both the OpenCV-C and the Xojo projects to get this wrapped up. So anyone who might be willing to contribute is welcome to. Please message me and we can discuss access to one or both projects. For now, we’re keeping the github repos private, until things are stable enough to call it a beta, at least (I think we’re quite close).
Some of the remaining work to be done: OpenCV uses lots of overloaded functions, which C doesn’t support, so we need to convert those to their own functions, with unique names (we’ve been simply numbering the variants). The following OpenCV modules have been mostly or completely done at this point:
…And most of this is also in the Xojo project, which is designed to make all of the OpenCV functions available as Xojo classes so that you don’t have to think about all the CVMat creation/destruction stuff.
We are not doing the OpenCV contrib modules at this time, and chose this first batch mainly because it covered the stuff we (my company) needs for an ongoing project. Happy to add more to that, but this is really most of the core modules for OpenCV.
At this point, my company has paid independent contractors to do the OpenCV-C work, and volunteers (namely @Antonio_Rinaldi ) and I have worked on the Xojo project. Our budget for this has basically run out. We might be able to come up with a bit more on the OpenCV-C side but because we’ve already sunk a bunch of money into it and we plan to make it open source, it’s hard to justify spending much more.
I do think it’s an important project and it really opens up a lot of possibilities for image processing in Xojo that simply don’t exist now. A little tease from the Xojo OpenCV-C manual:
Just bumping this - we may have someone to help us with some of the OpenCV-C stuff later in the month, but I’d love to get more eyes on the Xojo project in the mean time, so we can wrap it up and make this available to everyone - for free.
Let me know if you’re interested in contributing to bringing a modern version of OpenCV to Xojo!