12.07.2015 Views

Digital Image Processing (using Java)

Digital Image Processing (using Java)

Digital Image Processing (using Java)

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}public static void main(String[] argv) {StandardKernel kernel = new HighPassKernel();kernel.write(new java.io.OutputStreamWriter(System.out));}}(p.161)java GaussianKernel: generate for σ=1.0 Gussian filterBuffered<strong>Image</strong> output<strong>Image</strong> = ConvolutionOp.gaussianBlur(input<strong>Image</strong>, 3.0f);↖σ(p.162)LISTING 7.4 A kernel class to support Gaussian low pass filteringpublic class GaussianKernel extends StandardKernel {public GaussianKernel() {}this(1.0f);public GaussianKernel(float sigma) {}super(getSize(sigma), getSize(sigma), createKernelData(sigma));public static int getSize(float sigma) {int radius = (int) Math.ceil(4.0f*sigma);return 2*radius+1;}public static float[] createKernelData(float sigma) {int n = (int) Math.ceil(4.0f*sigma);int size = 2*n+1;float[] data = new float[size*size];double r, s = 2.0*sigma*sigma;float norm = 0.0f;- 46 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!