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;
00043 INT16 row_count;
00044 INT16 *min;
00045 INT16 *max;
00046
00047 PIXROW() {
00048 row_offset = 0;
00049 row_count = 0;
00050 min = NULL;
00051 max = NULL;
00052 }
00053 PIXROW(
00054 INT16 pos,
00055 INT16 count,
00056 PBLOB *blob);
00057
00058 ~PIXROW () {
00059 if (min != NULL)
00060 free_mem(min);
00061 if (max != NULL)
00062 free_mem(max);
00063 max = NULL;
00064 }
00065
00066 void plot(
00067 WINDOW fd) const;
00068
00069 BOX bounding_box() const;
00070 bool bad_box(int xsize, int ysize) const;
00071
00072 void contract(
00073 IMAGELINE *imlines,
00074 INT16 x_offset,
00075 INT16 foreground_colour);
00076
00077
00078 BOOL8 extend(IMAGELINE *imlines,
00079 BOX &imbox,
00080 PIXROW *prev,
00081 PIXROW *next,
00082 INT16 foreground_colour);
00083
00084
00085 void char_clip_image(IMAGELINE *imlines,
00086 BOX &im_box,
00087 ROW *row,
00088 IMAGE &clip_image,
00089 float &baseline_pos);
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,
00104 IMAGE &bin_image,
00105 PIXROW_LIST *&pixrow_list,
00106 IMAGELINE *&imlines,
00107 BOX &pix_box
00108 );
00109 IMAGELINE *generate_imlines(
00110 IMAGE &bin_image,
00111 BOX &pix_box);
00112
00113 WINDOW display_clip_image(WERD *word,
00114 IMAGE &bin_image,
00115 PIXROW_LIST *pixrow_list,
00116 BOX &pix_box
00117 );
00118 void display_images(IMAGE &clip_image, IMAGE &scaled_image);
00119 void plot_pixrows(
00120 PIXROW_LIST *pixrow_list,
00121 WINDOW win);
00122 #endif