tesseract
5.0.0-alpha-619-ge9db
|
#include "clusttool.h"
#include "mfoutline.h"
#include "blobs.h"
#include "mfx.h"
#include "params.h"
#include "classify.h"
#include <cmath>
#include <cstdio>
Go to the source code of this file.
Namespaces | |
tesseract | |
Functions | |
LIST | ConvertBlob (TBLOB *blob) |
MFOUTLINE | ConvertOutline (TESSLINE *outline) |
LIST | ConvertOutlines (TESSLINE *outline, LIST mf_outlines, OUTLINETYPE outline_type) |
void | FindDirectionChanges (MFOUTLINE Outline, float MinSlope, float MaxSlope) |
void | FreeMFOutline (void *arg) |
void | FreeOutlines (LIST Outlines) |
void | MarkDirectionChanges (MFOUTLINE Outline) |
MFEDGEPT * | NewEdgePoint () |
MFOUTLINE | NextExtremity (MFOUTLINE EdgePoint) |
void | NormalizeOutline (MFOUTLINE Outline, float XOrigin) |
void | ChangeDirection (MFOUTLINE Start, MFOUTLINE End, DIRECTION Direction) |
void | CharNormalizeOutline (MFOUTLINE Outline, const DENORM &cn_denorm) |
void | ComputeDirection (MFEDGEPT *Start, MFEDGEPT *Finish, float MinSlope, float MaxSlope) |
MFOUTLINE | NextDirectionChange (MFOUTLINE EdgePoint) |
Change the direction of every vector in the specified outline segment to Direction. The segment to be changed starts at Start and ends at End. Note that the previous direction of End must also be changed to reflect the change in direction of the point before it.
Start | defines start of segment of outline to be modified |
End | defines end of segment of outline to be modified |
Direction | new direction to assign to segment |
Definition at line 309 of file mfoutline.cpp.
This routine normalizes each point in Outline by translating it to the specified center and scaling it anisotropically according to the given scale factors.
Outline | outline to be character normalized |
cn_denorm |
Definition at line 326 of file mfoutline.cpp.
This routine computes the slope from Start to Finish and and then computes the approximate direction of the line segment from Start to Finish. The direction is quantized into 8 buckets: N, S, E, W, NE, NW, SE, SW Both the slope and the direction are then stored into the appropriate fields of the Start edge point. The direction is also stored into the PreviousDirection field of the Finish edge point.
Start | starting point to compute direction from |
Finish | finishing point to compute direction to |
MinSlope | slope below which lines are horizontal |
MaxSlope | slope above which lines are vertical |
Definition at line 363 of file mfoutline.cpp.
Convert a blob into a list of MFOUTLINEs (float-based microfeature format).
Definition at line 36 of file mfoutline.cpp.
Convert a TESSLINE into the float-based MFOUTLINE micro-feature format.
Definition at line 46 of file mfoutline.cpp.
LIST ConvertOutlines | ( | TESSLINE * | outline, |
LIST | mf_outlines, | ||
OUTLINETYPE | outline_type | ||
) |
Convert a tree of outlines to a list of MFOUTLINEs (lists of MFEDGEPTs).
outline | first outline to be converted |
mf_outlines | list to add converted outlines to |
outline_type | are the outlines outer or holes? |
Definition at line 88 of file mfoutline.cpp.
void FindDirectionChanges | ( | MFOUTLINE | Outline, |
float | MinSlope, | ||
float | MaxSlope | ||
) |
This routine searches through the specified outline, computes a slope for each vector in the outline, and marks each vector as having one of the following directions: N, S, E, W, NE, NW, SE, SW This information is then stored in the outline and the outline is returned.
Outline | micro-feature outline to analyze |
MinSlope | controls "snapping" of segments to horizontal |
MaxSlope | controls "snapping" of segments to vertical |
Definition at line 114 of file mfoutline.cpp.
void FreeMFOutline | ( | void * | arg | ) |
This routine deallocates all of the memory consumed by a micro-feature outline.
arg | micro-feature outline to be freed |
Definition at line 145 of file mfoutline.cpp.
void FreeOutlines | ( | LIST | Outlines | ) |
Release all memory consumed by the specified list of outlines.
Outlines | list of mf-outlines to be freed |
Definition at line 166 of file mfoutline.cpp.
void MarkDirectionChanges | ( | MFOUTLINE | Outline | ) |
This routine searches through the specified outline and finds the points at which the outline changes direction. These points are then marked as "extremities". This routine is used as an alternative to FindExtremities(). It forces the endpoints of the microfeatures to be at the direction changes rather than at the midpoint between direction changes.
Outline | micro-feature outline to analyze |
Definition at line 182 of file mfoutline.cpp.
MFEDGEPT* NewEdgePoint | ( | ) |
This routine returns the next point in the micro-feature outline that has a direction different than EdgePoint. The routine assumes that the outline being searched is not a degenerate outline (i.e. it must have 2 or more edge points).
EdgePoint | start search from this point |
Definition at line 434 of file mfoutline.cpp.
This routine returns the next point in the micro-feature outline that is an extremity. The search starts after EdgePoint. The routine assumes that the outline being searched is not a degenerate outline (i.e. it must have 2 or more edge points).
EdgePoint | start search from this point |
Definition at line 219 of file mfoutline.cpp.
void NormalizeOutline | ( | MFOUTLINE | Outline, |
float | XOrigin | ||
) |
This routine normalizes the coordinates of the specified outline so that the outline is deskewed down to the baseline, translated so that x=0 is at XOrigin, and scaled so that the height of a character cell from descender to ascender is 1. Of this height, 0.25 is for the descender, 0.25 for the ascender, and 0.5 for the x-height. The y coordinate of the baseline is 0.
Outline | outline to be normalized |
XOrigin | x-origin of text |
Definition at line 241 of file mfoutline.cpp.