Basic Image AlgorithmS Library
2.8.0
|
This Class handels Histogram matters on Images. More...
#include <Image/ColorHistogram.hh>
Public Member Functions | |
double | CalcSimilarity (const BIAS::ColorHistogram< StorageType > chist) const |
Calculates the Bhattacharyya similarity Coeiffient^2 which is the distance or difference of 2 colorhistograms. More... | |
double | CalcSimilarity (const BIAS::ColorHistogram< StorageType > chist, double &weight) const |
Calculates the Bhattacharyya similarity Coeiffient^2 which is the distance or difference of 2 colorhistograms. More... | |
int | CheckImageQuality (float percent, float &shutter, float &gain) |
checks the image quality depending on the given Histogram and increases ,decreases shutter and gain More... | |
int | CheckImageQualityComplete (float percent, float &shutter, float &gain) |
same as above but luminance vector is created form all pixels in histogram More... | |
int | CheckImageQualityRef (ColorHistogram< StorageType > &cHist, float percent, float &shutter, float &gain) |
same as above but checks similarity of luminance to a given reference histogram More... | |
int | Clear () |
Deletes current Histogram information. More... | |
ColorHistogram () | |
std Con-/Destructor More... | |
void | Dump (std::ostream &os=std::cout) |
dumps information on histogram More... | |
void | DumpCSV (std::ostream &os=std::cout) |
dumps information on histogram to ostream format: binsize tab ux tab uy tab lx tab ly hs histogram, as a matrix with binsize x binsize (tab separated) l values as a line with lenght binsize (tab separated) More... | |
int | GenerateCircleHist (BIAS::Image< StorageType > &image, int x, int y, int r) |
calcluates the cirlce formed histogram from data and adds them to the internal data structures More... | |
int | GenerateCircleHist (BIAS::Image< StorageType > &image) |
calculates the Histogram of the image in circle format ATTENTION: ROI must be set in upper function SetCROI if this function is used More... | |
template<> | |
int | GenerateCircleHist (Image< unsigned char > &img) |
int | GenerateHist (BIAS::Image< StorageType > &image, int ux, int uy, int lx, int ly) |
calcluates the histogram from data and adds them to the internal data structures More... | |
int | GenerateHist (BIAS::Image< StorageType > &image) |
calculates the Histogram of the image ATTENTION: ROI must be set in upper function SetROI if this function is used More... | |
template<> | |
int | GenerateHist (Image< unsigned char > &img) |
char * | GetBinaryData (int &length) |
int | GetBinSize () const |
GetBinSize. More... | |
int | GetBinSizeSat () const |
GetBinSizeSat. More... | |
int | GetHeightROI () const |
std::vector< std::vector < double > > | GetHist () const |
return the histogram with H&S values More... | |
std::vector< double > | GetHistL () const |
return the L-values of the HSLcolorspace that are <MINSAT in the ROI More... | |
int | GetNumberOfEntries () |
this calculates of binsize, binsizesat (1 each) coords (4) the matrix (nrofbinssat * nrofbins) lvector (nrofbins) luminance vector (nrofbins) total pixelcount (1) More... | |
void | GetROI (std::vector< int > &roi) const |
float | GetSaturatedBins () const |
returns the percentage [0..1] of HS-bins in the histogram that have values unequal to zero More... | |
int | GetWidthROI () const |
int | Read (const char *filename) |
reads a histogram from instream and fills the internal data structures More... | |
void | ReadBinaryData (char *data) |
int | SetBinSize (int binsize) |
set the binsize (must be divideable by 2pown) More... | |
int | SetBinSize (int binSizeHue, int binSizeSat) |
set the binsize for different binSizes (must be divideable by 2pown) More... | |
void | SetExpDist (bool expdist) |
sets expDist_ true or false, used to calculate the dist in CalcSimilarity More... | |
void | SetLambda (int lambda) |
sets Lambda, which is used to calculate the dist in CalcSimilarity More... | |
void | SetMinSat (int minsat) |
set minsat_, which defines the minimum saturation More... | |
int | SetROI (int ux, int uy, int lx, int ly) |
set the coords for the ROI More... | |
int | SetROI (int x, int y, int r) |
set the coords for the circle ROI More... | |
int | Update (const BIAS::ColorHistogram< StorageType > &hist, double factor=0.5) |
Updates the histogramm with values from hist, where the factor gives the weighting of the new values from hist. More... | |
~ColorHistogram () | |
Public Attributes | |
std::vector< double > | luminance_ |
Protected Member Functions | |
int | DeleteHist_ () |
deletes hist_, histl_... More... | |
void | Normalise_ () |
Normalizes the histogram to be able to use it in the Bhattacharyya... More... | |
Protected Attributes | |
unsigned int | binCount_ |
int | binSize_ |
int | binSizeSat_ |
bool | circle_ |
bool | expDist_ |
std::vector< std::vector < double > > | hist_ |
unsigned short int | histCount_ |
std::vector< double > | histl_ |
BIAS::Image< StorageType > * | image_ |
int | lambda_ |
int | lx_ |
int | ly_ |
double | maxBinVal_ |
double | minBinVal_ |
int | minSat_ |
int | mx_ |
int | my_ |
bool | normalised_ |
int | r_ |
int | shift_ |
int | shiftLum_ |
int | shiftSat_ |
int | ux_ |
int | uy_ |
This Class handels Histogram matters on Images.
It represents an histogram and offers basic methods on histograms.
Definition at line 54 of file ColorHistogram.hh.
BIAS::ColorHistogram< StorageType >::ColorHistogram | ( | ) |
std Con-/Destructor
This class creates a Histogram in the HSL color space.
Definition at line 51 of file ColorHistogram.cpp.
BIAS::ColorHistogram< StorageType >::~ColorHistogram | ( | ) |
Definition at line 67 of file ColorHistogram.cpp.
double BIAS::ColorHistogram< StorageType >::CalcSimilarity | ( | const BIAS::ColorHistogram< StorageType > | chist | ) | const |
Calculates the Bhattacharyya similarity Coeiffient^2 which is the distance or difference of 2 colorhistograms.
the | chist to compare with |
Definition at line 561 of file ColorHistogram.cpp.
References BIAS::ColorHistogram< StorageType >::hist_, and BIAS::ColorHistogram< StorageType >::histl_.
double BIAS::ColorHistogram< StorageType >::CalcSimilarity | ( | const BIAS::ColorHistogram< StorageType > | chist, |
double & | weight | ||
) | const |
Calculates the Bhattacharyya similarity Coeiffient^2 which is the distance or difference of 2 colorhistograms.
returns a weight, which is in [0..1] and is the percentage of the bins unequal zero.
the | chist to compare with |
Definition at line 588 of file ColorHistogram.cpp.
References BIAS::ColorHistogram< StorageType >::hist_, and BIAS::ColorHistogram< StorageType >::histl_.
int BIAS::ColorHistogram< StorageType >::CheckImageQuality | ( | float | percent, |
float & | shutter, | ||
float & | gain | ||
) |
checks the image quality depending on the given Histogram and increases ,decreases shutter and gain
percent | = percentage of pixels in the luminance vector required |
hist | = the colorhistogram of the interesting part of the image |
shutter | = shutter value |
gain | = gain value |
Definition at line 751 of file ColorHistogram.cpp.
int BIAS::ColorHistogram< StorageType >::CheckImageQualityComplete | ( | float | percent, |
float & | shutter, | ||
float & | gain | ||
) |
same as above but luminance vector is created form all pixels in histogram
Definition at line 723 of file ColorHistogram.cpp.
int BIAS::ColorHistogram< StorageType >::CheckImageQualityRef | ( | ColorHistogram< StorageType > & | cHist, |
float | percent, | ||
float & | shutter, | ||
float & | gain | ||
) |
same as above but checks similarity of luminance to a given reference histogram
cHist | = the reference colorHistogram |
Definition at line 659 of file ColorHistogram.cpp.
References BIAS::ColorHistogram< StorageType >::luminance_, BIAS::maxGain, BIAS::maxShutter, BIAS::minGain, and BIAS::minShutter.
int BIAS::ColorHistogram< StorageType >::Clear | ( | ) |
Deletes current Histogram information.
Definition at line 220 of file ColorHistogram.cpp.
|
protected |
deletes hist_, histl_...
Definition at line 946 of file ColorHistogram.cpp.
void BIAS::ColorHistogram< StorageType >::Dump | ( | std::ostream & | os = std::cout | ) |
dumps information on histogram
dumps information on histogram to ostream format: binsize tab ux tab uy tab lx tab ly hs histogram, as a matrix with binsize x binsize (tab separated) l values as a line with lenght binsize (tab separated)
os | = the outstream, default std::cout |
Definition at line 830 of file ColorHistogram.cpp.
void BIAS::ColorHistogram< StorageType >::DumpCSV | ( | std::ostream & | os = std::cout | ) |
dumps information on histogram to ostream format: binsize tab ux tab uy tab lx tab ly hs histogram, as a matrix with binsize x binsize (tab separated) l values as a line with lenght binsize (tab separated)
Definition at line 798 of file ColorHistogram.cpp.
int BIAS::ColorHistogram< StorageType >::GenerateCircleHist | ( | BIAS::Image< StorageType > & | image, |
int | x, | ||
int | y, | ||
int | r | ||
) |
calcluates the cirlce formed histogram from data and adds them to the internal data structures
image | = the image |
x | = middle point x of region of interest as circle |
y | = middly point y of region of interest as circle |
r | = radius of the circle |
Definition at line 256 of file ColorHistogram.cpp.
int BIAS::ColorHistogram< StorageType >::GenerateCircleHist | ( | BIAS::Image< StorageType > & | image | ) |
calculates the Histogram of the image in circle format ATTENTION: ROI must be set in upper function SetCROI if this function is used
image | = the image |
Definition at line 425 of file ColorHistogram.cpp.
References BIAS::ImageBase::CM_HSL, BIAS::ImageBase::GetColorModel(), and BIAS::BresenhamCircle::GetNext().
int BIAS::ColorHistogram< unsigned char >::GenerateCircleHist | ( | Image< unsigned char > & | img | ) |
Definition at line 494 of file ColorHistogram.cpp.
References BIAS::ImageBase::CM_HSL, BIAS::ImageBase::GetColorModel(), and BIAS::BresenhamCircle::GetNext().
int BIAS::ColorHistogram< StorageType >::GenerateHist | ( | BIAS::Image< StorageType > & | image, |
int | ux, | ||
int | uy, | ||
int | lx, | ||
int | ly | ||
) |
calcluates the histogram from data and adds them to the internal data structures
image | = the image |
ux | = upper left corner x of region of interest |
uy | = upper left corner y of region of interest |
lx | = lower right corner x of region of interest |
ly | = lower right corner y of region of interest |
Definition at line 240 of file ColorHistogram.cpp.
int BIAS::ColorHistogram< StorageType >::GenerateHist | ( | BIAS::Image< StorageType > & | image | ) |
calculates the Histogram of the image ATTENTION: ROI must be set in upper function SetROI if this function is used
image | = the image |
Definition at line 272 of file ColorHistogram.cpp.
References BIAS::ImageBase::CM_HSL, and BIAS::ImageBase::GetColorModel().
int BIAS::ColorHistogram< unsigned char >::GenerateHist | ( | Image< unsigned char > & | img | ) |
Definition at line 351 of file ColorHistogram.cpp.
References BIAS::ImageBase::CM_HSL, and BIAS::ImageBase::GetColorModel().
char * BIAS::ColorHistogram< StorageType >::GetBinaryData | ( | int & | length | ) |
Definition at line 975 of file ColorHistogram.cpp.
|
inline |
|
inline |
int BIAS::ColorHistogram< StorageType >::GetHeightROI | ( | ) | const |
Definition at line 188 of file ColorHistogram.cpp.
Referenced by BIAS::CondensHisto::SetReferenceHistogram().
std::vector< std::vector< double > > BIAS::ColorHistogram< StorageType >::GetHist | ( | ) | const |
return the histogram with H&S values
Definition at line 175 of file ColorHistogram.cpp.
Referenced by BIAS::IntegralHistogram::CalcSimilarity().
std::vector< double > BIAS::ColorHistogram< StorageType >::GetHistL | ( | ) | const |
return the L-values of the HSLcolorspace that are <MINSAT in the ROI
Definition at line 182 of file ColorHistogram.cpp.
Referenced by BIAS::IntegralHistogram::CalcSimilarity().
int BIAS::ColorHistogram< StorageType >::GetNumberOfEntries | ( | ) |
this calculates of binsize, binsizesat (1 each) coords (4) the matrix (nrofbinssat * nrofbins) lvector (nrofbins) luminance vector (nrofbins) total pixelcount (1)
Definition at line 865 of file ColorHistogram.cpp.
void BIAS::ColorHistogram< StorageType >::GetROI | ( | std::vector< int > & | roi | ) | const |
Definition at line 201 of file ColorHistogram.cpp.
float BIAS::ColorHistogram< StorageType >::GetSaturatedBins | ( | ) | const |
returns the percentage [0..1] of HS-bins in the histogram
that have values unequal to zero
Definition at line 959 of file ColorHistogram.cpp.
int BIAS::ColorHistogram< StorageType >::GetWidthROI | ( | ) | const |
Definition at line 194 of file ColorHistogram.cpp.
Referenced by BIAS::CondensHisto::SetReferenceHistogram().
|
protected |
Normalizes the histogram to be able to use it in the Bhattacharyya...
Difference
Definition at line 921 of file ColorHistogram.cpp.
int BIAS::ColorHistogram< StorageType >::Read | ( | const char * | filename | ) |
reads a histogram from instream and fills the internal data structures
is | = the instream |
Definition at line 876 of file ColorHistogram.cpp.
void BIAS::ColorHistogram< StorageType >::ReadBinaryData | ( | char * | data | ) |
Definition at line 1012 of file ColorHistogram.cpp.
int BIAS::ColorHistogram< StorageType >::SetBinSize | ( | int | binsize | ) |
set the binsize (must be divideable by 2pown)
Definition at line 101 of file ColorHistogram.cpp.
Referenced by BIAS::CondensHisto::SetReferenceHistogram().
int BIAS::ColorHistogram< StorageType >::SetBinSize | ( | int | binSizeHue, |
int | binSizeSat | ||
) |
set the binsize for different binSizes (must be divideable by 2pown)
Definition at line 132 of file ColorHistogram.cpp.
|
inline |
sets expDist_ true or false, used to calculate the dist in CalcSimilarity
Definition at line 105 of file ColorHistogram.hh.
|
inline |
sets Lambda, which is used to calculate the dist in CalcSimilarity
Definition at line 99 of file ColorHistogram.hh.
|
inline |
set minsat_, which defines the minimum saturation
Definition at line 92 of file ColorHistogram.hh.
int BIAS::ColorHistogram< StorageType >::SetROI | ( | int | ux, |
int | uy, | ||
int | lx, | ||
int | ly | ||
) |
set the coords for the ROI
Definition at line 75 of file ColorHistogram.cpp.
int BIAS::ColorHistogram< StorageType >::SetROI | ( | int | x, |
int | y, | ||
int | r | ||
) |
set the coords for the circle ROI
Definition at line 89 of file ColorHistogram.cpp.
int BIAS::ColorHistogram< StorageType >::Update | ( | const BIAS::ColorHistogram< StorageType > & | hist, |
double | factor = 0.5 |
||
) |
Updates the histogramm with values from hist,
where the factor gives the weighting of the new values from hist.
Definition at line 628 of file ColorHistogram.cpp.
References BIAS::ColorHistogram< StorageType >::binSize_, BIAS::ColorHistogram< StorageType >::hist_, BIAS::ColorHistogram< StorageType >::histl_, BIAS::ColorHistogram< StorageType >::lx_, BIAS::ColorHistogram< StorageType >::ly_, BIAS::ColorHistogram< StorageType >::ux_, and BIAS::ColorHistogram< StorageType >::uy_.
|
protected |
Definition at line 319 of file ColorHistogram.hh.
|
protected |
Definition at line 332 of file ColorHistogram.hh.
Referenced by BIAS::ColorHistogram< StorageType >::Update().
|
protected |
Definition at line 333 of file ColorHistogram.hh.
|
protected |
Definition at line 327 of file ColorHistogram.hh.
|
protected |
Definition at line 338 of file ColorHistogram.hh.
|
protected |
Definition at line 321 of file ColorHistogram.hh.
Referenced by BIAS::ColorHistogram< StorageType >::CalcSimilarity(), and BIAS::ColorHistogram< StorageType >::Update().
|
protected |
Definition at line 318 of file ColorHistogram.hh.
|
protected |
Definition at line 322 of file ColorHistogram.hh.
Referenced by BIAS::ColorHistogram< StorageType >::CalcSimilarity(), and BIAS::ColorHistogram< StorageType >::Update().
|
protected |
Definition at line 320 of file ColorHistogram.hh.
|
protected |
Definition at line 337 of file ColorHistogram.hh.
std::vector<double> BIAS::ColorHistogram< StorageType >::luminance_ |
Definition at line 302 of file ColorHistogram.hh.
Referenced by BIAS::ColorHistogram< StorageType >::CheckImageQualityRef().
|
protected |
Definition at line 324 of file ColorHistogram.hh.
Referenced by BIAS::ColorHistogram< StorageType >::Update().
|
protected |
Definition at line 324 of file ColorHistogram.hh.
Referenced by BIAS::ColorHistogram< StorageType >::Update().
|
protected |
Definition at line 329 of file ColorHistogram.hh.
|
protected |
Definition at line 329 of file ColorHistogram.hh.
|
protected |
Definition at line 337 of file ColorHistogram.hh.
|
protected |
Definition at line 325 of file ColorHistogram.hh.
|
protected |
Definition at line 325 of file ColorHistogram.hh.
|
protected |
Definition at line 316 of file ColorHistogram.hh.
|
protected |
Definition at line 325 of file ColorHistogram.hh.
|
protected |
Definition at line 334 of file ColorHistogram.hh.
|
protected |
Definition at line 336 of file ColorHistogram.hh.
|
protected |
Definition at line 335 of file ColorHistogram.hh.
|
protected |
Definition at line 324 of file ColorHistogram.hh.
Referenced by BIAS::ColorHistogram< StorageType >::Update().
|
protected |
Definition at line 324 of file ColorHistogram.hh.
Referenced by BIAS::ColorHistogram< StorageType >::Update().