Logo Search packages:      
Sourcecode: pfstools version File versions  Download package

float Histogram::getHighFrequency (  )  const

Returns frequence of the bin = max_bin - PERCENTIL * number_of_bins. Very light and very dark bins are not taken into consideration in this computations. It allows to skip very dark (black) and/or very light (white) pixels which can cover large areas of an image and lower the height of histogram for remaining pixels (undesirable situation: flat histogram with one large pick for very light bin).

Definition at line 281 of file histogram.cpp.

References getMaxFrequency().

Referenced by drawHistogram().

                                        {
      
      std::vector<float> vec;
      for( int i = 0; i < width; i++ ) {
            vec.push_back((float)frequencyValues[i]);
      }    
      std::sort(vec.begin(), vec.end());
      
      #define PERCENTIL 0.99

      float highFreq = vec[(int)((float)vec.size() * PERCENTIL)];
      
      // returns high frequency only if max frequency is 3 or more times higher
      float maxFreq = getMaxFrequency();

      if( (3*highFreq) > maxFreq)
            return maxFreq;
      else  
            return highFreq;
}


Generated by  Doxygen 1.6.0   Back to index