#include "clusttool.h"
#include "emalloc.h"
#include "mfoutline.h"
#include "blobs.h"
#include "const.h"
#include "mfx.h"
#include "params.h"
#include "classify.h"
#include <math.h>
#include <stdio.h>
Go to the source code of this file.
|
LIST | ConvertBlob (TBLOB *blob) |
|
MFOUTLINE | ConvertOutline (TESSLINE *outline) |
|
LIST | ConvertOutlines (TESSLINE *outline, LIST mf_outlines, OUTLINETYPE outline_type) |
|
void | FindDirectionChanges (MFOUTLINE Outline, FLOAT32 MinSlope, FLOAT32 MaxSlope) |
|
void | FreeMFOutline (void *arg) |
|
void | FreeOutlines (LIST Outlines) |
|
void | MarkDirectionChanges (MFOUTLINE Outline) |
|
MFEDGEPT * | NewEdgePoint () |
|
MFOUTLINE | NextExtremity (MFOUTLINE EdgePoint) |
|
void | NormalizeOutline (MFOUTLINE Outline, FLOAT32 XOrigin) |
|
void | ChangeDirection (MFOUTLINE Start, MFOUTLINE End, DIRECTION Direction) |
|
void | CharNormalizeOutline (MFOUTLINE Outline, const DENORM &cn_denorm) |
|
void | ComputeDirection (MFEDGEPT *Start, MFEDGEPT *Finish, FLOAT32 MinSlope, FLOAT32 MaxSlope) |
|
MFOUTLINE | NextDirectionChange (MFOUTLINE EdgePoint) |
|
Private Code
Definition at line 338 of file mfoutline.cpp.
355 for (Current = Start; Current != End; Current =
NextPointAfter (Current))
356 PointAt (Current)->Direction = Direction;
358 PointAt (End)->PreviousDirection = Direction;
#define NextPointAfter(E)
Definition at line 364 of file mfoutline.cpp.
387 CurrentPoint =
PointAt(Current);
395 while (Current != First);
#define NextPointAfter(E)
void LocalNormTransform(const TPOINT &pt, TPOINT *transformed) const
Definition at line 401 of file mfoutline.cpp.
440 Start->
Slope = Delta.
y / Delta.
x;
443 if (Start->
Slope > MinSlope)
444 if (Start->
Slope < MaxSlope)
450 else if (Start->
Slope < -MinSlope)
451 if (Start->
Slope > -MaxSlope)
457 else if (Delta.
y > 0)
458 if (Start->
Slope < -MinSlope)
459 if (Start->
Slope > -MaxSlope)
465 else if (Start->
Slope > MinSlope)
466 if (Start->
Slope < MaxSlope)
DIRECTION PreviousDirection
Definition at line 39 of file mfoutline.cpp.
LIST ConvertOutlines(TESSLINE *outline, LIST mf_outlines, OUTLINETYPE outline_type)
Definition at line 49 of file mfoutline.cpp.
59 StartPoint = outline->
loop;
60 EdgePoint = StartPoint;
62 NextPoint = EdgePoint->
next;
65 if (EdgePoint->
pos.
x != NextPoint->
pos.
x ||
66 EdgePoint->
pos.
y != NextPoint->
pos.
y) {
72 MFOutline =
push(MFOutline, NewPoint);
74 EdgePoint = NextPoint;
75 }
while (EdgePoint != StartPoint);
77 if (MFOutline !=
NULL)
MFEDGEPT * NewEdgePoint()
LIST push(LIST list, void *element)
#define MakeOutlineCircular(O)
Definition at line 90 of file mfoutline.cpp.
95 while (outline !=
NULL) {
97 if (mf_outline !=
NULL)
98 mf_outlines =
push(mf_outlines, mf_outline);
99 outline = outline->
next;
MFOUTLINE ConvertOutline(TESSLINE *outline)
LIST push(LIST list, void *element)
Definition at line 105 of file mfoutline.cpp.
142 while (EdgePoint != Outline);
#define NextPointAfter(E)
#define DegenerateOutline(O)
void ComputeDirection(MFEDGEPT *Start, MFEDGEPT *Finish, FLOAT32 MinSlope, FLOAT32 MaxSlope)
void FreeMFOutline |
( |
void * |
arg | ) |
|
Definition at line 148 of file mfoutline.cpp.
166 while (Start !=
NULL) {
void free_struct(void *deadstruct, inT32, const char *)
#define set_rest(l, cell)
void FreeOutlines |
( |
LIST |
Outlines | ) |
|
Definition at line 175 of file mfoutline.cpp.
void destroy_nodes(LIST list, void_dest destructor)
void FreeMFOutline(void *arg)
void MarkDirectionChanges |
( |
MFOUTLINE |
Outline | ) |
|
Definition at line 191 of file mfoutline.cpp.
222 while (Last != First);
MFOUTLINE NextDirectionChange(MFOUTLINE EdgePoint)
#define DegenerateOutline(O)
Definition at line 229 of file mfoutline.cpp.
void * alloc_struct(inT32 count, const char *)
Definition at line 477 of file mfoutline.cpp.
493 InitialDirection =
PointAt (EdgePoint)->Direction;
499 }
while (
PointAt(EdgePoint)->Direction == InitialDirection &&
#define NextPointAfter(E)
Definition at line 235 of file mfoutline.cpp.
251 while (!
PointAt(EdgePoint)->ExtremityMark)
#define NextPointAfter(E)
Definition at line 260 of file mfoutline.cpp.
289 }
while (EdgePoint != Outline);
#define NextPointAfter(E)
const int kBlnBaselineOffset