Error : 03-17 06:50:45.728: A/libc(1453): Fatal signal 11 (SIGSEGV) at 0x00000170 (code=1), thread 1453 (mple.opencvdemo)

asked 2014-03-17 03:35:07 -0500

TGMCians gravatar image

updated 2014-03-17 03:44:43 -0500

berak gravatar image

Hello, I am using OpenCV library in my android application for comparison the image stuff how they are similar.

So I am doing this using the Histogram calculation. I integrated the android -opencv java library 2.4.8 in my application and added the so (shared object) files in the libs folder.

public Mat histogram(String filenameIn, String filenameOut) {
    Mat img = Highgui.imread(filenameIn);
    Mat src = new Mat(img.height(), img.width(), CvType.CV_8UC2);
    Imgproc.cvtColor(img, src, Imgproc.COLOR_RGB2GRAY);
    Vector<Mat> bgr_planes = new Vector<Mat>();
    Core.split(src, bgr_planes);
    MatOfInt histSize = new MatOfInt(256);
    final MatOfFloat histRange = new MatOfFloat(0f, 256f);
    boolean accumulate = false;
    Mat b_hist = new Mat();
    Imgproc.calcHist(bgr_planes, new MatOfInt(0), new Mat(), b_hist, histSize, histRange, accumulate);
    Highgui.imwrite(filenameOut, b_hist);
    return b_hist;

This line Imgproc.cvtColor(img, src, Imgproc.COLOR_RGB2GRAY); creating a issue of 03-17 06:50:45.728: A/libc(1453): Fatal signal 11 (SIGSEGV) at 0x00000170 (code=1), thread 1453 (mple.opencvdemo).

I went through many links about this type of errors Fatal signal 11 (SIGSEGV) at 0x00000170 , as I read there might be some bug in the native code also.

Guys, look the issue and share your opinion the possibilities of this error

edit retag flag offensive close merge delete


oh dear, it would be sooo nice, if you could choose a less noisy title ..

berak gravatar imageberak ( 2014-03-17 03:45:50 -0500 )edit

Mat src = new Mat(img.height(), img.width(), CvType.CV_8UC2); // <-- why CV_8UC2 ?

i think, you just need Mat src = new Mat(); here

berak gravatar imageberak ( 2014-03-17 03:49:21 -0500 )edit

@berak Actually I want to compare two picture, object in the picture how similar they are, so I am doing this using Histogram calculcation. I tried with your suggestion also but same same issue persist

TGMCians gravatar imageTGMCians ( 2014-03-17 03:54:13 -0500 )edit

Mat img = Highgui.imread(filenameIn); // you don't check the outcome.

if ( img.empty() ) // whaa

berak gravatar imageberak ( 2014-03-17 04:02:42 -0500 )edit

@berak Yup , it is empty as I saw Mat [ 00CV_8UC1, isCont=false, isSubmat=false, nativeObj=0xb800e5d8, dataAddr=0x0 ] but why I am passing the correct path /storage/emulated/0/DCIM/1.jpg

TGMCians gravatar imageTGMCians ( 2014-03-17 04:14:23 -0500 )edit

Thanks, you saved my day, awesome, Image Path was wrong that is reason for this issue

TGMCians gravatar imageTGMCians ( 2014-03-17 04:19:17 -0500 )edit

oh, good ;)

berak gravatar imageberak ( 2014-03-17 04:23:55 -0500 )edit

@berak If you write all these in answer, definitely I will accept the answer. one question also what is minimum threshold value of Histogram comparison so that you can consider them similar.

TGMCians gravatar imageTGMCians ( 2014-03-17 04:26:40 -0500 )edit