ccstruct/genblob.cpp File Reference

#include "mfcpch.h"
#include "stepblob.h"
#include "polyblob.h"
#include "genblob.h"

Go to the source code of this file.

Functions


Function Documentation

int blob_comparator ( const void *  blob1p,
const void *  blob2p 
)

Sort blobs

Blob comparator used to sort a blob list so that blobs are in increasing order of left edge.

Definition at line 31 of file genblob.cpp.

References PBLOB::bounding_box(), and BOX::left().

Referenced by gblob_sort_list().

00034                      {
00035   PBLOB *blob1 = *(PBLOB **) blob1p;
00036   PBLOB *blob2 = *(PBLOB **) blob2p;
00037 
00038   return blob1->bounding_box ().left () - blob2->bounding_box ().left ();
00039 }

int c_blob_comparator ( const void *  blob1p,
const void *  blob2p 
)

Sort blobs

Blob comparator used to sort a blob list so that blobs are in increasing order of left edge.

Definition at line 48 of file genblob.cpp.

References C_BLOB::bounding_box(), and BOX::left().

Referenced by gblob_sort_list().

00051                        {
00052   C_BLOB *blob1 = *(C_BLOB **) blob1p;
00053   C_BLOB *blob2 = *(C_BLOB **) blob2p;
00054 
00055   return blob1->bounding_box ().left () - blob2->bounding_box ().left ();
00056 }

BOX gblob_bounding_box ( PBLOB blob,
BOOL8  polygonal 
)

Get bounding box

Return the bounding box of a generic blob.

Definition at line 64 of file genblob.cpp.

References PBLOB::bounding_box().

Referenced by find_row_of_box(), re_segment_word(), and resegment_box().

00067                         {
00068   if (polygonal)
00069     return blob->bounding_box ();
00070   else
00071     return ((C_BLOB *) blob)->bounding_box ();
00072 }

OUTLINE_LIST* gblob_out_list ( PBLOB blob,
BOOL8  polygonal 
)

Get outline list

Return the generic outline list of a generic blob.

Definition at line 103 of file genblob.cpp.

References PBLOB::out_list().

Referenced by find_row_of_box(), and resegment_box().

00106                               {
00107   if (polygonal)
00108     return blob->out_list ();
00109   else
00110     return (OUTLINE_LIST *) ((C_BLOB *) blob)->out_list ();
00111 }

void gblob_sort_list ( PBLOB_LIST *  blob_list,
BOOL8  polygonal 
)

Sort a gblob list

Sort a generic blob list into order of bounding box left edge

Definition at line 80 of file genblob.cpp.

References blob_comparator(), and c_blob_comparator().

Referenced by fix_sp_fp_word(), insert_rej_cblobs(), re_segment_word(), and resegment_box().

00083                       {
00084   PBLOB_IT b_it;
00085   C_BLOB_IT c_it;
00086 
00087   if (polygonal) {
00088     b_it.set_to_list (blob_list);
00089     b_it.sort (blob_comparator);
00090   }
00091   else {
00092     c_it.set_to_list ((C_BLOB_LIST *) blob_list);
00093     c_it.sort (c_blob_comparator);
00094   }
00095 }

BOX goutline_bounding_box ( OUTLINE outline,
BOOL8  polygonal 
)

Get bounding box

Return the bounding box of a generic outline.

Definition at line 119 of file genblob.cpp.

Referenced by find_row_of_box(), and resegment_box().

00122                            {
00123   if (polygonal)
00124     return outline->bounding_box ();
00125   else
00126     return ((C_OUTLINE *) outline)->bounding_box ();
00127 }


Generated on Wed Feb 28 19:49:16 2007 for Tesseract by  doxygen 1.5.1