Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Java code running faster than OpenCV native C++ code

I have written two versions of an android application using OpenCV. OpenCV is being used for following operations:

  • Resizing images
  • Color conversion from RGB to HSV
  • Computing ratio of pixel values of two images

The first version of the application does all these operations in Java and takes around 200 ms. However, the native implementation takes around 700 ms!

Moreover, I also measured the timings of Java implementation on Nexus 5 and Nexus 6 and I got following results:

Nexus 5: Java: 200 ms, C++: 700 ms!

Nexus 6: Java: 180 ms, C++: 900 ms!

Can somebody please explain why this is happening? Isn't the native implementation supposed to run faster?