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.
BoofCV on Android - threshold() returns black image
53 Views Asked by Sher Mi At
1
I ran into this too. The image is actually not black. The pixels all have a value of either 0 or 1. But 1 looks pretty much the same as 0 if you treat the image as something that could have pixel values anywhere up to 255.
One way to deal with this is to use
forEachPixel()
to multiply each pixel value by 255.