Tesseract  3.02
tesseract::SimpleClusterer Class Reference

List of all members.

Public Member Functions

 SimpleClusterer (int max_cluster_width)
void Add (int value)
int size () const
void GetClusters (GenericVector< Cluster > *clusters)

Detailed Description

Definition at line 663 of file paragraphs.cpp.


Constructor & Destructor Documentation

tesseract::SimpleClusterer::SimpleClusterer ( int  max_cluster_width) [inline, explicit]

Definition at line 665 of file paragraphs.cpp.

      : max_cluster_width_(max_cluster_width) {}

Member Function Documentation

void tesseract::SimpleClusterer::Add ( int  value) [inline]

Definition at line 667 of file paragraphs.cpp.

{ values_.push_back(value); }
void tesseract::SimpleClusterer::GetClusters ( GenericVector< Cluster > *  clusters)

Definition at line 687 of file paragraphs.cpp.

                                                                  {
  clusters->clear();
  values_.sort();
  for (int i = 0; i < values_.size();) {
    int orig_i = i;
    int lo = values_[i];
    int hi = lo;
    while (++i < values_.size() && values_[i] <= lo + max_cluster_width_) {
      hi = values_[i];
    }
    clusters->push_back(Cluster((hi + lo) / 2, i - orig_i));
  }
}
int tesseract::SimpleClusterer::size ( ) const [inline]

Definition at line 668 of file paragraphs.cpp.

{ return values_.size(); }

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