Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tesseract::SimpleClusterer Class Reference

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)
inlineexplicit

Definition at line 665 of file paragraphs.cpp.

666  : max_cluster_width_(max_cluster_width) {}

Member Function Documentation

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

Definition at line 667 of file paragraphs.cpp.

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

Definition at line 687 of file paragraphs.cpp.

687  {
688  clusters->clear();
689  values_.sort();
690  for (int i = 0; i < values_.size();) {
691  int orig_i = i;
692  int lo = values_[i];
693  int hi = lo;
694  while (++i < values_.size() && values_[i] <= lo + max_cluster_width_) {
695  hi = values_[i];
696  }
697  clusters->push_back(Cluster((hi + lo) / 2, i - orig_i));
698  }
699 }
virtual void clear()
int push_back(T object)
int size() const
Definition: genericvector.h:59
int tesseract::SimpleClusterer::size ( ) const
inline

Definition at line 668 of file paragraphs.cpp.

668 { return values_.size(); }
int size() const
Definition: genericvector.h:59

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