Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions | Variables
edgloop.h File Reference
`#include "scrollview.h"`
`#include "params.h"`
`#include "img.h"`
`#include "pdblock.h"`
`#include "coutln.h"`
`#include "crakedge.h"`

Go to the source code of this file.

## Macros
#define | BUCKETSIZE 16

## Functions
void | complete_edge (CRACKEDGE *start, C_OUTLINE_IT *outline_it)
ScrollView::Color | check_path_legal (CRACKEDGE *start)
inT16 | loop_bounding_box (CRACKEDGE *&start, ICOORD &botleft, ICOORD &topright)

## Variables
double | edges_threshold_greyfraction = 0.07
bool | edges_show_paths = FALSE
bool | edges_show_needles = FALSE
int | edges_children_per_grandchild = 10
int | edges_children_count_limit = 45
int | edges_maxedgelength = 16000
double | edges_childarea = 0.5
double | edges_boxarea = 0.8

## Macro Definition Documentation

#define BUCKETSIZE 16

Definition at line 30 of file edgloop.h.

## Function Documentation

ScrollView::Color check_path_legal | ( | CRACKEDGE * | start | ) |

Definition at line 70 of file edgloop.cpp.

{
int lastchain; //last chain code
int chaindiff; //chain code diff
inT32 length; //length of loop
inT32 chainsum; //sum of chain diffs
CRACKEDGE *edgept; //current point
const ERRCODE ED_ILLEGAL_SUM = "Illegal sum of chain codes";
length = 0;
chainsum = 0; //sum of chain codes
edgept = start;
lastchain = edgept->prev->stepdir; //previous chain code
do {
length++;
if (edgept->stepdir != lastchain) {
//chain code difference
chaindiff = edgept->stepdir - lastchain;
if (chaindiff > 2)
chaindiff -= 4;
else if (chaindiff < -2)
chaindiff += 4;
chainsum += chaindiff; //sum differences
lastchain = edgept->stepdir;
}
edgept = edgept->next;
}
while (edgept != start && length < edges_maxedgelength);
if ((chainsum != 4 && chainsum != -4)
|| edgept != start || length < MINEDGELENGTH) {
if (edgept != start) {
return ScrollView::YELLOW;
} else if (length < MINEDGELENGTH) {
return ScrollView::MAGENTA;
} else {
ED_ILLEGAL_SUM.error ("check_path_legal", TESSLOG, "chainsum=%d",
chainsum);
return ScrollView::GREEN;
}
}
//colour on inside
return chainsum < 0 ? ScrollView::BLUE : ScrollView::RED;
}

void complete_edge | ( | CRACKEDGE * | start,
|  | C_OUTLINE_IT * | outline_it
| ) |  |

Definition at line 40 of file edgloop.cpp.

{
ScrollView::Color colour; //colour to draw in
inT16 looplength; //steps in loop
ICOORD botleft; //bounding box
ICOORD topright;
C_OUTLINE *outline; //new outline
//check length etc.
colour = check_path_legal (start);
if (colour == ScrollView::RED || colour == ScrollView::BLUE) {
looplength = loop_bounding_box (start, botleft, topright);
outline = new C_OUTLINE (start, botleft, topright, looplength);
//add to list
outline_it->add_after_then_move (outline);
}
}

inT16 loop_bounding_box | ( | CRACKEDGE *& | start,
|  | ICOORD & | botleft,
|  | ICOORD & | topright
| ) |  |

Definition at line 122 of file edgloop.cpp.

{
inT16 length; //length of loop
inT16 leftmost; //on top row
CRACKEDGE *edgept; //current point
CRACKEDGE *realstart; //topleft start
edgept = start;
realstart = start;
botleft = topright = ICOORD (edgept->pos.x (), edgept->pos.y ());
leftmost = edgept->pos.x ();
length = 0; //coutn length
do {
edgept = edgept->next;
if (edgept->pos.x () < botleft.x ())
//get bounding box
botleft.set_x (edgept->pos.x ());
else if (edgept->pos.x () > topright.x ())
topright.set_x (edgept->pos.x ());
if (edgept->pos.y () < botleft.y ())
//get bounding box
botleft.set_y (edgept->pos.y ());
else if (edgept->pos.y () > topright.y ()) {
realstart = edgept;
leftmost = edgept->pos.x ();
topright.set_y (edgept->pos.y ());
}
else if (edgept->pos.y () == topright.y ()
&& edgept->pos.x () < leftmost) {
//leftmost on line
leftmost = edgept->pos.x ();
realstart = edgept;
}
length++; //count elements
}
while (edgept != start);
start = realstart; //shift it to topleft
return length;
}

## Variable Documentation

double edges_boxarea = 0.8

"Min area fraction of grandchild for box"

Definition at line 61 of file edgblob.cpp.

double edges_childarea = 0.5

"Max area fraction of child outline"

"Min area fraction of child outline"

Definition at line 59 of file edgblob.cpp.

int edges_children_count_limit = 45

"Max holes allowed in blob"

Definition at line 51 of file edgblob.cpp.

int edges_children_per_grandchild = 10

"Importance ratio for chucking outlines"

Definition at line 49 of file edgblob.cpp.

int edges_maxedgelength = 16000

"Max steps in any outline"

Definition at line 32 of file edgloop.cpp.

bool edges_show_needles = FALSE

"Draw edge needles"

bool edges_show_paths = FALSE

"Draw raw outlines"

double edges_threshold_greyfraction = 0.07

"Min edge diff for grad vector"