Commit 88e9e68e authored by Roland Levillain's avatar Roland Levillain
Browse files

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.
parent 6b9bc50e
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.
......
......@@ -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;
......
// 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;
}
......
// 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.
......
......@@ -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...
......
// 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);
......
......@@ -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);
......
// 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;
......
// 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;
}
......
......@@ -223,10 +223,6 @@ namespace scribo
}
// echo
// std::cout << "max_area = " << max_area << std::endl;
// 2nd pass = bg biggest component selection
{
......
// 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);
}
}
......
// 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 @@