mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-08 02:12:40 +08:00
doxygen classify/outfeat.cpp
This commit is contained in:
parent
6c511b9fa0
commit
f9b4080a56
@ -28,24 +28,24 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/**----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Public Code
|
Public Code
|
||||||
----------------------------------------------------------------------------**/
|
----------------------------------------------------------------------------*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
FEATURE_SET Classify::ExtractOutlineFeatures(TBLOB *Blob) {
|
/**
|
||||||
/*
|
* Convert each segment in the outline to a feature
|
||||||
** Parameters:
|
* and return the features.
|
||||||
** Blob blob to extract pico-features from
|
* @param Blob blob to extract pico-features from
|
||||||
** LineStats statistics on text row blob is in
|
* @param LineStats statistics on text row blob is in
|
||||||
** Globals: none
|
* @eturn Outline-features for Blob.
|
||||||
** Operation: Convert each segment in the outline to a feature
|
* @note Globals: none
|
||||||
** and return the features.
|
* @note Exceptions: none
|
||||||
** Return: Outline-features for Blob.
|
* @note History:
|
||||||
** Exceptions: none
|
* - 11/13/90, DSJ, Created.
|
||||||
** History: 11/13/90, DSJ, Created.
|
* - 05/24/91, DSJ, Updated for either char or baseline normalize.
|
||||||
** 05/24/91, DSJ, Updated for either char or baseline normalize.
|
|
||||||
*/
|
*/
|
||||||
|
FEATURE_SET Classify::ExtractOutlineFeatures(TBLOB *Blob) {
|
||||||
LIST Outlines;
|
LIST Outlines;
|
||||||
LIST RemainingOutlines;
|
LIST RemainingOutlines;
|
||||||
MFOUTLINE Outline;
|
MFOUTLINE Outline;
|
||||||
@ -71,30 +71,29 @@ FEATURE_SET Classify::ExtractOutlineFeatures(TBLOB *Blob) {
|
|||||||
} /* ExtractOutlineFeatures */
|
} /* ExtractOutlineFeatures */
|
||||||
} // namespace tesseract
|
} // namespace tesseract
|
||||||
|
|
||||||
/**----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Private Code
|
Private Code
|
||||||
----------------------------------------------------------------------------**/
|
----------------------------------------------------------------------------*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* This routine computes the midpoint between Start and
|
||||||
|
* End to obtain the x,y position of the outline-feature. It
|
||||||
|
* also computes the direction from Start to End as the
|
||||||
|
* direction of the outline-feature and the distance from
|
||||||
|
* Start to End as the length of the outline-feature.
|
||||||
|
* This feature is then
|
||||||
|
* inserted into the next feature slot in FeatureSet.
|
||||||
|
* @param Start starting point of outline-feature
|
||||||
|
* @param End ending point of outline-feature
|
||||||
|
* @param FeatureSet set to add outline-feature to
|
||||||
|
* @return none (results are placed in FeatureSet)
|
||||||
|
* @note Globals: none
|
||||||
|
* @note Exceptions: none
|
||||||
|
* @note History: 11/13/90, DSJ, Created.
|
||||||
|
*/
|
||||||
void AddOutlineFeatureToSet(FPOINT *Start,
|
void AddOutlineFeatureToSet(FPOINT *Start,
|
||||||
FPOINT *End,
|
FPOINT *End,
|
||||||
FEATURE_SET FeatureSet) {
|
FEATURE_SET FeatureSet) {
|
||||||
/*
|
|
||||||
** Parameters:
|
|
||||||
** Start starting point of outline-feature
|
|
||||||
** End ending point of outline-feature
|
|
||||||
** FeatureSet set to add outline-feature to
|
|
||||||
** Globals: none
|
|
||||||
** Operation: This routine computes the midpoint between Start and
|
|
||||||
** End to obtain the x,y position of the outline-feature. It
|
|
||||||
** also computes the direction from Start to End as the
|
|
||||||
** direction of the outline-feature and the distance from
|
|
||||||
** Start to End as the length of the outline-feature.
|
|
||||||
** This feature is then
|
|
||||||
** inserted into the next feature slot in FeatureSet.
|
|
||||||
** Return: none (results are placed in FeatureSet)
|
|
||||||
** Exceptions: none
|
|
||||||
** History: 11/13/90, DSJ, Created.
|
|
||||||
*/
|
|
||||||
FEATURE Feature;
|
FEATURE Feature;
|
||||||
|
|
||||||
Feature = NewFeature(&OutlineFeatDesc);
|
Feature = NewFeature(&OutlineFeatDesc);
|
||||||
@ -108,21 +107,20 @@ void AddOutlineFeatureToSet(FPOINT *Start,
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void ConvertToOutlineFeatures(MFOUTLINE Outline, FEATURE_SET FeatureSet) {
|
/**
|
||||||
/*
|
* This routine steps converts each section in the specified
|
||||||
** Parameters:
|
* outline to a feature described by its x,y position, length
|
||||||
** Outline outline to extract outline-features from
|
* and angle.
|
||||||
** FeatureSet set of features to add outline-features to
|
* @param Outline outline to extract outline-features from
|
||||||
** Globals: none
|
* @param FeatureSet set of features to add outline-features to
|
||||||
** Operation:
|
* @return none (results are returned in FeatureSet)
|
||||||
** This routine steps converts each section in the specified
|
* @note Globals: none
|
||||||
** outline to a feature described by its x,y position, length
|
* @note Exceptions: none
|
||||||
** and angle.
|
* @note History:
|
||||||
** Return: none (results are returned in FeatureSet)
|
* - 11/13/90, DSJ, Created.
|
||||||
** Exceptions: none
|
* - 5/24/91, DSJ, Added hidden edge capability.
|
||||||
** History: 11/13/90, DSJ, Created.
|
|
||||||
** 5/24/91, DSJ, Added hidden edge capability.
|
|
||||||
*/
|
*/
|
||||||
|
void ConvertToOutlineFeatures(MFOUTLINE Outline, FEATURE_SET FeatureSet) {
|
||||||
MFOUTLINE Next;
|
MFOUTLINE Next;
|
||||||
MFOUTLINE First;
|
MFOUTLINE First;
|
||||||
FPOINT FeatureStart;
|
FPOINT FeatureStart;
|
||||||
@ -152,19 +150,18 @@ void ConvertToOutlineFeatures(MFOUTLINE Outline, FEATURE_SET FeatureSet) {
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void NormalizeOutlineX(FEATURE_SET FeatureSet) {
|
/**
|
||||||
/*
|
* This routine computes the weighted average x position
|
||||||
** Parameters:
|
* over all of the outline-features in FeatureSet and then
|
||||||
** FeatureSet outline-features to be normalized
|
* renormalizes the outline-features to force this average
|
||||||
** Globals: none
|
* to be the x origin (i.e. x=0).
|
||||||
** Operation: This routine computes the weighted average x position
|
* @param FeatureSet outline-features to be normalized
|
||||||
** over all of the outline-features in FeatureSet and then
|
* @eturn none (FeatureSet is changed)
|
||||||
** renormalizes the outline-features to force this average
|
* @note Globals: none
|
||||||
** to be the x origin (i.e. x=0).
|
* @note Exceptions: none
|
||||||
** Return: none (FeatureSet is changed)
|
* @note History: 11/13/90, DSJ, Created.
|
||||||
** Exceptions: none
|
|
||||||
** History: 11/13/90, DSJ, Created.
|
|
||||||
*/
|
*/
|
||||||
|
void NormalizeOutlineX(FEATURE_SET FeatureSet) {
|
||||||
int i;
|
int i;
|
||||||
FEATURE Feature;
|
FEATURE Feature;
|
||||||
FLOAT32 Length;
|
FLOAT32 Length;
|
||||||
|
Loading…
Reference in New Issue
Block a user