sawpawan / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Java VM Crashed when I use cvHaarDetectObjects #191

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.code:        
     IplImage grayImage = cvLoadImage(imgfile, // filename
                CV_LOAD_IMAGE_GRAYSCALE); // isColor

        CvMemStorage storage = CvMemStorage.create();
        CvSeq faces = cvHaarDetectObjects(grayImage, classifier, storage, 1.1, 3,
                CV_HAAR_DO_CANNY_PRUNING);
               if (faces != null) {
            int total = faces.total();
            System.out.println("total face="+total);
            for (int i = 0; i < total; i++) {
                CvRect r = new CvRect(cvGetSeqElem(faces, i));
                int x = r.x(), y = r.y(), w = r.width(), h = r.height();
//              canvas.drawRect(x * scaleX, y * scaleY, (x + w) * scaleX,
//                      (y + h) * scaleY, paint);
                System.out.println("FACE: x="+x+" y="+y+" w="+w+" h="+h);
            }
        }
              cvClearMemStorage(storage);

2.  when concurrent execute ,jvm crash.

3. crash info:
# JRE version: 6.0_21-b06
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0-b16 mixed mode linux-amd64 )
# Problematic frame:
# C  [libopencv_objdetect.so.2.3.1+0x18720]  cvRunHaarClassifierCascadeSum+0x770

What version of the product are you using? On what operating system?

OpenCV-2.3.1,Linux version 2.6.18-238.el5xen

Original issue reported on code.google.com by quan...@gmail.com on 19 Apr 2012 at 4:39

GoogleCodeExporter commented 8 years ago
An error report file with more information

Original comment by quan...@gmail.com on 19 Apr 2012 at 4:42

Attachments:

GoogleCodeExporter commented 8 years ago
What are you assigning to the "classifier" variable?

Original comment by samuel.a...@gmail.com on 22 Apr 2012 at 2:51

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
new CvHaarClassifierCascade(
                cvLoad("/usr/local/OpenCV/data/haarcascades/haarcascade_frontalface_alt.xml"));

Original comment by quan...@gmail.com on 23 Apr 2012 at 2:12

GoogleCodeExporter commented 8 years ago
I found problem,classifier used static ,remove static ,that‘s  ok.
but create classifier will spend some time for each.

Original comment by quan...@gmail.com on 23 Apr 2012 at 3:14

GoogleCodeExporter commented 8 years ago
Did you make sure to call Loader.load(opencv_objdetect.class) before calling 
cvLoad()?

Original comment by samuel.a...@gmail.com on 23 Apr 2012 at 12:53

GoogleCodeExporter commented 8 years ago
yes,call Loader.load once. 

Original comment by quan...@gmail.com on 24 Apr 2012 at 2:42

GoogleCodeExporter commented 8 years ago
And the Demo class from the README.txt file works?

Original comment by samuel.a...@gmail.com on 24 Apr 2012 at 1:35

GoogleCodeExporter commented 8 years ago
yes,it works ok,  I found the problem , classifier must create each time. 
can't use static 

Original comment by quan...@gmail.com on 26 Apr 2012 at 2:42

GoogleCodeExporter commented 8 years ago
I still don't understand what the problem is, but if the Demo class works fine, 
then I don't think there is any problem... If you still think there is a 
problem, then please provide more details, thank you.

Original comment by samuel.a...@gmail.com on 26 Apr 2012 at 4:58

GoogleCodeExporter commented 8 years ago
Judging by the lack of feedback, I am guessing this issue has been resolved, 
but please let me know if this is not the case, thank you

Original comment by samuel.a...@gmail.com on 12 May 2012 at 11:54

GoogleCodeExporter commented 8 years ago
ok,it has been resolved.

Original comment by quan...@gmail.com on 14 May 2012 at 2:33