Can Android phone running image processing app 24/7

921 views Asked by At

I'm developing an image processing app on Android phones, which is expected to run 24/7. I've managed to do the following:

  • Use Camera2 interface to gain better fps.
  • Grab raw frames, using renderscript to convert to rgb and do image processing using opencv in a background service( no preview ). I got around 20fps after conversion to rgb at 1280x960 on LG G4.

So my questions are:

  • Is there anything else I need to optimize to minimize the memory and CPU usage?
  • Any chance that this application can run 24/7? Is delegating all the camera operations and processing to the background service sufficient to allow it run 24/7? When I leave it running, I can still feel the heat from the camera and its surrounding area.

Any suggestion would be appreciated. Thanks.

UPDATE 1

The app runs on LG G4 using Camera2 interface and do image processing in the background with the screen off, got too hot and the phone turned off itself after a few hours. What can I do to overcome this?

3

There are 3 answers

4
GBoz On

about the second question. I think the app can not run 24/7 because the phone will close itself because of the heat.

4
d91 On

Before answering to your question i must say that i am also new to image processing with android (but not to image processing field).

For the question one:
May be yes. Because image processing tasks are much memory intensive you may need to optimize your app in order to avoid things like memory leak(even if the android runtime perform routine garbage collection) . check the following links

link one

may be useful

when it comes to pixel level operation ( when you avoid using inbuilt functions of opencv or what ever the library you are using and do access and process pixels manually) it will be too slow. I am saying this based on my experience on my laptop. Hoping that you are using opencv for your app just take a look at the following opencv site ( it is for python but you can get the idea)

take an idea from this

and also this SO answer: SO answer

A tip i can remember: try to reduce Mat variable copying (copying Mat objects to other Mat objects) as much as you can

Question number two:
I will go with answer given by user7746903. This answer also linked with the memory that will be consumed by your background app. There will be much more memory intensive app running on background so it depends. Thank you.

0
Wy th On

For the first question: I feel its worth mentioning that you should by pass java as much as possible. Ie. using Java as the interfacial layer, then using JNI C as the call loop.

eg: Get texture from camera2 > supply texture to C function > call render script/ compute shaders from C and other processing functions > call java function to render to screen.

This speeds up CPU performance and reduces memory warnings (especially when rapid allocation and freeing of memory).