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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Math.max(1, Math.min(4, Integer.parseInt(argv[4])));int rescaleStrategy =Math.max(1, Math.min(3, Integer.parseInt(argv[5])));// Load image and kernelBuffered<strong>Image</strong> input<strong>Image</strong> = input.decodeAsBuffered<strong>Image</strong>();Kernel kernel =StandardKernel.createKernel(kernelInput, normaliseKernel);// Create convolution operator and convolve imageConvolutionOp convOp = new ConvolutionOp(kernel,borderStrategy, ConvolutionOp.SINGLE_PASS, rescaleStrategy);IntervalTimer timer = new IntervalTimer();timer.start();Buffered<strong>Image</strong> output<strong>Image</strong> = convOp.filter(input<strong>Image</strong>, null);System.out.println("Convolution finished [" + timer.stop() + " sec]");// Write results to output fileoutput.encode(output<strong>Image</strong>);System.exit(0);}}}catch (Exception e) {System.err.println(e);System.exit(1);}}else {System.err.println("usage: java Convolve " +" ");System.exit(1);}- 42 -

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

Saved successfully!

Ooh no, something went wrong!