Tesseract
3.02
|
00001 /****************************************************************************** 00002 ** Filename: intfx.h 00003 ** Purpose: Interface to high level integer feature extractor. 00004 ** Author: Robert Moss 00005 ** History: Tue May 21 15:51:57 MDT 1991, RWM, 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 #ifndef INTFX_H 00019 #define INTFX_H 00020 00024 #include "blobs.h" 00025 #include "intproto.h" 00026 #include "normalis.h" 00027 #include <math.h> 00028 00029 class DENORM; 00030 00031 namespace tesseract { 00032 class TrainingSample; 00033 } 00034 00035 struct INT_FX_RESULT_STRUCT { 00036 inT32 Length; // total length of all outlines 00037 inT16 Xmean, Ymean; // center of mass of all outlines 00038 inT16 Rx, Ry; // radius of gyration 00039 inT16 NumBL, NumCN; // number of features extracted 00040 inT16 Width; // Width of blob in BLN coords. 00041 uinT8 YBottom; // Bottom of blob in BLN coords. 00042 uinT8 YTop; // Top of blob in BLN coords. 00043 }; 00044 00048 void InitIntegerFX(); 00049 00050 // Returns a vector representing the direction of a feature with the given 00051 // theta direction in an INT_FEATURE_STRUCT. 00052 FCOORD FeatureDirection(uinT8 theta); 00053 00054 tesseract::TrainingSample* GetIntFeatures( 00055 tesseract::NormalizationMode mode, TBLOB *blob, 00056 const DENORM& denorm); 00057 00058 int ExtractIntFeat(TBLOB *Blob, 00059 const DENORM& denorm, 00060 INT_FEATURE_ARRAY BLFeat, 00061 INT_FEATURE_ARRAY CNFeat, 00062 INT_FX_RESULT_STRUCT* Results, 00063 inT32 *FeatureOutlineArray = 0); 00064 00065 uinT8 BinaryAnglePlusPi(inT32 Y, inT32 X); 00066 00067 int SaveFeature(INT_FEATURE_ARRAY FeatureArray, 00068 uinT16 FeatureNum, 00069 inT16 X, 00070 inT16 Y, 00071 uinT8 Theta); 00072 00073 uinT16 MySqrt(inT32 X, inT32 Y); 00074 00075 uinT8 MySqrt2(uinT16 N, uinT32 I, uinT8 *Exp); 00076 00077 void ClipRadius(uinT8 *RxInv, uinT8 *RxExp, uinT8 *RyInv, uinT8 *RyExp); 00078 #endif