Public Member Functions | Private Member Functions | Private Attributes | Friends
bsol_distance_histogram Class Reference

#include <bsol_distance_histogram.h>

List of all members.

Public Member Functions

 bsol_distance_histogram ()
 Constructors.
 bsol_distance_histogram (int nbins, double max_val)
 set up the histogram with bin spacing defined by max_val and nbins.
 bsol_distance_histogram (int nbins, vcl_vector< vsol_line_2d_sptr > const &lines)
 ~bsol_distance_histogram ()
 Destructor.
int n_bins () const
vcl_vector< double > & counts ()
vcl_vector< double > & values ()
vcl_vector< double > & weights ()
vcl_vector< double > const & counts () const
vcl_vector< double > const & values () const
vcl_vector< double > const & weights () const
void up_count (const double value, const double count, const double weight=1.0)
 update the histogram.
bool distance_peaks (double &peak1, double &peak2, double min_peak_height_ratio=0.5)
 find the first two (non-zero) distance peaks.
double min_val () const
 utility functions.
double max_val () const
double min_count () const
double max_count () const

Private Member Functions

void normalize_distance ()
 normalize the distance values which were weighted by the line length.
double interpolate_peak (int initial_peak)
 perform a parabolic interpolation using adjacent bins.

Private Attributes

double delta_
 bin value interval
vcl_vector< double > bin_counts_
 histogram counts
vcl_vector< double > bin_values_
 histogram values
vcl_vector< double > weights_
 value weights

Friends

vcl_ostream & operator<< (vcl_ostream &os, const bsol_distance_histogram &h)

Detailed Description

Definition at line 22 of file bsol_distance_histogram.h.


Constructor & Destructor Documentation

bsol_distance_histogram::bsol_distance_histogram ( )

Constructors.

Definition at line 12 of file bsol_distance_histogram.cxx.

bsol_distance_histogram::bsol_distance_histogram ( int  nbins,
double  max_val 
)

set up the histogram with bin spacing defined by max_val and nbins.

Definition at line 19 of file bsol_distance_histogram.cxx.

bsol_distance_histogram::bsol_distance_histogram ( int  nbins,
vcl_vector< vsol_line_2d_sptr > const &  lines 
)

Definition at line 33 of file bsol_distance_histogram.cxx.

bsol_distance_histogram::~bsol_distance_histogram ( )

Destructor.

Definition at line 74 of file bsol_distance_histogram.cxx.


Member Function Documentation

vcl_vector<double>& bsol_distance_histogram::counts ( ) [inline]

Definition at line 32 of file bsol_distance_histogram.h.

vcl_vector<double> const& bsol_distance_histogram::counts ( ) const [inline]

Definition at line 35 of file bsol_distance_histogram.h.

bool bsol_distance_histogram::distance_peaks ( double &  peak1,
double &  peak2,
double  min_peak_height_ratio = 0.5 
)

find the first two (non-zero) distance peaks.

There will typically be a large distance peak at small distances.

The second distance peak will correspond to periodic line segments

Definition at line 160 of file bsol_distance_histogram.cxx.

double bsol_distance_histogram::interpolate_peak ( int  initial_peak) [private]

perform a parabolic interpolation using adjacent bins.

refine the peak location using parabolic interpolation.

Definition at line 116 of file bsol_distance_histogram.cxx.

double bsol_distance_histogram::max_count ( ) const

Definition at line 327 of file bsol_distance_histogram.cxx.

double bsol_distance_histogram::max_val ( ) const

Definition at line 307 of file bsol_distance_histogram.cxx.

double bsol_distance_histogram::min_count ( ) const

Definition at line 315 of file bsol_distance_histogram.cxx.

double bsol_distance_histogram::min_val ( ) const

utility functions.

Definition at line 299 of file bsol_distance_histogram.cxx.

int bsol_distance_histogram::n_bins ( ) const [inline]

Definition at line 31 of file bsol_distance_histogram.h.

void bsol_distance_histogram::normalize_distance ( ) [private]

normalize the distance values which were weighted by the line length.

normalized bin distance = (Sum_i length_i*dist_i)/(Sum_i length_i).

Note distances can't be negative so the -1 flag indicates there was no count for that bin.

Definition at line 83 of file bsol_distance_histogram.cxx.

void bsol_distance_histogram::up_count ( const double  value,
const double  count,
const double  weight = 1.0 
)

update the histogram.

Definition at line 98 of file bsol_distance_histogram.cxx.

vcl_vector<double>& bsol_distance_histogram::values ( ) [inline]

Definition at line 33 of file bsol_distance_histogram.h.

vcl_vector<double> const& bsol_distance_histogram::values ( ) const [inline]

Definition at line 36 of file bsol_distance_histogram.h.

vcl_vector<double>& bsol_distance_histogram::weights ( ) [inline]

Definition at line 34 of file bsol_distance_histogram.h.

vcl_vector<double> const& bsol_distance_histogram::weights ( ) const [inline]

Definition at line 37 of file bsol_distance_histogram.h.


Friends And Related Function Documentation

vcl_ostream& operator<< ( vcl_ostream &  os,
const bsol_distance_histogram h 
) [friend]

Definition at line 339 of file bsol_distance_histogram.cxx.


Member Data Documentation

vcl_vector<double> bsol_distance_histogram::bin_counts_ [private]

histogram counts

Definition at line 62 of file bsol_distance_histogram.h.

vcl_vector<double> bsol_distance_histogram::bin_values_ [private]

histogram values

Definition at line 63 of file bsol_distance_histogram.h.

bin value interval

Definition at line 61 of file bsol_distance_histogram.h.

vcl_vector<double> bsol_distance_histogram::weights_ [private]

value weights

Definition at line 64 of file bsol_distance_histogram.h.


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