mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-27 14:39:20 -06:00
Auto filter of 'background'
This commit is contained in:
@@ -116,6 +116,7 @@ bool Histogram::add(float value, float repeat) {
|
||||
|
||||
_data[binIndex] += repeat;
|
||||
_numValues += repeat;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -281,4 +282,25 @@ void Histogram::print() const {
|
||||
std::cout << std::endl << std::endl << std::endl<< "==============" << std::endl;
|
||||
}
|
||||
|
||||
float Histogram::highestBinValue(bool equalized){
|
||||
int highestBin = 0;
|
||||
for(int i=0; i<_numBins; i++){
|
||||
if(_data[i] > _data[highestBin])
|
||||
highestBin = i;
|
||||
}
|
||||
|
||||
float low = _minValue + float(highestBin) / _numBins * (_maxValue - _minValue);
|
||||
float high = low + (_maxValue - _minValue) / float(_numBins);
|
||||
|
||||
if(!equalized){
|
||||
return (high+low)/2.0;
|
||||
}else{
|
||||
return equalize((high+low)/2.0);
|
||||
}
|
||||
}
|
||||
|
||||
float Histogram::binWidth(){
|
||||
return (_maxValue-_minValue)/_numBins;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user