00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef EDGBLOB_H
00021 #define EDGBLOB_H
00022
00023 #include "scrollview.h"
00024 #include "params.h"
00025 #include "img.h"
00026 #include "ocrblock.h"
00027 #include "coutln.h"
00028 #include "crakedge.h"
00029 #include "notdll.h"
00030
00031 #define BUCKETSIZE 16
00032
00033 class OL_BUCKETS
00034 {
00035 public:
00036 OL_BUCKETS(
00037 ICOORD bleft,
00038 ICOORD tright);
00039
00040 ~OL_BUCKETS () {
00041 delete[]buckets;
00042 }
00043 C_OUTLINE_LIST *operator () (
00044 inT16 x,
00045 inT16 y);
00046
00047 C_OUTLINE_LIST *start_scan() {
00048 for (index = 0; buckets[index].empty () && index < bxdim * bydim - 1;
00049 index++);
00050 return &buckets[index];
00051 }
00052
00053 C_OUTLINE_LIST *scan_next() {
00054 for (; buckets[index].empty () && index < bxdim * bydim - 1; index++);
00055 return &buckets[index];
00056 }
00057 inT32 count_children(
00058 C_OUTLINE *outline,
00059 inT32 max_count);
00060 inT32 outline_complexity(
00061 C_OUTLINE *outline,
00062 inT32 max_count,
00063 inT16 depth);
00064 void extract_children(
00065 C_OUTLINE *outline,
00066 C_OUTLINE_IT *it);
00067
00068 private:
00069 C_OUTLINE_LIST * buckets;
00070 inT16 bxdim;
00071 inT16 bydim;
00072 ICOORD bl;
00073 ICOORD tr;
00074 inT32 index;
00075 };
00076
00077 void extract_edges(Pix* pix,
00078 BLOCK* block);
00079 void outlines_to_blobs(
00080 BLOCK *block,
00081 ICOORD bleft,
00082 ICOORD tright,
00083 C_OUTLINE_LIST *outlines);
00084 void fill_buckets(
00085 C_OUTLINE_LIST *outlines,
00086 OL_BUCKETS *buckets
00087 );
00088 void empty_buckets(
00089 BLOCK *block,
00090 OL_BUCKETS *buckets
00091 );
00092 BOOL8 capture_children(
00093 OL_BUCKETS *buckets,
00094 C_BLOB_IT *reject_it,
00095 C_OUTLINE_IT *blob_it
00096 );
00097 #endif