Bruce
Bruce

Reputation: 2584

Super slow performance on android OpenCV image processing on specific phones but not all

I followed the documentation (http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#application-development-with-static-initialization) to initialize opencv in static initialization and it is working well so far on my phone.

However, some of my friends who helped testing my app, says the performance is very bad when they use the 'photo enhancement' feature, where I used openCV to apply some adaptive threshold filtering to sharpen the text in the images (example here: How to use OpenCV to process image so that the text become sharp and clear?). I still couldn't figure out why is that so.

Phone models that I tried it on:
1) My phone (samsung galaxy s3) - smooth (instant)
2) friend no.1 (samsung galaxy s2) - smooth (instant)
3) friend no.2 (samsung galaxy s2) - super laggy (takes few seconds for UI to regain responsiveness)
4) friend no.3 (htc one) - super laggy (takes few seconds for UI to regain responsiveness)
5) friend no.4 (samsung galaxy s4) - super laggy (takes few seconds for UI to regain responsiveness)

I recalled that my phone and friend no.1's phone installed older version of my app before, where the app was still using async initialization method (and have to install OpenCV manager from play store in order to use) and I can't think of anything different between the phones tested above..

Does anyone has similar experience? Any advice on what to look for?

Upvotes: 2

Views: 1274

Answers (1)

karlphillip
karlphillip

Reputation: 93458

There's a number of reasons why this could be happening. To make a fair evaluation you would have to restore each device to it's factory settings and execute profiling/benchmarking tools to figure out what's going on.

For instance, the phones that were found to be super laggy:

  • Could have too many widgets running on your homescreen, thus causing the device’s performance to slow down;
  • Could be using different Android versions;
  • Could be using Live Wallpapers (which require extra CPU cicles to run);
  • Generally speaking, a device could be running other background processes that are stealing CPU processing away from your app.

There is an official document for Android developers with performance tips. It's pretty interesting to read. They recommend a few tools for measure the performance of an application:

  • Caliper for Java microbenchmarking;
  • Traceview for profiling;
  • Systrace to analyze how the execution of your application fits into the larger Android environment, letting you see system and applications process execution on a common timeline.

There's also a nice article on vogella.com about analyzing Android performance issues. It's a must-read!

Upvotes: 1

Related Questions