All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
intfx.h File Reference
#include "blobs.h"
#include "intproto.h"
#include "normalis.h"
#include <math.h>

Go to the source code of this file.

Classes

struct  INT_FX_RESULT_STRUCT
 

Namespaces

 tesseract
 

Functions

void InitIntegerFX ()
 
FCOORD FeatureDirection (uinT8 theta)
 
TrainingSampletesseract::BlobToTrainingSample (const TBLOB &blob, bool nonlinear_norm, INT_FX_RESULT_STRUCT *fx_info, GenericVector< INT_FEATURE_STRUCT > *bl_features)
 
bool ExtractIntFeat (const TBLOB &blob, bool nonlinear_norm, INT_FEATURE_ARRAY BLFeat, INT_FEATURE_ARRAY CNFeat, INT_FX_RESULT_STRUCT *Results)
 

Variables

const double kStandardFeatureLength = 64.0 / 5
 

Function Documentation

bool ExtractIntFeat ( const TBLOB blob,
bool  nonlinear_norm,
INT_FEATURE_ARRAY  BLFeat,
INT_FEATURE_ARRAY  CNFeat,
INT_FX_RESULT_STRUCT Results 
)

Definition at line 513 of file intfx.cpp.

517  {
520  tesseract::Classify::ExtractFeatures(blob, nonlinear_norm,
521  &bl_features, &cn_features, results,
522  NULL);
523  if (bl_features.size() == 0 || cn_features.size() == 0 ||
524  bl_features.size() > MAX_NUM_INT_FEATURES ||
525  cn_features.size() > MAX_NUM_INT_FEATURES) {
526  return false; // Feature extraction failed.
527  }
528  memcpy(baseline_features, &bl_features[0],
529  bl_features.size() * sizeof(bl_features[0]));
530  memcpy(charnorm_features, &cn_features[0],
531  cn_features.size() * sizeof(cn_features[0]));
532  return true;
533 }
int size() const
Definition: genericvector.h:72
#define MAX_NUM_INT_FEATURES
Definition: intproto.h:132
static void ExtractFeatures(const TBLOB &blob, bool nonlinear_norm, GenericVector< INT_FEATURE_STRUCT > *bl_features, GenericVector< INT_FEATURE_STRUCT > *cn_features, INT_FX_RESULT_STRUCT *results, GenericVector< int > *outline_cn_counts)
Definition: intfx.cpp:445
#define NULL
Definition: host.h:144
FCOORD FeatureDirection ( uinT8  theta)

Definition at line 70 of file intfx.cpp.

70  {
71  return FCOORD(cos_table[theta], sin_table[theta]);
72 }
Definition: points.h:189
void InitIntegerFX ( )

Public Function Prototypes


Public Code

Definition at line 55 of file intfx.cpp.

55  {
56  static bool atan_table_init = false;
58  if (!atan_table_init) {
59  for (int i = 0; i < INT_CHAR_NORM_RANGE; ++i) {
60  cos_table[i] = cos(i * 2 * PI / INT_CHAR_NORM_RANGE + PI);
61  sin_table[i] = sin(i * 2 * PI / INT_CHAR_NORM_RANGE + PI);
62  }
63  atan_table_init = true;
64  }
66 }
#define INT_CHAR_NORM_RANGE
Definition: intproto.h:133
tesseract::CCUtilMutex atan_table_mutex
Definition: intfx.cpp:48
#define PI
Definition: const.h:19

Variable Documentation

const double kStandardFeatureLength = 64.0 / 5

Definition at line 46 of file intfx.h.