OOM occurs when calling detectMutiScale on android

asked 2016-11-29 07:40:57 -0600

mcwu0628 gravatar image

updated 2016-11-29 19:49:21 -0600

the error message was OpenCV Error: Insufficient memory (Failed to allocate 118180608 bytes) in void* cv::OutOfMemoryError(size_t),

Caused by: CvException [org.opencv.core.CvException: cv::Exception: /builds/master_pack-android/opencv/modules/core/src/matrix.cpp:411: error: (-215) u != 0 in function void cv::Mat::create(int, const int*, int)] at org.opencv.objdetect.CascadeClassifier.detectMultiScale_0(Native Method)

at org.opencv.objdetect.CascadeClassifier.detectMultiScale(CascadeClassifier.java:150)

How I call detectMultiScale() and the related parameters.

patternCascadeClassifier.detectMultiScale(grayImage, patternRects, 1.09, 1, Objdetect.CASCADE_SCALE_IMAGE|Objdetect.CASCADE_FIND_BIGGEST_OBJECT|Objdetect.CASCADE_DO_CANNY_PRUNING, new Size(10,10), new Size(50, 50));


in my program flow, I gotta call detectMultiScale() for several times. and the exception always occurs on the 7th calling.

I have released the related image data but this error still occurs. Does anyone can tell me how to call detectMultiScale() correctly or did I miss some usages of detectMultiScale()?

edit retag flag offensive close merge delete

Comments

in my program flow, I gotta call detectMultiScale() for several times.

on the same image ?

berak gravatar imageberak ( 2016-11-29 07:52:42 -0600 )edit

Oh btw, you are mixing old flags with a new interface. As far as I am aware Objdetect.CASCADE_SCALE_IMAGE|Objdetect.CASCADE_FIND_BIGGEST_OBJECT|Objdetect.CASCADE_DO_CANNY_PRUNING are no longer supported in the most recent OpenCV interface for detectMultiScale.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-11-30 04:20:12 -0600 )edit