001/******************************************************************************* 002 * This software is provided as a supplement to the authors' textbooks on digital 003 * image processing published by Springer-Verlag in various languages and editions. 004 * Permission to use and distribute this software is granted under the BSD 2-Clause 005 * "Simplified" License (see http://opensource.org/licenses/BSD-2-Clause). 006 * Copyright (c) 2006-2016 Wilhelm Burger, Mark J. Burge. All rights reserved. 007 * Visit http://imagingbook.com for additional details. 008 *******************************************************************************/ 009package imagingbook.lib.image; 010 011import ij.plugin.filter.Convolver; 012import ij.process.ImageProcessor; 013 014/** 015 * Utility methods for filtering images. 016 * None of the filter methods modifies the kernel, i.e., kernels are 017 * used as supplied and never normalized. 018 * @author WB 019 * 020 */ 021public abstract class Filter { 022 023 public static void convolveX (ImageProcessor fp, float[] h) { 024 Convolver conv = new Convolver(); 025 conv.setNormalize(false); 026 conv.convolve(fp, h, h.length, 1); 027 } 028 029 public static void convolveY (ImageProcessor fp, float[] h) { 030 Convolver conv = new Convolver(); 031 conv.setNormalize(false); 032 conv.convolve(fp, h, 1, h.length); 033 } 034 035 public static void convolveXY (ImageProcessor fp, float[] h) { 036 Convolver conv = new Convolver(); 037 conv.setNormalize(false); 038 conv.convolve(fp, h, h.length, 1); 039 conv.convolve(fp, h, 1, h.length); 040// convolveX(fp, h); 041// convolveY(fp, h); 042 } 043 044}