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.

}histTool.pack();histTool.setVisible(true);}catch (Exception e) {System.err.println(e);System.exit(1);}}else {Histogram hist = new Histogram();HistogramTool histTool = new HistogramTool(hist, "HistogramTool");histTool.pack();histTool.setVisible(true);}}CalcHist.javaimport java.awt.image.Buffered<strong>Image</strong>;import java.io.FileWriter;public class CalcHist {public static void main(String[] argv) {if (argv.length > 1) {try {<strong>Image</strong>Decoder input = <strong>Image</strong>File.create<strong>Image</strong>Decoder(argv[0]);Buffered<strong>Image</strong> image = input.decodeAsBuffered<strong>Image</strong>();Histogram histogram = new Histogram(image);FileWriter histFile = new FileWriter(argv[1]);histogram.write(histFile);if (argv.length > 2) {FileWriter cumHistFile = new FileWriter(argv[2]);histogram.writeCumulative(cumHistFile);}System.exit(0);}catch (Exception e) {System.err.println(e);- 33 -

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

Saved successfully!

Ooh no, something went wrong!