Android Error :Fatal signal 11 (SIGSEGV) at 0x760f1011 (code=1), thread 11933 [closed]

asked 2013-10-09 05:00:25 -0600

bunta gravatar image

updated 2013-10-09 06:32:25 -0600

berak gravatar image

The above is a common Bug in Android and I found in numerous places and most of the places recommended a solution of cleaning the memory.

Issue thrown at train method. faceRecognizer.train(images, labels);

https://groups.google.com/forum/#!topic/javacv/tniCCfSyg4c

https://code.google.com/p/javacv/issues/attachmentText?id=121&aid=1210011000&name=main.java&token=lCt0M3aJfIOKi8TDckxXmNe82_Q%3A1381308179983

I've tried all solution to solve the problem in Android but nothing worked, but same thing is fine in System\PC because of more memory and process I guess , if thats the reason The Code Sample-

import static com.googlecode.javacv.cpp.opencv_contrib.createEigenFaceRecognizer;
import static com.googlecode.javacv.cpp.opencv_core.IPL_DEPTH_8U;
import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImage;
import static com.googlecode.javacv.cpp.opencv_imgproc.CV_BGR2GRAY;
import static com.googlecode.javacv.cpp.opencv_imgproc.cvCvtColor;
import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;

import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.List;

import android.os.Environment;
import android.util.Log;

import com.googlecode.javacv.cpp.opencv_contrib.FaceRecognizer;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
import com.googlecode.javacv.cpp.opencv_core.MatVector;

public class OpenCVFaceRecognizer {

    static List<File> pathList = new ArrayList<File>();
    //pictureFile.getAbsolutePath()
    public static int verifyFace(String strTestImage){

        IplImage testImage = cvLoadImage(strTestImage);
        Log.i("testImagetestImage ", testImage.toString());
        String path = Environment.getExternalStorageDirectory().toString()
                    + "/FaceR_DB/FaceDB";
        Log.i("PATH 2", path);
        File root = new File(path);
        if(pathList != null && pathList.size()>0){
        pathList.clear();
        }
        if(!root.exists() || !root.isDirectory()){
            return -1;
        }
        List<File> listFilesForFolder = listFilesForFolder(root);   

        FilenameFilter pngFilter = new FilenameFilter() {
              public boolean accept(File dir, String name) {
                return name.toLowerCase().endsWith(".png");
              }
            };

            Log.i("SIZEEEEEEee", ""+listFilesForFolder.size());
            if(listFilesForFolder.size()<1){
                return -1;
            }
            MatVector images = new MatVector(listFilesForFolder.size());

            int[] labels = new int[listFilesForFolder.size()];

            int counter = 0;
            int label;

            IplImage img;
            IplImage grayImg;

            for (File image : listFilesForFolder) {
              // Get image and label:
              img = cvLoadImage(image.getAbsolutePath());
              String[] split = image.getName().split( "\\." );
             // System.out.println("NAME "+);
              label = Integer.parseInt(image.getName().split("\\.")[0]);
              // Convert image to grayscale:
              grayImg = IplImage.create(img.width(), img.height(), IPL_DEPTH_8U, 1);
              cvCvtColor(img, grayImg, CV_BGR2GRAY);
              // Append it in the image list:
              images.put(counter, grayImg);
              // And in the labels list:
              labels[counter] = label;
              Log.i("labels ", ""+labels+" img "+img);
              //img.release();
              cvReleaseImage(img); // tried both separately or together, still doesn't work\
            //  img = null;
              System.gc();
              // Increase counter for next image:
              counter++;
              Log.i("RELEASE ", "Released "+counter);
            }

            FaceRecognizer faceRecognizer = createEigenFaceRecognizer();

            Log.i("After images", ""+images.size()+" labels "+labels.length+" faceRecognizer "+faceRecognizer);
            faceRecognizer.train(images, labels);
            Log.i("PROJECTIOn ", "-- "+faceRecognizer.getDouble( "threshold" ));
            faceRecognizer.set( "threshold", 10000 );
            //get the MAT : projectedTrainFaceMat LINE 700
            //CvMat mat = faceRecognizer.getMat( testImage.gto );
           // faceRecognizer.save("C:\\Users\\choudhar\\Bunta_DB\\fisherface_at.yml");
           // CvMat eigenvalues = faceRecognizer.getMat("eigenvalues");
            //CvMat W = faceRecognizer.getMat("eigenvectors");
            //CvMat mean = faceRecognizer.getMat("mean");

            // Load the test image:
            IplImage greyTestImage = IplImage.create(testImage.width(), testImage.height(), IPL_DEPTH_8U, 1);
            cvCvtColor(testImage, greyTestImage, CV_BGR2GRAY);



            // And get a prediction:
          //  faceRecognizer.predict( greyTestImage, labels, new double[] {0.5} );
            return ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-11-22 14:36:03.279330