integralhistogram
Class Histogram

java.lang.Object
  extended by integralhistogram.Histogram
All Implemented Interfaces:
Hist

public class Histogram
extends java.lang.Object
implements Hist

this class implements the Hist interfeace, you can use this class to manage color histograms.

Author:
Giovanni Tarducci,Alessio Barducci

Constructor Summary
Histogram(int bitPerComp)
          class constructor.
 
Method Summary
 void copy(Hist srcHist)
          copy source histogram's bins onto the current histogram.
 void createFromImage(int imgWidth, int imgHeight, int[] imgPixels)
          use the current histogram ("this" operator) to store the (color) histogram of a source image.
 int getBinsPerComp()
          return the the number of bit per component (usually choosed by the user trought the implementation class's constructor)
 int getBinValue(int bin)
          return the content of the queried bin
 void normalize(float[] outputHist, int norm)
          normalize the current histogram and store the output in outputHist.
 void sumHists(Hist leftHist, Hist upHist, Hist up_leftHist, int currentPixel)
          compute an wavefront propagation step.
 void sumPixel(int pixelColor)
          update the histogram adding the pixelColor value in the right bin
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Histogram

public Histogram(int bitPerComp)
class constructor.

Parameters:
bitPerComp - number of bit per color (RGB) mode e.g.: bitPerComp = 2 mean you choosed 6 bits per pixel, that is: four possible values for each component, otherwise bitPerComp = 4 means you choosed 12 bit per pixel (16 possible values for each component). (be carefull, a 4 bit per component choose, for a source image source size of 300x300 pixels will ask you more than 1 GB of ram for the integral histogram's propagation method). usually you can achive your scope with: bitPerComp = 2.
Method Detail

getBinValue

public int getBinValue(int bin)
Description copied from interface: Hist
return the content of the queried bin

Specified by:
getBinValue in interface Hist
Parameters:
bin -
Returns:
int

getBinsPerComp

public int getBinsPerComp()
Description copied from interface: Hist
return the the number of bit per component (usually choosed by the user trought the implementation class's constructor)

Specified by:
getBinsPerComp in interface Hist
Returns:
int

copy

public void copy(Hist srcHist)
copy source histogram's bins onto the current histogram.

Specified by:
copy in interface Hist
Parameters:
srcHist - source histogram

sumPixel

public void sumPixel(int pixelColor)
update the histogram adding the pixelColor value in the right bin

Specified by:
sumPixel in interface Hist
Parameters:
pixelColor -

sumHists

public void sumHists(Hist leftHist,
                     Hist upHist,
                     Hist up_leftHist,
                     int currentPixel)
compute an wavefront propagation step.

Specified by:
sumHists in interface Hist
Parameters:
leftHist,upHist,up_LeftHist - source histograms used for propagation step
currentPixel - source image's pixel of the current point

normalize

public void normalize(float[] outputHist,
                      int norm)
normalize the current histogram and store the output in outputHist.

Specified by:
normalize in interface Hist
Parameters:
outputHist - normalization's output
norm - normalize factor

createFromImage

public void createFromImage(int imgWidth,
                            int imgHeight,
                            int[] imgPixels)
use the current histogram ("this" operator) to store the (color) histogram of a source image.

Specified by:
createFromImage in interface Hist
Parameters:
imgWidth -
imgHeight -
imgPixels - the pixels's array of the source image


processing library integralhistogram by Giovanni Tarducci, Alessio Barducci. (c) 2009