tesseract  3.03
/usr/local/google/home/jbreiden/tesseract-ocr-read-only/classify/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

namespace  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.

                                                   {
  GenericVector<INT_FEATURE_STRUCT> bl_features;
  GenericVector<INT_FEATURE_STRUCT> cn_features;
  tesseract::Classify::ExtractFeatures(blob, nonlinear_norm,
                                       &bl_features, &cn_features, results,
                                       NULL);
  if (bl_features.size() == 0 || cn_features.size() == 0 ||
      bl_features.size() > MAX_NUM_INT_FEATURES ||
      cn_features.size() > MAX_NUM_INT_FEATURES) {
    return false;  // Feature extraction failed.
  }
  memcpy(baseline_features, &bl_features[0],
         bl_features.size() * sizeof(bl_features[0]));
  memcpy(charnorm_features, &cn_features[0],
         cn_features.size() * sizeof(cn_features[0]));
  return true;
}

Definition at line 70 of file intfx.cpp.

                                     {
  return FCOORD(cos_table[theta], sin_table[theta]);
}
void InitIntegerFX ( )

---------------------------------------------------------------------------- Public Function Prototypes ----------------------------------------------------------------------------

---------------------------------------------------------------------------- Public Code ----------------------------------------------------------------------------

Definition at line 55 of file intfx.cpp.

                     {
  static bool atan_table_init = false;
  atan_table_mutex.Lock();
  if (!atan_table_init) {
    for (int i = 0; i < INT_CHAR_NORM_RANGE; ++i) {
      cos_table[i] = cos(i * 2 * PI / INT_CHAR_NORM_RANGE + PI);
      sin_table[i] = sin(i * 2 * PI / INT_CHAR_NORM_RANGE + PI);
    }
    atan_table_init = true;
  }
  atan_table_mutex.Unlock();
}

Variable Documentation

const double kStandardFeatureLength = 64.0 / 5

Definition at line 46 of file intfx.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines