/** * Applies median filter to a {@link Planar} * * @param input Input image. Not modified. * @param output (Optional) Storage for output image, Can be null. Modified. * @param radius Radius of the median blur function. * @param <T> Input image type. * @return Output blurred image. */ public static <T extends ImageGray<T>> Planar<T> median(Planar<T> input, @Nullable Planar<T> output, int radius ) { if( output == null ) output = input.createNew(input.width,input.height); for( int band = 0; band < input.getNumBands(); band++ ) { GBlurImageOps.median(input.getBand(band),output.getBand(band),radius); } return output; }
/** * Applies mean box filter to a {@link Planar} * * @param input Input image. Not modified. * @param output (Optional) Storage for output image, Can be null. Modified. * @param radius Radius of the box blur function. * @param storage (Optional) Storage for intermediate results. Same size as input image. Can be null. * @param <T> Input image type. * @return Output blurred image. */ public static <T extends ImageGray<T>> Planar<T> mean(Planar<T> input, @Nullable Planar<T> output, int radius , @Nullable T storage ) { if( storage == null ) storage = GeneralizedImageOps.createSingleBand(input.getBandType(),input.width,input.height); if( output == null ) output = input.createNew(input.width,input.height); for( int band = 0; band < input.getNumBands(); band++ ) { GBlurImageOps.mean(input.getBand(band),output.getBand(band),radius, storage); } return output; }
/** * Applies Gaussian blur to a {@link Planar} * * @param input Input image. Not modified. * @param output (Optional) Storage for output image, Can be null. Modified. * @param sigma Gaussian distribution's sigma. If ≤ 0 then will be selected based on radius. * @param radius Radius of the Gaussian blur function. If ≤ 0 then radius will be determined by sigma. * @param storage (Optional) Storage for intermediate results. Same size as input image. Can be null. * @param <T> Input image type. * @return Output blurred image. */ public static <T extends ImageGray<T>> Planar<T> gaussian(Planar<T> input, @Nullable Planar<T> output, double sigma , int radius, @Nullable T storage ) { if( storage == null ) storage = GeneralizedImageOps.createSingleBand(input.getBandType(), input.width, input.height); if( output == null ) output = input.createNew(input.width,input.height); for( int band = 0; band < input.getNumBands(); band++ ) { GBlurImageOps.gaussian(input.getBand(band),output.getBand(band),sigma,radius,storage); } return output; } }
@Override public void setBufferedImage(BufferedImage image) { BoofSwingUtil.checkGuiThread(); super.setBufferedImage(image); ConvertBufferedImage.convertFrom(image,imageFisheye,true); if( imageFisheye.getNumBands() != imageRendered.getNumBands() ) { imageRendered = imageFisheye.createNew(1,1); } renderPinhole(); }