本文整理汇总了C++中TBOX::move_left_edge方法的典型用法代码示例。如果您正苦于以下问题:C++ TBOX::move_left_edge方法的具体用法?C++ TBOX::move_left_edge怎么用?C++ TBOX::move_left_edge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBOX
的用法示例。
在下文中一共展示了TBOX::move_left_edge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: char_clip_word
void char_clip_word( //
WERD *word, //word to be processed
IMAGE &bin_image, //whole image
PIXROW_LIST *&pixrow_list, //pixrows built
IMAGELINE *&imlines, //lines cut from image
TBOX &pix_box //box defining imlines
) {
TBOX word_box = word->bounding_box ();
PBLOB_LIST *blob_list;
PBLOB_IT blob_it;
PIXROW_IT pixrow_it;
inT16 pix_offset; //Y pos of pixrow[0]
inT16 row_height; //No of pix rows
inT16 imlines_x_offset;
PIXROW *prev;
PIXROW *next;
PIXROW *current;
BOOL8 changed; //still improving
BOOL8 just_changed; //still improving
inT16 iteration_count = 0;
inT16 foreground_colour;
if (word->flag (W_INVERSE))
foreground_colour = 1;
else
foreground_colour = 0;
/* Define region for max pixrow expansion */
pix_box = word_box;
pix_box.move_bottom_edge (-pix_word_margin);
pix_box.move_top_edge (pix_word_margin);
pix_box.move_left_edge (-pix_word_margin);
pix_box.move_right_edge (pix_word_margin);
pix_box -= TBOX (ICOORD (0, 0 + BUG_OFFSET),
ICOORD (bin_image.get_xsize (),
bin_image.get_ysize () - BUG_OFFSET));
/* Generate pixrows list */
pix_offset = pix_box.bottom ();
row_height = pix_box.height ();
blob_list = word->blob_list ();
blob_it.set_to_list (blob_list);
pixrow_list = new PIXROW_LIST;
pixrow_it.set_to_list (pixrow_list);
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list (); blob_it.forward ()) {
PIXROW *row = new PIXROW (pix_offset, row_height, blob_it.data ());
ASSERT_HOST (!row->
bad_box (bin_image.get_xsize (), bin_image.get_ysize ()));
pixrow_it.add_after_then_move (row);
}
imlines = generate_imlines (bin_image, pix_box);
/* Contract pixrows - shrink min and max back to black pixels */
imlines_x_offset = pix_box.left ();
pixrow_it.move_to_first ();
for (pixrow_it.mark_cycle_pt ();
!pixrow_it.cycled_list (); pixrow_it.forward ()) {
ASSERT_HOST (!pixrow_it.data ()->
bad_box (bin_image.get_xsize (), bin_image.get_ysize ()));
pixrow_it.data ()->contract (imlines, imlines_x_offset,
foreground_colour);
ASSERT_HOST (!pixrow_it.data ()->
bad_box (bin_image.get_xsize (), bin_image.get_ysize ()));
}
/* Expand pixrows iteratively 1 pixel at a time */
do {
changed = FALSE;
pixrow_it.move_to_first ();
prev = NULL;
current = NULL;
next = pixrow_it.data ();
for (pixrow_it.mark_cycle_pt ();
!pixrow_it.cycled_list (); pixrow_it.forward ()) {
prev = current;
current = next;
if (pixrow_it.at_last ())
next = NULL;
else
next = pixrow_it.data_relative (1);
just_changed = current->extend (imlines, pix_box, prev, next,
foreground_colour);
ASSERT_HOST (!current->
bad_box (bin_image.get_xsize (),
bin_image.get_ysize ()));
changed = changed || just_changed;
}
iteration_count++;
}
while (changed);
}