tesseract
3.05.02
|
#include "ocrfeatures.h"
#include "emalloc.h"
#include "callcpp.h"
#include "danerror.h"
#include "freelist.h"
#include "scanutils.h"
#include <assert.h>
#include <math.h>
Go to the source code of this file.
Functions | |
BOOL8 | AddFeature (FEATURE_SET FeatureSet, FEATURE Feature) |
void | FreeFeature (FEATURE Feature) |
void | FreeFeatureSet (FEATURE_SET FeatureSet) |
FEATURE | NewFeature (const FEATURE_DESC_STRUCT *FeatureDesc) |
FEATURE_SET | NewFeatureSet (int NumFeatures) |
FEATURE | ReadFeature (FILE *File, const FEATURE_DESC_STRUCT *FeatureDesc) |
FEATURE_SET | ReadFeatureSet (FILE *File, const FEATURE_DESC_STRUCT *FeatureDesc) |
void | WriteFeature (FEATURE Feature, STRING *str) |
void | WriteFeatureSet (FEATURE_SET FeatureSet, STRING *str) |
void | WriteOldParamDesc (FILE *File, const FEATURE_DESC_STRUCT *FeatureDesc) |
BOOL8 AddFeature | ( | FEATURE_SET | FeatureSet, |
FEATURE | Feature | ||
) |
Add a feature to a feature set. If the feature set is already full, FALSE is returned to indicate that the feature could not be added to the set; otherwise, TRUE is returned.
FeatureSet | set of features to add Feature to |
Feature | feature to be added to FeatureSet |
Definition at line 44 of file ocrfeatures.cpp.
void FreeFeature | ( | FEATURE | Feature | ) |
Release the memory consumed by the specified feature.
Feature | feature to be deallocated. |
Definition at line 60 of file ocrfeatures.cpp.
void FreeFeatureSet | ( | FEATURE_SET | FeatureSet | ) |
Release the memory consumed by the specified feature set. This routine also frees the memory consumed by the features contained in the set.
FeatureSet | set of features to be freed |
Definition at line 77 of file ocrfeatures.cpp.
FEATURE NewFeature | ( | const FEATURE_DESC_STRUCT * | FeatureDesc | ) |
Allocate and return a new feature of the specified type.
FeatureDesc | description of feature to be created. |
Definition at line 94 of file ocrfeatures.cpp.
FEATURE_SET NewFeatureSet | ( | int | NumFeatures | ) |
Allocate and return a new feature set large enough to hold the specified number of features.
NumFeatures | maximum # of features to be put in feature set |
Definition at line 113 of file ocrfeatures.cpp.
FEATURE ReadFeature | ( | FILE * | File, |
const FEATURE_DESC_STRUCT * | FeatureDesc | ||
) |
Create a new feature of the specified type and read in the value of its parameters from File. The extra penalty for the feature is also computed by calling the appropriate function for the specified feature type. The correct text representation for a feature is a list of N floats where N is the number of parameters in the feature.
File | open text file to read feature from |
FeatureDesc | specifies type of feature to read from File |
Definition at line 138 of file ocrfeatures.cpp.
FEATURE_SET ReadFeatureSet | ( | FILE * | File, |
const FEATURE_DESC_STRUCT * | FeatureDesc | ||
) |
Create a new feature set of the specified type and read in the features from File. The correct text representation for a feature set is an integer which specifies the number (N) of features in a set followed by a list of N feature descriptions.
File | open text file to read new feature set from |
FeatureDesc | specifies type of feature to read from File |
Definition at line 164 of file ocrfeatures.cpp.
Appends a textual representation of Feature to str. This representation is simply a list of the N parameters of the feature, terminated with a newline. It is assumed that the ExtraPenalty field can be reconstructed from the parameters of the feature. It is also assumed that the feature type information is specified or assumed elsewhere.
Feature | feature to write out to str |
str | string to write Feature to |
Definition at line 191 of file ocrfeatures.cpp.
void WriteFeatureSet | ( | FEATURE_SET | FeatureSet, |
STRING * | str | ||
) |
Write a textual representation of FeatureSet to File. This representation is an integer specifying the number of features in the set, followed by a newline, followed by text representations for each feature in the set.
FeatureSet | feature set to write to File |
str | string to write Feature to |
Definition at line 211 of file ocrfeatures.cpp.
void WriteOldParamDesc | ( | FILE * | File, |
const FEATURE_DESC_STRUCT * | FeatureDesc | ||
) |
Write a textual representation of FeatureDesc to File in the old format (i.e. the format used by the clusterer).
This format is:
* Number of Params * Description of Param 1 * ... *
File | open text file to write FeatureDesc to |
FeatureDesc | feature descriptor to write to File |
Definition at line 236 of file ocrfeatures.cpp.