@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; } }
@Override public void processImage(FImage image) { for (int i = 0; i < numIterations; i++) { processImageOneIteration(image); } }
@Override public void processImage(FImage image) { correlate(image, template, true); }
@Override public void processImage(FImage image) { final FImage tmp = image.process(new MedianFilter(FilterSupport.createBlockSupport(sizeX, sizeY))); final float[][] tpix = tmp.pixels; final float[][] ipix = image.pixels; for (int y = 0; y < image.height; y++) for (int x = 0; x < image.width; x++) tpix[y][x] = ipix[y][x] < (tpix[y][x] - offset) ? 0f : 1f; image.internalAssign(tmp); } }
/** * Construct with the given support region for selecting pixels to take the * median from. The support mask is a set of <code>n</code> relative x, y * offsets from the pixel currently being processed, and can be created * using the methods or constants in the {@link FilterSupport} class. * * @param support * the support coordinates */ public MinMaxAnalyser(Set<Pixel> support) { this.support = support; if (FilterSupport.isBlockSupport(support)) { blockWidth = FilterSupport.getSupportWidth(support); blockHeight = FilterSupport.getSupportHeight(support); } }
/** * same as {@link #patchMean(float[][], int, int, int, int)} but the width and height are taken from data[0].length and data.length * @param data * @return the patch mean */ public static final float patchMean(final float[][] data){ return patchMean(data, 0, 0, data.length > 0 && data[0]!=null ? data[0].length : 0, data.length); } /**
protected static FImage normaliseImage(FImage image, FImage mask) { if (mask == null) { return image.process(new GammaCorrection()) .processInplace(new DifferenceOfGaussian()) .processInplace(new MaskedRobustContrastEqualisation()); } return image.process(new GammaCorrection()) .processInplace(new DifferenceOfGaussian()) .processInplace(new MaskedRobustContrastEqualisation(mask)) .multiply(mask); }
/** * Perform a single iteration of anisotropic diffusion * * @param image * the image */ public void processImageOneIteration(FImage image) { switch (neighbourMode) { case CONNECT_4: processImageOneIteration4(image); case CONNECT_8: processImageOneIteration8(image); } }
/** * Construct Fourier Transform by performing a forward transform on the * given image. If the centre option is set, the FFT will be re-ordered so * that the DC component is in the centre. * * @param image * the image to transform * @param centre * should the FFT be reordered so the centre is DC component */ public FourierTransform(FImage image, boolean centre) { this.centre = centre; process(image); }
/** * Construct Fourier Transform by performing a forward transform on the * given image. If the centre option is set, the FFT will be re-ordered so * that the DC component is in the centre. * * @param image * the image to transform * @param centre * should the FFT be reordered so the centre is DC component */ public FourierTransformComplex(FImage image, boolean centre) { this.centre = centre; process(image); }
/** * Default constructor with the template to match. When matching is * performed by {@link #analyseImage(FImage)}, the whole image * will be searched. * * @param template The template. * @param mode The matching mode. */ public FourierTemplateMatcher(FImage template, Mode mode) { this.correlation = new FourierCorrelation(template); this.mode = mode; this.templateWidth = template.width; this.templateHeight = template.height; }
@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; } }
@Override public void processImage(FImage image) { final FImage tmp = image.process(new MedianFilter(FilterSupport.createBlockSupport(sizeX, sizeY))); final float[][] tpix = tmp.pixels; final float[][] ipix = image.pixels; for (int y = 0; y < image.height; y++) for (int x = 0; x < image.width; x++) tpix[y][x] = ipix[y][x] < (tpix[y][x] - offset) ? 0f : 1f; image.internalAssign(tmp); } }
@Override public Float prepareWorkingSpace(FImage template) { return MeanCenter.patchMean(template.pixels); } },
@Override public void processImage(FImage image) { for (int i = 0; i < numIterations; i++) { processImageOneIteration(image); } }
@Override public void processImage(FImage image) { correlate(image, template, true); }
/** * Construct Fourier Transform by performing a forward transform on the * given image. If the centre option is set, the FFT will be re-ordered so * that the DC component is in the centre. * * @param image * the image to transform * @param centre * should the FFT be reordered so the centre is DC component */ public FourierTransform(FImage image, boolean centre) { this.centre = centre; process(image); }
/** * Construct Fourier Transform by performing a forward transform on the * given image. If the centre option is set, the FFT will be re-ordered so * that the DC component is in the centre. * * @param image * the image to transform * @param centre * should the FFT be reordered so the centre is DC component */ public FourierTransformComplex(FImage image, boolean centre) { this.centre = centre; process(image); }
/** * same as {@link #patchMean(float[][], int, int, int, int)} but the width and height are taken from data[0].length and data.length * @param data * @return the patch mean */ public static final float patchMean(final float[][] data){ return patchMean(data, 0, 0, data.length > 0 && data[0]!=null ? data[0].length : 0, data.length); } /**
@Override public Float prepareWorkingSpace(FImage template) { return MeanCenter.patchMean(template.pixels); } },