Re: Problems with equalizeHist function

417 views
Skip to first unread message

Andrey Pavlenko

unread,
Jan 17, 2013, 8:13:55 AM1/17/13
to
what OpenCV version do you use?
I've checked the latest 2.4.3.2 and the code works OK with minimal modifications:

 Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.wshed_exp);
 
 
Mat rgbMat = new Mat();
 
Utils.bitmapToMat(bmp, rgbMat);
 
 
Mat grayMat = new Mat();
 
Mat bwMat = new Mat();
 
 
Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY);
 
Imgproc.equalizeHist(grayMat, grayMat);
 
 
Imgproc.threshold(grayMat, bwMat, 127.5, 255.0, Imgproc.THRESH_OTSU);
 
Utils.matToBitmap(bwMat, bmp);

Just in case: some OpenCV version contained a bug in equalizeHist() that caused its crash in case of picture width isn't multiple of 4.
Reply all
Reply to author
Forward
0 new messages