00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00028 #ifndef CHARCUT_H
00029 #define CHARCUT_H
00030
00031 #include "pgedit.h"
00032 #include "notdll.h"
00033 #include "notdll.h"
00034 class ScrollView;
00035
00047 class PIXROW:public ELIST_LINK
00048 {
00049 public:
00050 inT16 row_offset;
00051 inT16 row_count;
00052 inT16 *min;
00053 inT16 *max;
00054
00055 PIXROW() {
00056 row_offset = 0;
00057 row_count = 0;
00058 min = NULL;
00059 max = NULL;
00060 }
00062 PIXROW(
00063 inT16 pos,
00064 inT16 count,
00065 PBLOB *blob);
00067 ~PIXROW () {
00068 if (min != NULL)
00069 free_mem(min);
00070 if (max != NULL)
00071 free_mem(max);
00072 max = NULL;
00073 }
00074
00079 void plot(ScrollView* fd) const;
00080
00085 TBOX bounding_box() const;
00086
00087 bool bad_box(int xsize, int ysize) const;
00088
00095 void contract(IMAGELINE *imlines,
00096 inT16 x_offset,
00097 inT16 foreground_colour);
00098
00105 BOOL8 extend(IMAGELINE *imlines,
00106 TBOX &imbox,
00107 PIXROW *prev,
00108 PIXROW *next,
00109 inT16 foreground_colour);
00110
00117 void char_clip_image(IMAGELINE *imlines,
00118 TBOX &im_box,
00119 ROW *row,
00120 IMAGE &clip_image,
00121 float &baseline_pos);
00122
00123 };
00124
00125 ELISTIZEH (PIXROW)
00126 extern INT_VAR_H (pix_word_margin, 3, "How far outside word BB to grow");
00127 extern BOOL_VAR_H (show_char_clipping, TRUE, "Show clip image window?");
00128 extern INT_VAR_H (net_image_width, 40, "NN input image width");
00129 extern INT_VAR_H (net_image_height, 36, "NN input image height");
00130 extern INT_VAR_H (net_image_x_height, 22, "NN input image x_height");
00131 void char_clip_word(WERD *word,
00132 IMAGE &bin_image,
00133 PIXROW_LIST *&pixrow_list,
00134 IMAGELINE *&imlines,
00135 TBOX &pix_box
00136 );
00138 IMAGELINE *generate_imlines(IMAGE &bin_image,
00139 TBOX &pix_box);
00140
00141 ScrollView* display_clip_image(WERD *word,
00142 IMAGE &bin_image,
00143 PIXROW_LIST *pixrow_list,
00144 TBOX &pix_box
00145 );
00146 void display_images(IMAGE &clip_image, IMAGE &scaled_image);
00147
00149 void plot_pixrows(PIXROW_LIST *pixrow_list,
00150 ScrollView* win);
00151 #endif