BoofAndroidDemo
BoofAndroidDemo copied to clipboard
BoofCV on Android - threshold() returns black image
Bitmap blurredBitmap = GaussianBlur.with(sApp.getApplicationContext()).radius(5).render(R.drawable.test_img_divider);
GrayU8 imageGray = ConvertBitmap.bitmapToGray(blurredBitmap,(GrayU8) null, null);
GrayU8 imageThreshold = GThresholdImageOps.threshold(imageGray, null, GThresholdImageOps.computeEntropy(imageGray, 0, 255), true);
Bitmap output = Bitmap.createBitmap(imageThreshold.width, imageThreshold.height, Bitmap.Config.ARGB_8888);
ConvertBitmap.grayToBitmap(imageThreshold, output, null); // output is totally black.
R.drawable.test_img_divider:

blurredBitmap:

imageGray(after it was converted to bitmap):

output:

The binary image has values of 0 or 1, which looks very similar to being black. Try using VisualizeImageData.binaryToBitmap() instead.