textord/edgblob.h

Go to the documentation of this file.
00001 
00019 #ifndef           EDGBLOB_H
00020 #define           EDGBLOB_H
00021 
00022 #include          "grphics.h"
00023 #include          "varable.h"
00024 #include          "img.h"
00025 #include          "ocrblock.h"
00026 #include          "coutln.h"
00027 #include          "crakedge.h"
00028 #include          "notdll.h"
00029 
00031 #define BUCKETSIZE      16
00032 
00039 class OL_BUCKETS
00040 {
00041   public:
00042     OL_BUCKETS(               //constructor
00043                ICOORD bleft,  //corners
00044                ICOORD tright);
00045 
00046     ~OL_BUCKETS () {             //cleanup
00047       delete[]buckets;
00048     }
00049     C_OUTLINE_LIST *operator () (//array access
00050       INT16 x,                   //image coords
00051       INT16 y);
00052                                  //first non-empty bucket
00053     C_OUTLINE_LIST *start_scan() { 
00054       for (index = 0; buckets[index].empty () && index < bxdim * bydim - 1;
00055         index++);
00056       return &buckets[index];
00057     }
00058                                  //next non-empty bucket
00059     C_OUTLINE_LIST *scan_next() { 
00060       for (; buckets[index].empty () && index < bxdim * bydim - 1; index++);
00061       return &buckets[index];
00062     }
00063     INT32 count_children(                     //recursive sum
00064                          C_OUTLINE *outline,  //parent outline
00065                          INT32 max_count);    //max output
00066     void extract_children(                     //single level get
00067                           C_OUTLINE *outline,  //parent outline
00068                           C_OUTLINE_IT *it);   //destination iterator
00069 
00070   private:
00071     C_OUTLINE_LIST * buckets;    //array of buckets
00072     INT16 bxdim;                 //size of array
00073     INT16 bydim;
00074     ICOORD bl;                   //corners
00075     ICOORD tr;
00076     INT32 index;                 //for extraction scan
00077 };
00078 
00079 void extract_edges(                 //find blobs
00080 #ifndef GRAPHICS_DISABLED
00081                    WINDOW window,   //window for output
00082 #endif
00083                    IMAGE *image,    //image to scan
00084                    IMAGE *t_image,  //thresholded image
00085                    ICOORD page_tr,  //corner of page
00086                    BLOCK *block     //block to scan
00087                   );
00088 void outlines_to_blobs(               //find blobs
00089                        BLOCK *block,  //block to scan
00090                        ICOORD bleft,  //block box //outlines in block
00091                        ICOORD tright,
00092                        C_OUTLINE_LIST *outlines);
00093 void fill_buckets(                           //find blobs
00094                   C_OUTLINE_LIST *outlines,  //outlines in block
00095                   OL_BUCKETS *buckets        //output buckets
00096                  );
00097 void empty_buckets(                     //find blobs
00098                    BLOCK *block,        //block to scan
00099                    OL_BUCKETS *buckets  //output buckets
00100                   );
00101 BOOL8 capture_children(                       //find children
00102                        OL_BUCKETS *buckets,   //bucket sort clanss
00103                        C_BLOB_IT *reject_it,  //dead grandchildren
00104                        C_OUTLINE_IT *blob_it  //output outlines
00105                       );
00106 #endif

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