Hi there, I was looking to use OpenCV for IOS in a...
# multiplatform
m
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?
b
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
Wait, what's wrong with their ios and android packs? https://opencv.org/releases/
m
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.
b
Ah, fair enough.
m
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.
b
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
m
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