Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>i think it is a memory allocation issue with opencv_core.CvMemStorage. this is a class that's not exposed in your library. i am having the same problem. I'm using javacv (directly, not javacvpro) because i want to run multiple haar cascades (you can load only one with javacvpro or the older hypermedia.video.*). if i run ALL of them on EACH frame, i'm good. if i run a different detector on each frame (and then cycle thru the detectors again), i get this error after a few cycles.</p> <p>the snippet below FAILS, but it is what i want to do (process each subsequent frame with a different detector):</p> <pre><code>// Using JavaCV directly, not JavaCVPro! import com.googlecode.javacpp.Loader; import com.googlecode.javacv.*; import com.googlecode.javacv.*; import com.googlecode.javacv.cpp.*; String cascades[] = { "haarcascade_eye.xml", // 0 "haarcascade_eye_tree_eyeglasses.xml", // 1 "haarcascade_frontalface_alt.xml" // 2 } int detectors[] = {1,3}; // haar detectors to use String cascPath = "C:/opencv/data/haarcascades/"; // preload multiple classifiers. can do this with javacvpro, not with javacv or hypermedia.video.* void haarSetup() { for (int i = 0; i &lt; detectors.length; i++) { String classifierFile = cascPath+cascades[detectors[i]]; classifier[i] = new opencv_objdetect.CvHaarClassifierCascade(opencv_core.cvLoad(classifierFile)); } storage = opencv_core.CvMemStorage.create(); opencv_core.cvClearMemStorage(storage); // is this needed? couldn't hurt, right? } // contains list of preloaded haar cascades. code not included here... opencv_core.CvSeq features[] = new opencv_core.CvSeq[detectors.length]; int whichHaar = 0; // run one cascade per frame, then cycle through them. void processHaars(PImage piz) { // convert to IplImage... BufferedImage imgBuf = (BufferedImage) piz.getNative(); opencv_core.IplImage iplImgOut=opencv_core.IplImage.createFrom(imgBuf); // do one haar cascade per invocation. int ii = whichHaar; features[ii] = opencv_objdetect.cvHaarDetectObjects(iplImgOut, classifier[ii], storage, 1.1, 3, opencv_objdetect.CV_HAAR_DO_CANNY_PRUNING); whichHaar++; if (whichHaar &gt;= detectors.length){ whichHaar = 0; // is THIS causing the problem?? opencv_core.cvClearMemStorage(storage); } } </code></pre> <p>this snippet WORKS forever, but i don't want what it does (run all detectors on a single frame):</p> <pre><code>void processHaars(PImage piz) { // convert to IplImage... BufferedImage imgBuf = (BufferedImage) piz.getNative(); opencv_core.IplImage iplImgOut=opencv_core.IplImage.createFrom(imgBuf); for (ii=0; ii&lt;detectors.length; ii++) faces[ii] = opencv_objdetect.cvHaarDetectObjects(iplImgOut, classifier[ii], storage, 1.1, 3, opencv_objdetect.CV_HAAR_DO_CANNY_PRUNING); opencv_core.cvClearMemStorage(storage); } </code></pre> <p>If i find a full solution, I'll post it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload