Tesseract  3.02
tesseract-ocr/classify/fxdefs.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002  **     Filename:    fxdefs.c
00003  **     Purpose:     Utility functions to be used by feature extractors.
00004  **     Author:      Dan Johnson
00005  **     History:     Sun Jan 21 15:29:02 1990, DSJ, Created.
00006  **
00007  **     (c) Copyright Hewlett-Packard Company, 1988.
00008  ** Licensed under the Apache License, Version 2.0 (the "License");
00009  ** you may not use this file except in compliance with the License.
00010  ** You may obtain a copy of the License at
00011  ** http://www.apache.org/licenses/LICENSE-2.0
00012  ** Unless required by applicable law or agreed to in writing, software
00013  ** distributed under the License is distributed on an "AS IS" BASIS,
00014  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  ** See the License for the specific language governing permissions and
00016  ** limitations under the License.
00017  ******************************************************************************/
00018 #include "fxdefs.h"
00019 #include "featdefs.h"
00020 #include "mf.h"
00021 #include "outfeat.h"
00022 #include "picofeat.h"
00023 #include "normfeat.h"
00024 
00025 /*-----------------------------------------------------------------------------
00026         Global Data Definitions and Declarations
00027 -----------------------------------------------------------------------------*/
00028 // Definitions of extractors separated from feature definitions.
00029 const FEATURE_EXT_STRUCT MicroFeatureExt = { ExtractMicros };
00030 const FEATURE_EXT_STRUCT CharNormExt = { ExtractCharNormFeatures };
00031 const FEATURE_EXT_STRUCT IntFeatExt = { ExtractIntCNFeatures };
00032 const FEATURE_EXT_STRUCT GeoFeatExt = { ExtractIntGeoFeatures };
00033 
00034 // MUST be kept in-sync with DescDefs in featdefs.cpp.
00035 const FEATURE_EXT_STRUCT* ExtractorDefs[NUM_FEATURE_TYPES] = {
00036   &MicroFeatureExt,
00037   &CharNormExt,
00038   &IntFeatExt,
00039   &GeoFeatExt
00040 };
00041 
00042 void SetupExtractors(FEATURE_DEFS_STRUCT *FeatureDefs) {
00043   for (int i = 0; i < NUM_FEATURE_TYPES; ++i)
00044     FeatureDefs->FeatureExtractors[i] = ExtractorDefs[i];
00045 }