ccmain/charcut.h

Go to the documentation of this file.
00001 
00020 #ifndef           CHARCUT_H
00021 #define           CHARCUT_H
00022 
00023 #include          "pgedit.h"
00024 #include          "notdll.h"
00025 #include          "notdll.h"
00026 
00039 class PIXROW:public ELIST_LINK
00040 {
00041   public:
00042     INT16 row_offset;            // y coord of min[0]
00043     INT16 row_count;             // length of arrays
00044     INT16 *min;                  // array of min x
00045     INT16 *max;                  // array of max x
00046 
00047     PIXROW() {  //empty constructor
00048       row_offset = 0;
00049       row_count = 0;
00050       min = NULL;
00051       max = NULL;
00052     }
00053     PIXROW(  // specified size
00054            INT16 pos,
00055            INT16 count,
00056            PBLOB *blob);
00057 
00058     ~PIXROW () {                 //destructor
00059       if (min != NULL)
00060         free_mem(min); 
00061       if (max != NULL)
00062         free_mem(max); 
00063       max = NULL;
00064     }
00065 
00066     void plot(                   //use current settings
00067               WINDOW fd) const;  // where to paint
00068 
00069     BOX bounding_box() const;  // return bounding box
00070     bool bad_box(int xsize, int ysize) const; // return true if box exceeds image
00071 
00072     void contract(                           // force end on black
00073                   IMAGELINE *imlines,        // image array
00074                   INT16 x_offset,            // of pixels[0]
00075                   INT16 foreground_colour);  // 0 or 1
00076 
00077                                  // image array
00078     BOOL8 extend(IMAGELINE *imlines,
00079                  BOX &imbox,
00080                  PIXROW *prev,              // for prev blob
00081                  PIXROW *next,              // for next blob
00082                  INT16 foreground_colour);  // 0 or 1
00083 
00084                                  //box of imlines extnt
00085     void char_clip_image(IMAGELINE *imlines,
00086                          BOX &im_box,
00087                          ROW *row,              //row containing word
00088                          IMAGE &clip_image,     //unscaled char image
00089                          float &baseline_pos);  //baseline ht in image
00090 
00091 };
00092 
00095 ELISTIZEH (PIXROW)
00096 extern INT_VAR_H (pix_word_margin, 3, "How far outside word BB to grow");
00097 extern BOOL_VAR_H (show_char_clipping, TRUE, "Show clip image window?");
00098 extern INT_VAR_H (net_image_width, 40, "NN input image width");
00099 extern INT_VAR_H (net_image_height, 36, "NN input image height");
00100 extern INT_VAR_H (net_image_x_height, 22, "NN input image x_height");
00102 void char_clip_word(                            //
00103                     WERD *word,                 // word to be processed
00104                     IMAGE &bin_image,           // whole image
00105                     PIXROW_LIST *&pixrow_list,  // pixrows built
00106                     IMAGELINE *&imlines,        // lines cut from image
00107                     BOX &pix_box                // box defining imlines
00108                    );
00109 IMAGELINE *generate_imlines(                   // get some imagelines
00110                             IMAGE &bin_image,  // from here
00111                             BOX &pix_box);
00112                                  // word to be processed
00113 WINDOW display_clip_image(WERD *word,
00114                           IMAGE &bin_image,          // whole image
00115                           PIXROW_LIST *pixrow_list,  // pixrows built
00116                           BOX &pix_box               // box of subimage
00117                          );
00118 void display_images(IMAGE &clip_image, IMAGE &scaled_image); 
00119 void plot_pixrows(  // plot for all blobs
00120                   PIXROW_LIST *pixrow_list,
00121                   WINDOW win);
00122 #endif

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