@Override public void processImage(FImage image) { final MinMaxAnalyser minimax = new MinMaxAnalyser(FilterSupport.createBlockSupport(sizeX, sizeY)); minimax.analyseImage(image); final float[][] minpix = minimax.min.pixels; final float[][] maxpix = minimax.max.pixels; final float[][] ipix = image.pixels; for (int y = 0; y < image.height; y++) for (int x = 0; x < image.width; x++) ipix[y][x] = (ipix[y][x] - minpix[y][x]) > (maxpix[y][x] - ipix[y][x]) ? 1 : 0; } }
final FImage thresh = new FImage(src.width, src.height); final MinMaxAnalyser mma = new MinMaxAnalyser(FilterSupport.BLOCK_3x3); src.analyseWith(mma);
@Override public void analyseImage(FImage image) { min = new FImage(image.width, image.height); max = new FImage(image.width, image.height); if (blockHeight >= 1 && blockWidth >= 1) { processBlock(image, blockWidth, blockHeight); } else { for (int y = 0; y < image.height; y++) { for (int x = 0; x < image.width; x++) { float minv = Float.MAX_VALUE; float maxv = -Float.MAX_VALUE; for (final Pixel sp : support) { final int xx = x + sp.x; final int yy = y + sp.y; if (xx >= 0 && xx < image.width - 1 && yy >= 0 && yy < image.height - 1) { minv = Math.min(minv, image.pixels[yy][xx]); maxv = Math.max(maxv, image.pixels[yy][xx]); } } min.pixels[y][x] = minv; max.pixels[y][x] = maxv; } } } }
@Override public void analyseImage(FImage image) { min = new FImage(image.width, image.height); max = new FImage(image.width, image.height); if (blockHeight >= 1 && blockWidth >= 1) { processBlock(image, blockWidth, blockHeight); } else { for (int y = 0; y < image.height; y++) { for (int x = 0; x < image.width; x++) { float minv = Float.MAX_VALUE; float maxv = -Float.MAX_VALUE; for (final Pixel sp : support) { final int xx = x + sp.x; final int yy = y + sp.y; if (xx >= 0 && xx < image.width - 1 && yy >= 0 && yy < image.height - 1) { minv = Math.min(minv, image.pixels[yy][xx]); maxv = Math.max(maxv, image.pixels[yy][xx]); } } min.pixels[y][x] = minv; max.pixels[y][x] = maxv; } } } }
@Override public void processImage(FImage image) { final MinMaxAnalyser minimax = new MinMaxAnalyser(FilterSupport.createBlockSupport(sizeX, sizeY)); minimax.analyseImage(image); final float[][] minpix = minimax.min.pixels; final float[][] maxpix = minimax.max.pixels; final float[][] ipix = image.pixels; for (int y = 0; y < image.height; y++) for (int x = 0; x < image.width; x++) ipix[y][x] = (ipix[y][x] - minpix[y][x]) > (maxpix[y][x] - ipix[y][x]) ? 1 : 0; } }