#include "blobs.h"
#include <cstdio>
Go to the source code of this file.
◆ DefineFeature
#define DefineFeature |
( |
|
Name, |
|
|
|
NL, |
|
|
|
NC, |
|
|
|
SN, |
|
|
|
PN |
|
) |
| const FEATURE_DESC_STRUCT Name = {((NL) + (NC)), SN, PN}; |
◆ DefineParam
#define DefineParam |
( |
|
Circular, |
|
|
|
NonEssential, |
|
|
|
Min, |
|
|
|
Max |
|
) |
| |
Value:{Circular, \
NonEssential, \
Min, \
Max, \
(Max) - (Min), \
(((Max) - (Min)) / 2.0), \
(((Max) + (Min)) / 2.0)},
Definition at line 81 of file ocrfeatures.h.
◆ EndParamDesc
◆ FEAT_NAME_SIZE
#define FEAT_NAME_SIZE 80 |
◆ StartParamDesc
#define StartParamDesc |
( |
|
Name | ) |
const PARAM_DESC Name[] = { |
◆ CHAR_FEATURES
◆ FEATURE
◆ FEATURE_DESC
◆ FEATURE_SET
◆ AddFeature()
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.
- Parameters
-
FeatureSet | set of features to add Feature to |
Feature | feature to be added to FeatureSet |
- Returns
- true if feature added to set, false if set is already full.
Definition at line 39 of file ocrfeatures.cpp.
◆ FreeFeature()
void FreeFeature |
( |
FEATURE |
Feature | ) |
|
Release the memory consumed by the specified feature.
- Parameters
-
Feature | feature to be deallocated. |
Definition at line 53 of file ocrfeatures.cpp.
◆ FreeFeatureSet()
Release the memory consumed by the specified feature set. This routine also frees the memory consumed by the features contained in the set.
- Parameters
-
FeatureSet | set of features to be freed |
Definition at line 61 of file ocrfeatures.cpp.
◆ NewFeature()
Allocate and return a new feature of the specified type.
- Parameters
-
FeatureDesc | description of feature to be created. |
- Returns
- New FEATURE.
Definition at line 77 of file ocrfeatures.cpp.
82 (FeatureDesc->
NumParams - 1) *
sizeof(
float)));
83 Feature->
Type = FeatureDesc;
◆ NewFeatureSet()
Allocate and return a new feature set large enough to hold the specified number of features.
- Parameters
-
NumFeatures | maximum # of features to be put in feature set |
- Returns
- New FEATURE_SET.
Definition at line 93 of file ocrfeatures.cpp.
98 (NumFeatures - 1) *
sizeof (
FEATURE)));
◆ ReadFeatureSet()
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.
- Parameters
-
File | open text file to read new feature set from |
FeatureDesc | specifies type of feature to read from File |
- Returns
- New feature set read from File.
Definition at line 139 of file ocrfeatures.cpp.
146 for (
int i = 0; i < NumFeatures; i++)
147 AddFeature(FeatureSet, ReadFeature(File, FeatureDesc));
◆ WriteFeatureSet()
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.
- Parameters
-
FeatureSet | feature set to write to File |
str | string to write Feature to |
Definition at line 179 of file ocrfeatures.cpp.
184 for (
int i = 0; i < FeatureSet->
NumFeatures; i++) {
185 WriteFeature(FeatureSet->
Features[i], str);