tesseract  5.0.0-alpha-619-ge9db
tesseract::FloatWordFeature Struct Reference

#include <imagedata.h>

Static Public Member Functions

static void FromWordFeatures (const GenericVector< WordFeature > &word_features, GenericVector< FloatWordFeature > *float_features)
 
static int SortByXBucket (const void *, const void *)
 

Public Attributes

float x
 
float y
 
float dir
 
int x_bucket
 

Detailed Description

Definition at line 87 of file imagedata.h.

Member Function Documentation

◆ FromWordFeatures()

void tesseract::FloatWordFeature::FromWordFeatures ( const GenericVector< WordFeature > &  word_features,
GenericVector< FloatWordFeature > *  float_features 
)
static

Definition at line 96 of file imagedata.cpp.

98  {
99  for (int i = 0; i < word_features.size(); ++i) {
100  FloatWordFeature f;
101  f.x = word_features[i].x();
102  f.y = word_features[i].y();
103  f.dir = word_features[i].dir();
104  f.x_bucket = 0; // Will set it later.
105  float_features->push_back(f);
106  }
107 }

◆ SortByXBucket()

int tesseract::FloatWordFeature::SortByXBucket ( const void *  v1,
const void *  v2 
)
static

Definition at line 111 of file imagedata.cpp.

111  {
112  const auto* f1 = static_cast<const FloatWordFeature*>(v1);
113  const auto* f2 = static_cast<const FloatWordFeature*>(v2);
114  int x_diff = f1->x_bucket - f2->x_bucket;
115  if (x_diff == 0) return f1->y - f2->y;
116  return x_diff;
117 }

Member Data Documentation

◆ dir

float tesseract::FloatWordFeature::dir

Definition at line 95 of file imagedata.h.

◆ x

float tesseract::FloatWordFeature::x

Definition at line 93 of file imagedata.h.

◆ x_bucket

int tesseract::FloatWordFeature::x_bucket

Definition at line 96 of file imagedata.h.

◆ y

float tesseract::FloatWordFeature::y

Definition at line 94 of file imagedata.h.


The documentation for this struct was generated from the following files:
GenericVector::push_back
int push_back(T object)
Definition: genericvector.h:799
GenericVector::size
int size() const
Definition: genericvector.h:71