JIU 0.12.0 Homepage

net.sourceforge.jiu.color.io
Class HistogramSerialization

java.lang.Object
  extended bynet.sourceforge.jiu.color.io.HistogramSerialization

public class HistogramSerialization
extends Object

This class has static methods for saving histograms. Text files (actually, any PrintStream, so you could write to standard output using System.out) are used to store the histogram information. Hint: When creating a PrintStream object yourself, set the autoFlush argument of the constructor to false. You should also wrap your OutputStream object into a BufferedOutputStream object. That may speed things up.

A simple format is used for storing the histograms. The first line holds the number of components. This would be 3 for a three-dimensional histogram, e.g.for RGB color images, or 1 for a one-dimensional histogram as used for a grayscale image.

Next, as many lines as dimensions follow. Each line holds the maximum value allowed for that component. The minimum value is always zero. Typically, the maximum values are all the same, e.g. 255 for each component of a 24 bit RGB truecolor image.

Following these header lines is the actual histogram. Each line holds a non-zero counter value for one pixel. The counter is always the last integer value in the line.

Example:

 34 0 55 4033
 
For the histogram of an RGB24Image, this would mean that the pixel red=34, green=0, blue=55 occurs 4033 times.
 0 2
 
For the histogram of any one channel image, this means that the value 0 occurs twice.


Method Summary
static void save(Histogram1D hist, PrintStream out)
          Saves a one-dimensional histogram to a text output stream.
static void save(Histogram3D hist, PrintStream out)
          Saves a three-dimensional histogram to a text output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

save

public static void save(Histogram1D hist,
                        PrintStream out)
Saves a one-dimensional histogram to a text output stream.

Parameters:
hist - the histogram that will be written to a stream
out - the stream that will be written to

save

public static void save(Histogram3D hist,
                        PrintStream out)
Saves a three-dimensional histogram to a text output stream.

Parameters:
hist - the histogram to be saved
out - the output stream where the histogram will be saved to

JIU 0.12.0 Homepage

Copyright © 2000, 2001, 2002, 2003, 2004 Marco Schmidt