mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-07 18:02:40 +08:00
partial doxygen classify/mfx.cpp
This commit is contained in:
parent
f85655b304
commit
4bbc7aa6d2
100
classify/mfx.cpp
100
classify/mfx.cpp
@ -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 "mfdefs.h"
|
#include "mfdefs.h"
|
||||||
#include "mfoutline.h"
|
#include "mfoutline.h"
|
||||||
#include "clusttool.h" //NEEDED
|
#include "clusttool.h" //NEEDED
|
||||||
@ -28,9 +28,9 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
/**----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Variables
|
Variables
|
||||||
----------------------------------------------------------------------------**/
|
----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* old numbers corresponded to 10.0 degrees and 80.0 degrees */
|
/* old numbers corresponded to 10.0 degrees and 80.0 degrees */
|
||||||
double_VAR(classify_min_slope, 0.414213562,
|
double_VAR(classify_min_slope, 0.414213562,
|
||||||
@ -38,9 +38,9 @@ double_VAR(classify_min_slope, 0.414213562,
|
|||||||
double_VAR(classify_max_slope, 2.414213562,
|
double_VAR(classify_max_slope, 2.414213562,
|
||||||
"Slope above which lines are called vertical");
|
"Slope above which lines are called vertical");
|
||||||
|
|
||||||
/**----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Macros
|
Macros
|
||||||
----------------------------------------------------------------------------**/
|
----------------------------------------------------------------------------*/
|
||||||
/* miscellaneous macros */
|
/* miscellaneous macros */
|
||||||
#define NormalizeAngle(A) ( (((A)<0)?((A)+2*PI):(A)) / (2*PI) )
|
#define NormalizeAngle(A) ( (((A)<0)?((A)+2*PI):(A)) / (2*PI) )
|
||||||
|
|
||||||
@ -54,25 +54,22 @@ MICROFEATURES ConvertToMicroFeatures(MFOUTLINE Outline,
|
|||||||
|
|
||||||
MICROFEATURE ExtractMicroFeature(MFOUTLINE Start, MFOUTLINE End);
|
MICROFEATURE ExtractMicroFeature(MFOUTLINE Start, MFOUTLINE End);
|
||||||
|
|
||||||
/**----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Public Code
|
Public Code
|
||||||
----------------------------------------------------------------------------**/
|
----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/**
|
||||||
MICROFEATURES BlobMicroFeatures(TBLOB* Blob, const DENORM& cn_denorm) {
|
* This routine extracts micro-features from the specified
|
||||||
/*
|
* blob and returns a list of the micro-features. All
|
||||||
** Parameters:
|
* micro-features are normalized according to the specified
|
||||||
** Blob blob to extract micro-features from
|
* line statistics.
|
||||||
** denorm control parameter to feature extractor
|
* @param Blob blob to extract micro-features from
|
||||||
** Operation:
|
* @param cn_denorm control parameter to feature extractor
|
||||||
** This routine extracts micro-features from the specified
|
* @return List of micro-features extracted from the blob.
|
||||||
** blob and returns a list of the micro-features. All
|
* @note Exceptions: none
|
||||||
** micro-features are normalized according to the specified
|
* @note History: 7/21/89, DSJ, Created.
|
||||||
** line statistics.
|
|
||||||
** Return: List of micro-features extracted from the blob.
|
|
||||||
** Exceptions: none
|
|
||||||
** History: 7/21/89, DSJ, Created.
|
|
||||||
*/
|
*/
|
||||||
|
MICROFEATURES BlobMicroFeatures(TBLOB* Blob, const DENORM& cn_denorm) {
|
||||||
MICROFEATURES MicroFeatures = NIL_LIST;
|
MICROFEATURES MicroFeatures = NIL_LIST;
|
||||||
LIST Outlines;
|
LIST Outlines;
|
||||||
LIST RemainingOutlines;
|
LIST RemainingOutlines;
|
||||||
@ -104,26 +101,23 @@ MICROFEATURES BlobMicroFeatures(TBLOB* Blob, const DENORM& cn_denorm) {
|
|||||||
Private Code
|
Private Code
|
||||||
---------------------------------------------------------------------------*/
|
---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/**
|
||||||
FLOAT32 ComputeOrientation(MFEDGEPT *Start, MFEDGEPT *End) {
|
* This routine computes the orientation parameter of the
|
||||||
/*
|
* specified micro-feature. The orientation is the angle of
|
||||||
** Parameters:
|
* the vector from Start to End. It is normalized to a number
|
||||||
** Start starting edge point of micro-feature
|
* between 0 and 1 where 0 corresponds to 0 degrees and 1
|
||||||
** End ending edge point of micro-feature
|
* corresponds to 360 degrees. The actual range is [0,1), i.e.
|
||||||
** Globals: none
|
* 1 is excluded from the range (since it is actual the
|
||||||
** Operation:
|
* same orientation as 0). This routine assumes that Start
|
||||||
** This routine computes the orientation parameter of the
|
* and End are not the same point.
|
||||||
** specified micro-feature. The orientation is the angle of
|
* @param Start starting edge point of micro-feature
|
||||||
** the vector from Start to End. It is normalized to a number
|
* @param End ending edge point of micro-feature
|
||||||
** between 0 and 1 where 0 corresponds to 0 degrees and 1
|
* @note Globals: none
|
||||||
** corresponds to 360 degrees. The actual range is [0,1), i.e.
|
* @return Orientation parameter for the specified micro-feature.
|
||||||
** 1 is excluded from the range (since it is actual the
|
* @note Exceptions: none
|
||||||
** same orientation as 0). This routine assumes that Start
|
* @note History: 7/27/89, DSJ, Created.
|
||||||
** and End are not the same point.
|
|
||||||
** Return: Orientation parameter for the specified micro-feature.
|
|
||||||
** Exceptions: none
|
|
||||||
** History: 7/27/89, DSJ, Created.
|
|
||||||
*/
|
*/
|
||||||
|
FLOAT32 ComputeOrientation(MFEDGEPT *Start, MFEDGEPT *End) {
|
||||||
FLOAT32 Orientation;
|
FLOAT32 Orientation;
|
||||||
|
|
||||||
Orientation = NormalizeAngle (AngleFrom (Start->Point, End->Point));
|
Orientation = NormalizeAngle (AngleFrom (Start->Point, End->Point));
|
||||||
@ -135,20 +129,17 @@ FLOAT32 ComputeOrientation(MFEDGEPT *Start, MFEDGEPT *End) {
|
|||||||
} /* ComputeOrientation */
|
} /* ComputeOrientation */
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/**
|
||||||
|
* Convert Outline to MicroFeatures
|
||||||
|
* @param Outline outline to extract micro-features from
|
||||||
|
* @param MicroFeatures list of micro-features to add to
|
||||||
|
* @return List of micro-features with new features added to front.
|
||||||
|
* @note Globals: none
|
||||||
|
* @note Exceptions: none
|
||||||
|
* @note History: 7/26/89, DSJ, Created.
|
||||||
|
*/
|
||||||
MICROFEATURES ConvertToMicroFeatures(MFOUTLINE Outline,
|
MICROFEATURES ConvertToMicroFeatures(MFOUTLINE Outline,
|
||||||
MICROFEATURES MicroFeatures) {
|
MICROFEATURES MicroFeatures) {
|
||||||
/*
|
|
||||||
** Parameters:
|
|
||||||
** Outline outline to extract micro-features from
|
|
||||||
** MicroFeatures list of micro-features to add to
|
|
||||||
** Globals: none
|
|
||||||
** Operation:
|
|
||||||
** This routine
|
|
||||||
** Return: List of micro-features with new features added to front.
|
|
||||||
** Exceptions: none
|
|
||||||
** History: 7/26/89, DSJ, Created.
|
|
||||||
*/
|
|
||||||
MFOUTLINE Current;
|
MFOUTLINE Current;
|
||||||
MFOUTLINE Last;
|
MFOUTLINE Last;
|
||||||
MFOUTLINE First;
|
MFOUTLINE First;
|
||||||
@ -174,8 +165,6 @@ MICROFEATURES ConvertToMicroFeatures(MFOUTLINE Outline,
|
|||||||
} /* ConvertToMicroFeatures */
|
} /* ConvertToMicroFeatures */
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
MICROFEATURE ExtractMicroFeature(MFOUTLINE Start, MFOUTLINE End) {
|
|
||||||
/*
|
/*
|
||||||
** Parameters:
|
** Parameters:
|
||||||
** Start starting point of micro-feature
|
** Start starting point of micro-feature
|
||||||
@ -194,6 +183,7 @@ MICROFEATURE ExtractMicroFeature(MFOUTLINE Start, MFOUTLINE End) {
|
|||||||
** History: 7/26/89, DSJ, Created.
|
** History: 7/26/89, DSJ, Created.
|
||||||
** 11/17/89, DSJ, Added handling for Start and End same point.
|
** 11/17/89, DSJ, Added handling for Start and End same point.
|
||||||
*/
|
*/
|
||||||
|
MICROFEATURE ExtractMicroFeature(MFOUTLINE Start, MFOUTLINE End) {
|
||||||
MICROFEATURE NewFeature;
|
MICROFEATURE NewFeature;
|
||||||
MFEDGEPT *P1, *P2;
|
MFEDGEPT *P1, *P2;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user