Commit c05d4df5 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Fix compilation of Scribo tools.

	* src/debug/show_links_bbox_overlap.cc,
	* src/debug/show_links_center_aligned.cc,
	* src/debug/show_links_non_h_aligned.cc,
	* src/debug/show_links_several_right.cc,
	* src/debug/show_links_several_right_overlap.cc,
	* src/debug/show_links_single_down.cc,
	* src/debug/show_links_single_down_left_aligned.cc,
	* src/debug/show_links_single_down_right_aligned.cc,
	* src/debug/show_links_single_left.cc,
	* src/debug/show_links_single_left_dmax_ratio.cc,
	* src/debug/show_links_single_right.cc,
	* src/debug/show_links_single_right_dmax_ratio.cc,
	* src/debug/show_links_single_up.cc,
	* src/debug/show_links_single_up_left_aligned.cc,
	* src/debug/show_links_single_up_right_aligned.cc,
	* src/debug/show_objects_large.cc,
	* src/debug/show_objects_large_small.cc,
	* src/debug/show_objects_small.cc,
	* src/debug/show_objects_thick.cc,
	* src/debug/show_objects_thin.cc,
	* src/filter/objects_large.cc,
	* src/filter/objects_small.cc,
	* src/filter/objects_thick.cc,
	* src/filter/objects_thin.cc,
	* src/filter/objects_with_holes.cc,
	* src/filter/objects_with_holes_pgm.cc,
	* src/preprocessing/preprocess.cc,
	* src/preprocessing/split_bg_fg.cc,
	* src/preprocessing/unskew.cc,
	* src/primitive/extract/extract_discontinued_hlines.cc,
	* src/primitive/extract/extract_discontinued_lines.cc,
	* src/primitive/extract/extract_discontinued_vlines.cc,
	* src/primitive/extract/extract_thick_hlines.cc,
	* src/primitive/extract/extract_thick_vlines.cc,
	* src/primitive/find/find_discontinued_lines.cc,
	* src/primitive/find/find_single_lines.cc,
	* src/primitive/find/find_thick_and_single_lines.cc,
	* src/primitive/find/find_thick_lines.cc,
	* src/primitive/group/Makefile.am,
	* src/primitive/group/group_from_double_link.cc,
	* src/primitive/group/group_from_double_several_links.cc,
	* src/primitive/group/group_from_several_left_links.cc,
	* src/primitive/group/group_from_single_link.cc,
	* src/table/erase.cc,
	* src/text/cleantxt.cc: Here.
parent a0961e1c
2010-08-09 Guillaume Lazzara <z@lrde.epita.fr>
Fix compilation of Scribo tools.
* src/debug/show_links_bbox_overlap.cc,
* src/debug/show_links_center_aligned.cc,
* src/debug/show_links_non_h_aligned.cc,
* src/debug/show_links_several_right.cc,
* src/debug/show_links_several_right_overlap.cc,
* src/debug/show_links_single_down.cc,
* src/debug/show_links_single_down_left_aligned.cc,
* src/debug/show_links_single_down_right_aligned.cc,
* src/debug/show_links_single_left.cc,
* src/debug/show_links_single_left_dmax_ratio.cc,
* src/debug/show_links_single_right.cc,
* src/debug/show_links_single_right_dmax_ratio.cc,
* src/debug/show_links_single_up.cc,
* src/debug/show_links_single_up_left_aligned.cc,
* src/debug/show_links_single_up_right_aligned.cc,
* src/debug/show_objects_large.cc,
* src/debug/show_objects_large_small.cc,
* src/debug/show_objects_small.cc,
* src/debug/show_objects_thick.cc,
* src/debug/show_objects_thin.cc,
* src/filter/objects_large.cc,
* src/filter/objects_small.cc,
* src/filter/objects_thick.cc,
* src/filter/objects_thin.cc,
* src/filter/objects_with_holes.cc,
* src/filter/objects_with_holes_pgm.cc,
* src/preprocessing/preprocess.cc,
* src/preprocessing/split_bg_fg.cc,
* src/preprocessing/unskew.cc,
* src/primitive/extract/extract_discontinued_hlines.cc,
* src/primitive/extract/extract_discontinued_lines.cc,
* src/primitive/extract/extract_discontinued_vlines.cc,
* src/primitive/extract/extract_thick_hlines.cc,
* src/primitive/extract/extract_thick_vlines.cc,
* src/primitive/find/find_discontinued_lines.cc,
* src/primitive/find/find_single_lines.cc,
* src/primitive/find/find_thick_and_single_lines.cc,
* src/primitive/find/find_thick_lines.cc,
* src/primitive/group/Makefile.am,
* src/primitive/group/group_from_double_link.cc,
* src/primitive/group/group_from_double_several_links.cc,
* src/primitive/group/group_from_several_left_links.cc,
* src/primitive/group/group_from_single_link.cc,
* src/table/erase.cc,
* src/text/cleantxt.cc: Here.
2010-08-09 Guillaume Lazzara <z@lrde.epita.fr>
Catch up with the current interface of scribo::debug::usage.
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -37,7 +38,7 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
#include <scribo/primitive/extract/objects.hh>
#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_right_link.hh>
#include <scribo/primitive/link/with_single_left_link.hh>
#include <scribo/filter/object_links_bbox_overlap.hh>
......@@ -64,10 +65,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
"Show valid or invalid links according the bboxes overlap.",
"Show valid or invalid links according"
" the bboxes overlap.",
"input.pbm ratio output.ppm",
args_desc,
"A color image. Valid links are drawn in green, invalid ones in red.");
args_desc);
image2d<bool> input;
io::pbm::load(input, argv[1]);
......@@ -75,17 +76,17 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
object_image(L) objects
= scribo::primitive::extract::objects(input, c8(), nbboxes);
component_set<L> comps
= scribo::primitive::extract::components(input, c8(), nbboxes);
// Finding right links.
object_links<L> right_links
= primitive::link::with_single_right_link(objects);
= primitive::link::with_single_right_link(comps);
// Filtering.
object_links<L> hratio_filtered_links
= filter::object_links_bbox_overlap(objects, right_links, atof(argv[2]));
= filter::object_links_bbox_overlap(right_links, atof(argv[2]));
// Debug image.
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -37,7 +38,7 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
#include <scribo/primitive/extract/objects.hh>
#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_right_link.hh>
#include <scribo/filter/object_links_center_aligned.hh>
......@@ -62,10 +63,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
"Show valid or invalid links according the horizontal alignment (based on center line).",
"Show valid or invalid links according the "
"horizontal alignment (based on center line).",
"input.pbm max_alpha output.ppm",
args_desc,
"A color image. Valid links are drawn in green, invalid ones in red.");
args_desc);
image2d<bool> input;
io::pbm::load(input, argv[1]);
......@@ -73,17 +74,17 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
object_image(L) objects
= scribo::primitive::extract::objects(input, c8(), nbboxes);
component_set<L> comps
= scribo::primitive::extract::components(input, c8(), nbboxes);
// Finding right links.
object_links<L> right_links
= primitive::link::with_single_right_link(objects);
= primitive::link::with_single_right_link(comps);
// Filtering.
object_links<L> filtered_links
= filter::object_links_center_aligned(objects, right_links, atof(argv[2]));
= filter::object_links_center_aligned(right_links, atof(argv[2]));
// Debug image.
image2d<value::rgb8> decision_image
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -37,10 +38,10 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
#include <scribo/primitive/extract/objects.hh>
#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_right_link.hh>
#include <scribo/primitive/link/with_single_left_link.hh>
#include <scribo/filter/object_links_non_h_aligned.hh>
#include <scribo/filter/object_links_non_aligned_simple.hh>
#include <scribo/debug/decision_image.hh>
#include <scribo/debug/links_decision_image.hh>
......@@ -64,10 +65,11 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
"Show valid or invalid links according the horizontal alignment (based on top and bottom lines).",
"Show valid or invalid links according the "
"horizontal alignment (based on top and "
"bottom lines).",
"input.pbm delta output.ppm",
args_desc,
"A color image. Valid links are drawn in green, invalid ones in red.");
args_desc);
image2d<bool> input;
io::pbm::load(input, argv[1]);
......@@ -75,17 +77,18 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
object_image(L) objects
= scribo::primitive::extract::objects(input, c8(), nbboxes);
component_set<L> comps
= scribo::primitive::extract::components(input, c8(), nbboxes);
// Finding right links.
object_links<L> right_links
= primitive::link::with_single_right_link(objects);
= primitive::link::with_single_right_link(comps);
// Filtering.
object_links<L> filtered_links
= filter::object_links_non_h_aligned(objects, right_links, atoi(argv[2]));
= filter::object_links_non_aligned_simple(right_links,
anchor::MassCenter,
atoi(argv[2]));
// Debug image.
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -28,8 +29,6 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/alias/neighb2d.hh>
#include <mln/data/convert.hh>
#include <mln/value/rgb8.hh>
#include <mln/value/label_16.hh>
#include <mln/literal/colors.hh>
......@@ -37,7 +36,7 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/ppm/save.hh>
#include <scribo/primitive/extract/objects.hh>
#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_several_right_links.hh>
#include <scribo/draw/bounding_boxes.hh>
......@@ -49,8 +48,10 @@
const char *args_desc[][2] =
{
{ "input.pbm", "A binary image. True for objects and False for the background." },
{ "max_nbh_dist", " Maximum distance for neighborhood search. (common value : 30)" },
{ "input.pbm", "A binary image. True for objects and False for the "
"background." },
{ "max_nbh_dist", " Maximum distance for neighborhood search."
"(common value : 30)" },
{0, 0}
};
......@@ -65,8 +66,7 @@ int main(int argc, char* argv[])
return scribo::debug::usage(argv,
"Show sucessful/unsuccessful right links between components.",
"input.pbm max_nbh_dist output.ppm",
args_desc,
"A color image. Valid links are drawn in green, invalid ones in red.");
args_desc);
image2d<bool> input;
io::pbm::load(input, argv[1]);
......@@ -74,17 +74,12 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
object_image(L) objects
= scribo::primitive::extract::objects(input, c8(), nbboxes);
component_set<L> comps
= scribo::primitive::extract::components(input, c8(), nbboxes);
// Finding right links.
object_links<L> right_link
= primitive::link::with_several_right_links(objects, atoi(argv[2]));
// Drawing links.
mln::util::array<mln_result_(accu::center<mln_psite_(L)>)>
mass_centers = labeling::compute(accu::meta::center(),
objects, objects.nlabels());
= primitive::link::with_several_right_links(comps, atoi(argv[2]));
image2d<value::rgb8> decision_image
= scribo::debug::several_links_decision_image(input,
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -41,7 +42,7 @@
#include <mln/draw/line.hh>
#include <scribo/primitive/extract/objects.hh>
#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/internal/link_several_dmax_base.hh>
#include <scribo/primitive/link/internal/compute_anchor.hh>
#include <scribo/primitive/link/compute_several.hh>
......@@ -67,12 +68,16 @@ namespace scribo
typedef mln_site(L) P;
several_right_overlap_debug_functor(const I& input,
const object_image(L)& objects,
const component_set<L>& comps,
float dmax)
: super_(objects, dmax, 3)
: super_(comps, dmax)
{
this->anchors_.append(anchor::Top);
this->anchors_.append(anchor::Bottom);
this->anchors_.append(anchor::Center);
output_ = data::convert(value::rgb8(), input);
scribo::draw::bounding_boxes(output_, objects, literal::blue);
scribo::draw::bounding_boxes(output_, comps, literal::blue);
mln_postcondition(output_.is_valid());
}
......@@ -86,8 +91,7 @@ namespace scribo
if (c.first() != anchor::Invalid)
{
mln_site(L)
p = primitive::link::internal::compute_anchor(this->objects_,
this->mass_centers_,
p = primitive::link::internal::compute_anchor(this->components_,
current_object,
c.first());
mln::draw::line(output_, p, c.second(), literal::green);
......@@ -99,9 +103,9 @@ namespace scribo
mln_site(L)
start_point_(unsigned current_object, anchor::Type anchor)
{
return primitive::link::internal::compute_anchor(this->objects_,
this->mass_centers_,
current_object, anchor);
return primitive::link::internal::compute_anchor(this->components_,
current_object,
anchor);
}
......@@ -134,10 +138,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
"Show sucessful/unsuccessful right links between components.",
"Show sucessful/unsuccessful right links "
"between components.",
"input.pbm max_nbh_dist output.ppm",
args_desc,
"A color image. Valid links are drawn in green, invalid ones in red.");
args_desc);
typedef image2d<bool> I;
I input;
......@@ -146,12 +150,12 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
object_image(L) objects
= scribo::primitive::extract::objects(input, c8(), nbboxes);
component_set<L> comps
= scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
several_right_overlap_debug_functor<I, L> functor(input,
objects, atof(argv[2]));
comps, atof(argv[2]));
primitive::link::compute_several(functor);
io::ppm::save(functor.output_, argv[3]);
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -39,8 +40,8 @@
#include <mln/draw/line.hh>
#include <scribo/primitive/extract/objects.hh>
#include <scribo/primitive/link/internal/link_ms_dmax_base.hh>
#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/internal/link_single_dmax_base.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/draw/bounding_boxes.hh>
......@@ -54,23 +55,23 @@ namespace scribo
template <typename I, typename L>
struct single_down_link_debug_functor
: primitive::link::internal::link_ms_dmax_base<L,
single_down_link_debug_functor<I, L> >
: primitive::link::internal::link_single_dmax_base<L,
single_down_link_debug_functor<I, L> >
{
typedef single_down_link_debug_functor<I, L> self_t;
typedef
primitive::link::internal::link_ms_dmax_base<L, self_t> super_;
primitive::link::internal::link_single_dmax_base<L, self_t> super_;
public:
typedef mln_site(L) P;
single_down_link_debug_functor(const I& input,
const object_image(L)& objects,
const component_set<L>& comps,
float dmax)
: super_(objects, dmax, 0)
: super_(comps, dmax, anchor::Vertical)
{
output_ = data::convert(value::rgb8(), input);
scribo::draw::bounding_boxes(output_, objects, literal::blue);
scribo::draw::bounding_boxes(output_, comps, literal::blue);
mln_postcondition(output_.is_valid());
}
......@@ -134,10 +135,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
"Show sucessful/unsuccessful down links between components.",
"Show sucessful/unsuccessful down links "
"between components.",
"input.pbm max_nbh_dist output.ppm",
args_desc,
"A color image. Valid links are drawn in green, invalid ones in red.");
args_desc);
typedef image2d<bool> I;
I input;
......@@ -146,11 +147,11 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
object_image(L) objects
= scribo::primitive::extract::objects(input, c8(), nbboxes);
component_set<L> comps
= scribo::primitive::extract::components(input, c8(), nbboxes);
// Write debug image.
single_down_link_debug_functor<I, L> functor(input, objects, atof(argv[2]));
single_down_link_debug_functor<I, L> functor(input, comps, atof(argv[2]));
primitive::link::compute(functor);
io::ppm::save(functor.output_, argv[3]);
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -41,7 +42,7 @@
#include <mln/draw/line.hh>
#include <scribo/primitive/extract/objects.hh>
#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_down_link.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/filter/object_links_left_aligned.hh>
......@@ -54,7 +55,8 @@
const char *args_desc[][2] =
{
{ "input.pbm", "A binary image. True for objects and False for the background." },
{ "input.pbm", "A binary image. True for objects and False for the "
"background." },
{ "dmax", "The maximum lookup distance. (common value : 300)" },
{0, 0}
};
......@@ -70,8 +72,7 @@ int main(int argc, char* argv[])
return scribo::debug::usage(argv,
"Show sucessful/unsuccessful down links between components.",
"input.pbm dmax output.ppm",
args_desc,
"A color image. Valid links are drawn in green, invalid ones in red.");
args_desc);
typedef image2d<bool> I;
I input;
......@@ -80,20 +81,21 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
object_image(L) objects
= scribo::primitive::extract::objects(input, c8(), nbboxes);
component_set<L> comps
= scribo::primitive::extract::components(input, c8(), nbboxes);
object_links<L>
down_links = primitive::link::with_single_down_link(objects,
down_links = primitive::link::with_single_down_link(comps,
atof(argv[2]),
anchor::Left);
// Filtering.
down_links = filter::object_links_left_aligned(objects, down_links, 5);
down_links = filter::object_links_left_aligned(down_links, 5);
scribo::debug::save_linked_bboxes_image(input, objects, down_links,
scribo::debug::save_linked_bboxes_image(input, down_links,
literal::blue, literal::green,
argv[3], anchor::ActualLeft);
anchor::ActualLeft,
argv[3]);
}
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -41,7 +42,7 @@
#include <mln/draw/line.hh>
#include <scribo/primitive/extract/objects.hh>
#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_down_link.hh>
#include <scribo/primitive/link/compute.hh>
#include <scribo/filter/object_links_right_aligned.hh>
......@@ -54,7 +55,8 @@
const char *args_desc[][2] =
{
{ "input.pbm", "A binary image. True for objects and False for the background." },
{ "input.pbm", "A binary image. True for objects and False for the "
"background." },
{ "dmax", "The maximum lookup distance. (common value : 300)" },
{0, 0}
};
......@@ -68,10 +70,10 @@ int main(int argc, char* argv[])
if (argc != 4)
return scribo::debug::usage(argv,
"Show sucessful/unsuccessful down links between components.",
"Show sucessful/unsuccessful down links "
"between components.",
"input.pbm dmax output.ppm",
args_desc,
"A color image. Valid links are drawn in green, invalid ones in red.");
args_desc);
typedef image2d<bool> I;
I input;
......@@ -80,20 +82,21 @@ int main(int argc, char* argv[])
// Finding objects.
value::label_16 nbboxes;
typedef image2d<value::label_16> L;
object_image(L) objects
= scribo::primitive::extract::objects(input, c8(), nbboxes);
component_set<L> comps
= scribo::primitive::extract::components(input, c8(), nbboxes);
object_links<L>
down_links = primitive::link::with_single_down_link(objects,
down_links = primitive::link::with_single_down_link(comps,
atof(argv[2]),
anchor::Right);
// Filtering.
down_links = filter::object_links_right_aligned(objects, down_links, 5);
down_links = filter::object_links_right_aligned(down_links, 5);
scribo::debug::save_linked_bboxes_image(input, objects, down_links,
scribo::debug::save_linked_bboxes_image(input, down_links,
literal::blue, literal::green,
argv[3], anchor::ActualRight);
anchor::ActualRight,
argv[3]);
}
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -39,7 +40,7 @@
#include <mln/draw/line.hh>
#include <scribo/primitive/extract/objects.hh>
#include <scribo/primitive/extract/components.hh>
#include <scribo/primitive/link/with_single_left_link.hh>
#include <scribo/primitive/link/internal/link_single_dmax_base.hh>
#include <scribo/primitive/link/compute.hh>
......@@ -55,23 +56,23 @@ namespace scribo
template <typename I, typename L>
struct single_left_link_debug_functor
: primitive::link::internal::link_ms_dmax_base<L,
single_left_link_debug_functor<I, L> >
: primitive::link::internal::link_single_dmax_base<L,
single_left_link_debug_functor<I, L> >
{
typedef single_left_link_debug_functor<I, L> self_t;
typedef
primitive::link::internal::link_ms_dmax_base<L, self_t> super_;
primitive::link::internal::link_single_dmax_base<L, self_t> super_;
public:
typedef mln_site(L) P;
single_left_link_debug_functor(const I& input,
const object_image(L)& objects,
const component_set<L>& components,
float dmax)
: super_(objects, dmax)