Error : 03-17 06:50:45.728: A/libc(1453): Fatal signal 11 (SIGSEGV) at 0x00000170 (code=1), thread 1453 (mple.opencvdemo)
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
oh dear, it would be sooo nice, if you could choose a less noisy title ..
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 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
Mat img = Highgui.imread(filenameIn); // you don't check the outcome.
if ( img.empty() ) // whaa
@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
Thanks, you saved my day, awesome, Image Path was wrong that is reason for this issue
oh, good ;)
@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.