tesseract 4.1.1
Loading...
Searching...
No Matches
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 665 of file paragraphs.cpp.

Constructor & Destructor Documentation

◆ SimpleClusterer()

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

Definition at line 667 of file paragraphs.cpp.

668 : max_cluster_width_(max_cluster_width) {}

Member Function Documentation

◆ Add()

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

Definition at line 669 of file paragraphs.cpp.

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

◆ GetClusters()

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

Definition at line 689 of file paragraphs.cpp.

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

◆ size()

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

Definition at line 670 of file paragraphs.cpp.

670{ return values_.size(); }

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