Ask Your Question

Revision history [back]

Fatal signal 11 (SIGSEGV) in Android 6.0

What I do:

1.I Write the face detection in opencv c++ and call from android using wrapper.

2.I used android native camera and pass image(Mat) to the detection method(detection method is shown below)

3.Its working in android 4.0 to android 5.1 but while running in android 6.0, the application crashes

4.I added LOGD inside the c++ source code to find exactly where the crash happen.

5.Crashing happening at always at the end of the detection method in Android 6.0

6.Sample Code

CascadeClassifier cascade;

Rect detection(Mat& image)
{
   LOGD("face1");
    vector<Rect> val;
    Mat im(image.size(),CV_8UC1);
    if(image.channels()==3)
    {
        cvtColor(image,im,COLOR_BGR2GRAY);
    }
    else
    {
        image.copyTo(im);
    }
     LOGD("face2");
    cascade.detectMultiScale(im, val, 1.1,2,CASCADE_FIND_BIGGEST_OBJECT,Size(image.cols/3,image.rows/3));
     LOGD("face3");
    if(val.size()==0)
     {
    return Rect(0,0,0,0);
     }
     LOGD("face4");
    return val[0];
}

7.Calling method in c++

Rect ROI=detection(image);
LOGD("val1: %d",ROI.x);
LOGD("val2: %d",ROI.y);
LOGD("val3: %d",ROI.width);
LOGD("val4: %d",ROI.height);

8.Android logcat message

When not giving face to camera it show in logcat like this

09-21 18:25:52.612 20436 20615 D qualitycheck: quality1
09-21 18:25:52.612 20436 20615 D qualitycheck: quality3
09-21 18:25:52.612 20436 20615 D qualitycheck: quality4
09-21 18:25:52.612 20436 20615 D qualitycheck: face1
09-21 18:25:52.622 20436 20615 D qualitycheck: face2
09-21 18:25:52.642 20436 20615 D qualitycheck: face3
09-21 18:25:52.642 20436 20615 D qualitycheck: quality27
09-21 18:25:52.642 20436 20615 D qualitycheck: res: 0
09-21 18:25:52.642 20436 20615 D qualitycheck: res1: 0
09-21 18:25:52.642 20436 20615 D qualitycheck: res2: 0
09-21 18:25:52.642 20436 20615 D qualitycheck: res3: 0
09-21 18:25:52.642 20436 20615 D qualitycheck: quality28
09-21 18:25:52.642 20436 20615 D qualitycheck: quality18
09-21 18:25:52.642 20436 20615 I QualityCheck : 1000

When giving face to camera it show in logcat like this

09-21 18:25:57.662 20436 20615 D qualitycheck: quality1
09-21 18:25:57.662 20436 20615 D qualitycheck: quality3
09-21 18:25:57.662 20436 20615 D qualitycheck: quality4
09-21 18:25:57.662 20436 20615 D qualitycheck: face1
09-21 18:25:57.662 20436 20615 D qualitycheck: face2
09-21 18:25:57.702 20436 20615 D qualitycheck: face3
09-21 18:25:57.702 20436 20615 D qualitycheck: face4

then application crashes

9.The log "face4" is shown ,but its not returning in detection method ,while running in android 6.0.

please help me to solve this issue.

Detailed log - https://s3.amazonaws.com/uploads.hipchat.com/140263/1400779/kS4OjMvPGa5d1zy/logcat.txt