Ask Your Question
0

What would be an effective way to avoid out of memory in OpenCV android?

asked 2013-08-28 19:53:21 -0600

Linda gravatar image

updated 2013-08-29 00:48:39 -0600

Moster gravatar image

I want to use OpenCV android in JNI in my Android application. What would be an effective way to avoid out of memory in OpenCV android?

The below is one way I am considering. But not sure whether is good or feasible. For example, I have an input image file. The desired size would be 3000x2000.

So I try to estimate the whole memory the JNI might use. Then I will use one method (which one? For example, allocate memory and then delete: does it takes a long time) to see whether there is sufficent memory. If not, then I will downsize the size of the image to be processed (the downsized size is not desired, but still acceptable).

Is there any better way? Thanks in advance!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-08-28 23:21:47 -0600

utkarshmankad gravatar image

If you want to use OpenCv in Android, try using OpenCv4Android SDK -OpenCv for Android. The SDK is very robust, well defined, efficient and gives near Desktop system performance (Android OS Architecture limits performance to certain level for advanced applications, for the application user the difference is unnoticable). The development cycle is simple and quick. I've successfully migrated my applications from OpenCv C++ to OpenCv4Android.

edit flag offensive delete link more

Comments

Thanks. I have used OpenCV4Android SDK, and developed one application. However, I want to know the limitation of memory. Any idea? Thanks.

Linda gravatar imageLinda ( 2013-08-29 00:25:12 -0600 )edit

As far as I know the java memory is quite small, like 50-100mb, maybe more on newer devices. If you use the android NDK, it is unlimited (or at least you will rather meet the physical limit than the software limit)

Moster gravatar imageMoster ( 2013-08-29 00:44:21 -0600 )edit

Thanks. Do you think the available NDK memory is the total physical memory, minus: memory used by the system, memory used by applications?

Linda gravatar imageLinda ( 2013-08-30 12:14:27 -0600 )edit

In theory this should be correct, but usually the android system kills apps running in the background when an other app needs more memory.

Moster gravatar imageMoster ( 2013-09-02 02:52:42 -0600 )edit

Question Tools

Stats

Asked: 2013-08-28 19:53:21 -0600

Seen: 933 times

Last updated: Aug 28 '13