OpenCVForUnity icon indicating copy to clipboard operation
OpenCVForUnity copied to clipboard

Performance low in Android when compared to OpenCV Android Sdk

Open atul109 opened this issue 5 years ago • 2 comments

Feature detection and matching using ORB is better performing in normal OpenCV Android Sdk than OpenCVForUnity. Eg: I get ~20 matches for an image in OpenCVForUnity, for the same image using OpenCV Android Sdk gets ~80 matches in similar conditions. Is OpenCVForUnity android build with ARM optimisations like NEON Enabled?

atul109 avatar Dec 09 '19 06:12 atul109

The OpenCVForUnity library is built using build_sdk.py in the same way as normal OpenCV Android Sdk. So NEON optimization is enabled. https://github.com/opencv/opencv/blob/master/platforms/android/ndk-16.config.py

When reproducing code equivalent to Feature2DExample using OpenCV Android Sdk, is there a significant difference in the results of Feature detection and matching? https://github.com/EnoxSoftware/OpenCVForUnity/blob/master/Assets/OpenCVForUnity/Examples/MainModules/features2d/Feature2DExample/Feature2DExample.cs

EnoxSoftware avatar Dec 09 '19 10:12 EnoxSoftware

I tried with this sample https://github.com/EnoxSoftware/MarkerLessARExample/blob/master/Assets/MarkerLessARExample/MarkerLessAR/PatternDetector.cs Line 476 : Debug.Log ("matches " + matches.ToString ()); matches size varies a lot between OpenCV Android Sdk (version 4.1.2) and OpenCVForUnity(4.1.0).

Also Optical flow is working better in OpenCVForUnity, A combination of both in a single library would have been great.

atul109 avatar Dec 10 '19 08:12 atul109