It would be great if we can get access to OpenCV functionality, leveraging OpenCV's official Java and Objective-C bindings.. like how it was implemented here as an example:
This is a blog post explaining how they did it: