mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-08 02:12:40 +08:00
doxygen classify/picofeat.cpp
This commit is contained in:
parent
f9b4080a56
commit
aa1df05321
@ -15,9 +15,9 @@
|
|||||||
** See the License for the specific language governing permissions and
|
** See the License for the specific language governing permissions and
|
||||||
** limitations under the License.
|
** limitations under the License.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
/**----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Include Files and Type Defines
|
Include Files and Type Defines
|
||||||
----------------------------------------------------------------------------**/
|
----------------------------------------------------------------------------*/
|
||||||
#include "picofeat.h"
|
#include "picofeat.h"
|
||||||
|
|
||||||
#include "classify.h"
|
#include "classify.h"
|
||||||
@ -49,23 +49,23 @@ void ConvertToPicoFeatures2(MFOUTLINE Outline, FEATURE_SET FeatureSet);
|
|||||||
|
|
||||||
void NormalizePicoX(FEATURE_SET FeatureSet);
|
void NormalizePicoX(FEATURE_SET FeatureSet);
|
||||||
|
|
||||||
/**----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Public Code
|
Public Code
|
||||||
----------------------------------------------------------------------------**/
|
----------------------------------------------------------------------------*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
FEATURE_SET Classify::ExtractPicoFeatures(TBLOB *Blob) {
|
/**
|
||||||
/*
|
* Operation: Dummy for now.
|
||||||
** Parameters:
|
*
|
||||||
** Blob blob to extract pico-features from
|
* Globals:
|
||||||
** LineStats statistics on text row blob is in
|
* - classify_norm_method normalization method currently specified
|
||||||
** Globals:
|
* @param Blob blob to extract pico-features from
|
||||||
** classify_norm_method normalization method currently specified
|
* @param LineStats statistics on text row blob is in
|
||||||
** Operation: Dummy for now.
|
* @eturn Pico-features for Blob.
|
||||||
** Return: Pico-features for Blob.
|
* @note Exceptions: none
|
||||||
** Exceptions: none
|
* @notw History: 9/4/90, DSJ, Created.
|
||||||
** History: 9/4/90, DSJ, Created.
|
|
||||||
*/
|
*/
|
||||||
|
FEATURE_SET Classify::ExtractPicoFeatures(TBLOB *Blob) {
|
||||||
LIST Outlines;
|
LIST Outlines;
|
||||||
LIST RemainingOutlines;
|
LIST RemainingOutlines;
|
||||||
MFOUTLINE Outline;
|
MFOUTLINE Outline;
|
||||||
@ -88,29 +88,28 @@ FEATURE_SET Classify::ExtractPicoFeatures(TBLOB *Blob) {
|
|||||||
} /* ExtractPicoFeatures */
|
} /* ExtractPicoFeatures */
|
||||||
} // namespace tesseract
|
} // namespace tesseract
|
||||||
|
|
||||||
/**----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Private Code
|
Private Code
|
||||||
----------------------------------------------------------------------------**/
|
----------------------------------------------------------------------------*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* This routine converts an entire segment of an outline
|
||||||
|
* into a set of pico features which are added to
|
||||||
|
* FeatureSet. The length of the segment is rounded to the
|
||||||
|
* nearest whole number of pico-features. The pico-features
|
||||||
|
* are spaced evenly over the entire segment.
|
||||||
|
* Globals:
|
||||||
|
* - classify_pico_feature_length length of a single pico-feature
|
||||||
|
* @param Start starting point of pico-feature
|
||||||
|
* @param End ending point of pico-feature
|
||||||
|
* @param FeatureSet set to add pico-feature to
|
||||||
|
* @return none (results are placed in FeatureSet)
|
||||||
|
* @note Exceptions: none
|
||||||
|
* @note History: Tue Apr 30 15:44:34 1991, DSJ, Created.
|
||||||
|
*/
|
||||||
void ConvertSegmentToPicoFeat(FPOINT *Start,
|
void ConvertSegmentToPicoFeat(FPOINT *Start,
|
||||||
FPOINT *End,
|
FPOINT *End,
|
||||||
FEATURE_SET FeatureSet) {
|
FEATURE_SET FeatureSet) {
|
||||||
/*
|
|
||||||
** Parameters:
|
|
||||||
** Start starting point of pico-feature
|
|
||||||
** End ending point of pico-feature
|
|
||||||
** FeatureSet set to add pico-feature to
|
|
||||||
** Globals:
|
|
||||||
** classify_pico_feature_length length of a single pico-feature
|
|
||||||
** Operation: This routine converts an entire segment of an outline
|
|
||||||
** into a set of pico features which are added to
|
|
||||||
** FeatureSet. The length of the segment is rounded to the
|
|
||||||
** nearest whole number of pico-features. The pico-features
|
|
||||||
** are spaced evenly over the entire segment.
|
|
||||||
** Return: none (results are placed in FeatureSet)
|
|
||||||
** Exceptions: none
|
|
||||||
** History: Tue Apr 30 15:44:34 1991, DSJ, Created.
|
|
||||||
*/
|
|
||||||
FEATURE Feature;
|
FEATURE Feature;
|
||||||
FLOAT32 Angle;
|
FLOAT32 Angle;
|
||||||
FLOAT32 Length;
|
FLOAT32 Length;
|
||||||
@ -148,23 +147,21 @@ void ConvertSegmentToPicoFeat(FPOINT *Start,
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void ConvertToPicoFeatures2(MFOUTLINE Outline, FEATURE_SET FeatureSet) {
|
/**
|
||||||
/*
|
* This routine steps thru the specified outline and cuts it
|
||||||
** Parameters:
|
* up into pieces of equal length. These pieces become the
|
||||||
** Outline outline to extract micro-features from
|
* desired pico-features. Each segment in the outline
|
||||||
** FeatureSet set of features to add pico-features to
|
* is converted into an integral number of pico-features.
|
||||||
** Globals:
|
*
|
||||||
** classify_pico_feature_length
|
* Globals:
|
||||||
** length of features to be extracted
|
* - classify_pico_feature_length length of features to be extracted
|
||||||
** Operation:
|
* @param Outline outline to extract micro-features from
|
||||||
** This routine steps thru the specified outline and cuts it
|
* @param FeatureSet set of features to add pico-features to
|
||||||
** up into pieces of equal length. These pieces become the
|
* @return none (results are returned in FeatureSet)
|
||||||
** desired pico-features. Each segment in the outline
|
* @note Exceptions: none
|
||||||
** is converted into an integral number of pico-features.
|
* @note History: 4/30/91, DSJ, Adapted from ConvertToPicoFeatures().
|
||||||
** Return: none (results are returned in FeatureSet)
|
|
||||||
** Exceptions: none
|
|
||||||
** History: 4/30/91, DSJ, Adapted from ConvertToPicoFeatures().
|
|
||||||
*/
|
*/
|
||||||
|
void ConvertToPicoFeatures2(MFOUTLINE Outline, FEATURE_SET FeatureSet) {
|
||||||
MFOUTLINE Next;
|
MFOUTLINE Next;
|
||||||
MFOUTLINE First;
|
MFOUTLINE First;
|
||||||
MFOUTLINE Current;
|
MFOUTLINE Current;
|
||||||
@ -194,19 +191,18 @@ void ConvertToPicoFeatures2(MFOUTLINE Outline, FEATURE_SET FeatureSet) {
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void NormalizePicoX(FEATURE_SET FeatureSet) {
|
/**
|
||||||
/*
|
* This routine computes the average x position over all
|
||||||
** Parameters:
|
* of the pico-features in FeatureSet and then renormalizes
|
||||||
** FeatureSet pico-features to be normalized
|
* the pico-features to force this average to be the x origin
|
||||||
** Globals: none
|
* (i.e. x=0).
|
||||||
** Operation: This routine computes the average x position over all
|
* @param FeatureSet pico-features to be normalized
|
||||||
** of the pico-features in FeatureSet and then renormalizes
|
* @return none (FeatureSet is changed)
|
||||||
** the pico-features to force this average to be the x origin
|
* @note Globals: none
|
||||||
** (i.e. x=0).
|
* @note Exceptions: none
|
||||||
** Return: none (FeatureSet is changed)
|
* @note History: Tue Sep 4 16:50:08 1990, DSJ, Created.
|
||||||
** Exceptions: none
|
|
||||||
** History: Tue Sep 4 16:50:08 1990, DSJ, Created.
|
|
||||||
*/
|
*/
|
||||||
|
void NormalizePicoX(FEATURE_SET FeatureSet) {
|
||||||
int i;
|
int i;
|
||||||
FEATURE Feature;
|
FEATURE Feature;
|
||||||
FLOAT32 Origin = 0.0;
|
FLOAT32 Origin = 0.0;
|
||||||
@ -225,16 +221,15 @@ void NormalizePicoX(FEATURE_SET FeatureSet) {
|
|||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @param blob blob to extract features from
|
||||||
|
* @param denorm normalization/denormalization parameters.
|
||||||
|
* @return Integer character-normalized features for blob.
|
||||||
|
* @note Exceptions: none
|
||||||
|
* @note History: 8/8/2011, rays, Created.
|
||||||
|
*/
|
||||||
FEATURE_SET Classify::ExtractIntCNFeatures(
|
FEATURE_SET Classify::ExtractIntCNFeatures(
|
||||||
const TBLOB& blob, const INT_FX_RESULT_STRUCT& fx_info) {
|
const TBLOB& blob, const INT_FX_RESULT_STRUCT& fx_info) {
|
||||||
/*
|
|
||||||
** Parameters:
|
|
||||||
** blob blob to extract features from
|
|
||||||
** denorm normalization/denormalization parameters.
|
|
||||||
** Return: Integer character-normalized features for blob.
|
|
||||||
** Exceptions: none
|
|
||||||
** History: 8/8/2011, rays, Created.
|
|
||||||
*/
|
|
||||||
INT_FX_RESULT_STRUCT local_fx_info(fx_info);
|
INT_FX_RESULT_STRUCT local_fx_info(fx_info);
|
||||||
GenericVector<INT_FEATURE_STRUCT> bl_features;
|
GenericVector<INT_FEATURE_STRUCT> bl_features;
|
||||||
tesseract::TrainingSample* sample = tesseract::BlobToTrainingSample(
|
tesseract::TrainingSample* sample = tesseract::BlobToTrainingSample(
|
||||||
@ -258,16 +253,15 @@ FEATURE_SET Classify::ExtractIntCNFeatures(
|
|||||||
} /* ExtractIntCNFeatures */
|
} /* ExtractIntCNFeatures */
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @param blob blob to extract features from
|
||||||
|
* @param denorm normalization/denormalization parameters.
|
||||||
|
* @return Geometric (top/bottom/width) features for blob.
|
||||||
|
* @note Exceptions: none
|
||||||
|
* @note History: 8/8/2011, rays, Created.
|
||||||
|
*/
|
||||||
FEATURE_SET Classify::ExtractIntGeoFeatures(
|
FEATURE_SET Classify::ExtractIntGeoFeatures(
|
||||||
const TBLOB& blob, const INT_FX_RESULT_STRUCT& fx_info) {
|
const TBLOB& blob, const INT_FX_RESULT_STRUCT& fx_info) {
|
||||||
/*
|
|
||||||
** Parameters:
|
|
||||||
** blob blob to extract features from
|
|
||||||
** denorm normalization/denormalization parameters.
|
|
||||||
** Return: Geometric (top/bottom/width) features for blob.
|
|
||||||
** Exceptions: none
|
|
||||||
** History: 8/8/2011, rays, Created.
|
|
||||||
*/
|
|
||||||
INT_FX_RESULT_STRUCT local_fx_info(fx_info);
|
INT_FX_RESULT_STRUCT local_fx_info(fx_info);
|
||||||
GenericVector<INT_FEATURE_STRUCT> bl_features;
|
GenericVector<INT_FEATURE_STRUCT> bl_features;
|
||||||
tesseract::TrainingSample* sample = tesseract::BlobToTrainingSample(
|
tesseract::TrainingSample* sample = tesseract::BlobToTrainingSample(
|
||||||
|
Loading…
Reference in New Issue
Block a user