PICCANTE  0.4
The hottest HDR imaging library!
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
pic::Histogram Class Reference

The Histogram class is a class for creating, managing, loading, and saving histogram for an Image. More...

#include <histogram.hpp>

Public Member Functions

 Histogram ()
 Histogram is the basic constructor setting variables to defaults. More...
 
 Histogram (Image *imgIn, VALUE_SPACE type, int nBin, int channel=0)
 Histogram is an extension of the basic constructor, where calculate is called in order to populate the Histogram. More...
 
 ~Histogram ()
 ~Histogram is the basic destructor which frees memory. More...
 
void release ()
 release More...
 
void calculate (Image *imgIn, VALUE_SPACE type=VS_LIN, int nBin=256, BBox *box=NULL, int channel=0)
 calculate computes the histogram of an input image. In the case of LDR images, they are ssumed to be normalized; i.e. with values in [0, 1]. This function computes the histogram for a single color channel. More...
 
void uniform (float fMin, float fMax, uint value, VALUE_SPACE type, int nBin)
 uniform More...
 
void update (float fMin, float fMax)
 update More...
 
int project (float x)
 project converts an input value in the histogram domain. More...
 
float unproject (int ind)
 unproject converts a histogram value back to its original domain. More...
 
void ceiling (float k)
 ceiling limits the maximum value of the histogram using Ward algorithm. More...
 
void clip (uint value)
 clip clips the histogram to value. More...
 
float * cumulativef (bool bNormalized)
 cumulativef computes the cumulative Histogram. More...
 
float * getCumulativef ()
 getCumulativef this function returns the cumulative Histogram. Note that cumulativef needs to be computed before otherwise the function will return a NULL pointer. More...
 
float getfMin ()
 getfMin More...
 
float getfMax ()
 getfMax More...
 
float * getNormalized (bool bNor=true)
 getNormalized normalizes the Histogram. More...
 
float getOtsu ()
 getOtsu More...
 
void write (std::string name, bool bNor)
 write saves the Histogram as an Image into a file. More...
 
std::vector< float > exposureCovering (int nBits=8, float overlap=1.0f)
 exposureCovering computes the exposure values for fully covering the dynamic range of the image. This function works only if the histogram was compute usign VS_LOG_2. More...
 
float getBestExposure (int nBits, float overlap=0.5f)
 getBestExposure computes the best interval center. More...
 

Public Attributes

uintbin
 
uintbin_work
 

Protected Member Functions

float projectDomain (float x)
 projectDomain applies the histogram domain to x. More...
 
float unprojectDomain (float x)
 unprojectDomain removes the histogram domain to x. More...
 
void update (float x)
 update More...
 

Protected Attributes

float * bin_c
 
float * bin_nor
 
int nBin
 
VALUE_SPACE type
 
float fMin
 
float fMax
 
float deltaMaxMin
 
float nBinf
 
float epsilon
 

Detailed Description

The Histogram class is a class for creating, managing, loading, and saving histogram for an Image.

Constructor & Destructor Documentation

◆ Histogram() [1/2]

pic::Histogram::Histogram ( )
inline

Histogram is the basic constructor setting variables to defaults.

◆ Histogram() [2/2]

pic::Histogram::Histogram ( Image imgIn,
VALUE_SPACE  type,
int  nBin,
int  channel = 0 
)
inline

Histogram is an extension of the basic constructor, where calculate is called in order to populate the Histogram.

Parameters
imgInis an input image for which Histogram needs to be computed.
typeis the space of computations (please see calculate()).
nBinis the number of bins of the Histogram.
channelis the color channel for which Histogram needs to be computed.

◆ ~Histogram()

pic::Histogram::~Histogram ( )
inline

~Histogram is the basic destructor which frees memory.

Member Function Documentation

◆ calculate()

void pic::Histogram::calculate ( Image imgIn,
VALUE_SPACE  type = VS_LIN,
int  nBin = 256,
BBox box = NULL,
int  channel = 0 
)
inline

calculate computes the histogram of an input image. In the case of LDR images, they are ssumed to be normalized; i.e. with values in [0, 1]. This function computes the histogram for a single color channel.

Parameters
imgInis the input image for which the histogram needs to be computed
typeis the domain space for histogram computations. Histogram can be computed as: VS_LDR (256 bins), VS_LIN (linear space), VS_LOG_2 (logarithm 2 base), VS_LOG_E (natural logarithm space), and VS_LOG_10 (logarithm 10 base).
nBinis the number of bins of the Histogram to be computed. The default value is 256.
boxis the slice where to compute the histogram.
channelis the color channel for which the Histogram will be computed.

◆ ceiling()

void pic::Histogram::ceiling ( float  k)
inline

ceiling limits the maximum value of the histogram using Ward algorithm.

Parameters
k

◆ clip()

void pic::Histogram::clip ( uint  value)
inline

clip clips the histogram to value.

Parameters
valuethe maximum allowed value in the histogram.

◆ cumulativef()

float* pic::Histogram::cumulativef ( bool  bNormalized)
inline

cumulativef computes the cumulative Histogram.

Parameters
bNormalizedis a boolean value; if it is true values of the Histogram will be normalized.
Returns
It returns the cumulative Histogram as a float pointer.

◆ exposureCovering()

std::vector< float > pic::Histogram::exposureCovering ( int  nBits = 8,
float  overlap = 1.0f 
)
inline

exposureCovering computes the exposure values for fully covering the dynamic range of the image. This function works only if the histogram was compute usign VS_LOG_2.

Parameters
nBitsis the number of bit used for storing each output exposure image. The default value is 8.
overlapis the value, in f-stops, of overlapping between two exposure images. This value is set to 1 by default.
Returns
It returns an std::vector<float> which contains the exposure values in f-stops for all required exposures for covering information.

◆ getBestExposure()

float pic::Histogram::getBestExposure ( int  nBits,
float  overlap = 0.5f 
)
inline

getBestExposure computes the best interval center.

Parameters
nBitsis the number of bits in the budget for the output image.
Returns
It returns the exposure, in f-stops, for setting the image with the best exposure at given dynamic range.

◆ getCumulativef()

float* pic::Histogram::getCumulativef ( )
inline

getCumulativef this function returns the cumulative Histogram. Note that cumulativef needs to be computed before otherwise the function will return a NULL pointer.

Returns
It returns a float pointer to the cumulative Histogram.

◆ getfMax()

float pic::Histogram::getfMax ( )
inline

getfMax

Returns

◆ getfMin()

float pic::Histogram::getfMin ( )
inline

getfMin

Returns

◆ getNormalized()

float* pic::Histogram::getNormalized ( bool  bNor = true)
inline

getNormalized normalizes the Histogram.

Returns
It returns the normalized Histogram as a float pointer.

◆ getOtsu()

float pic::Histogram::getOtsu ( )
inline

getOtsu

Returns

◆ project()

int pic::Histogram::project ( float  x)
inline

project converts an input value in the histogram domain.

Parameters
xis an input value.
Returns
x is projected in the histogram domain.

◆ projectDomain()

float pic::Histogram::projectDomain ( float  x)
inlineprotected

projectDomain applies the histogram domain to x.

Parameters
xis an input value.
Returns
x is converted into the histogram domain.

◆ release()

void pic::Histogram::release ( )
inline

release

◆ uniform()

void pic::Histogram::uniform ( float  fMin,
float  fMax,
uint  value,
VALUE_SPACE  type,
int  nBin 
)
inline

uniform

Parameters
value
type
nBin

◆ unproject()

float pic::Histogram::unproject ( int  ind)
inline

unproject converts a histogram value back to its original domain.

Parameters
indis a histogram value.
Returns
ind is converted back to its original domain.

◆ unprojectDomain()

float pic::Histogram::unprojectDomain ( float  x)
inlineprotected

unprojectDomain removes the histogram domain to x.

Parameters
xis an input value.
Returns
x is converted back to its original domain.

◆ update() [1/2]

void pic::Histogram::update ( float  x)
inlineprotected

update

Parameters
x

◆ update() [2/2]

void pic::Histogram::update ( float  fMin,
float  fMax 
)
inline

update

Parameters
fMin
fMax

◆ write()

void pic::Histogram::write ( std::string  name,
bool  bNor 
)
inline

write saves the Histogram as an Image into a file.

Parameters
nameis the filename where to save the Histogram.
bNoris a boolean value for normalizing or not the Histogram.

Member Data Documentation

◆ bin

uint* pic::Histogram::bin

◆ bin_c

float* pic::Histogram::bin_c
protected

◆ bin_nor

float* pic::Histogram::bin_nor
protected

◆ bin_work

uint * pic::Histogram::bin_work

◆ deltaMaxMin

float pic::Histogram::deltaMaxMin
protected

◆ epsilon

float pic::Histogram::epsilon
protected

◆ fMax

float pic::Histogram::fMax
protected

◆ fMin

float pic::Histogram::fMin
protected

◆ nBin

int pic::Histogram::nBin
protected

◆ nBinf

float pic::Histogram::nBinf
protected

◆ type

VALUE_SPACE pic::Histogram::type
protected

The documentation for this class was generated from the following file: