Hi there, I was looking to use OpenCV for IOS in a KMM project, though as it is written in C++ this currently seems not possible. I am curious as to whether a wrapper for OpenCV written in objective-c should allow me to do this?
10/20/2021, 10:28 AM
Isn't there an openCV written in C? You could use that to build a KMM native library for ios and android native. Or you could use JNI and android jvm
Yep there is a C implementation, but it hasnt been maintained in around 10 years I believe, (OpenCV made the switch from C to C++ in 2.4), so functionality like Mat are unavailable.
10/20/2021, 10:36 AM
Ah, fair enough.
10/20/2021, 10:41 AM
For the packs, I am unsure how I would be able to share my code using these. From what I understand the iOS framework is still written in C++, and so would be accessible from Swift, but not from the kotlin shared code.
10/20/2021, 10:42 AM
Yeah, you'd need multi layer bindings
Cpp to objc to kotlin native
Then with expect actual in common kotlin to kotlin native and android
10/20/2021, 10:48 AM
This is what im going for currently. I found this: https://github.com/Legoless/LegoCV
It provides bindings for OpenCV in Objective C.
The compilation goes well until cinteropLegoCVIos, for which it fails, can’t currently see what is wrong.
But mostly just wanted to check that multi layer bindings this should conceptually work, so thank you, I will keep working on it