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(
00043 ICOORD bleft,
00044 ICOORD tright);
00045
00046 ~OL_BUCKETS () {
00047 delete[]buckets;
00048 }
00049 C_OUTLINE_LIST *operator () (
00050 INT16 x,
00051 INT16 y);
00052
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
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(
00064 C_OUTLINE *outline,
00065 INT32 max_count);
00066 void extract_children(
00067 C_OUTLINE *outline,
00068 C_OUTLINE_IT *it);
00069
00070 private:
00071 C_OUTLINE_LIST * buckets;
00072 INT16 bxdim;
00073 INT16 bydim;
00074 ICOORD bl;
00075 ICOORD tr;
00076 INT32 index;
00077 };
00078
00079 void extract_edges(
00080 #ifndef GRAPHICS_DISABLED
00081 WINDOW window,
00082 #endif
00083 IMAGE *image,
00084 IMAGE *t_image,
00085 ICOORD page_tr,
00086 BLOCK *block
00087 );
00088 void outlines_to_blobs(
00089 BLOCK *block,
00090 ICOORD bleft,
00091 ICOORD tright,
00092 C_OUTLINE_LIST *outlines);
00093 void fill_buckets(
00094 C_OUTLINE_LIST *outlines,
00095 OL_BUCKETS *buckets
00096 );
00097 void empty_buckets(
00098 BLOCK *block,
00099 OL_BUCKETS *buckets
00100 );
00101 BOOL8 capture_children(
00102 OL_BUCKETS *buckets,
00103 C_BLOB_IT *reject_it,
00104 C_OUTLINE_IT *blob_it
00105 );
00106 #endif