
* scribo/afp/components.hh, * scribo/estim/components_features.hh, * scribo/filter/objects_with_holes.hh, * scribo/filter/separators_in_borders.hh, * scribo/io/xml/load.hh, * scribo/postprocessing/fill_object_holes.hh, * scribo/preprocessing/deskew.hh, * scribo/primitive/extract/lines_h_thick_and_thin.hh, * scribo/primitive/extract/non_text.hh, * scribo/primitive/extract/separators_nonvisible.hh, * scribo/text/clean_inplace.hh, * scribo/text/extract_paragraphs_hdoc.hh, * scribo/text/merging.hh: Here. --- scribo/ChangeLog | 19 ++++++ scribo/scribo/afp/components.hh | 12 ---- scribo/scribo/estim/components_features.hh | 24 +------- scribo/scribo/filter/objects_with_holes.hh | 33 +--------- scribo/scribo/filter/separators_in_borders.hh | 14 ----- scribo/scribo/io/xml/load.hh | 15 +---- scribo/scribo/postprocessing/fill_object_holes.hh | 9 --- scribo/scribo/preprocessing/deskew.hh | 3 +- .../primitive/extract/lines_h_thick_and_thin.hh | 3 +- scribo/scribo/primitive/extract/non_text.hh | 4 -- .../primitive/extract/separators_nonvisible.hh | 65 +------------------- scribo/scribo/text/clean_inplace.hh | 15 +---- scribo/scribo/text/extract_paragraphs_hdoc.hh | 44 ------------- scribo/scribo/text/merging.hh | 53 +--------------- 14 files changed, 27 insertions(+), 286 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index ca61cc9..5e6a519 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,24 @@ 2013-08-27 Roland Levillain <roland@lrde.epita.fr> + Remove dead code in Scribo. + + * scribo/afp/components.hh, + * scribo/estim/components_features.hh, + * scribo/filter/objects_with_holes.hh, + * scribo/filter/separators_in_borders.hh, + * scribo/io/xml/load.hh, + * scribo/postprocessing/fill_object_holes.hh, + * scribo/preprocessing/deskew.hh, + * scribo/primitive/extract/lines_h_thick_and_thin.hh, + * scribo/primitive/extract/non_text.hh, + * scribo/primitive/extract/separators_nonvisible.hh, + * scribo/text/clean_inplace.hh, + * scribo/text/extract_paragraphs_hdoc.hh, + * scribo/text/merging.hh: + Here. + +2013-08-27 Roland Levillain <roland@lrde.epita.fr> + Display Scribo errors on std::cerr, not std::cout. * scribo/scribo/text/merging.hh, diff --git a/scribo/scribo/afp/components.hh b/scribo/scribo/afp/components.hh index e68a7c2..c457dc9 100644 --- a/scribo/scribo/afp/components.hh +++ b/scribo/scribo/afp/components.hh @@ -137,9 +137,6 @@ namespace mln V current_label = 0; int dp_border; -// util::timer time; -// time.start(); - // init { extension::adjust(input, nbh); @@ -148,10 +145,6 @@ namespace mln initialize(data, input); } -// float t = time; -// std::cout << "init = " << t << std::endl; -// time.restart(); - // 1st pass { util::array<int> dp = positive_offsets_wrt(input, nbh); @@ -181,9 +174,6 @@ namespace mln } } -// t = time; -// std::cout << "1st pass = " << t << std::endl; -// time.restart(); // 2nd pass { @@ -216,8 +206,6 @@ namespace mln label.element(p) = label.element(dta.parent); } } -// t = time; -// std::cout << "2nd pass = " << t << std::endl; nlabels = current_label; return label; diff --git a/scribo/scribo/estim/components_features.hh b/scribo/scribo/estim/components_features.hh index 06be1ce..04aeac8 100644 --- a/scribo/scribo/estim/components_features.hh +++ b/scribo/scribo/estim/components_features.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -98,8 +98,6 @@ namespace scribo L skel_lbl; mln_value(L) nlabels; - // util::timer t; - // t.start(); { int psi = 7; int vals[] = { 0, 9, 0, 9, 0, @@ -113,22 +111,9 @@ namespace scribo dist = transform::distance_front(logical::not_(bin_input), c8(), mln::make::w_window2d_int(vals), mln_max(value::int_u8)); - // t.stop(); - // std::cout << "Distance front " << t << std::endl; - // t.restart(); - dist_t dist_map = arith::revert(dist); - - // t.stop(); - // std::cout << "Revert " << t << std::endl; - // t.restart(); - B K = topo::skeleton::crest(bin_input, dist, c8(), psi); - // t.stop(); - // std::cout << "Crest " << t << std::endl; - // t.restart(); - typedef neighb<win::multiple_size<2u, window2d, pw::value_<J> > > nbh_t; @@ -139,10 +124,7 @@ namespace scribo topo::skeleton::is_simple_point<nbh_t>(nbh), K, dist_map); - // t.stop(); - // std::cout << "Skeleton constrained " << t << std::endl; } - // t.restart(); const L& lbl = output.labeled_image(); @@ -163,10 +145,6 @@ namespace scribo output(c).update_features(features); } - - // t.stop(); - // std::cout << "compute color and boldness " << t << std::endl; - return output; } diff --git a/scribo/scribo/filter/objects_with_holes.hh b/scribo/scribo/filter/objects_with_holes.hh index 22d045f..f915300 100644 --- a/scribo/scribo/filter/objects_with_holes.hh +++ b/scribo/scribo/filter/objects_with_holes.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Copyright (C) 2009, 2010, 2011, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -203,11 +203,6 @@ namespace scribo const L& lbl = components.labeled_image(); -// std::cout << "components.nlabels = " << components.nelements() << std::endl; - -// util::timer timer_; -// timer_.start(); - // init { extension::adjust_fill(lbl, nbh, mln_max(mln_value(L))); @@ -219,19 +214,12 @@ namespace scribo // FIXME: Improve. -// util::timer t2; -// t2.start(); bboxes_ima = internal::compute_bboxes_image(components); -// float t2_ = t2; -// std::cout << "compute bboxes image " << t2_ << std::endl; to_keep(0) = true; } -// float t_ = timer_; -// std::cout << "init = " << t_ << std::endl; // 1st pass -// timer_.restart(); { util::array<int> dp = positive_offsets_wrt(lbl, nbh); const unsigned n_nbhs = dp.nelements(); @@ -261,14 +249,11 @@ namespace scribo } // for_all(pxl) } -// t_ = timer_; -// std::cout << "1st pass = " << t_ << std::endl; // FIXME: Iterate over another label when a label is marked as // "to be kept". // 2nd pass -// timer_.restart(); { unsigned kept = 0; mln_fwd_pixter(const L) pxl(bboxes_ima); // Forward. @@ -313,16 +298,6 @@ namespace scribo // } } -// float t_ = timer_; -// std::cout << "2nd pass = " << t_ << std::endl; - -// std::cout << "kept = " << kept << std::endl; -// debug::println(parent); -// std::cout << bg_comps << std::endl; -// std::cout << to_keep << std::endl; - -// timer_.restart(); - if (kept == components.nelements()) { return components; @@ -330,8 +305,6 @@ namespace scribo component_set<L> output = components.duplicate(); output.update_tags(to_keep, component::Ignored); -// t_ = timer_; -// std::cout << "init output = " << t_ << std::endl; return output; } @@ -348,8 +321,6 @@ namespace scribo { mln_trace("scribo::filter::objects_with_holes"); -// std::cout << components.nelements() << std::endl; - typedef component_set<L> O; neighb2d nbh = c8(); @@ -383,7 +354,6 @@ namespace scribo } // 1st pass -// std::cout << "1st pass" << std::endl; { util::array<int> dp = positive_offsets_wrt(lbl, nbh); const unsigned n_nbhs = dp.nelements(); @@ -415,7 +385,6 @@ namespace scribo } // 2nd pass -// std::cout << "2nd pass" << std::endl; { unsigned kept = 0; mln_fwd_pixter(const L) pxl(bboxes_ima); // Forward. diff --git a/scribo/scribo/filter/separators_in_borders.hh b/scribo/scribo/filter/separators_in_borders.hh index ae9ff70..884cae5 100644 --- a/scribo/scribo/filter/separators_in_borders.hh +++ b/scribo/scribo/filter/separators_in_borders.hh @@ -182,22 +182,8 @@ namespace scribo || util::box_is_included(vline(c).bbox(), bb) || util::box_is_included(vline(c).bbox(), bl)) { - // std::cout << vline(c).bbox() << " is included in "; - // if (util::box_is_included(vline(c).bbox(), bt)) - // std::cout << bt << std::endl; - // if (util::box_is_included(vline(c).bbox(), br)) - // std::cout << br << std::endl; - // if (util::box_is_included(vline(c).bbox(), bb)) - // std::cout << bb << std::endl; - // if (util::box_is_included(vline(c).bbox(), bl)) - // std::cout << bl << std::endl; - vline(c).update_tag(component::Ignored); } - // else - // { - // std::cout << vline(c).bbox() << " is not included in " << bt << " - " << br << " - " << bb << " - " << bl << std::endl; - // } } // FIXME: warning this call may produce inconsistent data // Ignored components are still in the separator image... diff --git a/scribo/scribo/io/xml/load.hh b/scribo/scribo/io/xml/load.hh index 0ba7aab..1d51294 100644 --- a/scribo/scribo/io/xml/load.hh +++ b/scribo/scribo/io/xml/load.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -179,7 +179,6 @@ namespace scribo case ComponentSet: { comp_set_data = new scribo::internal::component_set_data<L>(); - // qDebug() << qName << " - atts.value(\"nelements\").toInt() = " << atts.value("nelements").toInt();; comp_set_data->soft_init(atts.value("nelements").toInt()); } break; @@ -223,7 +222,6 @@ namespace scribo // Object links case ObjectLinks: { - // qDebug() << "object_links created"; links = object_links<L>(components); } break; @@ -232,7 +230,6 @@ namespace scribo // Object groups case ObjectGroups: { - //qDebug() << "Processing object_groups"; group_info_.reserve(atts.value("ngroups").toInt()); group_info_.resize(1); } @@ -242,15 +239,11 @@ namespace scribo // Text data case TextData: { - // qDebug() << "TextData"; - // Reserve space for line data. lines_data.resize(atts.value("nlines").toInt() + 1); - // qDebug() << "line_set created"; lines = line_set<L>(groups, lines_data); llinks = line_links<L>(lines); par_data = new scribo::internal::paragraph_set_data<L>(llinks, atts.value("nparagraphs").toInt()); - // std::cout << par_data->pars_.nelements() << " - " << llinks.nelements() << " - " << lines.nelements() << std::endl; } break; @@ -258,8 +251,6 @@ namespace scribo // Text Region case TextRegion: { - // qDebug() << "TextRegion"; - current_paragraph = paragraph_info<L>(llinks); current_paragraph.set_color_( scribo::util::hex_to_color(atts.value("color").toUtf8().constData())); @@ -421,7 +412,6 @@ namespace scribo // Component set case ComponentSet: { - // qDebug() << "Component set done"; components = component_set<L>(comp_set_data); } @@ -430,7 +420,6 @@ namespace scribo // Line case Line: { - // qDebug() << "Line done"; line_data->bbox_ = bbox; lines_data(current_line_id) = line_info<L>(current_line_id, line_data); lines_data(current_line_id).update_ebbox(); @@ -443,7 +432,6 @@ namespace scribo // TextRegion case TextRegion: { - // qDebug() << TextRegion; par_data->pars_(current_paragraph_id++) = current_paragraph; } break; @@ -451,7 +439,6 @@ namespace scribo // Page case Page: { - // qDebug() << "Page done"; lines.update_line_data_(lines_data); parset = paragraph_set<L>(par_data); doc.set_paragraphs(parset); diff --git a/scribo/scribo/postprocessing/fill_object_holes.hh b/scribo/scribo/postprocessing/fill_object_holes.hh index 636b929..7632fee 100644 --- a/scribo/scribo/postprocessing/fill_object_holes.hh +++ b/scribo/scribo/postprocessing/fill_object_holes.hh @@ -343,8 +343,6 @@ namespace scribo // Holes card Image -// std::cout << "> Holes card image" << std::endl; - L nlabels; res_t res = labeling::blobs_and_compute(input, c8(), nlabels, A()); @@ -357,9 +355,6 @@ namespace scribo // Threshold Image -// std::cout << "> Threshold image" << std::endl; - - I input_i = logical::not_(input); res = labeling::blobs_and_compute(input_i, c8(), nlabels, A()); @@ -375,8 +370,6 @@ namespace scribo // Thresholding -// std::cout << "> Thresholding" << std::endl; - I hole_mask; initialize(hole_mask, holes); data::fill(hole_mask, false); @@ -388,8 +381,6 @@ namespace scribo // Cleanup -// std::cout << "> Cleanup" << std::endl; - data::fill((output | pw::value(hole_mask)).rw(), false); diff --git a/scribo/scribo/preprocessing/deskew.hh b/scribo/scribo/preprocessing/deskew.hh index 555bad7..a3fca24 100644 --- a/scribo/scribo/preprocessing/deskew.hh +++ b/scribo/scribo/preprocessing/deskew.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2010, 2013 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -416,7 +416,6 @@ namespace scribo mlc_is_not_a(mln_value(I), value::Vectorial)::check(); double angle = internal::perform_deskew(input_gl); -// std::cout << angle << std::endl; mln_concrete(I) output = input_gl; diff --git a/scribo/scribo/primitive/extract/lines_h_thick_and_thin.hh b/scribo/scribo/primitive/extract/lines_h_thick_and_thin.hh index e774bee..e3a17da 100644 --- a/scribo/scribo/primitive/extract/lines_h_thick_and_thin.hh +++ b/scribo/scribo/primitive/extract/lines_h_thick_and_thin.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2011, 2012 EPITA Research and Development Laboratory +// Copyright (C) 2011, 2012, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -294,7 +294,6 @@ namespace scribo if (next_tag != tag_bot) continue; flush_tag(input, col, tag_bot, r, next_tag); // bot - // std::cout << "found at col " << col << " from row " << row << " to " << r-1 << std::endl; draw_vertical(output, col, row, r); row = r - 1; } diff --git a/scribo/scribo/primitive/extract/non_text.hh b/scribo/scribo/primitive/extract/non_text.hh index e2ebbd7..a533af3 100644 --- a/scribo/scribo/primitive/extract/non_text.hh +++ b/scribo/scribo/primitive/extract/non_text.hh @@ -223,10 +223,6 @@ namespace scribo } - // echo - // std::cout << "max_area = " << max_area << std::endl; - - // 2nd pass = bg biggest component selection { diff --git a/scribo/scribo/primitive/extract/separators_nonvisible.hh b/scribo/scribo/primitive/extract/separators_nonvisible.hh index 85fc191..565bb7e 100644 --- a/scribo/scribo/primitive/extract/separators_nonvisible.hh +++ b/scribo/scribo/primitive/extract/separators_nonvisible.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010, 2011, 2012 EPITA Research and Development +// Copyright (C) 2010, 2011, 2012, 2013 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -126,43 +126,27 @@ namespace scribo max_angle = 5, min_card = 3; - // mln::util::timer t; - // mln::util::timer gt; - - // gt.start(); - bool _debug_ = logger().is_at_level(AuxiliaryResults); // Closing structural - Connect characters. - // t.start(); win::hline2d vl(17); mln_concrete(I) input_clo = morpho::closing::structural(in, vl); - // float t_ = t; - // std::cout << "closing_structural - " << t_ << std::endl; - // Debug logger().log_image(AuxiliaryResults, input_clo, "input_clo"); // Rotate (OK) - // t.restart(); input_clo = scribo::preprocessing::rotate_90(input_clo, false); - // t_ = t; - // std::cout << "rotate_90 - " << t_ << std::endl; /// Finding components. - // t.restart(); V ncomponents; component_set<L> components = scribo::primitive::extract::components(input_clo, c8(), ncomponents); - // t_ = t; - // std::cout << "extract::components - " << t_ << std::endl; - // Debug logger().log_image(AuxiliaryResults, data::convert(value::int_u8(), @@ -170,7 +154,6 @@ namespace scribo "lbl"); unsigned dmax = 5; - // t.restart(); object_links<L> top_right, bot_right; object_links<L> top_left, bot_left; @@ -185,15 +168,11 @@ namespace scribo anchor::TopStrictLeft); top_right = primitive::link::compute(functor, anchor::TopStrictLeft); - // t.stop(); - // Debug logger().log_image(AuxiliaryResults, functor.debug_, "right_top"); logger().log_image(AuxiliaryResults, functor.debug_angle_, "right_top_angle"); - // t.resume(); - // Left link::internal::single_left_dmax_ratio_aligned_functor<L,Dmax_F> lfunctor(components, Dmax_F(dmax), min_angle, max_angle, @@ -201,8 +180,6 @@ namespace scribo top_left = primitive::link::compute(lfunctor, anchor::TopStrictLeft); - // t.stop(); - // Debug if (_debug_) { @@ -218,7 +195,6 @@ namespace scribo logger().log_image(AuxiliaryResults, output, "left_right_top"); } - // t.resume(); } @@ -229,7 +205,6 @@ namespace scribo functor(components, Dmax_F(dmax), min_angle, max_angle, anchor::BottomStrictRight); bot_right = primitive::link::compute(functor, anchor::BottomStrictRight); - // t.stop(); // Debug if (_debug_) @@ -239,14 +214,12 @@ namespace scribo "right_bot_angle"); } - // t.resume(); // Left link::internal::single_left_dmax_ratio_aligned_functor<L,Dmax_F> lfunctor(components, Dmax_F(dmax), min_angle, max_angle, anchor::BottomStrictRight); bot_left = primitive::link::compute(lfunctor, anchor::BottomStrictRight); - // t.stop(); // Debug if (_debug_) @@ -265,28 +238,18 @@ namespace scribo } - // t_ = t; - // std::cout << "links - " << t_ << std::endl; - // Merge links and build CC groups - // t.restart(); object_groups<L> top_groups = primitive::group::from_double_link_any(top_left, top_right); object_groups<L> bot_groups = primitive::group::from_double_link_any(bot_left, bot_right); - // t_ = t; - // std::cout << "group - " << t_ << std::endl; // Filter CC groups - // t.restart(); top_groups = filter::object_groups_small(top_groups, min_card); bot_groups = filter::object_groups_small(bot_groups, min_card); - // t_ = t; - // std::cout << "small groups - " << t_ << std::endl; // Compute group bboxes - // t.restart(); mln_concrete(I) separators; initialize(separators, input_clo); @@ -294,10 +257,7 @@ namespace scribo data::fill(separators, false); extension::fill(separators, false); - // t_ = t; - // std::cout << "Initialize separators image - " << t_ << std::endl; - // t.restart(); for_all_groups(d, top_groups) if (top_groups(d).is_valid()) { @@ -320,9 +280,6 @@ namespace scribo } - // t_ = t; - // std::cout << "Drawing output image - " << t_ << std::endl; - if (_debug_) { @@ -367,7 +324,6 @@ namespace scribo logger().log_image(AuxiliaryResults, input_with_seps, "input_with_seps"); } - // t.restart(); unsigned length = 25; dpoint2d @@ -375,7 +331,6 @@ namespace scribo dp2( 21, 0); // Adjusting extension. - // t.restart(); extension::adjust_fill(input_clo, length / 2, 0); accu::count_value<bool> accu(true); @@ -383,20 +338,12 @@ namespace scribo J tmp = accu::transform_line(accu, input_clo, length, 1); - // t_ = t; - // std::cout << "* accu::transform_line - " << t_ << std::endl; - - // t.restart(); value::int_u8 nlabels; mln_ch_value(I,value::int_u8) sep_lbl = labeling::value(separators, true, c8(), nlabels); - // t_ = t; - // std::cout << "* labeling seps - " << t_ << std::endl; - // t.restart(); - mln::util::array<bool> relbl(unsigned(nlabels) + 1, true); relbl(0) = false; @@ -453,13 +400,7 @@ namespace scribo } - // t_ = t; - // std::cout << "* reading data - " << t_ << std::endl; - - // t.restart(); labeling::relabel_inplace(sep_lbl, nlabels, relbl); - // t_ = t; - // std::cout << "* relabel_inplace - " << t_ << std::endl; mln_concrete(I) output = data::convert(bool(), sep_lbl); @@ -469,10 +410,6 @@ namespace scribo "separators_filtered"); } - // gt.stop(); - // t_ = gt; - // std::cout << "Non visible separators: " << t_ << std::endl; - return scribo::preprocessing::rotate_90(output, true); } } diff --git a/scribo/scribo/text/clean_inplace.hh b/scribo/scribo/text/clean_inplace.hh index 3955fff..51d20c6 100644 --- a/scribo/scribo/text/clean_inplace.hh +++ b/scribo/scribo/text/clean_inplace.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory +// Copyright (C) 2010, 2011, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -43,8 +43,6 @@ # include <mln/logical/not.hh> -//# include <mln/world/binary_2d/enlarge.hh> - # include <mln/debug/filename.hh> # include <mln/io/pbm/save.hh> @@ -109,29 +107,18 @@ namespace scribo return; float fact = line.x_height() / 40.0f; -// std::cout << fact << " - " << input.domain() << std::endl; if (fact < 1) { -// std::cout << "Upsampling..." << " - " -// << fact << std::endl; while (fact < 0.90) { input = scribo::upsampling::eagle(input); // 2x upsampling fact *= 2.0f; -// std::cout << "fact = " << fact -// << " - input.domain = " << input.domain() -// << std::endl; } } else if (fact > 2.5f) { -// std::cout << "subsampling::bilinear" << " - " -// << std::ceil(fact) << std::endl; input = subsampling::bilinear(input, int(std::ceil(fact - 0.5))); // math::floor instead? - } -// else -// std::cout << "not clean_inplaceing text. Seems ok." << std::endl; } diff --git a/scribo/scribo/text/extract_paragraphs_hdoc.hh b/scribo/scribo/text/extract_paragraphs_hdoc.hh index cc379cb..cd52b67 100644 --- a/scribo/scribo/text/extract_paragraphs_hdoc.hh +++ b/scribo/scribo/text/extract_paragraphs_hdoc.hh @@ -192,13 +192,6 @@ namespace scribo // const unsigned nlines = lines.nelements(); - // image2d<value::rgb8> links = data::convert(value::rgb8(), input); - // for (unsigned l = 0; l < nlines; ++l) - // { - // mln::draw::line(links, lines(l).bbox().pcenter(), lines(left(l)).bbox().pcenter(), literal::red); - // } - // mln::io::ppm::save(links, "out_links.ppm"); - // For each line for_all_lines(l, lines) if (lines(l).is_textline()) @@ -781,36 +774,6 @@ namespace scribo } } } - - // Only debug - // { - // image2d<value::rgb8> debug = data::convert(value::rgb8(), input); - - // mln::util::array<accu::shape::bbox<point2d> > nbbox(output.nelements()); - // for_all_lines(l, lines) - // if (lines(l).is_textline()) - // { - // // if (lines(i).is_textline()) - // // { - // // mln::draw::box(debug, lines(i).bbox(), literal::red); - // nbbox(output(l)).take(lines(l).bbox()); - // // } - // } - - // for (unsigned i = 0; i < nbbox.nelements(); ++i) - // if (nbbox(i).is_valid()) - // { - // box2d b = nbbox(i).to_result(); - // mln::draw::box(debug, b, literal::orange); - // b.enlarge(1); - // mln::draw::box(debug, b, literal::orange); - // b.enlarge(1); - // mln::draw::box(debug, b, literal::orange); - // } - - // mln::io::ppm::save(debug, "out_paragraph.ppm"); - // } - } //------------------------------------------------------------- @@ -1303,18 +1266,11 @@ namespace scribo rbbox.resize(lines.nelements() + 1); -// std::cout << "Preparing lines" << std::endl; internal::prepare_lines(input.domain(), lines , blocks, rbbox); -// io::pgm::save(blocks, "blocks.pgm"); -// std::cout << "Linking left" << std::endl; internal::process_left_link(blocks, rbbox, lines , left); -// std::cout << "Linking right" << std::endl; internal::process_right_link(blocks, rbbox, lines , right); -// std::cout << "Finalizing links" << std::endl; internal::finalize_links(left, right, lines ); - // std::cout << "Finalizing merging" << std::endl; // finalize_line_merging(left, right, lines); -// std::cout << "Extracting paragraphs" << std::endl; internal::paragraph_links(left, right, output, lines); paragraph_set<L> par_set = make::paragraph(output, right); diff --git a/scribo/scribo/text/merging.hh b/scribo/scribo/text/merging.hh index c8878f2..2c19913 100644 --- a/scribo/scribo/text/merging.hh +++ b/scribo/scribo/text/merging.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010, 2012 EPITA Research and Development Laboratory +// Copyright (C) 2010, 2012, 2013 EPITA Research and Development Laboratory // (LRDE) // // This file is part of Olena. @@ -185,7 +185,6 @@ namespace scribo l2 = my_find_root(parent, l2); if (l1 == l2) { - //std::cerr << "what! in'do_union': already merged!!!" << std::endl; return l1; } @@ -509,24 +508,6 @@ namespace scribo const box2d& l_ted_ebbox = l_ted.ebbox(); -// std::cout << "top_row = " << top_row << " - bot_row = " << bot_row << std::endl; -// std::cout << std::abs(bot_row - l_ted.baseline()) -// << " - d " -// << std::abs(bot_row - l_ted.descent()) -// << " - dd " -// << std::abs(bot_row - l_ted.ebbox().pmax().row()) -// << " - " -// << std::abs(top_row - l_ted.meanline()) -// << " - a " -// << std::abs(top_row - l_ted.ascent()) -// << " - aa " -// << std::abs(top_row - l_ted.ebbox().pmin().row()) -// << " - " -// << l_ted.ascent() -// << " - " -// << l_ted.descent() -// << std::endl; - if ((std::abs(bot_row - l_ted.baseline()) < 5 || std::abs(bot_row - l_ted_ebbox.pmax().row()) < 5) && @@ -665,8 +646,6 @@ namespace scribo const box2d& b = lines(l).bbox(); - // unsigned tl, tr, ml, mc, mr, bl, br; - const box2d& b_ = lines(l).ebbox(); /* @@ -765,8 +744,6 @@ namespace scribo l = do_union(lines, l, mc, parent); // } -// std::cout << "weird: inclusion of a txt_line in a txt_line!" << std::endl; - /// Merge is perform if the current line is a /// petouille considered as a line. // if ((std::abs(lines(l).ascent() - lines(mc).ascent()) >= 5) @@ -867,10 +844,6 @@ namespace scribo if (lcand == 0) // Skip background. continue; - // if (lines(lcand).type() != line::Text) - // std::cerr << "again!" << std::endl; - - if (lines(l_).type() == line::Text) { // l_ and lcand look like text line chunks. @@ -955,16 +928,6 @@ namespace scribo } -// std::cout -// << " new txtline = " << count_new_txtline << std::endl -// << " comp IN txtline = " << count_comp_IN_txtline << std::endl -// << " 2 lines merge = " << count_two_lines_merge << std::endl -// << " comp HITS txtline = " << count_comp_HITS_txtline << std::endl -// << " txtline IN junk = " << count_txtline_IN_junk << std::endl -// << " txtline IN txtline = " << count_txtline_IN_txtline << std::endl -// << " WTF! = " << count_WTF << std::endl; - - (void) ith_pass; // if (ith_pass == 1) // { @@ -1034,8 +997,6 @@ namespace scribo // Sort lines by bbox.nelements() and ids. std::sort(v.begin(), v.end(), func); -// mln::util::timer t; - // Setting lines as text lines according to specific criterions. for_all_lines(l, lines) @@ -1044,10 +1005,7 @@ namespace scribo // First pass -// t.start(); one_merge_pass(1, input_domain, v, lines, parent); -// float ts = t.stop(); -// std::cout << "time " << ts << std::endl; // lines.force_stats_update(); @@ -1058,10 +1016,7 @@ namespace scribo // Second pass -// t.start(); one_merge_pass(2, input_domain, v, lines, parent); // <- last pass -// ts = t.stop(); -// std::cout << "time " << ts << std::endl; lines.force_stats_update(); @@ -1081,15 +1036,9 @@ namespace scribo { using namespace mln; -// mln::util::timer t; -// t.start(); - scribo::line_set<L> output = internal::draw_boxes(lines.components().labeled_image().domain(), lines); -// float ts = t.stop(); -// std::cout << ts << std::endl; - return output; } -- 1.7.10.4