calculateThresholdForBlock(luminances, subWidth, subHeight, width, height, blackPoints, newMatrix); matrix = newMatrix; } else {
calculateThresholdForBlock(luminances, subWidth, subHeight, width, height, blackPoints, newMatrix); matrix = newMatrix; } else {
private void binarizeEntireImage() throws NotFoundException { if (matrix == null) { LuminanceSource source = getLuminanceSource(); if (source.getWidth() >= MINIMUM_DIMENSION && source.getHeight() >= MINIMUM_DIMENSION) { byte[] luminances = source.getMatrix(); int width = source.getWidth(); int height = source.getHeight(); int subWidth = width >> 3; int subHeight = height >> 3; int[][] blackPoints = calculateBlackPoints(luminances, subWidth, subHeight, width); matrix = new BitMatrix(width, height); calculateThresholdForBlock(luminances, subWidth, subHeight, width, blackPoints, matrix); } else { // If the image is too small, fall back to the global histogram approach. matrix = super.getBlackMatrix(); } } }