Ask Your Question

Revision history [back]

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

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!

click to hide/show revision 2
retagged

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

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!