tesseract  4.0.0-1-g2a2b
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 666 of file paragraphs.cpp.

Constructor & Destructor Documentation

◆ SimpleClusterer()

tesseract::SimpleClusterer::SimpleClusterer ( int  max_cluster_width)
inlineexplicit

Definition at line 668 of file paragraphs.cpp.

669  : max_cluster_width_(max_cluster_width) {}

Member Function Documentation

◆ Add()

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

Definition at line 670 of file paragraphs.cpp.

670 { values_.push_back(value); }
int push_back(T object)

◆ GetClusters()

void tesseract::SimpleClusterer::GetClusters ( GenericVector< Cluster > *  clusters)

Definition at line 690 of file paragraphs.cpp.

690  {
691  clusters->clear();
692  values_.sort();
693  for (int i = 0; i < values_.size();) {
694  int orig_i = i;
695  int lo = values_[i];
696  int hi = lo;
697  while (++i < values_.size() && values_[i] <= lo + max_cluster_width_) {
698  hi = values_[i];
699  }
700  clusters->push_back(Cluster((hi + lo) / 2, i - orig_i));
701  }
702 }
int size() const
Definition: genericvector.h:71
int push_back(T object)

◆ size()

int tesseract::SimpleClusterer::size ( ) const
inline

Definition at line 671 of file paragraphs.cpp.

671 { return values_.size(); }
int size() const
Definition: genericvector.h:71

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