Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
May 2009
- 11 participants
- 312 discussions
#122: [TRAITS] image_if_base
---------------------+------------------------------------------------------
Reporter: duhamel | Owner: Olena Team
Type: defect | Status: new
Priority: major | Milestone: Olena 1.0ß
Component: Milena | Version: 1.0
Keywords: |
---------------------+------------------------------------------------------
In source:trunk/milena/mln/core/internal/image_if_base.hh data trait is
suspect.
For example an image_if from an image1d has always data trait raw !
--
Ticket URL: <https://trac.lrde.org/olena/ticket/122>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image library.
2
1
Re: [Olena-patches] [Olena] #118: Ensure Milena supports separate compilation
by Olena Trac 28 May '09
by Olena Trac 28 May '09
28 May '09
#118: Ensure Milena supports separate compilation
-----------------------+----------------------------------------------------
Reporter: levill_r | Owner: lazzara
Type: defect | Status: new
Priority: critical | Milestone: Olena 1.0
Component: Milena | Version: 1.0
Resolution: | Keywords: multiple objects separate compilation
-----------------------+----------------------------------------------------
Changes (by theo):
* owner: Olena Team => lazzara
--
Ticket URL: <https://trac.lrde.org/olena/ticket/118#comment:2>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
1
0
---
ChangeLog | 4 ++++
configure.ac | 5 +++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cac5c73..c8021ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ * configure.ac: Configure scribo/src/* directories.
+
+2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
* configure.ac: Configure new test directories.
2009-05-28 Edwin Carlinet <carlinet(a)lrde.epita.fr>
diff --git a/configure.ac b/configure.ac
index 43e0452..e0433e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -180,6 +180,11 @@ AC_CONFIG_FILES([
scribo/Makefile
scribo/src/Makefile
scribo/src/binarization/Makefile
+ scribo/src/extract/Makefile
+ scribo/src/extract/primitive/Makefile
+ scribo/src/filter/Makefile
+ scribo/src/preprocessing/Makefile
+ scribo/src/table/Makefile
])
AC_CONFIG_FILES([scribo/tests/data.hh])
--
1.5.6.5
1
0
* preprocessing/all.hh,
* all.hh: fix includes.
* binarization/simple.hh: fix documentation and warnings.
* make/text.hh: add routine signature.
* preprocessing/unskew.hh: remove useless debug.
* scribo.mk: update path to milena directory.
* tests/preprocessing/unskew.cc: new test for unskew routine.
* tests/unit_test/unit-tests.mk: update unit test list.
* text/clean.hh: enlarge the image before cleaning it up.
---
scribo/ChangeLog | 21 ++++++++++++++
scribo/all.hh | 12 ++++----
scribo/binarization/simple.hh | 24 +++++-----------
scribo/make/text.hh | 19 +++++++++++--
scribo/preprocessing/all.hh | 4 +-
scribo/preprocessing/unskew.hh | 1 -
scribo/scribo.mk | 4 +-
scribo/tests/preprocessing/unskew.cc | 17 ++++++++++++
scribo/tests/unit_test/unit-tests.mk | 38 +++++++++++++++-----------
scribo/text/clean.hh | 49 +++++++++++++++++++++++++--------
10 files changed, 131 insertions(+), 58 deletions(-)
create mode 100644 scribo/tests/preprocessing/unskew.cc
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 7b25394..4e49716 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,26 @@
2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Small fixes in Scribo.
+
+ * preprocessing/all.hh,
+ * all.hh: fix includes.
+
+ * binarization/simple.hh: fix documentation and warnings.
+
+ * make/text.hh: add routine signature.
+
+ * preprocessing/unskew.hh: remove useless debug.
+
+ * scribo.mk: update path to milena directory.
+
+ * tests/preprocessing/unskew.cc: new test for unskew routine.
+
+ * tests/unit_test/unit-tests.mk: update unit test list.
+
+ * text/clean.hh: enlarge the image before cleaning it up.
+
+2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Update samples in Scribo.
* src/Makefile.am,
diff --git a/scribo/all.hh b/scribo/all.hh
index 80c4bbf..d78e6a2 100644
--- a/scribo/all.hh
+++ b/scribo/all.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -39,14 +39,14 @@ namespace scribo
} // end of namespace scribo
+# include <scribo/core/all.hh>
+# include <scribo/debug/all.hh>
# include <scribo/draw/all.hh>
-# include <scribo/table/all.hh>
-# include <scribo/util/all.hh>
# include <scribo/filter/all.hh>
# include <scribo/make/all.hh>
+# include <scribo/preprocessing/all.hh>
+# include <scribo/table/all.hh>
# include <scribo/text/all.hh>
-# include <scribo/core/all.hh>
-# include <scribo/debug/all.hh>
-# include <scribo/deskew/all.hh>
+# include <scribo/util/all.hh>
#endif // ! SCRIBO_ALL_HH
diff --git a/scribo/binarization/simple.hh b/scribo/binarization/simple.hh
index 46953e9..36a5131 100644
--- a/scribo/binarization/simple.hh
+++ b/scribo/binarization/simple.hh
@@ -72,21 +72,13 @@ namespace scribo
/// Simple binarization of a gray-level document.
/*!
*
- * \param[in] input_ A binary image.
- * \param[in] nbh_ The neighborhood used for labeling image components.
- * \param[out] nlines The number of lines found.
- * \param[in] vwin Window used to extract the vertical lines in a morphological
- * opening
- * \param[in] hwin Window used to extract the horizontal lines in a morphological
- * opening
+ * \param[in] input_ A gray-level image.
*
- * \return pair of array of bounding boxes. The first array holds the
- * vertical lines bounding boxes and the second one the
- * horizontal lines bounding boxes.
+ * \result A Boolean image.
*/
template <typename I>
mln_ch_value(I, bool)
- simple(const Image<I>& input);
+ simple(const Image<I>& input_);
@@ -114,7 +106,7 @@ namespace scribo
unsigned nbasins;
mln_ch_value(I, unsigned) w = morpho::watershed::flooding(g, c4(), nbasins);
- h = histo::compute(input | (pw::value(w) == pw::cst(0)));
+ h = histo::compute(input | (pw::value(w) == pw::cst(0u)));
}
@@ -128,13 +120,13 @@ namespace scribo
convert::from_to(h, h_);
hs_ = linear::gaussian_1d(h_, sigma, 0);
l = labeling::regional_minima(hs_, c2(), n);
-
- if (n < 3)
+
+ if (n < 3u)
{
std::cerr << "This method has not worked properly!" << std::endl;
debug::histo(h, "tmp_h.txt");
-
+
std::ofstream file("tmp_hs.txt");
mln_piter(box1d) p(h_.domain());
for_all(p)
@@ -149,7 +141,7 @@ namespace scribo
c[0] = point1d(0); // Force a neutral value for the non-label value (0).
}
- int threshold;
+ unsigned threshold;
{
std::vector<int> v;
diff --git a/scribo/make/text.hh b/scribo/make/text.hh
index cac6356..406a77f 100644
--- a/scribo/make/text.hh
+++ b/scribo/make/text.hh
@@ -79,6 +79,20 @@ namespace scribo
V& nbboxes);
+ /// Construct a new util::text from another one.
+ ///
+ /// \param[in] text A text structure.
+ /// \param[in] f_ A function v2v or v2b. It will be used to regroup text
+ /// components.
+ ///
+ /// \return a new util::text.
+ //
+ template <typename L, typename F>
+ scribo::util::text<L>
+ text(const scribo::util::text<L>& text,
+ const Function<F>& f_);
+
+
# ifndef MLN_INCLUDE_ONLY
template <typename L>
@@ -123,9 +137,7 @@ namespace scribo
return make::text(cboxes, lbl, nbboxes);
}
- //FIXME: we want the following routine to construct a new util::text
- // from another one and a relabeling function. It avoids recomputing
- // the whole underlying data (mass centers, bboxes...)
+
template <typename L, typename F>
scribo::util::text<L>
text(const scribo::util::text<L>& text,
@@ -139,6 +151,7 @@ namespace scribo
mln_value(L) new_nbboxes;
mln::fun::i2v::array<mln_value(L)> fv2v
= mln::make::relabelfun(f, text.nbboxes(), new_nbboxes);
+
L lbl = labeling::relabel(text.label_image(), text.nbboxes(), fv2v);
mln::util::array< accu::bbox<mln_site(L)> > tboxes(new_nbboxes.next());
diff --git a/scribo/preprocessing/all.hh b/scribo/preprocessing/all.hh
index 145d6f4..0218eaa 100644
--- a/scribo/preprocessing/all.hh
+++ b/scribo/preprocessing/all.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -43,6 +43,6 @@ namespace scribo
} // end of namespace scribo
-# include <scribo/preprocessing/hough.hh>
+# include <scribo/preprocessing/unskew.hh>
#endif // ! SCRIBO_PREPROCESSING_ALL_HH
diff --git a/scribo/preprocessing/unskew.hh b/scribo/preprocessing/unskew.hh
index bb71505..d092034 100644
--- a/scribo/preprocessing/unskew.hh
+++ b/scribo/preprocessing/unskew.hh
@@ -80,7 +80,6 @@ namespace scribo
point2d max_p = accu::compute(accu::max_site<image2d<float> >(), hough_ima);
- std::cout << max_p.col() << std::endl;
double angle = 0;
int max_angle = max_p.col();
diff --git a/scribo/scribo.mk b/scribo/scribo.mk
index 866d51a..b32fe80 100644
--- a/scribo/scribo.mk
+++ b/scribo/scribo.mk
@@ -1,5 +1,5 @@
-include $(top_srcdir)/milena/tests/tests.mk
+#include $(top_srcdir)/milena/tests/tests.mk
# Add path to Scribo's headers
-AM_CPPFLAGS += -I$(top_srcdir)/ -I$(top_builddir)/
+AM_CPPFLAGS = -I$(top_srcdir)/ -I$(top_builddir)/ -I$(top_srcdir)/milena -I$(top_builddir)/milena -DNDEBUG -O2
diff --git a/scribo/tests/preprocessing/unskew.cc b/scribo/tests/preprocessing/unskew.cc
new file mode 100644
index 0000000..c0291fe
--- /dev/null
+++ b/scribo/tests/preprocessing/unskew.cc
@@ -0,0 +1,17 @@
+#include <mln/core/image/image2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/io/pbm/save.hh>
+
+#include <scribo/preprocessing/unskew.hh>
+
+
+int main(int argc, char *argv[])
+{
+ (void) argc;
+ using namespace mln;
+
+ image2d<bool> ima;
+ io::pbm::load(ima, argv[1]);
+
+ io::pbm::save(scribo::preprocessing::unskew(ima), "tr.pbm");
+}
diff --git a/scribo/tests/unit_test/unit-tests.mk b/scribo/tests/unit_test/unit-tests.mk
index f7204da..761253b 100644
--- a/scribo/tests/unit_test/unit-tests.mk
+++ b/scribo/tests/unit_test/unit-tests.mk
@@ -5,36 +5,42 @@ scribo_all \
scribo_binarization_simple \
scribo_core_all \
scribo_core_central_sites \
-scribo_core_component_bboxes \
scribo_core_erase_bboxes \
scribo_core_macros \
+scribo_core_object_image \
scribo_debug_all \
scribo_debug_save_label_image \
scribo_debug_save_linked_textbboxes_image \
scribo_debug_save_table_image \
scribo_debug_save_textbboxes_image \
+scribo_debug_usage \
scribo_demat \
+scribo_demat_old \
scribo_draw_all \
scribo_draw_bounding_box_links \
scribo_draw_bounding_boxes \
+scribo_extract_lines_discontinued \
scribo_extract_primitive_canvas \
scribo_extract_primitive_cells \
scribo_extract_primitive_lines_discontinued \
scribo_extract_primitive_lines_h_discontinued \
+scribo_extract_primitive_lines_h_thick \
scribo_extract_primitive_lines_thick \
scribo_extract_primitive_lines_v_discontinued \
+scribo_extract_primitive_lines_v_thick \
scribo_extract_primitive_objects \
scribo_filter_all \
-scribo_filter_large_components \
-scribo_filter_small_components \
-scribo_filter_thick_bboxes \
-scribo_filter_thin_bboxes \
+scribo_filter_large_objects \
+scribo_filter_small_objects \
+scribo_filter_thick_objects \
+scribo_filter_thin_objects \
scribo_make_all \
scribo_make_debug_filename \
scribo_make_influence_zone_graph \
scribo_make_text \
scribo_preprocessing_all \
scribo_preprocessing_unskew \
+scribo_src_woot \
scribo_table_align_lines_horizontaly \
scribo_table_align_lines_verticaly \
scribo_table_all \
@@ -42,8 +48,6 @@ scribo_table_connect_horizontal_lines \
scribo_table_connect_vertical_lines \
scribo_table_erase \
scribo_table_extract \
-scribo_table_extract_lines_with_opening \
-scribo_table_extract_lines_with_rank \
scribo_table_internal_align_lines \
scribo_table_internal_all \
scribo_table_internal_connect_lines \
@@ -53,7 +57,6 @@ scribo_table_repair_horizontal_lines \
scribo_table_repair_vertical_lines \
scribo_text_all \
scribo_text_clean \
-scribo_text_extract_bboxes \
scribo_text_extract_lines \
scribo_text_grouping_all \
scribo_text_grouping_group_from_double_link \
@@ -82,36 +85,42 @@ scribo_all_SOURCES = scribo_all.cc
scribo_binarization_simple_SOURCES = scribo_binarization_simple.cc
scribo_core_all_SOURCES = scribo_core_all.cc
scribo_core_central_sites_SOURCES = scribo_core_central_sites.cc
-scribo_core_component_bboxes_SOURCES = scribo_core_component_bboxes.cc
scribo_core_erase_bboxes_SOURCES = scribo_core_erase_bboxes.cc
scribo_core_macros_SOURCES = scribo_core_macros.cc
+scribo_core_object_image_SOURCES = scribo_core_object_image.cc
scribo_debug_all_SOURCES = scribo_debug_all.cc
scribo_debug_save_label_image_SOURCES = scribo_debug_save_label_image.cc
scribo_debug_save_linked_textbboxes_image_SOURCES = scribo_debug_save_linked_textbboxes_image.cc
scribo_debug_save_table_image_SOURCES = scribo_debug_save_table_image.cc
scribo_debug_save_textbboxes_image_SOURCES = scribo_debug_save_textbboxes_image.cc
+scribo_debug_usage_SOURCES = scribo_debug_usage.cc
scribo_demat_SOURCES = scribo_demat.cc
+scribo_demat_old_SOURCES = scribo_demat_old.cc
scribo_draw_all_SOURCES = scribo_draw_all.cc
scribo_draw_bounding_box_links_SOURCES = scribo_draw_bounding_box_links.cc
scribo_draw_bounding_boxes_SOURCES = scribo_draw_bounding_boxes.cc
+scribo_extract_lines_discontinued_SOURCES = scribo_extract_lines_discontinued.cc
scribo_extract_primitive_canvas_SOURCES = scribo_extract_primitive_canvas.cc
scribo_extract_primitive_cells_SOURCES = scribo_extract_primitive_cells.cc
scribo_extract_primitive_lines_discontinued_SOURCES = scribo_extract_primitive_lines_discontinued.cc
scribo_extract_primitive_lines_h_discontinued_SOURCES = scribo_extract_primitive_lines_h_discontinued.cc
+scribo_extract_primitive_lines_h_thick_SOURCES = scribo_extract_primitive_lines_h_thick.cc
scribo_extract_primitive_lines_thick_SOURCES = scribo_extract_primitive_lines_thick.cc
scribo_extract_primitive_lines_v_discontinued_SOURCES = scribo_extract_primitive_lines_v_discontinued.cc
+scribo_extract_primitive_lines_v_thick_SOURCES = scribo_extract_primitive_lines_v_thick.cc
scribo_extract_primitive_objects_SOURCES = scribo_extract_primitive_objects.cc
scribo_filter_all_SOURCES = scribo_filter_all.cc
-scribo_filter_large_components_SOURCES = scribo_filter_large_components.cc
-scribo_filter_small_components_SOURCES = scribo_filter_small_components.cc
-scribo_filter_thick_bboxes_SOURCES = scribo_filter_thick_bboxes.cc
-scribo_filter_thin_bboxes_SOURCES = scribo_filter_thin_bboxes.cc
+scribo_filter_large_objects_SOURCES = scribo_filter_large_objects.cc
+scribo_filter_small_objects_SOURCES = scribo_filter_small_objects.cc
+scribo_filter_thick_objects_SOURCES = scribo_filter_thick_objects.cc
+scribo_filter_thin_objects_SOURCES = scribo_filter_thin_objects.cc
scribo_make_all_SOURCES = scribo_make_all.cc
scribo_make_debug_filename_SOURCES = scribo_make_debug_filename.cc
scribo_make_influence_zone_graph_SOURCES = scribo_make_influence_zone_graph.cc
scribo_make_text_SOURCES = scribo_make_text.cc
scribo_preprocessing_all_SOURCES = scribo_preprocessing_all.cc
scribo_preprocessing_unskew_SOURCES = scribo_preprocessing_unskew.cc
+scribo_src_woot_SOURCES = scribo_src_woot.cc
scribo_table_align_lines_horizontaly_SOURCES = scribo_table_align_lines_horizontaly.cc
scribo_table_align_lines_verticaly_SOURCES = scribo_table_align_lines_verticaly.cc
scribo_table_all_SOURCES = scribo_table_all.cc
@@ -119,8 +128,6 @@ scribo_table_connect_horizontal_lines_SOURCES = scribo_table_connect_horizontal_
scribo_table_connect_vertical_lines_SOURCES = scribo_table_connect_vertical_lines.cc
scribo_table_erase_SOURCES = scribo_table_erase.cc
scribo_table_extract_SOURCES = scribo_table_extract.cc
-scribo_table_extract_lines_with_opening_SOURCES = scribo_table_extract_lines_with_opening.cc
-scribo_table_extract_lines_with_rank_SOURCES = scribo_table_extract_lines_with_rank.cc
scribo_table_internal_align_lines_SOURCES = scribo_table_internal_align_lines.cc
scribo_table_internal_all_SOURCES = scribo_table_internal_all.cc
scribo_table_internal_connect_lines_SOURCES = scribo_table_internal_connect_lines.cc
@@ -130,7 +137,6 @@ scribo_table_repair_horizontal_lines_SOURCES = scribo_table_repair_horizontal_li
scribo_table_repair_vertical_lines_SOURCES = scribo_table_repair_vertical_lines.cc
scribo_text_all_SOURCES = scribo_text_all.cc
scribo_text_clean_SOURCES = scribo_text_clean.cc
-scribo_text_extract_bboxes_SOURCES = scribo_text_extract_bboxes.cc
scribo_text_extract_lines_SOURCES = scribo_text_extract_lines.cc
scribo_text_grouping_all_SOURCES = scribo_text_grouping_all.cc
scribo_text_grouping_group_from_double_link_SOURCES = scribo_text_grouping_group_from_double_link.cc
diff --git a/scribo/text/clean.hh b/scribo/text/clean.hh
index c8fa552..7a11329 100644
--- a/scribo/text/clean.hh
+++ b/scribo/text/clean.hh
@@ -34,14 +34,28 @@
/// Improve the quality of a text area.
# include <mln/core/concept/weighted_window.hh>
+# include <mln/core/routine/extend.hh>
+
# include <mln/morpho/skeleton_constrained.hh>
+
# include <mln/topo/skeleton/is_simple_point.hh>
# include <mln/topo/skeleton/crest.hh>
# include <mln/logical/not.hh>
-//# include <mln/debug/filename.hh>
-//# include <mln/io/pbm/save.hh>
+# include <mln/world/binary_2d/enlarge.hh>
+
+# include <mln/debug/filename.hh>
+# include <mln/io/pbm/save.hh>
+
+#include <mln/labeling/wrap.hh>
+#include <mln/win/octagon2d.hh>
+
+#include <mln/arith/revert.hh>
+
+
+#include <mln/linear/gaussian.hh>
+#include <mln/value/int_u8.hh>
namespace scribo
{
@@ -57,7 +71,7 @@ namespace scribo
# ifndef MLN_INCLUDE_ONLY
-// static int plop = 0;
+ static int plop = 0;
template <typename I, typename W>
mln_concrete(I)
@@ -72,30 +86,41 @@ namespace scribo
mln_precondition(input.is_valid());
mln_precondition(dmap_win.is_valid());
+ I input_large = world::binary_2d::enlarge(input, 2);
+
+// image2d<bool> blur = linear::gaussian(input_large, 2);
+// image2d<value::int_u8> blur = linear::gaussian(level::convert(value::int_u8(), input_large), 2);
+// image2d<bool> blur = level::transform(linear::gaussian(level::convert(value::int_u8(), input_large), 2), fun::v2b::threshold<value::int_u8>(100));
+
mln_ch_value(I,unsigned)
- dmap = transform::distance_front(logical::not_(input), c8(),
+ dmap = transform::distance_front(logical::not_(input_large), c8(),
dmap_win,
mln_max(unsigned));
+// io::pgm::save(labeling::wrap(dmap), mln::debug::filename("dmap.pgm"));
- I constraint = topo::skeleton::crest(input, dmap, c8());
+// I skeleton = topo::skeleton::crest(input_large, dmap, c8());
+ I constraint = topo::skeleton::crest(input_large, dmap, c8());
mln_postcondition(constraint.is_valid());
+// io::pgm::save(labeling::wrap(constraint), mln::debug::filename("constraint.pgm"));
+
I skeleton =
- morpho::skeleton_constrained(input, c8(),
+ morpho::skeleton_constrained(input_large, c8(),
topo::skeleton::is_simple_point<I,neighb2d>,
- extend(constraint, false), dmap);
+ extend(constraint, false), arith::revert(dmap));
- win::rectangle2d disk(3,3);
+ win::octagon2d disk(7);
I output = morpho::dilation(skeleton, disk);
-// if (plop < 10)
-// {
+// if (plop > 20 && plop < 50)
+ {
// io::pbm::save(input, mln::debug::filename("input.pbm"));
+// io::pbm::save(input_large, mln::debug::filename("input_large_4x.pbm"));
// io::pbm::save(skeleton, mln::debug::filename("skeleton.pbm"));
// io::pbm::save(output, mln::debug::filename("dil_skel.pbm"));
-// ++plop;
-// }
+ }
+ ++plop;
trace::exiting("scribo::text::clean");
return output;
}
--
1.5.6.5
1
0
* src/Makefile.am,
* src/extract/Makefile.am,
* src/extract/primitive/Makefile.am,
* src/filter/Makefile.am,
* src/preprocessing/Makefile.am,
* src/table/Makefile.am: update build system.
* src/binarization/simple.cc,
* src/dmap.cc,
* src/extract_text_single_link.cc,
* src/recognition.cc:
Make them standalone programs
- Improve 'usage' output,
- cleanup includes
- add a header.
* src/extract/primitive/extract_discontinued_hlines.cc,
* src/extract/primitive/extract_discontinued_vlines.cc,
* src/extract/primitive/extract_thick_hlines.cc,
* src/extract/primitive/extract_thick_vlines.cc,
* src/filter/large_objects.cc,
* src/filter/small_objects.cc,
* src/filter/thick_objects.cc,
* src/filter/thin_objects.cc,
* src/negate.cc,
* src/preprocessing/unskew.cc,
* src/superpose.cc: new samples.
* src/table_erase.cc,
* src/table_extract.cc: move...
* src/table/erase.cc,
* src/table/extract.cc: ... here.
Make them standalone programs:
- Improve 'usage' output,
- cleanup includes
---
scribo/ChangeLog | 41 +++++++++++
scribo/src/Makefile.am | 18 +++---
scribo/src/binarization/simple.cc | 48 ++++++++++---
scribo/src/dmap.cc | 75 +++++++++++++++++--
scribo/src/extract/Makefile.am | 6 ++
scribo/src/extract/primitive/Makefile.am | 17 +++++
.../primitive/extract_discontinued_hlines.cc} | 59 ++++++++--------
.../primitive/extract_discontinued_vlines.cc} | 59 ++++++++--------
.../primitive/extract_thick_hlines.cc} | 54 ++++++++------
.../primitive/extract_thick_vlines.cc} | 54 ++++++++------
scribo/src/extract_text_single_link.cc | 28 ++++++--
scribo/src/filter/Makefile.am | 14 ++++
.../{table_erase.cc => filter/large_objects.cc} | 62 ++++++++--------
.../{table_erase.cc => filter/small_objects.cc} | 63 ++++++++--------
.../{table_erase.cc => filter/thick_objects.cc} | 63 ++++++++--------
.../src/{table_erase.cc => filter/thin_objects.cc} | 63 ++++++++--------
scribo/src/{table_extract.cc => negate.cc} | 44 +++++------
scribo/src/preprocessing/Makefile.am | 9 +++
.../{table_extract.cc => preprocessing/unskew.cc} | 45 +++++-------
scribo/src/recognition.cc | 73 +++++++++----------
scribo/src/{table_extract.cc => superpose.cc} | 49 +++++++------
scribo/src/table/Makefile.am | 11 +++
scribo/src/{table_erase.cc => table/erase.cc} | 49 ++++++++-----
scribo/src/{table_extract.cc => table/extract.cc} | 38 ++++++----
24 files changed, 628 insertions(+), 414 deletions(-)
create mode 100644 scribo/src/extract/Makefile.am
create mode 100644 scribo/src/extract/primitive/Makefile.am
copy scribo/src/{table_erase.cc => extract/primitive/extract_discontinued_hlines.cc} (58%)
copy scribo/src/{table_erase.cc => extract/primitive/extract_discontinued_vlines.cc} (58%)
copy scribo/src/{table_extract.cc => extract/primitive/extract_thick_hlines.cc} (59%)
copy scribo/src/{table_extract.cc => extract/primitive/extract_thick_vlines.cc} (59%)
create mode 100644 scribo/src/filter/Makefile.am
copy scribo/src/{table_erase.cc => filter/large_objects.cc} (57%)
copy scribo/src/{table_erase.cc => filter/small_objects.cc} (57%)
copy scribo/src/{table_erase.cc => filter/thick_objects.cc} (57%)
copy scribo/src/{table_erase.cc => filter/thin_objects.cc} (57%)
copy scribo/src/{table_extract.cc => negate.cc} (60%)
create mode 100644 scribo/src/preprocessing/Makefile.am
copy scribo/src/{table_extract.cc => preprocessing/unskew.cc} (60%)
copy scribo/src/{table_extract.cc => superpose.cc} (60%)
create mode 100644 scribo/src/table/Makefile.am
rename scribo/src/{table_erase.cc => table/erase.cc} (66%)
rename scribo/src/{table_extract.cc => table/extract.cc} (70%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index fae746e..7b25394 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,46 @@
2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Update samples in Scribo.
+
+ * src/Makefile.am,
+ * src/extract/Makefile.am,
+ * src/extract/primitive/Makefile.am,
+ * src/filter/Makefile.am,
+ * src/preprocessing/Makefile.am,
+ * src/table/Makefile.am: update build system.
+
+ * src/binarization/simple.cc,
+ * src/dmap.cc,
+ * src/extract_text_single_link.cc,
+ * src/recognition.cc:
+ Make them standalone programs
+ - Improve 'usage' output,
+ - cleanup includes
+ - add a header.
+
+ * src/extract/primitive/extract_discontinued_hlines.cc,
+ * src/extract/primitive/extract_discontinued_vlines.cc,
+ * src/extract/primitive/extract_thick_hlines.cc,
+ * src/extract/primitive/extract_thick_vlines.cc,
+ * src/filter/large_objects.cc,
+ * src/filter/small_objects.cc,
+ * src/filter/thick_objects.cc,
+ * src/filter/thin_objects.cc,
+ * src/negate.cc,
+ * src/preprocessing/unskew.cc,
+ * src/superpose.cc: new samples.
+
+ * src/table_erase.cc,
+ * src/table_extract.cc: move...
+
+ * src/table/erase.cc,
+ * src/table/extract.cc: ... here.
+ Make them standalone programs:
+ - Improve 'usage' output,
+ - cleanup includes
+
+2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Add new test images for Scribo.
* tests/img/table_to_be_repaired.pbm,
diff --git a/scribo/src/Makefile.am b/scribo/src/Makefile.am
index 72b202d..7d02f86 100644
--- a/scribo/src/Makefile.am
+++ b/scribo/src/Makefile.am
@@ -6,7 +6,9 @@ recognition_CXXFLAGS = -I$(HOME)/local/include $(HOME)/local/lib/libtesseract_fu
recognition_LDFLAGS = -lpthread
SUBDIRS = \
- binarization
+ binarization \
+ preprocessing \
+ table
bin_PROGRAMS = \
dmap \
@@ -17,13 +19,12 @@ bin_PROGRAMS = \
extract_text_several_left_links \
extract_text_single_link \
morpho \
+ negate \
recognition \
- table_erase \
- table_extract \
+ superpose \
table_rebuild_opening \
table_rebuild_rank \
- thin_bboxes \
- unskew
+ thin_bboxes
dmap_SOURCES = dmap.cc
extract_text_double_link_SOURCES = extract_text_double_link.cc
@@ -32,12 +33,11 @@ extract_text_graph_SOURCES = extract_text_graph.cc
extract_text_several_graph_SOURCES = extract_text_several_graph.cc
extract_text_several_left_links_SOURCES = extract_text_several_left_links.cc
extract_text_single_link_SOURCES = extract_text_single_link.cc
-morpho_SOURCES = morpho.cc
+morpho_SOURCES = morpho.cc
+negate_SOURCES = negate.cc
recognition_SOURCES = recognition.cc
-table_erase_SOURCES = table_erase.cc
-table_extract_SOURCES = table_extract.cc
+superpose_SOURCES = superpose.cc
table_rebuild_opening_SOURCES = table_rebuild_opening.cc
table_rebuild_rank_SOURCES = table_rebuild_rank.cc
thin_bboxes_SOURCES = thin_bboxes.cc
-unskew_SOURCES = unskew.cc
diff --git a/scribo/src/binarization/simple.cc b/scribo/src/binarization/simple.cc
index f738f43..77079e7 100644
--- a/scribo/src/binarization/simple.cc
+++ b/scribo/src/binarization/simple.cc
@@ -1,17 +1,46 @@
-#include <scribo/binarization/simple.hh>
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file scribo/src/binarization/simple.cc
+///
+/// Simple binarization in Scribo.
#include <mln/io/pgm/load.hh>
#include <mln/io/pbm/save.hh>
+#include <scribo/binarization/simple.hh>
+#include <scribo/debug/usage.hh>
-
-void usage(char* argv[])
+const char *args_desc[][2] =
{
- std::cerr << "usage: " << argv[0] << " input.pgm output.pbm" << std::endl
- << " Simple binarization in SCRIBO." << std::endl;
- std::abort();
-}
-
+ { "input.pgm", "A gray level image." },
+ {0, 0}
+};
int main(int argc, char *argv[])
@@ -20,7 +49,8 @@ int main(int argc, char *argv[])
using value::int_u8;
if (argc != 3)
- usage(argv);
+ return usage(argv, "Simple binarization of a gray-level image.", "input.pbm output.pbm",
+ args_desc, "A binary image.");
trace::entering("main");
diff --git a/scribo/src/dmap.cc b/scribo/src/dmap.cc
index 0375691..520bc92 100644
--- a/scribo/src/dmap.cc
+++ b/scribo/src/dmap.cc
@@ -1,26 +1,85 @@
-#include <mln/essential/2d.hh>
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file scribo/src/dmap.cc
+///
+/// Compute a distance map and an influence zone image.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
#include <mln/core/var.hh>
-#include <mln/fun/l2l/wrap.hh>
+
+#include <mln/labeling/blobs.hh>
+#include <mln/labeling/colorize.hh>
+#include <mln/labeling/wrap.hh>
+
#include <mln/transform/distance_and_influence_zone_geodesic.hh>
-int main(int, char *argv[])
+#include <mln/value/label_16.hh>
+#include <mln/value/rgb8.hh>
+
+#include <mln/io/pbm/load.hh>
+#include <mln/io/ppm/save.hh>
+#include <mln/io/pgm/save.hh>
+
+int usage(char* argv[])
+{
+ std::cerr << "usage: " << argv[0] << " input.pgm dmap.pgm iz.ppm"
+ << std::endl
+ << " Compute a distance map and an influence zone image."
+ << std::endl;
+ return 1;
+}
+
+
+int main(int argc, char *argv[])
{
using namespace mln;
- using value::int_u16;
using value::label_16;
- using value::label_8;
using value::rgb8;
+ if (argc != 4)
+ return usage(argv);
+
image2d<bool> ima;
io::pbm::load(ima, argv[1]);
label_16 nlabels;
image2d<label_16> lbl = labeling::blobs(ima, c8(), nlabels);
- mln_VAR(res, transform::distance_and_influence_zone_geodesic(lbl, c8(), mln_max(unsigned)));
+ mln_VAR(res,
+ transform::distance_and_influence_zone_geodesic(lbl,
+ c8(),
+ mln_max(unsigned)));
- io::pgm::save(level::transform(res.first(), fun::l2l::wrap<label_8>()), "dmap.pgm");
- io::ppm::save(labeling::colorize(value::rgb8(), res.second(), nlabels), "iz.ppm");
+ io::pgm::save(labeling::wrap(res.first()), argv[2]);
+ io::ppm::save(labeling::colorize(value::rgb8(), res.second(), nlabels),
+ argv[3]);
}
diff --git a/scribo/src/extract/Makefile.am b/scribo/src/extract/Makefile.am
new file mode 100644
index 0000000..3913680
--- /dev/null
+++ b/scribo/src/extract/Makefile.am
@@ -0,0 +1,6 @@
+## Process this file through Automake to create Makefile.in.
+
+include $(top_srcdir)/scribo/scribo.mk
+
+SUBDIRS = \
+ primitive
diff --git a/scribo/src/extract/primitive/Makefile.am b/scribo/src/extract/primitive/Makefile.am
new file mode 100644
index 0000000..4512d08
--- /dev/null
+++ b/scribo/src/extract/primitive/Makefile.am
@@ -0,0 +1,17 @@
+## Process this file through Automake to create Makefile.in.
+
+include $(top_srcdir)/scribo/scribo.mk
+
+
+bin_PROGRAMS = \
+ extract_discontinued_vlines \
+ extract_discontinued_hlines \
+ extract_thick_vlines \
+ extract_thick_hlines
+
+extract_discontinued_vlines_SOURCES = extract_discontinued_vlines.cc
+extract_discontinued_hlines_SOURCES = extract_discontinued_hlines.cc
+extract_thick_vlines_SOURCES = extract_thick_vlines.cc
+extract_thick_hlines_SOURCES = extract_thick_hlines.cc
+
+
diff --git a/scribo/src/table_erase.cc b/scribo/src/extract/primitive/extract_discontinued_hlines.cc
similarity index 58%
copy from scribo/src/table_erase.cc
copy to scribo/src/extract/primitive/extract_discontinued_hlines.cc
index 15cf880..6b7c3c4 100644
--- a/scribo/src/table_erase.cc
+++ b/scribo/src/extract/primitive/extract_discontinued_hlines.cc
@@ -1,4 +1,5 @@
// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,52 +26,50 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/extract/primitive/extract_discontinued_hlines.cc
+///
+/// Extract discontinued horizontal lines.
#include <mln/core/image/image2d.hh>
-#include <mln/io/pbm/load.hh>
-#include <mln/io/pbm/save.hh>
-#include <mln/io/dump/save.hh>
#include <mln/value/label_16.hh>
#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/all.hh>
+#include <mln/level/convert.hh>
-#include <scribo/table/extract.hh>
+#include <scribo/extract/primitive/lines_h_discontinued.hh>
+#include <scribo/debug/usage.hh>
-#include <scribo/primitive/lines_h_discontinued.hh>
-#include <scribo/primitive/lines_v_discontinued.hh>
-
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image." },
+ { "length", " Minimum line length." },
+ { "rank", " Filter rank." },
+ {0, 0}
+};
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
using namespace mln;
- using mln::value::label_16;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 5)
+ return usage(argv, "Extract discontinued horizontal lines", "input.pbm length rank output.pbm",
+ args_desc, "A binary image of horizontal lines.");
- scribo::make::internal::debug_filename_prefix = "table_erase";
+ trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
-
- typedef util::couple<util::array<box2d>,
- util::array<box2d> > tables_t;
- label_16 nhlines, nvlines;
- util::array<box2d> vlines, hlines;
- image2d<label_16> lbl_v = primitive::lines_v_discontinued(input, c8(),
- nvlines, 51, 8);
- image2d<label_16> lbl_h = primitive::lines_h_discontinued(input, c8(),
- nhlines, 51, 6);
+ value::label_16 nlines;
+ image2d<bool> lines
+ = level::convert(bool(),
+ scribo::extract::primitive::lines_h_discontinued(input,
+ c8(),
+ nlines,
+ atoi(argv[2]),
+ atoi(argv[3])));
+ io::pbm::save(lines, argv[4]);
- image2d<bool> input_notables = scribo::table::erase(input, tables);
- io::pbm::save(input_notables, scribo::make::debug_filename("input_notables.pbm"));
+ trace::exiting("main");
}
diff --git a/scribo/src/table_erase.cc b/scribo/src/extract/primitive/extract_discontinued_vlines.cc
similarity index 58%
copy from scribo/src/table_erase.cc
copy to scribo/src/extract/primitive/extract_discontinued_vlines.cc
index 15cf880..7bd3391 100644
--- a/scribo/src/table_erase.cc
+++ b/scribo/src/extract/primitive/extract_discontinued_vlines.cc
@@ -1,4 +1,5 @@
// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,52 +26,50 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/extract/primitive/extract_discontinued_vlines.cc
+///
+/// Extract discontinued vertical lines.
#include <mln/core/image/image2d.hh>
-#include <mln/io/pbm/load.hh>
-#include <mln/io/pbm/save.hh>
-#include <mln/io/dump/save.hh>
#include <mln/value/label_16.hh>
#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/all.hh>
+#include <mln/level/convert.hh>
-#include <scribo/table/extract.hh>
+#include <scribo/extract/primitive/lines_v_discontinued.hh>
+#include <scribo/debug/usage.hh>
-#include <scribo/primitive/lines_h_discontinued.hh>
-#include <scribo/primitive/lines_v_discontinued.hh>
-
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image." },
+ { "length", " Minimum line length." },
+ { "rank", " Filter rank." },
+ {0, 0}
+};
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
using namespace mln;
- using mln::value::label_16;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 5)
+ return usage(argv, "Extract discontinued vertical lines", "input.pbm length rank output.pbm",
+ args_desc, "A binary image of vertical lines.");
- scribo::make::internal::debug_filename_prefix = "table_erase";
+ trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
-
- typedef util::couple<util::array<box2d>,
- util::array<box2d> > tables_t;
- label_16 nhlines, nvlines;
- util::array<box2d> vlines, hlines;
- image2d<label_16> lbl_v = primitive::lines_v_discontinued(input, c8(),
- nvlines, 51, 8);
- image2d<label_16> lbl_h = primitive::lines_h_discontinued(input, c8(),
- nhlines, 51, 6);
+ value::label_16 nlines;
+ image2d<bool> lines
+ = level::convert(bool(),
+ scribo::extract::primitive::lines_v_discontinued(input,
+ c8(),
+ nlines,
+ atoi(argv[2]),
+ atoi(argv[3])));
+ io::pbm::save(lines, argv[4]);
- image2d<bool> input_notables = scribo::table::erase(input, tables);
- io::pbm::save(input_notables, scribo::make::debug_filename("input_notables.pbm"));
+ trace::exiting("main");
}
diff --git a/scribo/src/table_extract.cc b/scribo/src/extract/primitive/extract_thick_hlines.cc
similarity index 59%
copy from scribo/src/table_extract.cc
copy to scribo/src/extract/primitive/extract_thick_hlines.cc
index b184e53..dfc8038 100644
--- a/scribo/src/table_extract.cc
+++ b/scribo/src/extract/primitive/extract_thick_hlines.cc
@@ -1,4 +1,5 @@
// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,43 +26,48 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/extract/primitive/extract_thick_hlines.cc
+///
+/// Extract thick horizontal lines.
-#include <mln/essential/2d.hh>
-#include <mln/io/dump/save.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/value/label_16.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/all.hh>
+#include <mln/level/convert.hh>
-#include <scribo/table/extract.hh>
+#include <scribo/extract/primitive/lines_h_thick.hh>
+#include <scribo/debug/usage.hh>
-
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image." },
+ { "length", " Minimum line length." },
+ {0, 0}
+};
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
using namespace mln;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 4)
+ return usage(argv, "Extract thick horizontal lines", "input.pbm length output.pbm",
+ args_desc, "A binary image of horizontal lines.");
- scribo::make::internal::debug_filename_prefix = argv[0];
+ trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
-
- trace::quiet = false;
-
- value::label_16 ncells;
- image2d<value::label_16> tables = scribo::table::extract(input, ncells).first();
- std::cout << "ncells (including background) = " << ncells << std::endl;
- io::ppm::save(mln::labeling::colorize(value::rgb8(), tables, ncells),
- scribo::make::debug_filename("table_cells.ppm"));
+ value::label_16 nlines;
+ image2d<bool> lines
+ = level::convert(bool(),
+ scribo::extract::primitive::lines_h_thick(input,
+ c8(),
+ nlines,
+ atoi(argv[2])));
+ io::pbm::save(lines, argv[3]);
- io::dump::save(tables, scribo::make::debug_filename("table_cells.dump"));
+ trace::exiting("main");
}
diff --git a/scribo/src/table_extract.cc b/scribo/src/extract/primitive/extract_thick_vlines.cc
similarity index 59%
copy from scribo/src/table_extract.cc
copy to scribo/src/extract/primitive/extract_thick_vlines.cc
index b184e53..dd20126 100644
--- a/scribo/src/table_extract.cc
+++ b/scribo/src/extract/primitive/extract_thick_vlines.cc
@@ -1,4 +1,5 @@
// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,43 +26,48 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/extract/primitive/extract_thick_vlines.cc
+///
+/// Extract thick vertical lines.
-#include <mln/essential/2d.hh>
-#include <mln/io/dump/save.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/value/label_16.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/all.hh>
+#include <mln/level/convert.hh>
-#include <scribo/table/extract.hh>
+#include <scribo/extract/primitive/lines_v_thick.hh>
+#include <scribo/debug/usage.hh>
-
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image." },
+ { "length", " Minimum line length." },
+ {0, 0}
+};
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
using namespace mln;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 4)
+ return usage(argv, "Extract thick vertical lines", "input.pbm length output.pbm",
+ args_desc, "A binary image of vertical lines.");
- scribo::make::internal::debug_filename_prefix = argv[0];
+ trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
-
- trace::quiet = false;
-
- value::label_16 ncells;
- image2d<value::label_16> tables = scribo::table::extract(input, ncells).first();
- std::cout << "ncells (including background) = " << ncells << std::endl;
- io::ppm::save(mln::labeling::colorize(value::rgb8(), tables, ncells),
- scribo::make::debug_filename("table_cells.ppm"));
+ value::label_16 nlines;
+ image2d<bool> lines
+ = level::convert(bool(),
+ scribo::extract::primitive::lines_v_thick(input,
+ c8(),
+ nlines,
+ atoi(argv[2])));
+ io::pbm::save(lines, argv[3]);
- io::dump::save(tables, scribo::make::debug_filename("table_cells.dump"));
+ trace::exiting("main");
}
diff --git a/scribo/src/extract_text_single_link.cc b/scribo/src/extract_text_single_link.cc
index 55e5068..4b361a0 100644
--- a/scribo/src/extract_text_single_link.cc
+++ b/scribo/src/extract_text_single_link.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,9 +25,23 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
+/// \file scribo/src/extract_text_single_link.cc
+///
+/// Extract text lines objects using a single left link grouping method.
+
#include <iostream>
-#include <mln/essential/2d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+
+#include <mln/labeling/colorize.hh>
+
+#include <mln/util/array.hh>
+
+#include <mln/value/label_16.hh>
+#include <mln/literal/colors.hh>
+
+#include <mln/io/pbm/load.hh>
#include <scribo/text/extract_bboxes.hh>
#include <scribo/text/grouping/group_with_single_left_link.hh>
@@ -38,19 +52,21 @@
#include <scribo/debug/save_linked_textbboxes_image.hh>
#include <scribo/make/debug_filename.hh>
-int usage(const char *name)
+
+int usage(char *argv[])
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
+ std::cout << "Usage: " << argv[0] << " <input.pbm> " << std::endl;
return 1;
}
+
int main(int argc, char* argv[])
{
using namespace scribo;
using namespace mln;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 2)
+ return usage(argv);
scribo::make::internal::debug_filename_prefix = "extract_text_single_link";
diff --git a/scribo/src/filter/Makefile.am b/scribo/src/filter/Makefile.am
new file mode 100644
index 0000000..9ebacf3
--- /dev/null
+++ b/scribo/src/filter/Makefile.am
@@ -0,0 +1,14 @@
+## Process this file through Automake to create Makefile.in.
+
+include $(top_srcdir)/scribo/scribo.mk
+
+bin_PROGRAMS = \
+ large_objects \
+ small_objects \
+ thick_objects \
+ thin_objects
+
+large_objects_SOURCES = large_objects.cc
+small_objects_SOURCES = small_objects.cc
+thick_objects_SOURCES = thick_objects.cc
+thin_objects_SOURCES = thin_objects.cc
diff --git a/scribo/src/table_erase.cc b/scribo/src/filter/large_objects.cc
similarity index 57%
copy from scribo/src/table_erase.cc
copy to scribo/src/filter/large_objects.cc
index 15cf880..f986c67 100644
--- a/scribo/src/table_erase.cc
+++ b/scribo/src/filter/large_objects.cc
@@ -1,4 +1,5 @@
// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,52 +26,51 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/filter/large_objects.cc
+///
+/// Filter too large objects.
#include <mln/core/image/image2d.hh>
-#include <mln/io/pbm/load.hh>
-#include <mln/io/pbm/save.hh>
-#include <mln/io/dump/save.hh>
-#include <mln/value/label_16.hh>
#include <mln/core/alias/neighb2d.hh>
+#include <mln/level/convert.hh>
+#include <mln/io/pbm/all.hh>
-#include <scribo/table/extract.hh>
+#include <mln/value/label_16.hh>
-#include <scribo/primitive/lines_h_discontinued.hh>
-#include <scribo/primitive/lines_v_discontinued.hh>
+#include <scribo/filter/large_objects.hh>
+#include <scribo/debug/usage.hh>
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image. 'True' for objects, 'False'\
+for the background." },
+ { "max_area", "The maximum object area value. Objects with an area greater\
+than this value are removed." },
+ {0, 0}
+};
-
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
using namespace mln;
- using mln::value::label_16;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 4)
+ return usage(argv, "Filter too large objects", "input.pbm max_area output.pbm",
+ args_desc, "A binary image.");
- scribo::make::internal::debug_filename_prefix = "table_erase";
+ trace::entering("main");
- image2d<bool> input;
+ typedef image2d<bool> I;
+ I input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
- typedef util::couple<util::array<box2d>,
- util::array<box2d> > tables_t;
+ value::label_16 nobjects;
+ typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
+ obj_ima_t objects
+ = scribo::extract::primitive::objects(input, c8(), nobjects);
+
+ obj_ima_t filtered = scribo::filter::large_objects(objects, atoi(argv[2]));
+ io::pbm::save(level::convert(bool(), filtered), argv[3]);
- label_16 nhlines, nvlines;
- util::array<box2d> vlines, hlines;
- image2d<label_16> lbl_v = primitive::lines_v_discontinued(input, c8(),
- nvlines, 51, 8);
- image2d<label_16> lbl_h = primitive::lines_h_discontinued(input, c8(),
- nhlines, 51, 6);
+ trace::exiting("main");
- image2d<bool> input_notables = scribo::table::erase(input, tables);
- io::pbm::save(input_notables, scribo::make::debug_filename("input_notables.pbm"));
}
diff --git a/scribo/src/table_erase.cc b/scribo/src/filter/small_objects.cc
similarity index 57%
copy from scribo/src/table_erase.cc
copy to scribo/src/filter/small_objects.cc
index 15cf880..8fe9e1b 100644
--- a/scribo/src/table_erase.cc
+++ b/scribo/src/filter/small_objects.cc
@@ -1,4 +1,5 @@
// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,52 +26,50 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/filter/small_objects.cc
+///
+/// Filter too small objects.
#include <mln/core/image/image2d.hh>
-#include <mln/io/pbm/load.hh>
-#include <mln/io/pbm/save.hh>
-#include <mln/io/dump/save.hh>
-#include <mln/value/label_16.hh>
#include <mln/core/alias/neighb2d.hh>
+#include <mln/level/convert.hh>
+#include <mln/io/pbm/all.hh>
+#include <mln/value/label_16.hh>
-#include <scribo/table/extract.hh>
-
-#include <scribo/primitive/lines_h_discontinued.hh>
-#include <scribo/primitive/lines_v_discontinued.hh>
+#include <scribo/filter/small_objects.hh>
+#include <scribo/debug/usage.hh>
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
-
+ { "input.pbm", "A binary image. 'True' for objects, 'False'\
+for the background." },
+ { "min_area", "The minimum object area value. Objects with an area less than \
+or equal to this value are removed." },
+ {0, 0}
+};
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
using namespace mln;
- using mln::value::label_16;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 4)
+ return usage(argv, "Filter too small objects", "input.pbm min_area output.pbm",
+ args_desc, "A binary image.");
- scribo::make::internal::debug_filename_prefix = "table_erase";
+ trace::entering("main");
- image2d<bool> input;
+ typedef image2d<bool> I;
+ I input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
- typedef util::couple<util::array<box2d>,
- util::array<box2d> > tables_t;
+ value::label_16 nobjects;
+ typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
+ obj_ima_t objects
+ = scribo::extract::primitive::objects(input, c8(), nobjects);
+
+ obj_ima_t filtered = scribo::filter::small_objects(objects, atoi(argv[2]));
+ io::pbm::save(level::convert(bool(), filtered), argv[3]);
- label_16 nhlines, nvlines;
- util::array<box2d> vlines, hlines;
- image2d<label_16> lbl_v = primitive::lines_v_discontinued(input, c8(),
- nvlines, 51, 8);
- image2d<label_16> lbl_h = primitive::lines_h_discontinued(input, c8(),
- nhlines, 51, 6);
+ trace::exiting("main");
- image2d<bool> input_notables = scribo::table::erase(input, tables);
- io::pbm::save(input_notables, scribo::make::debug_filename("input_notables.pbm"));
}
diff --git a/scribo/src/table_erase.cc b/scribo/src/filter/thick_objects.cc
similarity index 57%
copy from scribo/src/table_erase.cc
copy to scribo/src/filter/thick_objects.cc
index 15cf880..e09ef60 100644
--- a/scribo/src/table_erase.cc
+++ b/scribo/src/filter/thick_objects.cc
@@ -1,4 +1,5 @@
// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,52 +26,50 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/filter/thick_objects.cc
+///
+/// Filter too thick objects.
#include <mln/core/image/image2d.hh>
-#include <mln/io/pbm/load.hh>
-#include <mln/io/pbm/save.hh>
-#include <mln/io/dump/save.hh>
-#include <mln/value/label_16.hh>
#include <mln/core/alias/neighb2d.hh>
+#include <mln/level/convert.hh>
+#include <mln/io/pbm/all.hh>
+#include <mln/value/label_16.hh>
-#include <scribo/table/extract.hh>
-
-#include <scribo/primitive/lines_h_discontinued.hh>
-#include <scribo/primitive/lines_v_discontinued.hh>
+#include <scribo/filter/thick_objects.hh>
+#include <scribo/debug/usage.hh>
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
-
+ { "input.pbm", "A binary image. 'True' for objects, 'False'\
+for the background." },
+ { "max_thick", "The maximum object thickness value. Objects with bounding\
+box hight or width higher than this value are removed." },
+ {0, 0}
+};
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
using namespace mln;
- using mln::value::label_16;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 4)
+ return usage(argv, "Filter too thick objects", "input.pbm max_thick output.pbm",
+ args_desc, "A binary image.");
- scribo::make::internal::debug_filename_prefix = "table_erase";
+ trace::entering("main");
- image2d<bool> input;
+ typedef image2d<bool> I;
+ I input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
- typedef util::couple<util::array<box2d>,
- util::array<box2d> > tables_t;
+ value::label_16 nobjects;
+ typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
+ obj_ima_t objects
+ = scribo::extract::primitive::objects(input, c8(), nobjects);
+
+ obj_ima_t filtered = scribo::filter::thick_objects(objects, atoi(argv[2]));
+ io::pbm::save(level::convert(bool(), filtered), argv[3]);
- label_16 nhlines, nvlines;
- util::array<box2d> vlines, hlines;
- image2d<label_16> lbl_v = primitive::lines_v_discontinued(input, c8(),
- nvlines, 51, 8);
- image2d<label_16> lbl_h = primitive::lines_h_discontinued(input, c8(),
- nhlines, 51, 6);
+ trace::exiting("main");
- image2d<bool> input_notables = scribo::table::erase(input, tables);
- io::pbm::save(input_notables, scribo::make::debug_filename("input_notables.pbm"));
}
diff --git a/scribo/src/table_erase.cc b/scribo/src/filter/thin_objects.cc
similarity index 57%
copy from scribo/src/table_erase.cc
copy to scribo/src/filter/thin_objects.cc
index 15cf880..138d9f5 100644
--- a/scribo/src/table_erase.cc
+++ b/scribo/src/filter/thin_objects.cc
@@ -1,4 +1,5 @@
// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,52 +26,50 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/filter/thin_objects.cc
+///
+/// Filter too thin objects.
#include <mln/core/image/image2d.hh>
-#include <mln/io/pbm/load.hh>
-#include <mln/io/pbm/save.hh>
-#include <mln/io/dump/save.hh>
-#include <mln/value/label_16.hh>
#include <mln/core/alias/neighb2d.hh>
+#include <mln/level/convert.hh>
+#include <mln/io/pbm/all.hh>
+#include <mln/value/label_16.hh>
-#include <scribo/table/extract.hh>
-
-#include <scribo/primitive/lines_h_discontinued.hh>
-#include <scribo/primitive/lines_v_discontinued.hh>
+#include <scribo/filter/thin_objects.hh>
+#include <scribo/debug/usage.hh>
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
-
+ { "input.pbm", "A binary image. 'True' for objects, 'False'\
+for the background." },
+ { "min_thin", "The minimum object thinness value. Objects with bounding\
+box hight or width less than or equal to this value are removed." },
+ {0, 0}
+};
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
using namespace mln;
- using mln::value::label_16;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 4)
+ return usage(argv, "Filter too thin objects", "input.pbm min_thin output.pbm",
+ args_desc, "A binary image.");
- scribo::make::internal::debug_filename_prefix = "table_erase";
+ trace::entering("main");
- image2d<bool> input;
+ typedef image2d<bool> I;
+ I input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
- typedef util::couple<util::array<box2d>,
- util::array<box2d> > tables_t;
+ value::label_16 nobjects;
+ typedef object_image(mln_ch_value_(I,value::label_16)) obj_ima_t;
+ obj_ima_t objects
+ = scribo::extract::primitive::objects(input, c8(), nobjects);
+
+ obj_ima_t filtered = scribo::filter::thin_objects(objects, atoi(argv[2]));
+ io::pbm::save(level::convert(bool(), filtered), argv[3]);
- label_16 nhlines, nvlines;
- util::array<box2d> vlines, hlines;
- image2d<label_16> lbl_v = primitive::lines_v_discontinued(input, c8(),
- nvlines, 51, 8);
- image2d<label_16> lbl_h = primitive::lines_h_discontinued(input, c8(),
- nhlines, 51, 6);
+ trace::exiting("main");
- image2d<bool> input_notables = scribo::table::erase(input, tables);
- io::pbm::save(input_notables, scribo::make::debug_filename("input_notables.pbm"));
}
diff --git a/scribo/src/table_extract.cc b/scribo/src/negate.cc
similarity index 60%
copy from scribo/src/table_extract.cc
copy to scribo/src/negate.cc
index b184e53..4761759 100644
--- a/scribo/src/table_extract.cc
+++ b/scribo/src/negate.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,43 +25,39 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/negate.cc
+///
+/// Negate a binary image.
-#include <mln/essential/2d.hh>
-#include <mln/io/dump/save.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/logical/not.hh>
+#include <mln/io/pbm/all.hh>
-#include <scribo/table/extract.hh>
+#include <scribo/debug/usage.hh>
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image." },
+ {0, 0}
+};
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
+ mln::trace::entering("main");
using namespace mln;
- if (argc < 1)
- return usage(argv[0]);
-
- scribo::make::internal::debug_filename_prefix = argv[0];
+ if (argc != 3)
+ return usage(argv, "Negate a binary image", "input.pbm output.pbm",
+ args_desc, "A binary image.");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
- trace::quiet = false;
+ io::pbm::save(logical::not_(input), argv[2]);
- value::label_16 ncells;
- image2d<value::label_16> tables = scribo::table::extract(input, ncells).first();
+ mln::trace::exiting("main");
- std::cout << "ncells (including background) = " << ncells << std::endl;
- io::ppm::save(mln::labeling::colorize(value::rgb8(), tables, ncells),
- scribo::make::debug_filename("table_cells.ppm"));
-
- io::dump::save(tables, scribo::make::debug_filename("table_cells.dump"));
}
+
diff --git a/scribo/src/preprocessing/Makefile.am b/scribo/src/preprocessing/Makefile.am
new file mode 100644
index 0000000..903e076
--- /dev/null
+++ b/scribo/src/preprocessing/Makefile.am
@@ -0,0 +1,9 @@
+## Process this file through Automake to create Makefile.in.
+
+include $(top_srcdir)/scribo/scribo.mk
+
+bin_PROGRAMS = \
+ unskew
+
+unskew_SOURCES = unskew.cc
+
diff --git a/scribo/src/table_extract.cc b/scribo/src/preprocessing/unskew.cc
similarity index 60%
copy from scribo/src/table_extract.cc
copy to scribo/src/preprocessing/unskew.cc
index b184e53..716ceb6 100644
--- a/scribo/src/table_extract.cc
+++ b/scribo/src/preprocessing/unskew.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,43 +25,38 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/unskew.cc
+///
+/// Unskew a binary document.
-#include <mln/essential/2d.hh>
-#include <mln/io/dump/save.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/io/pbm/all.hh>
-#include <scribo/table/extract.hh>
+#include <scribo/preprocessing/unskew.hh>
+#include <scribo/debug/usage.hh>
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image. 'True' for objects, 'false' for background." },
+ {0, 0}
+};
+
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
+ mln::trace::entering("main");
using namespace mln;
- if (argc < 1)
- return usage(argv[0]);
-
- scribo::make::internal::debug_filename_prefix = argv[0];
+ if (argc != 3)
+ return usage(argv, "Unskew a binary image", "input.pbm output.pbm",
+ args_desc, "A binary image.");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
-
- trace::quiet = false;
-
- value::label_16 ncells;
- image2d<value::label_16> tables = scribo::table::extract(input, ncells).first();
- std::cout << "ncells (including background) = " << ncells << std::endl;
- io::ppm::save(mln::labeling::colorize(value::rgb8(), tables, ncells),
- scribo::make::debug_filename("table_cells.ppm"));
+ io::pbm::save(scribo::preprocessing::unskew(input), argv[2]);
- io::dump::save(tables, scribo::make::debug_filename("table_cells.dump"));
+ mln::trace::exiting("main");
}
diff --git a/scribo/src/recognition.cc b/scribo/src/recognition.cc
index 4c270f5..8bac8d2 100644
--- a/scribo/src/recognition.cc
+++ b/scribo/src/recognition.cc
@@ -25,45 +25,41 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
+/// \file scribo/src/recognition.cc
+///
+/// Text extraction and recognition.
+
#include <iostream>
#include <mln/core/image/image2d.hh>
-#include <mln/labeling/colorize.hh>
-#include <mln/labeling/wrap.hh>
-
-#include <mln/util/timer.hh>
#include <mln/util/array.hh>
#include <mln/io/txt/save.hh>
#include <mln/io/pbm/load.hh>
-#include <mln/io/ppm/save.hh>
-#include <mln/io/pgm/save.hh>
#include <mln/value/label_16.hh>
#include <mln/core/alias/neighb2d.hh>
-#include <scribo/text/extract_bboxes.hh>
+#include <scribo/extract/primitive/objects.hh>
+
#include <scribo/text/grouping/group_with_several_left_links.hh>
#include <scribo/text/grouping/group_with_several_right_links.hh>
-#include <scribo/debug/save_linked_textbboxes_image.hh>
#include <scribo/text/grouping/group_from_double_link.hh>
-#include <scribo/filter/small_components.hh>
-#include <scribo/filter/thin_bboxes.hh>
+#include <scribo/filter/small_objects.hh>
+#include <scribo/filter/thin_objects.hh>
#include <scribo/text/recognition.hh>
-#include <scribo/debug/save_textbboxes_image.hh>
-#include <scribo/make/debug_filename.hh>
+#include <scribo/debug/usage.hh>
-#include <scribo/preprocessing/unskew.hh>
-
-
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> <output.txt>" << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image. 'True' for objects, 'False'\
+for the background." },
+ {0, 0}
+};
+
int main(int argc, char* argv[])
@@ -71,36 +67,35 @@ int main(int argc, char* argv[])
using namespace scribo;
using namespace mln;
- if (argc < 3)
- return usage(argv[0]);
+ if (argc != 2)
+ return usage(argv, "Text extraction and recognition", "input.pbm",
+ args_desc, "The text is printed on the standard output.");
- scribo::make::internal::debug_filename_prefix = argv[2];
+ trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- input = preprocessing::unskew(input);
-
/// Extract text.
+ typedef mln_ch_value_(image2d<bool>,value::label_16) lbl_t;
value::label_16 nbboxes;
- scribo::util::text<image2d<value::label_16> > text
- = text::extract_bboxes(input, c8(), nbboxes);
- text = filter::small_components(text,4);
- text = filter::thin_bboxes(text,2);
+ object_image(lbl_t)
+ objects = scribo::extract::primitive::objects(input, c8(), nbboxes);
+
+ /// Filter non interesting objects
+ objects = filter::small_objects(objects, 4);
+ objects = filter::thin_objects<lbl_t>(objects, 2);
+
+ /// Group objects.
mln::util::array<unsigned> left_link
- = text::grouping::group_with_several_left_links(text, 30);
+ = text::grouping::group_with_several_left_links<lbl_t>(objects, 30);
mln::util::array<unsigned> right_link
- = text::grouping::group_with_several_right_links(text, 30);
- text = text::grouping::group_from_double_link(text, left_link, right_link);
-
- io::ppm::save(mln::labeling::colorize(value::rgb8(),
- labeling::wrap(text.label_image())),
- scribo::make::debug_filename("lbl_color.ppm"));
- io::pgm::save(labeling::wrap(text.label_image()),
- scribo::make::debug_filename("lbl.pgm"));
+ = text::grouping::group_with_several_right_links(objects, 30);
+ objects = text::grouping::group_from_double_link(objects, left_link, right_link);
- image2d<char> ima_txt = scribo::text::recognition(text, "fra");
+ /// Try to recognize text in grouped objects.
+ scribo::text::recognition(objects, "fra");
- io::txt::save(ima_txt, argv[2]);
+ trace::exiting("main");
}
diff --git a/scribo/src/table_extract.cc b/scribo/src/superpose.cc
similarity index 60%
copy from scribo/src/table_extract.cc
copy to scribo/src/superpose.cc
index b184e53..2e1cfce 100644
--- a/scribo/src/table_extract.cc
+++ b/scribo/src/superpose.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,43 +25,44 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <iostream>
+/// \file scribo/src/superpose.cc
+///
+/// Superpose two binary images.
-#include <mln/essential/2d.hh>
-#include <mln/io/dump/save.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/debug/superpose.hh>
+#include <mln/logical/not.hh>
+#include <mln/io/pbm/all.hh>
+#include <mln/io/ppm/save.hh>
-#include <scribo/table/extract.hh>
+#include <scribo/debug/usage.hh>
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image." },
+ { "data.pbm", "A binary image." },
+ {0, 0}
+};
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
+ mln::trace::entering("main");
using namespace mln;
- if (argc < 1)
- return usage(argv[0]);
-
- scribo::make::internal::debug_filename_prefix = argv[0];
+ if (argc != 4)
+ return usage(argv, "Superpose two binary images", "input.pbm data.pbm output.ppm",
+ args_desc, "A color image. Data from 'data.pbm' is colored in red.");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
- trace::quiet = false;
+ image2d<bool> data;
+ io::pbm::load(data, argv[2]);
- value::label_16 ncells;
- image2d<value::label_16> tables = scribo::table::extract(input, ncells).first();
+ io::ppm::save(debug::superpose(input, data), argv[3]);
- std::cout << "ncells (including background) = " << ncells << std::endl;
- io::ppm::save(mln::labeling::colorize(value::rgb8(), tables, ncells),
- scribo::make::debug_filename("table_cells.ppm"));
-
- io::dump::save(tables, scribo::make::debug_filename("table_cells.dump"));
+ mln::trace::exiting("main");
}
+
diff --git a/scribo/src/table/Makefile.am b/scribo/src/table/Makefile.am
new file mode 100644
index 0000000..2575429
--- /dev/null
+++ b/scribo/src/table/Makefile.am
@@ -0,0 +1,11 @@
+## Process this file through Automake to create Makefile.in.
+
+include $(top_srcdir)/scribo/scribo.mk
+
+bin_PROGRAMS = \
+ erase \
+ extract
+
+erase_SOURCES = erase.cc
+extract_SOURCES = extract.cc
+
diff --git a/scribo/src/table_erase.cc b/scribo/src/table/erase.cc
similarity index 66%
rename from scribo/src/table_erase.cc
rename to scribo/src/table/erase.cc
index 15cf880..dd9a21d 100644
--- a/scribo/src/table_erase.cc
+++ b/scribo/src/table/erase.cc
@@ -36,14 +36,18 @@
#include <scribo/table/extract.hh>
-#include <scribo/primitive/lines_h_discontinued.hh>
-#include <scribo/primitive/lines_v_discontinued.hh>
+#include <scribo/extract/primitive/lines_h_discontinued.hh>
+#include <scribo/extract/primitive/lines_v_discontinued.hh>
-int usage(const char *name)
+#include <scribo/debug/usage.hh>
+
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image. 'True' for objects, 'False'\
+for the background." },
+ {0, 0}
+};
+
int main(int argc, char* argv[])
@@ -52,25 +56,30 @@ int main(int argc, char* argv[])
using namespace mln;
using mln::value::label_16;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 3)
+ return usage(argv, "Remove tables from a binary image.",
+ "input.pbm output.pbm",
+ args_desc, "A binary image without tables.");
- scribo::make::internal::debug_filename_prefix = "table_erase";
+ trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
- typedef util::couple<util::array<box2d>,
- util::array<box2d> > tables_t;
+ typedef image2d<label_16> lbl_t;
label_16 nhlines, nvlines;
- util::array<box2d> vlines, hlines;
- image2d<label_16> lbl_v = primitive::lines_v_discontinued(input, c8(),
- nvlines, 51, 8);
- image2d<label_16> lbl_h = primitive::lines_h_discontinued(input, c8(),
- nhlines, 51, 6);
-
- image2d<bool> input_notables = scribo::table::erase(input, tables);
- io::pbm::save(input_notables, scribo::make::debug_filename("input_notables.pbm"));
+ object_image(lbl_t)
+ lbl_v = extract::primitive::lines_v_discontinued(input, c8(),
+ nvlines, 51, 8);
+ object_image(lbl_t)
+ lbl_h = extract::primitive::lines_h_discontinued(input, c8(),
+ nhlines, 51, 6);
+
+ image2d<bool> input_notables
+ = scribo::table::erase(input,
+ mln::make::couple(lbl_v.bboxes(),lbl_h.bboxes()));
+ io::pbm::save(input_notables, argv[2]);
+
+ trace::exiting("main");
}
diff --git a/scribo/src/table_extract.cc b/scribo/src/table/extract.cc
similarity index 70%
rename from scribo/src/table_extract.cc
rename to scribo/src/table/extract.cc
index b184e53..7e3b57d 100644
--- a/scribo/src/table_extract.cc
+++ b/scribo/src/table/extract.cc
@@ -27,17 +27,25 @@
#include <iostream>
-#include <mln/essential/2d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/io/ppm/save.hh>
#include <mln/io/dump/save.hh>
+#include <mln/value/label_16.hh>
+#include <mln/labeling/colorize.hh>
+#include <mln/value/rgb8.hh>
#include <scribo/table/extract.hh>
+#include <scribo/debug/usage.hh>
-int usage(const char *name)
+const char *args_desc[][2] =
{
- std::cout << "Usage: " << name << " <input.pbm> " << std::endl;
- return 1;
-}
+ { "input.pbm", "A binary image. 'True' for objects, 'False'\
+for the background." },
+ { "output.dump", "A label image stored as milena dump image." },
+ {0, 0}
+};
int main(int argc, char* argv[])
@@ -45,23 +53,23 @@ int main(int argc, char* argv[])
using namespace scribo;
using namespace mln;
- if (argc < 1)
- return usage(argv[0]);
+ if (argc != 4)
+ return usage(argv, "Extract tables from a binary image.",
+ "input.pbm output.dump output.ppm",
+ args_desc, "A color images. 'White' color means \
+the background, other colors indicates cells.");
- scribo::make::internal::debug_filename_prefix = argv[0];
+ trace::entering("main");
image2d<bool> input;
io::pbm::load(input, argv[1]);
- logical::not_inplace(input);
-
- trace::quiet = false;
value::label_16 ncells;
image2d<value::label_16> tables = scribo::table::extract(input, ncells).first();
- std::cout << "ncells (including background) = " << ncells << std::endl;
- io::ppm::save(mln::labeling::colorize(value::rgb8(), tables, ncells),
- scribo::make::debug_filename("table_cells.ppm"));
+ io::ppm::save(mln::labeling::colorize(value::rgb8(), tables, ncells), argv[3]);
+
+ io::dump::save(tables, argv[2]);
- io::dump::save(tables, scribo::make::debug_filename("table_cells.dump"));
+ trace::exiting("main");
}
--
1.5.6.5
1
0
* tests/img/table_to_be_repaired.pbm,
* tests/img/table_to_be_repaired2.pbm,
* tests/img/table_to_be_repaired3.pbm,
* tests/img/text_to_group.pbm,
* tests/img/text_to_group_and_clean.pbm: new.
---
scribo/ChangeLog | 10 ++++++++++
scribo/tests/img/table_to_be_repaired.pbm | Bin 0 -> 528 bytes
scribo/tests/img/table_to_be_repaired2.pbm | Bin 0 -> 528 bytes
scribo/tests/img/table_to_be_repaired3.pbm | 4 ++++
scribo/tests/img/text_to_group.pbm | Bin 0 -> 448 bytes
scribo/tests/img/text_to_group_and_clean.pbm | Bin 0 -> 448 bytes
6 files changed, 14 insertions(+), 0 deletions(-)
create mode 100644 scribo/tests/img/table_to_be_repaired.pbm
create mode 100644 scribo/tests/img/table_to_be_repaired2.pbm
create mode 100644 scribo/tests/img/table_to_be_repaired3.pbm
create mode 100644 scribo/tests/img/text_to_group.pbm
create mode 100644 scribo/tests/img/text_to_group_and_clean.pbm
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index b1540a0..fae746e 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,15 @@
2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Add new test images for Scribo.
+
+ * tests/img/table_to_be_repaired.pbm,
+ * tests/img/table_to_be_repaired2.pbm,
+ * tests/img/table_to_be_repaired3.pbm,
+ * tests/img/text_to_group.pbm,
+ * tests/img/text_to_group_and_clean.pbm: new.
+
+2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Improve and fix tests in Scribo.
* tests/filter/small_and_large_bboxes.cc: add real tests.
diff --git a/scribo/tests/img/table_to_be_repaired.pbm b/scribo/tests/img/table_to_be_repaired.pbm
new file mode 100644
index 0000000000000000000000000000000000000000..2ffc8ac567d72a11e0d796037cad2e984e25055c
GIT binary patch
literal 528
zcmWGA;Zjy`4svx2@ei_6aQE~LPzdnzRdCD9DM>9-2um$0&dkqKFw`^TGBZ#xGvNCF
h|Nn=2ARb0E&@2BxFfcIGg9t)2NHGu$C;y|wCjesRsa^m8
literal 0
HcmV?d00001
diff --git a/scribo/tests/img/table_to_be_repaired2.pbm b/scribo/tests/img/table_to_be_repaired2.pbm
new file mode 100644
index 0000000000000000000000000000000000000000..18976ef51f16f26b60155cd9fb884b12ebe6b1f4
GIT binary patch
literal 528
zcmWGA;Zjy`4svx2@ei_6aQE~LPzdnzRdCD9DM>9-2um$0&dkqKFw`^TGBZ#xGvNCF
u|Nn=2Af^@Fz`$StGM^AlMf-t9{r|wgz)%k&2+<(LKmhUogJDJk{RIHmww4C~
literal 0
HcmV?d00001
diff --git a/scribo/tests/img/table_to_be_repaired3.pbm b/scribo/tests/img/table_to_be_repaired3.pbm
new file mode 100644
index 0000000..98bb82b
--- /dev/null
+++ b/scribo/tests/img/table_to_be_repaired3.pbm
@@ -0,0 +1,4 @@
+P4
+# CREATOR: GIMP PNM Filter Version 1.1
+60 60
+ÿÿÿÿÿÿÿðÿÿÿÿÿÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿüÿÿðÿÿÿüÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿñÿÿÿðÿÿÿñÿÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿÿÿÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿÿÿÿÿðÿÿÿÿÿÿÿðÿÿÿðÿÿÿðÿÿÿðÿÿÿðÿÿÿðÿÿÿðÿÿÿðÿÿÿðÿÿÿÿÿÿÿðÿÿÿñÿÿÿðÿÿÿñÿÿÿðÿÿÿÿÿÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿüÿÿðÿÿÿüÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿóÿÿðÿÿÿóÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿñÿÿÿðÿÿÿñÿÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿðÿÿðÿÿÿöÿÿðÿÿÿöÿÿðÿÿÿðÿÿðÿÿÿÿÿÿÿðÿÿÿÿÿÿÿð
\ No newline at end of file
diff --git a/scribo/tests/img/text_to_group.pbm b/scribo/tests/img/text_to_group.pbm
new file mode 100644
index 0000000000000000000000000000000000000000..1d91af4d33bcbdd594a855e6e0438879001c4542
GIT binary patch
literal 448
zcmWGA;Zjy`4svx2@ei_6aQE~LPzdnzRdCD9DM>9-2um$0&dkqKFw`^TGBZ#xHQ@RW
z0Urj6ZV+H%aNuD4u>bn6|M9Q?l1;<RA=MuZ^8Xm>e*o>j|L=eOZ=n5T(lB#KwI5wQ
E09P|}>;M1&
literal 0
HcmV?d00001
diff --git a/scribo/tests/img/text_to_group_and_clean.pbm b/scribo/tests/img/text_to_group_and_clean.pbm
new file mode 100644
index 0000000000000000000000000000000000000000..0df913e5493783a2724f38ced7839dd1186a9c9c
GIT binary patch
literal 448
zcmWGA;Zjy`4svx2@ei_6aQE~LPzdnzRdCD9DM>9-2um$0&dkqKFw`^TGBZ#xHQ@RW
z0Uyxm#~=au{~yq4gt{LfCQu(b4OW3+9zq|ge1iZJg98WShyB-o{f~eBmuwnl4la9e
pi8sjqW2pZDwEzCU|MkCt_LE7&%)w<3Li|rXkPQqUbQ-MU0|4oqZ(0BV
literal 0
HcmV?d00001
--
1.5.6.5
1
0
* tests/filter/small_and_large_bboxes.cc: add real tests.
* tests/table/extract_lines_with_rank.cc: update routine calls.
* tests/table/repair_lines.cc: replace 'essential' include.
---
scribo/ChangeLog | 10 +++++
scribo/tests/filter/small_and_large_bboxes.cc | 45 +++++++++++++++---------
scribo/tests/table/extract_lines_with_rank.cc | 44 ++++++++++++++++++------
scribo/tests/table/repair_lines.cc | 9 ++++-
4 files changed, 79 insertions(+), 29 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 05ca9d5..b1540a0 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,15 @@
2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Improve and fix tests in Scribo.
+
+ * tests/filter/small_and_large_bboxes.cc: add real tests.
+
+ * tests/table/extract_lines_with_rank.cc: update routine calls.
+
+ * tests/table/repair_lines.cc: replace 'essential' include.
+
+2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Cleanup object filters in Scribo.
* filter/large_components.hh,
diff --git a/scribo/tests/filter/small_and_large_bboxes.cc b/scribo/tests/filter/small_and_large_bboxes.cc
index 98fbcd7..ddd5b70 100644
--- a/scribo/tests/filter/small_and_large_bboxes.cc
+++ b/scribo/tests/filter/small_and_large_bboxes.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -27,7 +27,12 @@
#include <iostream>
-#include <mln/essential/2d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/util/graph.hh>
+#include <mln/value/label_16.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/literal/colors.hh>
#include <scribo/text/extract_bboxes.hh>
#include <scribo/text/grouping/group_with_graph.hh>
@@ -56,7 +61,7 @@ int main(int argc, char* argv[])
if (argc < 2)
{
usage(argv[0]);
- img = SCRIBO_IMG_DIR "/text_to_group.pbm";
+ img = SCRIBO_IMG_DIR "/text_to_group_and_clean.pbm";
}
else
img = argv[1];
@@ -72,27 +77,33 @@ int main(int argc, char* argv[])
mln::util::graph g = text::grouping::group_with_graph(textbboxes, 30);
- std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
- scribo::debug::save_linked_textbboxes_image(input,
- textbboxes, g,
- literal::red, literal::cyan,
- "test_graph_left_linked.ppm");
+
+ mln_assertion(nbboxes == 12u);
+// std::cout << "BEFORE - nbboxes = " << nbboxes << std::endl;
+// scribo::debug::save_linked_textbboxes_image(input,
+// textbboxes, g,
+// literal::red, literal::cyan,
+// "test_graph_left_linked.ppm");
text_t grouped_textbboxes
= text::grouping::group_from_graph(textbboxes, g);
- std::cout << "AFTER - nbboxes = " << grouped_textbboxes.nbboxes().next() << std::endl;
+// std::cout << "AFTER - nbboxes = " << grouped_textbboxes.nbboxes().next() << std::endl;
+//
+// scribo::debug::save_textbboxes_image(input, grouped_textbboxes.bboxes(),
+// literal::red,
+// "test_graph_grouped_text.ppm");
+
+ mln_assertion(grouped_textbboxes.nbboxes() == 6u);
- scribo::debug::save_textbboxes_image(input, grouped_textbboxes.bboxes(),
- literal::red,
- "test_graph_grouped_text.ppm");
+ text_t
+ filtered_textbboxes = scribo::filter::small_components(grouped_textbboxes, 20);
- text_t filtered_textbboxes
- = scribo::filter::small_components(grouped_textbboxes, 6);
+ mln_assertion(filtered_textbboxes.nbboxes() == 2u);
- scribo::debug::save_textbboxes_image(input, filtered_textbboxes.bboxes(),
- literal::red,
- "test_graph_filtered_text.ppm");
+// scribo::debug::save_textbboxes_image(input, filtered_textbboxes.bboxes(),
+// literal::red,
+// "test_graph_filtered_text.ppm");
}
diff --git a/scribo/tests/table/extract_lines_with_rank.cc b/scribo/tests/table/extract_lines_with_rank.cc
index 16e8066..436cc7e 100644
--- a/scribo/tests/table/extract_lines_with_rank.cc
+++ b/scribo/tests/table/extract_lines_with_rank.cc
@@ -26,10 +26,25 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <mln/essential/2d.hh>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/box2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/util/array.hh>
#include <mln/util/couple.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/value/label_8.hh>
+#include <mln/win/vline2d.hh>
+#include <mln/win/hline2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+
+#include <mln/literal/colors.hh>
+
+#include <mln/io/pgm/save.hh>
+
+#include <scribo/extract/primitive/lines_h_discontinued.hh>
+#include <scribo/extract/primitive/lines_v_discontinued.hh>
-#include <scribo/primitive/discontinued_lines.hh>
#include <scribo/debug/save_table_image.hh>
#include <scribo/tests/data.hh>
@@ -53,18 +68,25 @@ int main(int argc, char *argv[])
vboxes,
hboxes;
vboxes.append(make::box2d(0,0, 59,59));
- vboxes.append(make::box2d(0,28, 27, 32));
- vboxes.append(make::box2d(31,28, 59,32));
+ vboxes.append(make::box2d(0,28, 25, 32));
+ vboxes.append(make::box2d(33,28, 59,32));
hboxes.append(make::box2d(0,0, 59,59));
- hboxes.append(make::box2d(27,0, 31, 26));
- hboxes.append(make::box2d(27,34, 31,59));
+ hboxes.append(make::box2d(27,0, 31, 24));
+ hboxes.append(make::box2d(27,36, 31,59));
+
+ value::label_8 nbboxes;
- value::label_16 nbboxes;
+ lineboxes_t hboxes_, vboxes_;
- lineboxes_t hboxes_ = scribo::primitive::discontinued_lines(input, c8(),
- nbboxes, win::hline2d(11), 2);
- lineboxes_t vboxes_ = scribo::primitive::discontinued_lines(input, c8(),
- nbboxes, win::vline2d(11), 2);
+ typedef image2d<value::label_8> lbl_t;
+ lbl_t
+ hlbl = scribo::extract::primitive::lines_h_discontinued(input, c8(),
+ nbboxes, 11, 2,
+ hboxes_);
+ lbl_t
+ vlbl = scribo::extract::primitive::lines_v_discontinued(input, c8(),
+ nbboxes, 11, 2,
+ vboxes_);
mln_assertion(hboxes_ == hboxes);
mln_assertion(vboxes_ == vboxes);
}
diff --git a/scribo/tests/table/repair_lines.cc b/scribo/tests/table/repair_lines.cc
index ff7e92f..995d52b 100644
--- a/scribo/tests/table/repair_lines.cc
+++ b/scribo/tests/table/repair_lines.cc
@@ -26,8 +26,15 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <mln/essential/2d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/box2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/util/array.hh>
#include <mln/util/couple.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/value/label_16.hh>
+#include <mln/win/vline2d.hh>
+#include <mln/win/hline2d.hh>
#include <scribo/table/repair_vertical_lines.hh>
#include <scribo/table/repair_horizontal_lines.hh>
--
1.5.6.5
1
0
* filter/large_components.hh,
* filter/small_components.hh,
* filter/thick_bboxes.hh,
* filter/thin_bboxes.hh: Move...
* filter/large_objects.hh,
* filter/small_objects.hh,
* filter/thick_objects.hh,
* filter/thin_objects.hh: ... here. Make use of labeled_image type and
cleanup comments.
---
scribo/ChangeLog | 15 +++
scribo/filter/large_components.hh | 214 -----------------------------------
scribo/filter/large_objects.hh | 198 +++++++++++++++++++++++++++++++++
scribo/filter/small_components.hh | 222 -------------------------------------
scribo/filter/small_objects.hh | 217 ++++++++++++++++++++++++++++++++++++
scribo/filter/thick_bboxes.hh | 204 ----------------------------------
scribo/filter/thick_objects.hh | 191 +++++++++++++++++++++++++++++++
scribo/filter/thin_bboxes.hh | 200 ---------------------------------
scribo/filter/thin_objects.hh | 191 +++++++++++++++++++++++++++++++
9 files changed, 812 insertions(+), 840 deletions(-)
delete mode 100644 scribo/filter/large_components.hh
create mode 100644 scribo/filter/large_objects.hh
delete mode 100644 scribo/filter/small_components.hh
create mode 100644 scribo/filter/small_objects.hh
delete mode 100644 scribo/filter/thick_bboxes.hh
create mode 100644 scribo/filter/thick_objects.hh
delete mode 100644 scribo/filter/thin_bboxes.hh
create mode 100644 scribo/filter/thin_objects.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 0c8eae6..05ca9d5 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,20 @@
2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Cleanup object filters in Scribo.
+
+ * filter/large_components.hh,
+ * filter/small_components.hh,
+ * filter/thick_bboxes.hh,
+ * filter/thin_bboxes.hh: Move...
+
+ * filter/large_objects.hh,
+ * filter/small_objects.hh,
+ * filter/thick_objects.hh,
+ * filter/thin_objects.hh: ... here. Make use of labeled_image type and
+ cleanup comments.
+
+2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Make use of labeled_image type in Scribo.
* text/extract_bboxes.hh,
diff --git a/scribo/filter/large_components.hh b/scribo/filter/large_components.hh
deleted file mode 100644
index c3ea79b..0000000
--- a/scribo/filter/large_components.hh
+++ /dev/null
@@ -1,214 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef SCRIBO_FILTER_LARGE_COMPONENTS_HH
-# define SCRIBO_FILTER_LARGE_COMPONENTS_HH
-
-/// \file scribo/filter/large_components.hh
-///
-/// Remove large components in a binary image.
-
-
-# include <mln/core/concept/image.hh>
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/concept/function.hh>
-
-# include <mln/labeling/blobs.hh>
-# include <mln/labeling/relabel.hh>
-
-# include <mln/util/array.hh>
-# include <mln/value/label_16.hh>
-
-# include <mln/pw/all.hh>
-
-# include <scribo/make/text.hh>
-
-namespace scribo
-{
-
- namespace filter
- {
-
- using namespace mln;
-
-
- /// Remove large components in a binary image.
- /// Set to 'false' all the removed components.
- ///
- /// \param[in] input_ A binary image.
- /// \param[in] nbh_ A neighborhood used for labeling \p input_.
- /// \param[in] label_type The label type used for labeling.
- /// \param[in] max_size The minimum cardinality of a component.
- ///
- /// \return A binary image without large components.
- template <typename I, typename N, typename V>
- mln_concrete(I)
- large_components(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- const V& label_type,
- unsigned max_size);
-
- /// Remove too large text components.
- ///
- /// \param[in] text Text data.
- /// \param[in] min_size The minimum cardinality of a component.
- ///
- /// \return updated text data.
- template <typename I>
- scribo::util::text<I>
- large_components(const scribo::util::text<I>& text,
- unsigned min_size);
-
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- namespace internal
- {
-
-
- /// Filter Functor.
- /// Return false for all components which are too large.
- template <typename R>
- struct filter_large_components_functor
- : Function_l2b< filter_large_components_functor<R> >
- {
-
- /// Constructor
- ///
- /// \param[in] compbboxes Component bounding boxes.
- /// \param[in] max_size Maximum component size.
- filter_large_components_functor(const mln::util::array<R>& compbboxes,
- unsigned max_size)
- : compbboxes_(compbboxes), max_size_(max_size)
- {
- }
-
-
- /// Check if the component is large enough.
- ///
- /// \param l A label.
- ///
- /// \return false if the component area is strictly inferion to
- /// \p max_size_.
- bool operator()(const value::label_16& l) const
- {
- return compbboxes_[l] <= max_size_;
- }
-
-
- /// The component bounding boxes.
- const mln::util::array<R>& compbboxes_;
- /// The maximum area.
- unsigned max_size_;
- };
-
-
- } // end of namespace scribo::filter::internal
-
-
-
- template <typename I, typename N, typename V>
- inline
- mln_concrete(I)
- large_components(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- const V& label_type,
- unsigned max_size)
- {
- trace::entering("scribo::filter::large_components");
-
- const I& input = exact(input_);
- const N& nbh = exact(nbh_);
-
- mln_precondition(input.is_valid());
- mln_precondition(nbh.is_valid());
-
- V nlabels;
- mln_ch_value(I,V) lbl = labeling::blobs(input, nbh, nlabels);
-
- typedef accu::count<mln_psite(I)> accu_count_t;
- typedef mln_result(accu_count_t) accu_count_res_t;
- typedef mln::util::array<accu_count_res_t> nsitecomp_t;
- nsitecomp_t nsitecomp = labeling::compute(accu_count_t(), lbl, nlabels);
-
- typedef internal::filter_large_components_functor<accu_count_res_t> func_t;
- func_t fl2b(nsitecomp, max_size);
- labeling::relabel_inplace(lbl, nlabels, fl2b);
-
- mln_concrete(I) output = duplicate(input);
- data::fill((output | pw::value(lbl) == literal::zero).rw(), false);
-
- trace::exiting("scribo::filter::large_components");
- return output;
- }
-
-
- template <typename I>
- inline
- scribo::util::text<I>
- large_components(const scribo::util::text<I>& text,
- unsigned max_size)
- {
- trace::entering("scribo::filter::large_components");
-
- mln_precondition(text.is_valid());
-
- typedef mln_site(I) P;
- typedef accu::count<P> accu_count_t;
- typedef mln_result(accu_count_t) accu_count_res_t;
- typedef mln::util::array<accu_count_res_t> nsitecomp_t;
-
- fun::i2v::array<bool> f(text.nbboxes().next(), false);
- f(0) = true;
- mln::util::array<box<P> > bresult;
- bresult.append(box<P>());
- for_all_components(i, text.bboxes())
- {
- accu_count_res_t count = set::compute(accu_count_t(), text.bbox(i));
- if (count <= max_size)
- {
- bresult.append(text.bbox(i));
- f(i) = true;
- }
- }
-
- util::text<I> output = scribo::make::text(text, f);
-
- trace::exiting("scribo::filter::large_components");
- return output;
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::filter
-
-} // end of namespace scribo
-
-#endif // ! SCRIBO_FILTER_LARGE_COMPONENTS_HH
diff --git a/scribo/filter/large_objects.hh b/scribo/filter/large_objects.hh
new file mode 100644
index 0000000..16e50c6
--- /dev/null
+++ b/scribo/filter/large_objects.hh
@@ -0,0 +1,198 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef SCRIBO_FILTER_LARGE_OBJECTS_HH
+# define SCRIBO_FILTER_LARGE_OBJECTS_HH
+
+/// \file scribo/filter/large_objects.hh
+///
+/// Remove large objects in a binary image.
+
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+# include <mln/core/concept/function.hh>
+
+# include <mln/labeling/compute.hh>
+# include <mln/accu/count.hh>
+
+# include <mln/util/array.hh>
+
+# include <mln/pw/all.hh>
+
+# include <scribo/core/object_image.hh>
+# include <scribo/extract/primitive/objects.hh>
+
+namespace scribo
+{
+
+ namespace filter
+ {
+
+ using namespace mln;
+
+
+ /// Remove large objects in a binary image.
+ /// Set to 'false' all the removed objects.
+ ///
+ /// \param[in] input_ A binary image.
+ /// \param[in] nbh_ A neighborhood used for labeling \p input_.
+ /// \param[in] label_type The label type used for labeling.
+ /// \param[in] max_size The minimum cardinality of an object.
+ ///
+ /// \return A binary image without large objects.
+ template <typename I, typename N, typename V>
+ mln_concrete(I)
+ large_objects(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ const V& label_type,
+ unsigned max_size);
+
+ /// Remove too large text objects.
+ ///
+ /// \param[in] objects An object image.
+ /// \param[in] max_size The minimum cardinality of an object.
+ ///
+ /// \return updated text data.
+ template <typename L>
+ object_image(L)
+ large_objects(const object_image(L)& objects,
+ unsigned max_size);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ namespace internal
+ {
+
+
+ /// Filter Functor.
+ /// Return false for all objects which are too large.
+ template <typename L>
+ struct large_objects_filter
+ : Function_v2b< large_objects_filter<L> >
+ {
+
+ typedef accu::count<mln_psite(L)> card_t;
+
+ /// Constructor
+ ///
+ /// \param[in] compbboxes Component bounding boxes.
+ /// \param[in] max_size Maximum object size.
+ large_objects_filter(const object_image(L)& objects,
+ unsigned max_size)
+ {
+ card_ = labeling::compute(card_t(), objects, objects.nlabels());
+ max_size_ = max_size;
+ }
+
+
+ /// Check if the object is large enough.
+ ///
+ /// \param l A label.
+ ///
+ /// \return false if the object area is strictly inferior to
+ /// \p max_size_.
+ bool operator()(const mln_value(L)& l) const
+ {
+ return card_[l] <= max_size_;
+ }
+
+
+ /// The object bounding boxes.
+ mln::util::array<mln_result(card_t)> card_;
+ /// The maximum area.
+ unsigned max_size_;
+ };
+
+
+ } // end of namespace scribo::filter::internal
+
+
+
+ template <typename I, typename N, typename V>
+ inline
+ mln_concrete(I)
+ large_objects(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ const V& label_type,
+ unsigned max_size)
+ {
+ trace::entering("scribo::filter::large_objects");
+
+ const I& input = exact(input_);
+ const N& nbh = exact(nbh_);
+
+ mln_precondition(input.is_valid());
+ mln_precondition(nbh.is_valid());
+
+ V nlabels;
+ typedef object_image(mln_ch_value(I,V)) lbl_t;
+ lbl_t lbl = extract::primitive::objects(input, nbh, nlabels);
+
+ typedef internal::large_objects_filter<lbl_t> func_t;
+ func_t fv2b(lbl, max_size);
+ labeling::relabel_inplace(lbl, nlabels, fv2b);
+
+ mln_concrete(I) output = duplicate(input);
+ data::fill((output | pw::value(lbl) == literal::zero).rw(), false);
+
+ trace::exiting("scribo::filter::large_objects");
+ return output;
+ }
+
+
+ template <typename L>
+ inline
+ object_image(L)
+ large_objects(const object_image(L)& objects,
+ unsigned max_size)
+ {
+ trace::entering("scribo::filter::large_objects");
+
+ mln_precondition(objects.is_valid());
+
+ internal::large_objects_filter<L> f(objects, max_size);
+
+ object_image(L) output;
+ output.init_from_(objects);
+ output.relabel(f);
+
+ trace::exiting("scribo::filter::large_objects");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::filter
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_FILTER_LARGE_OBJECTS_HH
diff --git a/scribo/filter/small_components.hh b/scribo/filter/small_components.hh
deleted file mode 100644
index c28772b..0000000
--- a/scribo/filter/small_components.hh
+++ /dev/null
@@ -1,222 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef SCRIBO_FILTER_SMALL_COMPONENTS_HH
-# define SCRIBO_FILTER_SMALL_COMPONENTS_HH
-
-/// \file scribo/filter/small_components.hh
-///
-/// Remove small components in a binary image.
-
-
-# include <mln/core/concept/image.hh>
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/concept/function.hh>
-
-# include <mln/labeling/blobs.hh>
-# include <mln/labeling/relabel.hh>
-
-# include <mln/make/relabelfun.hh>
-
-# include <mln/util/array.hh>
-
-# include <mln/pw/all.hh>
-
-# include <mln/accu/count.hh>
-
-# include <mln/set/compute.hh>
-
-# include <scribo/util/text.hh>
-# include <scribo/make/text.hh>
-
-
-namespace scribo
-{
-
- namespace filter
- {
-
- using namespace mln;
-
-
- /// Remove small components in a binary image.
- /// Set to 'false' all the removed components.
- ///
- /// \param[in] input_ A binary image.
- /// \param[in] nbh_ A neighborhood used for labeling \p input_.
- /// \param[in] label_type The label type used for labeling.
- /// \param[in] min_size The minimum cardinality of a component.
- ///
- /// \return A binary image without small components.
- template <typename I, typename N, typename V>
- mln_concrete(I)
- small_components(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- const V& label_type,
- unsigned min_size);
-
-
- /// Remove too small text components.
- ///
- /// \param[in] text Text data.
- /// \param[in] min_size The minimum cardinality of a component.
- ///
- /// \return Lines of text without too small components.
- template <typename I>
- scribo::util::text<I>
- small_components(const scribo::util::text<I>& text,
- unsigned min_size);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- namespace internal
- {
-
-
- /// Filter Functor.
- /// Return false for all components which are too small.
- template <typename B>
- struct filter_small_components_functor
- : Function_v2b< filter_small_components_functor<B> >
- {
-
- /// Constructor
- ///
- /// \param[in] compbboxes Component bounding boxes.
- /// \param[in] min_size Minimum component size.
- filter_small_components_functor(const mln::util::array<B>& compbboxes,
- unsigned min_size)
- : compbboxes_(compbboxes), min_size_(min_size)
- {
- }
-
-
- /// Check if the component is large enough.
- ///
- /// \param l A label.
- ///
- /// \return false if the component area is strictly inferion to
- /// \p min_size_.
- template <typename L>
- bool operator()(const L& l) const
- {
- return compbboxes_[l] >= min_size_;
- }
-
- /// The component bounding boxes.
- const mln::util::array<B>& compbboxes_;
-
- /// The minimum area.
- unsigned min_size_;
- };
-
-
- } // end of namespace scribo::filter::internal
-
-
-
- template <typename I, typename N, typename V>
- inline
- mln_concrete(I)
- small_components(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- const V& label_type,
- unsigned min_size)
- {
- trace::entering("scribo::filter::small_components");
-
- const I& input = exact(input_);
- const N& nbh = exact(nbh_);
-
- mln_precondition(input.is_valid());
- mln_precondition(nbh.is_valid());
-
- V nlabels;
- mln_ch_value(I,V) lbl = labeling::blobs(input, nbh, nlabels);
-
- typedef accu::count<mln_psite(I)> accu_count_t;
- typedef mln_result(accu_count_t) accu_count_res_t;
- typedef mln::util::array<accu_count_res_t> compbboxes_t;
- compbboxes_t compbboxes = labeling::compute(accu_count_t(), lbl, nlabels);
-
- typedef internal::filter_small_components_functor<accu_count_res_t> func_t;
- func_t fv2b(compbboxes, min_size);
- labeling::relabel_inplace(lbl, nlabels, fv2b);
-
- mln_concrete(I) output = duplicate(input);
- data::fill((output | pw::value(lbl) == literal::zero).rw(), false);
-
- trace::exiting("scribo::filter::small_components");
- return output;
- }
-
-
- template <typename L>
- inline
- scribo::util::text<L>
- small_components(const scribo::util::text<L>& text,
- unsigned min_size)
- {
- trace::entering("scribo::filter::small_components");
-
- mln_precondition(text.is_valid());
-
- typedef mln_site(L) P;
- typedef accu::count<P> accu_count_t;
- typedef mln_result(accu_count_t) accu_count_res_t;
- typedef mln::util::array<accu_count_res_t> nsitecomp_t;
-
- fun::i2v::array<bool> f(text.nbboxes().next(), false);
- f(0) = true;
- mln::util::array<box<P> > bresult;
- bresult.append(box<P>());
- for_all_components(i, text.bboxes())
- {
- accu_count_res_t count = set::compute(accu_count_t(), text.bbox(i));
- if (count >= min_size)
- {
- bresult.append(text.bbox(i));
- f(i) = true;
- }
- }
-
- util::text<L> output = scribo::make::text(text, f);
-
- trace::exiting("scribo::filter::small_components");
- return output;
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::filter
-
-} // end of namespace scribo
-
-#endif // ! SCRIBO_FILTER_SMALL_COMPONENTS_HH
diff --git a/scribo/filter/small_objects.hh b/scribo/filter/small_objects.hh
new file mode 100644
index 0000000..0b7844e
--- /dev/null
+++ b/scribo/filter/small_objects.hh
@@ -0,0 +1,217 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef SCRIBO_FILTER_SMALL_OBJECTS_HH
+# define SCRIBO_FILTER_SMALL_OBJECTS_HH
+
+/// \file scribo/filter/small_objects.hh
+///
+/// Remove small objects in a binary image.
+
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+# include <mln/core/concept/function.hh>
+
+# include <mln/labeling/blobs.hh>
+# include <mln/labeling/relabel.hh>
+
+# include <mln/make/relabelfun.hh>
+
+# include <mln/util/array.hh>
+
+# include <mln/pw/all.hh>
+
+# include <mln/accu/count.hh>
+
+# include <mln/set/compute.hh>
+
+# include <scribo/core/object_image.hh>
+# include <scribo/extract/primitive/objects.hh>
+
+
+//forward declaration.
+namespace mln
+{
+ namespace accu
+ {
+ template <typename T> struct count;
+ }
+}
+
+namespace scribo
+{
+
+ namespace filter
+ {
+
+ using namespace mln;
+
+
+ /// Remove small objects in a binary image.
+ /// Set to 'false' all the removed objects.
+ ///
+ /// \param[in] input_ A binary image.
+ /// \param[in] nbh_ A neighborhood used for labeling \p input_.
+ /// \param[in] label_type The label type used for labeling.
+ /// \param[in] min_size The minimum cardinality of an object.
+ ///
+ /// \return A binary image without small objects.
+ template <typename I, typename N, typename V>
+ mln_concrete(I)
+ small_objects(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ const V& label_type,
+ unsigned min_size);
+
+
+ /// Remove too small objects.
+ ///
+ /// \param[in] objects An object image.
+ /// \param[in] min_size The minimum cardinality of an object.
+ ///
+ /// \return An object image without small objects.
+ template <typename L>
+ object_image(L)
+ small_objects(const object_image(L)& objects,
+ unsigned min_size);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ namespace internal
+ {
+
+
+ /// Filter Functor.
+ /// Return false for all objects which are too small.
+ template <typename L>
+ struct small_objects_filter
+ : Function_v2b< small_objects_filter<L> >
+ {
+ typedef accu::count<mln_psite(L)> card_t;
+
+ /// Constructor
+ ///
+ /// \param[in] objects Component bounding boxes.
+ /// \param[in] min_size Minimum component size.
+ //
+ small_objects_filter(const object_image(L)& objects,
+ unsigned min_size)
+ {
+ card_ = labeling::compute(card_t(), objects, objects.nlabels());
+ min_size_ = min_size;
+ }
+
+
+ /// Check if the component is large enough.
+ ///
+ /// \param l A label.
+ ///
+ /// \return false if the component area is strictly inferion to
+ /// \p min_size_.
+ //
+ bool operator()(const mln_value(L)& l) const
+ {
+ if (l == literal::zero)
+ return true;
+ return card_[l] >= min_size_;
+ }
+
+ /// The component bounding boxes.
+ mln::util::array<mln_result(card_t)> card_;
+
+ /// The minimum area.
+ unsigned min_size_;
+ };
+
+
+ } // end of namespace scribo::filter::internal
+
+
+
+ template <typename I, typename N, typename V>
+ inline
+ mln_concrete(I)
+ small_objects(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ const V& label_type,
+ unsigned min_size)
+ {
+ trace::entering("scribo::filter::small_objects");
+
+ const I& input = exact(input_);
+ const N& nbh = exact(nbh_);
+
+ mln_precondition(input.is_valid());
+ mln_precondition(nbh.is_valid());
+
+ V nlabels;
+ typedef object_image(mln_ch_value(I,V)) lbl_t;
+ lbl_t lbl = extract::primitive::objects(input, nbh, nlabels);
+
+ typedef internal::small_objects_filter<lbl_t> func_t;
+ func_t fv2b(lbl, min_size);
+ labeling::relabel_inplace(lbl, nlabels, fv2b);
+
+ mln_concrete(I) output = duplicate(input);
+ data::fill((output | pw::value(lbl) == literal::zero).rw(), false);
+
+ trace::exiting("scribo::filter::small_objects");
+ return output;
+ }
+
+
+ template <typename L>
+ inline
+ object_image(L)
+ small_objects(const object_image(L)& objects,
+ unsigned min_size)
+ {
+ trace::entering("scribo::filter::small_objects");
+
+ mln_precondition(objects.is_valid());
+
+ internal::small_objects_filter<L> f(objects, min_size);
+
+ object_image(L) output;
+ output.init_from_(objects);
+ output.relabel(f);
+
+ trace::exiting("scribo::filter::small_objects");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::filter
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_FILTER_SMALL_OBJECTS_HH
diff --git a/scribo/filter/thick_bboxes.hh b/scribo/filter/thick_bboxes.hh
deleted file mode 100644
index 9f717b3..0000000
--- a/scribo/filter/thick_bboxes.hh
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef SCRIBO_FILTER_THICK_BBOXES_HH
-# define SCRIBO_FILTER_THICK_BBOXES_HH
-
-/// \file scribo/filter/thick_bboxes.hh
-///
-/// Remove too thick bboxes.
-
-# include <mln/labeling/blobs.hh>
-# include <mln/labeling/compute.hh>
-# include <mln/util/array.hh>
-
-# include <scribo/util/text.hh>
-
-# include <scribo/make/text.hh>
-
-
-namespace scribo
-{
-
- namespace filter
- {
-
- /// Remove components thicker or equal to \p max_thickness.
- ///
- /// \param[in] input_ A binary image.
- /// \param[in] nbh_ A neighborhood used in labeling algorithms.
- /// \param[in] label_type The label type used for labeling.
- /// \param[in] max_thickness The maximum thickness value.
- ///
- /// \result A binary image without thick components.
- template <typename I, typename N, typename V>
- inline
- mln_concrete(I)
- thick_bboxes(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- const V& label_type,
- unsigned max_thickness);
-
-
- /// Remove lines of text thicker or equal to \p max_thickness.
- ///
- /// \param[in] text Lines of text.
- /// \param[in] max_thickness The maximum thickness value.
- ///
- /// \result Lines of text without too thick lines.
- template <typename L>
- inline
- scribo::util::text<L>
- thick_bboxes(const scribo::util::text<L>& text,
- unsigned max_thickness);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- namespace internal
- {
-
- /// Filter Functor. Return false for all components which are too
- /// large.
- template <typename R>
- struct filter_too_thick_component_functor
- : Function_l2b< filter_too_thick_component_functor<R> >
- {
-
- /// Constructor
- ///
- /// \param[in] compbboxes component bounding boxes.
- /// \param[in] max_thickness the maximum thickness allowed.
- filter_too_thick_component_functor(const mln::util::array<R>& compbboxes,
- unsigned max_thickness)
- : compbboxes_(compbboxes), max_thickness_(max_thickness)
- {
- }
-
-
- /// Return false if the components is thicker than
- /// \p max_thickness_.
- ///
- /// \param[in] l An image value.
- bool operator()(const value::label_16& l) const
- {
- return compbboxes_[l].nrows() < max_thickness_
- && compbboxes_[l].ncols() < max_thickness_;
- }
-
-
- /// Component bounding boxes.
- const mln::util::array<R>& compbboxes_;
-
- /// The maximum thickness.
- unsigned max_thickness_;
- };
-
-
- } // end of namespace scribo::filter::internal
-
-
- template <typename I, typename N, typename V>
- inline
- mln_concrete(I)
- thick_bboxes(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- const V& label_type,
- unsigned max_thickness)
- {
- trace::entering("scribo::filter::thick_bboxes");
-
- const I& input = exact(input_);
- const N& nbh = exact(nbh_);
-
- mln_precondition(input.is_valid());
- mln_precondition(nbh.is_valid());
-
- V nlabels;
- mln_ch_value(I,V) lbl = labeling::blobs(input, nbh, nlabels);
-
- typedef accu::bbox<mln_psite(I)> accu_bbox_t;
- typedef mln_result(accu_bbox_t) accu_bbox_res_t;
- typedef mln::util::array<accu_bbox_res_t> compbboxes_t;
- compbboxes_t compbboxes = labeling::compute(accu_bbox_t(), lbl, nlabels);
-
- typedef internal::filter_too_thick_component_functor<accu_bbox_res_t> func_t;
- func_t fl2b(compbboxes, max_thickness);
- labeling::relabel_inplace(lbl, nlabels, fl2b);
-
- mln_concrete(I) output = duplicate(input);
- data::fill((output | pw::value(lbl) == literal::zero).rw(), false);
-
- trace::exiting("scribo::filter::thick_bboxes");
- return output;
- }
-
-
- template <typename L>
- inline
- scribo::util::text<L>
- thick_bboxes(const scribo::util::text<L>& text,
- unsigned max_thickness)
- {
- trace::entering("scribo::filter::thick_bboxes");
-
- mln_precondition(text.is_valid());
-
- typedef mln_site(L) P;
- typedef accu::bbox<P> accu_bbox_t;
- typedef mln_result(accu_bbox_t) accu_bbox_res_t;
- typedef mln::util::array<accu_bbox_res_t> nsitecomp_t;
-
- typedef internal::filter_too_thick_component_functor<accu_bbox_res_t> func_t;
- func_t is_not_too_thick(text.bboxes(), max_thickness);
-
- fun::i2v::array<bool> f(text.nbboxes().next(), false);
- f(0) = true;
- mln::util::array<box<P> > bresult;
- bresult.append(box<P>());
- for_all_components(i, text.bboxes())
- if (is_not_too_thick(i))
- {
- bresult.append(text.bbox(i));
- f(i) = true;
- }
-
- util::text<L> output = scribo::make::text(text, f);
-
- trace::exiting("scribo::filter::thick_bboxes");
- /// FIXME: construct a new util::text from the old one.
- return output;
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::filter
-
-} // end of namespace scribo
-
-
-#endif // ! SCRIBO_FILTER_THICK_BBOXES_HH
diff --git a/scribo/filter/thick_objects.hh b/scribo/filter/thick_objects.hh
new file mode 100644
index 0000000..d7ef128
--- /dev/null
+++ b/scribo/filter/thick_objects.hh
@@ -0,0 +1,191 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef SCRIBO_FILTER_THICK_OBJECTS_HH
+# define SCRIBO_FILTER_THICK_OBJECTS_HH
+
+/// \file scribo/filter/thick_objects.hh
+///
+/// Remove too thick objects.
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/object_image.hh>
+# include <scribo/extract/primitive/objects.hh>
+
+
+
+namespace scribo
+{
+
+ namespace filter
+ {
+
+ using namespace mln;
+
+ /// Remove objects thicker or equal to \p max_thickness.
+ ///
+ /// \param[in] input_ A binary image.
+ /// \param[in] nbh_ A neighborhood used in labeling algorithms.
+ /// \param[in] label_type The label type used for labeling.
+ /// \param[in] max_thickness The maximum thickness value.
+ ///
+ /// \result A binary image without thick objects.
+ //
+ template <typename I, typename N, typename V>
+ inline
+ mln_concrete(I)
+ thick_objects(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ const V& label_type,
+ unsigned max_thickness);
+
+
+ /// Remove lines of text thicker or equal to \p max_thickness.
+ ///
+ /// \param[in] objects An object image.
+ /// \param[in] max_thickness The maximum thickness value.
+ ///
+ /// \result An object image without too thick objects.
+ //
+ template <typename L>
+ inline
+ object_image(L)
+ thick_objects(const object_image(L)& objects,
+ unsigned max_thickness);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ /// Filter Functor. Return false for all objects which are too
+ /// large.
+ template <typename L>
+ struct thick_object_filter
+ : Function_v2b< thick_object_filter<L> >
+ {
+
+ /// Constructor
+ ///
+ /// \param[in] objects An object image.
+ /// \param[in] max_thickness the maximum thickness allowed.
+ thick_object_filter(const object_image(L)& objects,
+ unsigned max_thickness)
+ : objects_(objects), max_thickness_(max_thickness)
+ {
+ }
+
+
+ /// Return false if the objects is thicker than
+ /// \p max_thickness_.
+ ///
+ /// \param[in] l An image value.
+ bool operator()(const mln_value(L)& l) const
+ {
+ return objects_.bbox(l).nrows() < max_thickness_
+ && objects_.bbox(l).ncols() < max_thickness_;
+ }
+
+
+ /// An object image.
+ object_image(L) objects_;
+
+ /// The maximum thickness.
+ unsigned max_thickness_;
+ };
+
+
+ } // end of namespace scribo::filter::internal
+
+
+ template <typename I, typename N, typename V>
+ inline
+ mln_concrete(I)
+ thick_objects(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ const V& label_type,
+ unsigned max_thickness)
+ {
+ trace::entering("scribo::filter::thick_objects");
+
+ const I& input = exact(input_);
+ const N& nbh = exact(nbh_);
+
+ mln_precondition(input.is_valid());
+ mln_precondition(nbh.is_valid());
+
+ V nlabels;
+ typedef mln_ch_value(I,V) lbl_t;
+ object_image(lbl_t) objects
+ = extract::primitive::objects(input, nbh, nlabels);
+
+ typedef internal::thick_object_filter<lbl_t> func_t;
+ func_t fv2b(objects, max_thickness);
+ objects.relabel(fv2b);
+
+ mln_concrete(I) output = duplicate(input);
+ data::fill((output | pw::value(objects) == literal::zero).rw(), false);
+
+ trace::exiting("scribo::filter::thick_objects");
+ return output;
+ }
+
+
+ template <typename L>
+ inline
+ object_image(L)
+ thick_objects(const object_image(L)& objects,
+ unsigned max_thickness)
+ {
+ trace::entering("scribo::filter::thick_objects");
+
+ mln_precondition(text.is_valid());
+
+ typedef internal::thick_object_filter<L> func_t;
+ func_t is_not_too_thick(objects, max_thickness);
+
+ object_image(L) output;
+ output.init_from_(objects);
+ output.relabel(is_not_too_thick);
+
+ trace::exiting("scribo::filter::thick_objects");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::filter
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_FILTER_THICK_OBJECTS_HH
diff --git a/scribo/filter/thin_bboxes.hh b/scribo/filter/thin_bboxes.hh
deleted file mode 100644
index 1463a64..0000000
--- a/scribo/filter/thin_bboxes.hh
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef SCRIBO_FILTER_THIN_BBOXES_HH
-# define SCRIBO_FILTER_THIN_BBOXES_HH
-
-/// \file scribo/filter/thin_bboxes.hh
-///
-/// Remove too thin bboxes.
-
-# include <mln/labeling/blobs.hh>
-# include <mln/labeling/compute.hh>
-# include <mln/util/array.hh>
-
-# include <scribo/util/text.hh>
-
-namespace scribo
-{
-
- namespace filter
- {
-
- /// Remove components thinner or equal to \p min_thickness.
- ///
- /// \param[in] input_ a binary image.
- /// \param[in] nbh_ a neighborhood used in labeling algorithms.
- /// \param[in] label_type the label type used for labeling.
- /// \param[in] min_thickness the minimum thickness value.
- ///
- /// \result A binary image without thin components.
- template <typename I, typename N, typename V>
- inline
- mln_concrete(I)
- thin_bboxes(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- const V& label_type,
- unsigned min_thickness);
-
- /// Remove lines of text thinner or equal to \p min_thickness.
- ///
- /// \param[in] text lines of text.
- /// \param[in] min_thickness the minimum thickness value.
- ///
- /// \result Lines of text without too thin lines.
- template <typename L>
- inline
- scribo::util::text<L>
- thin_bboxes(const scribo::util::text<L>& text,
- unsigned min_thickness);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- namespace internal
- {
-
-
- /// Filter Functor.
- /// Return false for all components which are too large.
- template <typename R>
- struct filter_too_thin_component_functor
- : Function_v2b< filter_too_thin_component_functor<R> >
- {
-
- /// Constructor
- ///
- /// \param[in] compbboxes component bounding boxes.
- /// \param[in] min_thickness the minimum thickness allowed.
- filter_too_thin_component_functor(const mln::util::array<R>& compbboxes,
- unsigned min_thickness)
- : compbboxes_(compbboxes), min_thickness_(min_thickness)
- {
- }
-
-
- /// Return false if the components is thinner than
- /// \p min_thickness_.
- ///
- /// \param[in] l An image value.
- bool operator()(const value::label_16& l) const
- {
- return compbboxes_[l].nrows() > min_thickness_
- && compbboxes_[l].ncols() > min_thickness_;
- }
-
-
- /// Component bounding boxes.
- const mln::util::array<R>& compbboxes_;
-
- /// The minimum thickness.
- unsigned min_thickness_;
- };
-
-
- } // end of namespace scribo::filter::internal
-
-
- template <typename I, typename N, typename V>
- inline
- mln_concrete(I)
- thin_bboxes(const Image<I>& input_,
- const Neighborhood<N>& nbh_,
- const V& label_type,
- unsigned min_thickness)
- {
- trace::entering("scribo::filter::thin_bboxes");
-
- const I& input = exact(input_);
- const N& nbh = exact(nbh_);
-
- mln_precondition(input.is_valid());
- mln_precondition(nbh.is_valid());
-
- V nlabels;
- mln_ch_value(I,V) lbl = labeling::blobs(input, nbh, nlabels);
-
- typedef accu::bbox<mln_psite(I)> accu_bbox_t;
- typedef mln_result(accu_bbox_t) accu_bbox_res_t;
- typedef mln::util::array<accu_bbox_res_t> compbboxes_t;
- compbboxes_t compbboxes = labeling::compute(accu_bbox_t(), lbl, nlabels);
-
- typedef internal::filter_too_thin_component_functor<accu_bbox_res_t> func_t;
- func_t fv2b(compbboxes, min_thickness);
- labeling::relabel_inplace(lbl, nlabels, fv2b);
-
- mln_concrete(I) output = duplicate(input);
- data::fill((output | pw::value(lbl) == literal::zero).rw(), false);
-
- trace::exiting("scribo::filter::thin_bboxes");
- return output;
- }
-
-
- template <typename L>
- inline
- scribo::util::text<L>
- thin_bboxes(const scribo::util::text<L>& text,
- unsigned min_thickness)
- {
- trace::entering("scribo::filter::thin_bboxes");
-
- mln_precondition(text.is_valid());
-
- typedef mln_site(L) P;
- typedef accu::bbox<P> accu_bbox_t;
- typedef mln_result(accu_bbox_t) accu_bbox_res_t;
- typedef mln::util::array<accu_bbox_res_t> nsitecomp_t;
-
- typedef internal::filter_too_thin_component_functor<accu_bbox_res_t> func_t;
- func_t is_not_too_thin(text.bboxes(), min_thickness);
-
- fun::i2v::array<bool> f(text.nbboxes().next(), false);
- f(0) = true;
- mln::util::array<box<P> > bresult;
- bresult.append(box<P>());
- for_all_components(i, text.bboxes())
- if (is_not_too_thin(i))
- {
- bresult.append(text.bbox(i));
- f(i) = true;
- }
-
- util::text<L> output = scribo::make::text(text, f);
-
- trace::exiting("scribo::filter::thin_bboxes");
- return output;
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::filter
-
-} // end of namespace scribo
-
-
-#endif // ! SCRIBO_FILTER_THIN_BBOXES_HH
diff --git a/scribo/filter/thin_objects.hh b/scribo/filter/thin_objects.hh
new file mode 100644
index 0000000..45e491a
--- /dev/null
+++ b/scribo/filter/thin_objects.hh
@@ -0,0 +1,191 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef SCRIBO_FILTER_THIN_OBJECTS_HH
+# define SCRIBO_FILTER_THIN_OBJECTS_HH
+
+/// \file scribo/filter/thin_objects.hh
+///
+/// Remove too thin objects.
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+
+# include <mln/util/array.hh>
+
+# include <scribo/core/object_image.hh>
+# include <scribo/extract/primitive/objects.hh>
+
+namespace scribo
+{
+
+ namespace filter
+ {
+
+ using namespace mln;
+
+ /// Remove objects thinner or equal to \p min_thickness.
+ ///
+ /// \param[in] input_ a binary image.
+ /// \param[in] nbh_ a neighborhood used in labeling algorithms.
+ /// \param[in] label_type the label type used for labeling.
+ /// \param[in] min_thickness the minimum thickness value.
+ ///
+ /// \result A binary image without thin objects.
+ //
+ template <typename I, typename N, typename V>
+ inline
+ mln_concrete(I)
+ thin_objects(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ const V& label_type,
+ unsigned min_thickness);
+
+ /// Remove lines of text thinner or equal to \p min_thickness.
+ ///
+ /// \param[in] objects An object image.
+ /// \param[in] min_thickness the minimum thickness value.
+ ///
+ /// \result An object image without too thin objects.
+ //
+ template <typename L>
+ inline
+ object_image(L)
+ thin_objects(const object_image(L)& text,
+ unsigned min_thickness);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+
+ /// Filter Functor.
+ /// Return false for all objects which are too large.
+ template <typename L>
+ struct thin_objects_filter
+ : Function_v2b< thin_objects_filter<L> >
+ {
+ typedef accu::bbox<mln_psite(L)> box_accu_t;
+
+ /// Constructor
+ ///
+ /// \param[in] objects object bounding boxes.
+ /// \param[in] min_thickness the minimum thickness allowed.
+ thin_objects_filter(const object_image(L)& objects,
+ unsigned min_thickness)
+ : objects_(objects), min_thickness_(min_thickness)
+ {
+ }
+
+
+ /// Return false if the objects is thinner than
+ /// \p min_thickness_.
+ ///
+ /// \param[in] l An image value.
+ bool operator()(const mln_value(L)& l) const
+ {
+ if (l == literal::zero)
+ return true;
+ return objects_.bbox(l).nrows() > min_thickness_
+ && objects_.bbox(l).ncols() > min_thickness_;
+ }
+
+ /// Component bounding boxes.
+ object_image(L) objects_;
+
+ /// The minimum thickness.
+ unsigned min_thickness_;
+ };
+
+
+ } // end of namespace scribo::filter::internal
+
+
+ template <typename I, typename N, typename V>
+ inline
+ mln_concrete(I)
+ thin_objects(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ const V& label_type,
+ unsigned min_thickness)
+ {
+ trace::entering("scribo::filter::thin_objects");
+
+ const I& input = exact(input_);
+ const N& nbh = exact(nbh_);
+
+ mln_precondition(input.is_valid());
+ mln_precondition(nbh.is_valid());
+
+ V nlabels;
+ typedef mln_ch_value(I,V) lbl_t;
+ object_image(lbl_t) objects
+ = extract::primitive::objects(input, nbh, nlabels);
+
+ typedef internal::thin_objects_filter<lbl_t> func_t;
+ func_t fv2b(objects, min_thickness);
+ objects.relabel(fv2b);
+
+ mln_concrete(I) output = duplicate(input);
+ data::fill((output | pw::value(objects) == literal::zero).rw(), false);
+
+ trace::exiting("scribo::filter::thin_objects");
+ return output;
+ }
+
+
+ template <typename L>
+ inline
+ object_image(L)
+ thin_objects(const object_image(L)& objects,
+ unsigned min_thickness)
+ {
+ trace::entering("scribo::filter::thin_objects");
+
+ mln_precondition(objects.is_valid());
+
+ typedef internal::thin_objects_filter<L> func_t;
+ func_t is_not_too_thin(objects, min_thickness);
+
+ object_image(L) output;
+ output.init_from_(objects);
+ output.relabel(is_not_too_thin);
+
+ trace::exiting("scribo::filter::thin_objects");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::filter
+
+} // end of namespace scribo
+
+
+#endif // ! SCRIBO_FILTER_THIN_OBJECTS_HH
--
1.5.6.5
1
0
* text/extract_bboxes.hh,
* core/component_bboxes.hh: useless so removed.
* core/object_image.hh: new. Define a macro wrapping labeled_image
type.
* table/extract_lines_with_opening.hh: removed. Replaced by
lines_*_thick.
* table/extract_lines_with_rank.hh: removed. Replaced by
lines_*_discontinued.
* extract/primitive/lines_discontinued.hh,
* extract/primitive/lines_h_discontinued.hh,
* extract/primitive/lines_h_thick.hh,
* extract/primitive/lines_thick.hh,
* extract/primitive/lines_v_discontinued.hh,
* extract/primitive/lines_v_thick.hh,
* extract/primitive/objects.hh,
* table/extract.hh,
* text/grouping/group_from_double_link.hh,
* text/grouping/group_from_graph.hh,
* text/grouping/group_with_several_left_links.hh,
* text/grouping/group_with_several_right_links.hh,
* text/grouping/internal/find_left_link.hh,
* text/grouping/internal/find_right_link.hh,
* text/recognition.hh: make use of labeled_image type.
---
scribo/ChangeLog | 32 +++++
scribo/core/component_bboxes.hh | 92 ------------
scribo/core/object_image.hh | 42 ++++++
scribo/debug/usage.hh | 49 +++++++
scribo/extract/primitive/lines_discontinued.hh | 98 ++++----------
scribo/extract/primitive/lines_h_discontinued.hh | 62 +++------
scribo/extract/primitive/lines_h_thick.hh | 133 ++++++++++++++++++
scribo/extract/primitive/lines_thick.hh | 55 +-------
scribo/extract/primitive/lines_v_discontinued.hh | 60 ++------
scribo/extract/primitive/lines_v_thick.hh | 133 ++++++++++++++++++
scribo/extract/primitive/objects.hh | 47 ++-----
scribo/table/extract.hh | 20 ++--
scribo/table/extract_lines_with_opening.hh | 141 -------------------
scribo/table/extract_lines_with_rank.hh | 146 --------------------
scribo/text/extract_bboxes.hh | 103 --------------
scribo/text/grouping/group_from_double_link.hh | 31 ++---
scribo/text/grouping/group_from_graph.hh | 64 +++------
.../text/grouping/group_with_several_left_links.hh | 34 +++--
.../grouping/group_with_several_right_links.hh | 39 +++---
scribo/text/grouping/internal/find_left_link.hh | 18 +--
scribo/text/grouping/internal/find_right_link.hh | 16 +--
scribo/text/recognition.hh | 37 +++--
22 files changed, 592 insertions(+), 860 deletions(-)
delete mode 100644 scribo/core/component_bboxes.hh
create mode 100644 scribo/core/object_image.hh
create mode 100644 scribo/debug/usage.hh
create mode 100644 scribo/extract/primitive/lines_h_thick.hh
create mode 100644 scribo/extract/primitive/lines_v_thick.hh
delete mode 100644 scribo/table/extract_lines_with_opening.hh
delete mode 100644 scribo/table/extract_lines_with_rank.hh
delete mode 100644 scribo/text/extract_bboxes.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 86d8a0f..0c8eae6 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,35 @@
+2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Make use of labeled_image type in Scribo.
+
+ * text/extract_bboxes.hh,
+ * core/component_bboxes.hh: useless so removed.
+
+ * core/object_image.hh: new. Define a macro wrapping labeled_image
+ type.
+
+ * table/extract_lines_with_opening.hh: removed. Replaced by
+ lines_*_thick.
+
+ * table/extract_lines_with_rank.hh: removed. Replaced by
+ lines_*_discontinued.
+
+ * extract/primitive/lines_discontinued.hh,
+ * extract/primitive/lines_h_discontinued.hh,
+ * extract/primitive/lines_h_thick.hh,
+ * extract/primitive/lines_thick.hh,
+ * extract/primitive/lines_v_discontinued.hh,
+ * extract/primitive/lines_v_thick.hh,
+ * extract/primitive/objects.hh,
+ * table/extract.hh,
+ * text/grouping/group_from_double_link.hh,
+ * text/grouping/group_from_graph.hh,
+ * text/grouping/group_with_several_left_links.hh,
+ * text/grouping/group_with_several_right_links.hh,
+ * text/grouping/internal/find_left_link.hh,
+ * text/grouping/internal/find_right_link.hh,
+ * text/recognition.hh: make use of labeled_image type.
+
2009-05-27 Roland Levillain <roland(a)lrde.epita.fr>
Add the list of SCRIBO's unit tests.
diff --git a/scribo/core/component_bboxes.hh b/scribo/core/component_bboxes.hh
deleted file mode 100644
index 16b6fa0..0000000
--- a/scribo/core/component_bboxes.hh
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
-// (LRDE)
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-
-#ifndef SCRIBO_CORE_COMPONENT_BBOXES_HH
-# define SCRIBO_CORE_COMPONENT_BBOXES_HH
-
-/// \file scribo/core/component_bboxes.hh
-///
-/// Extract the bounding boxes of image components.
-
-# include <mln/core/concept/image.hh>
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/site_set/box.hh>
-
-# include <mln/labeling/blobs.hh>
-# include <mln/labeling/compute.hh>
-
-# include <mln/util/array.hh>
-
-# include <mln/debug/println.hh>
-
-namespace scribo
-{
-
- using namespace mln;
-
- /// Extract the components bboxes.
- template <typename I, typename N, typename V>
- util::couple<util::array< box<mln_site(I)> >, mln_ch_value(I,V)>
- component_bboxes(const Image<I>& input,
- const Neighborhood<N>& nbh,
- V& nbboxes);
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename I, typename N, typename V>
- inline
- util::couple<util::array< box<mln_site(I)> >, mln_ch_value(I,V)>
- component_bboxes(const Image<I>& input,
- const Neighborhood<N>& nbh,
- V& nbboxes)
- {
- trace::entering("scribo::component_bboxes");
-
- mlc_equal(mln_value(I),bool)::check();
- mlc_is_a(V, mln::value::Symbolic)::check();
- mln_precondition(exact(input).is_valid());
- mln_precondition(exact(nbh).is_valid());
-
- mln_ch_value(I,V) lbl = labeling::blobs(input, nbh, nbboxes);
- mln_assertion(exact(lbl).is_valid());
-
- typedef util::array< box<mln_site(I)> > bboxes_t;
- bboxes_t bboxes = labeling::compute(accu::meta::bbox(), lbl, nbboxes);
- mln_postcondition(bboxes.nelements() == nbboxes.next());
-
- trace::exiting("scribo::component_bboxes");
- return mln::make::couple(bboxes, lbl);
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
-} // end of namespace scribo
-
-
-#endif // ! SCRIBO_CORE_COMPONENT_BBOXES_HH
diff --git a/scribo/core/object_image.hh b/scribo/core/object_image.hh
new file mode 100644
index 0000000..98c5b83
--- /dev/null
+++ b/scribo/core/object_image.hh
@@ -0,0 +1,42 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+
+#ifndef SCRIBO_CORE_OBJECT_IMAGE_HH
+# define SCRIBO_CORE_OBJECT_IMAGE_HH
+
+/// \file scribo/core/object_image.hh
+///
+/// FIXME.
+
+# include <mln/core/image/imorph/labeled_image.hh>
+
+# define object_image(L) \
+ labeled_image<L>
+
+#endif // ! SCRIBO_CORE_OBJECT_IMAGE_HH
diff --git a/scribo/debug/usage.hh b/scribo/debug/usage.hh
new file mode 100644
index 0000000..733083e
--- /dev/null
+++ b/scribo/debug/usage.hh
@@ -0,0 +1,49 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file scribo/debug/usage.hh
+///
+/// Format program usage.
+
+
+int usage(char* argv[], const char *desc, const char* args,
+ const char*args_desc[][2], const char *out_desc)
+{
+ std::cout << desc << std::endl;
+ std::cout << "-----------" << std::endl;
+ std::cout << "Usage: " << argv[0] << " " << args << std::endl;
+
+ for (unsigned i = 0; args_desc[i][0] != 0; ++i)
+ std::cout << " " << args_desc[i][0] << ": " << args_desc[i][1]
+ << std::endl;
+
+ std::cout << std::endl << "Output: " << out_desc << std::endl;
+ std::cout << "-----------" << std::endl;
+ std::cout << "EPITA/LRDE - Scribo 2009" << std::endl;
+ return 1;
+}
+
diff --git a/scribo/extract/primitive/lines_discontinued.hh b/scribo/extract/primitive/lines_discontinued.hh
index 5730fcc..1218c2a 100644
--- a/scribo/extract/primitive/lines_discontinued.hh
+++ b/scribo/extract/primitive/lines_discontinued.hh
@@ -30,7 +30,7 @@
#ifndef SCRIBO_EXTRACT_PRIMITIVE_LINES_DISCONTINUED_HH
# define SCRIBO_EXTRACT_PRIMITIVE_LINES_DISCONTINUED_HH
-/// \file scribo/primitive/lines/discontinued.hh
+/// \file scribo/primitive/lines/lines_discontinued.hh
///
/// Extract discontinued lines in a binary image.
@@ -38,19 +38,15 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/window.hh>
# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/site_set/box.hh>
# include <mln/labeling/blobs.hh>
# include <mln/morpho/rank_filter.hh>
-
-# include <mln/accu/bbox.hh>
-
-# include <mln/util/array.hh>
-# include <mln/util/couple.hh>
+# include <mln/morpho/dilation.hh>
# include <scribo/core/macros.hh>
-# include <scribo/core/component_bboxes.hh>
+# include <scribo/core/object_image.hh>
+# include <scribo/extract/primitive/objects.hh>
namespace scribo
{
@@ -70,28 +66,18 @@ namespace scribo
*
* \param[in] input_ A binary image.
* \param[in] nbh_ The neighborhood used for labeling image
- * components.
+ * the lines.
* \param[in,out] nlines The label type used for labeling.
* \param[in] win_ A Window used to extract lines.
* \param[in] rank_k Rank used for filtering.
- * \param[in,out] line_bboxes line bounding boxes.
*
* \return An image in which lines are labeled.
*/
template <typename I, typename N, typename V, typename W>
- mln_ch_value(I,V)
- discontinued(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nlines,
- const Window<W>& win_, unsigned rank_k,
- util::array<box<mln_site(I)> >& line_bboxes);
-
-
- /// \overload
- template <typename I, typename N, typename V, typename W>
- mln_ch_value(I,V)
- discontinued(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nlines,
- const Window<W>& win_, unsigned rank_k);
+ object_image(mln_ch_value(I,V))
+ lines_discontinued(const Image<I>& input_,
+ const Neighborhood<N>& nbh_, V& nlines,
+ const Window<W>& win_, unsigned rank_k);
@@ -104,12 +90,12 @@ namespace scribo
template <typename I, typename N, typename V, typename W>
void
- discontinued_tests(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nlines,
- const Window<W>& win_, unsigned rank_k)
+ lines_discontinued_tests(const Image<I>& input,
+ const Neighborhood<N>& nbh, V& nlines,
+ const Window<W>& win, unsigned rank_k)
{
mlc_equal(mln_value(I),bool)::check();
- mlc_equal(mln_site(I)::dim, 2)::check();
+ mlc_bool(mln_site_(I)::dim == 2)::check();
mlc_is_a(V, mln::value::Symbolic)::check();
mln_precondition(exact(input).is_valid());
@@ -126,61 +112,33 @@ namespace scribo
template <typename I, typename N, typename V, typename W>
inline
- mln_ch_value(I,V)
- discontinued(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nlines,
- const Window<W>& win_, unsigned rank_k)
- {
- trace::entering("scribo::primitive::discontinued");
-
- internal::discontinued_tests(input_, nbh_, nlines, win_, rank_k);
-
- const I& input = exact(input_);
- const N& nbh = exact(nbh_);
- const W& win = exact(win_);
-
- mln_ch_value(I,bool) filter = morpho::rank_filter(input, win, vrank_k);
- mln_ch_value(I,V) output = labeling::blobs(filter, nbh, nlines);
-
- trace::exiting("scribo::primitive::discontinued");
- return output;
- }
-
-
-
-
- template <typename I, typename N, typename V, typename W>
- inline
- mln_ch_value(I,V)
- discontinued(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nlines,
- const Window<W>& win_, unsigned rank_k,
- util::array<box<mln_site(I)> >& line_bboxes)
+ object_image(mln_ch_value(I,V))
+ lines_discontinued(const Image<I>& input_,
+ const Neighborhood<N>& nbh_, V& nlines,
+ const Window<W>& win_, unsigned rank_k)
{
- trace::entering("scribo::primitive::discontinued");
+ trace::entering("scribo::primitive::lines_discontinued");
- internal::discontinued_tests(input_, nbh_, nlines, win_, rank_k);
+ internal::lines_discontinued_tests(input_, nbh_, nlines, win_, rank_k);
const I& input = exact(input_);
const N& nbh = exact(nbh_);
const W& win = exact(win_);
- mln_ch_value(I,V)
- output = discontinued(input, nbh, nlines, win, rank_k);
+ mln_ch_value(I,bool) filter
+ = morpho::dilation(morpho::rank_filter(input, win, rank_k), W(win.length() / 2));
+ object_image(mln_ch_value(I,V)) output
+ = extract::primitive::objects(filter, nbh, nlines);
- line_bboxes = labeling::compute(accu::meta::bbox(), output, nlines);
- mln_postcondition(line_bboxes.nelements() == nlines.next());
- // for_all_components(i, line_bboxes)
- // {
- // line_bboxes[i].enlarge(0, win.length() / 2);
- // line_bboxes[i].crop_wrt(input.domain());
- // }
+ //FIXME: we would like to enlarge the component in the right direction,
+ // in order to avoid rank filter side effects (smaller components).
- trace::exiting("scribo::primitive::discontinued");
+ trace::exiting("scribo::primitive::lines_discontinued");
return output;
}
-# endif // !MLN_INCLUDE_ONLY
+
+# endif // ! MLN_INCLUDE_ONLY
} // end of namespace scribo::extract::primitive
diff --git a/scribo/extract/primitive/lines_h_discontinued.hh b/scribo/extract/primitive/lines_h_discontinued.hh
index 7f31bff..c20c51d 100644
--- a/scribo/extract/primitive/lines_h_discontinued.hh
+++ b/scribo/extract/primitive/lines_h_discontinued.hh
@@ -37,6 +37,11 @@
# include <mln/core/concept/neighborhood.hh>
# include <mln/win/hline2d.hh>
+# include <scribo/core/object_image.hh>
+# include <scribo/extract/primitive/lines_discontinued.hh>
+
+
+
namespace scribo
{
@@ -46,6 +51,7 @@ namespace scribo
namespace primitive
{
+ using namespace mln;
/// Extract horizontal discontinued lines.
/*!
@@ -60,43 +66,36 @@ namespace scribo
* from 0.
*/
template <typename I, typename N, typename V>
- mln_ch_value(I,V)
+ object_image(mln_ch_value(I,V))
lines_h_discontinued(const Image<I>& input,
const Neighborhood<N>& nbh, V& nlines,
unsigned line_length, unsigned rank_k);
- /// \overload
- template <typename I, typename N, typename V>
- mln_ch_value(I,V)
- lines_h_discontinued(const Image<I>& input,
- const Neighborhood<N>& nbh, V& nlines,
- unsigned line_length, unsigned rank_k,
- util::array<box<mln_site(I)> >& line_bboxes);
-
-
# ifndef MLN_INCLUDE_ONLY
namespace internal
{
- template <typename I, typename N, typename V, typename W>
+ template <typename I, typename N, typename V>
void
- lines_h_discontinued_tests(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nlines,
+ lines_h_discontinued_tests(const Image<I>& input,
+ const Neighborhood<N>& nbh, V& nlines,
unsigned line_length, unsigned rank_k)
{
mlc_equal(mln_value(I),bool)::check();
- mlc_equal(mln_site(I)::dim, 2)::check();
+ mlc_bool(mln_site_(I)::dim == 2)::check();
mlc_is_a(V, mln::value::Symbolic)::check();
mln_precondition(exact(input).is_valid());
mln_precondition(exact(nbh).is_valid());
- mln_precondition(exact(win).is_valid());
- mln_precondition(!(line_length % 2));
+ mln_precondition(line_length % 2);
+ (void) input;
+ (void) nbh;
(void) nlines;
+ (void) line_length;
(void) rank_k;
}
@@ -105,20 +104,20 @@ namespace scribo
template <typename I, typename N, typename V>
- mln_ch_value(I,V)
+ object_image(mln_ch_value(I,V))
lines_h_discontinued(const Image<I>& input,
const Neighborhood<N>& nbh, V& nlines,
unsigned line_length, unsigned rank_k)
{
trace::entering("scribo::primitive::lines_h_discontinued");
- internal::line_h_discontinued_tests(input, nbh, nlines,
+ internal::lines_h_discontinued_tests(input, nbh, nlines,
line_length, rank_k);
win::hline2d win(line_length);
- mln_ch_value(I,V)
- output = lines_discontinued(input, nh, nlines, win, rank_k);
+ object_image(mln_ch_value(I,V))
+ output = lines_discontinued(input, nbh, nlines, win, rank_k);
trace::exiting("scribo::primitive::lines_h_discontinued");
return output;
@@ -126,29 +125,6 @@ namespace scribo
- template <typename I, typename N, typename V>
- mln_ch_value(I,V)
- lines_h_discontinued(const Image<I>& input,
- const Neighborhood<N>& nbh, V& nlines,
- unsigned line_length, unsigned rank_k,
- util::array<box<mln_site(I)> >& line_bboxes)
- {
- trace::entering("scribo::primitive::lines_h_discontinued");
-
- internal::line_h_discontinued_tests(input, nbh, nlines,
- line_length, rank_k);
-
- win::hline2d win(line_length);
- mln_ch_value(I,V)
- output = internal::line_h_discontinued_tests(input, nbh, nlines,
- line_length, rank_k,
- line_bboxes);
-
- trace::exiting("scribo::primitive::lines_h_discontinued");
- return output;
- }
-
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace scribo::extract::primitive
diff --git a/scribo/extract/primitive/lines_h_thick.hh b/scribo/extract/primitive/lines_h_thick.hh
new file mode 100644
index 0000000..0762bbc
--- /dev/null
+++ b/scribo/extract/primitive/lines_h_thick.hh
@@ -0,0 +1,133 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef SCRIBO_EXTRACT_PRIMITIVE_LINES_H_THICK_HH
+# define SCRIBO_EXTRACT_PRIMITIVE_LINES_H_THICK_HH
+
+/// \file scribo/primitive/lines_h_thick.hh
+///
+/// Extract horizontal thick lines.
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+# include <mln/win/hline2d.hh>
+
+# include <scribo/core/object_image.hh>
+# include <scribo/extract/primitive/lines_thick.hh>
+
+namespace scribo
+{
+
+ namespace extract
+ {
+
+ namespace primitive
+ {
+
+ using namespace mln;
+
+ /// Extract thick lines in a binary image.
+ /*!
+ * Only non discontinued lines are correctly extracted with this routine.
+ *
+ * \param[in] input_ A binary image.
+ * \param[in] nbh_ The neighborhood used for labeling image
+ * components.
+ * \param[in,out] nlines Type used for labeling.
+ * \param[in] line_length The minimum line length.
+ *
+ * \return An image in which lines are labeled.
+ */
+ template <typename I, typename N, typename V, typename W>
+ object_image(mln_ch_value(I,V))
+ lines_thick(const Image<I>& input_,
+ const Neighborhood<N>& nbh_, V& nlines,
+ unsigned line_length);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ namespace internal
+ {
+
+ template <typename I, typename N, typename V>
+ void
+ lines_h_thick_tests(const Image<I>& input,
+ const Neighborhood<N>& nbh, V& nlines,
+ unsigned line_length)
+ {
+ mlc_equal(mln_value(I),bool)::check();
+ mlc_bool(mln_site_(I)::dim == 2)::check();
+ mlc_is_a(V, mln::value::Symbolic)::check();
+
+ mln_precondition(exact(input).is_valid());
+ mln_precondition(exact(nbh).is_valid());
+ mln_precondition(line_length % 2);
+
+ (void) input;
+ (void) nbh;
+ (void) nlines;
+ (void) line_length;
+ }
+
+ } // end of namespace scribo::primitive::internal
+
+
+
+ template <typename I, typename N, typename V>
+ object_image(mln_ch_value(I,V))
+ lines_h_thick(const Image<I>& input,
+ const Neighborhood<N>& nbh, V& nlines,
+ unsigned line_length)
+ {
+ trace::entering("scribo::primitive::lines_h_thick");
+
+ internal::lines_h_thick_tests(input, nbh, nlines,
+ line_length);
+
+ win::hline2d win(line_length);
+
+ object_image(mln_ch_value(I,V))
+ output = lines_thick(input, nbh, nlines, win);
+
+ trace::exiting("scribo::primitive::lines_h_thick");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::extract::primitive
+
+ } // end of namespace scribo::extract
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_H_THICK_HH
+
diff --git a/scribo/extract/primitive/lines_thick.hh b/scribo/extract/primitive/lines_thick.hh
index ea5e8d1..3777822 100644
--- a/scribo/extract/primitive/lines_thick.hh
+++ b/scribo/extract/primitive/lines_thick.hh
@@ -38,17 +38,12 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/window.hh>
# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/site_set/box.hh>
-# include <mln/morpho/erosion.hh>
-
-# include <mln/accu/bbox.hh>
-
-# include <mln/util/array.hh>
-# include <mln/util/couple.hh>
+# include <mln/morpho/opening/structural.hh>
+# include <scribo/core/object_image.hh>
# include <scribo/core/macros.hh>
-# include <scribo/core/component_bboxes.hh>
+# include <scribo/extract/primitive/objects.hh>
namespace scribo
{
@@ -71,20 +66,11 @@ namespace scribo
* components.
* \param[in,out] nlines Type used for labeling.
* \param[in] win_ Window used to extract the lines
- * \param[in,out] line_bboxes Line bounding boxes.
*
* \return An image in which lines are labeled.
*/
template <typename I, typename N, typename V, typename W>
- mln_ch_value(I,V)
- lines_thick(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nlines,
- const Window<W>& win_,
- util::array<box<mln_site(I)>& line_bboxes);
-
- /// \overload
- template <typename I, typename N, typename V, typename W>
- mln_ch_value(I,V)
+ object_image(mln_ch_value(I,V))
lines_thick(const Image<I>& input_,
const Neighborhood<N>& nbh_, V& nlines,
const Window<W>& win_);
@@ -104,7 +90,7 @@ namespace scribo
const Window<W>& win_)
{
mlc_equal(mln_value(I),bool)::check();
- mlc_equal(mln_site(I)::dim, 2)::check();
+ mlc_bool(mln_site_(I)::dim == 2)::check();
mlc_is_a(V, mln::value::Symbolic)::check();
mln_precondition(exact(input).is_valid());
@@ -120,7 +106,7 @@ namespace scribo
template <typename I, typename N, typename V, typename W>
inline
- mln_ch_value(I,V)
+ object_image(mln_ch_value(I,V))
lines_thick(const Image<I>& input_,
const Neighborhood<N>& nbh_, V& nlines,
const Window<W>& win_)
@@ -134,39 +120,14 @@ namespace scribo
const W& win = exact(win_);
mln_ch_value(I,bool) filter = morpho::opening::structural(input, win);
- mln_ch_value(I,V) output = labeling::blobs(filter, nbh, nlines);
+ object_image(mln_ch_value(I,V)) output
+ = extract::primitive::objects(filter, nbh, nlines);
trace::exiting("scribo::primitive::lines_thick");
return output;
}
-
- template <typename I, typename N, typename V, typename W>
- inline
- mln_ch_value(I,V)
- lines_thick(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nlines,
- const Window<W>& win_,
- util::array<box<mln_site(I)>& line_bboxes)
- {
- trace::entering("scribo::primitive::lines_thick");
-
- internal::lines_thick_tests(input_, nbh_, nlines, win_);
-
- const I& input = exact(input_);
- const N& nbh = exact(nbh_);
- const W& win = exact(win_);
-
- mln_ch_value(I,V) output = lines_thick(input, nbh, nlines, win);
-
- line_bboxes = labeling::compute(accu::meta::bbox(), output, nlines);
- mln_postcondition(line_bboxes.nelements() == nlines.next());
-
- trace::exiting("scribo::primitive::lines_thick");
- return output;
- }
-
# endif // !MLN_INCLUDE_ONLY
} // end of namespace scribo::extract::primitive
diff --git a/scribo/extract/primitive/lines_v_discontinued.hh b/scribo/extract/primitive/lines_v_discontinued.hh
index 26edbb4..050e371 100644
--- a/scribo/extract/primitive/lines_v_discontinued.hh
+++ b/scribo/extract/primitive/lines_v_discontinued.hh
@@ -36,6 +36,10 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
+# include <scribo/core/object_image.hh>
+# include <scribo/extract/primitive/lines_discontinued.hh>
+
+
namespace scribo
{
@@ -55,21 +59,12 @@ namespace scribo
* \param[in] line_length The minimum line length expected. (must be
* odd).
* \param[in] rank_k Rank filter parameter.
- * \param[in,out] line_bboxes Will store the line bounding boxes.
*
* \result An image in which lines are labeled with a value different
* from 0.
*/
template <typename I, typename N, typename V>
- mln_ch_value(I,V)
- lines_v_discontinued(const Image<I>& input,
- const Neighborhood<N>& nbh, V& nlines,
- unsigned line_length, unsigned rank_k,
- util::array<box<mln_site(I)> >& line_bboxes);
-
- /// \overload
- template <typename I, typename N, typename V>
- mln_ch_value(I,V)
+ object_image(mln_ch_value(I,V))
lines_v_discontinued(const Image<I>& input,
const Neighborhood<N>& nbh, V& nlines,
unsigned line_length, unsigned rank_k);
@@ -81,20 +76,19 @@ namespace scribo
namespace internal
{
- template <typename I, typename N, typename V, typename W>
+ template <typename I, typename N, typename V>
void
- lines_v_discontinued_tests(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nlines,
+ lines_v_discontinued_tests(const Image<I>& input,
+ const Neighborhood<N>& nbh, V& nlines,
unsigned line_length, unsigned rank_k)
{
mlc_equal(mln_value(I),bool)::check();
- mlc_equal(mln_site(I)::dim, 2)::check();
+ mlc_bool(mln_site_(I)::dim == 2)::check();
mlc_is_a(V, mln::value::Symbolic)::check();
mln_precondition(exact(input).is_valid());
mln_precondition(exact(nbh).is_valid());
- mln_precondition(exact(win).is_valid());
- mln_precondition(!(line_length % 2));
+ mln_precondition(line_length % 2);
(void) nlines;
(void) rank_k;
@@ -105,44 +99,20 @@ namespace scribo
template <typename I, typename N, typename V>
- mln_ch_value(I,V)
+ object_image(mln_ch_value(I,V))
lines_v_discontinued(const Image<I>& input,
const Neighborhood<N>& nbh, V& nlines,
unsigned line_length, unsigned rank_k)
{
trace::entering("scribo::primitive::lines_v_discontinued");
- internal::line_v_discontinued_tests(input, nbh, nlines,
- line_length, rank_k);
-
- win::hline2d win(line_length);
-
- mln_ch_value(I,V)
- output = lines_discontinued(input, nh, nlines, win, rank_k);
-
- trace::exiting("scribo::primitive::lines_v_discontinued");
- return output;
- }
-
-
-
- template <typename I, typename N, typename V>
- mln_ch_value(I,V)
- lines_v_discontinued(const Image<I>& input,
- const Neighborhood<N>& nbh, V& nlines,
- unsigned line_length, unsigned rank_k,
- util::array<box<mln_site(I)> >& line_bboxes)
- {
- trace::entering("scribo::primitive::lines_v_discontinued");
-
- internal::line_v_discontinued_tests(input, nbh, nlines,
+ internal::lines_v_discontinued_tests(input, nbh, nlines,
line_length, rank_k);
win::vline2d win(line_length);
- mln_ch_value(I,V)
- output = internal::line_v_discontinued_tests(input, nbh, nlines,
- line_length, rank_k,
- line_bboxes);
+
+ object_image(mln_ch_value(I,V))
+ output = lines_discontinued(input, nbh, nlines, win, rank_k);
trace::exiting("scribo::primitive::lines_v_discontinued");
return output;
diff --git a/scribo/extract/primitive/lines_v_thick.hh b/scribo/extract/primitive/lines_v_thick.hh
new file mode 100644
index 0000000..6cdecb7
--- /dev/null
+++ b/scribo/extract/primitive/lines_v_thick.hh
@@ -0,0 +1,133 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+// (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef SCRIBO_EXTRACT_PRIMITIVE_LINES_V_THICK_HH
+# define SCRIBO_EXTRACT_PRIMITIVE_LINES_V_THICK_HH
+
+/// \file scribo/primitive/lines_v_thick.hh
+///
+/// Extract vertical thick lines.
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+# include <mln/win/vline2d.hh>
+
+# include <scribo/core/object_image.hh>
+# include <scribo/extract/primitive/lines_thick.hh>
+
+namespace scribo
+{
+
+ namespace extract
+ {
+
+ namespace primitive
+ {
+
+ using namespace mln;
+
+ /// Extract thick lines in a binary image.
+ /*!
+ * Only non discontinued lines are correctly extracted with this routine.
+ *
+ * \param[in] input_ A binary image.
+ * \param[in] nbh_ The neighborhood used for labeling image
+ * components.
+ * \param[in,out] nlines Type used for labeling.
+ * \param[in] line_length The minimum line length.
+ *
+ * \return An image in which lines are labeled.
+ */
+ template <typename I, typename N, typename V, typename W>
+ object_image(mln_ch_value(I,V))
+ lines_thick(const Image<I>& input_,
+ const Neighborhood<N>& nbh_, V& nlines,
+ unsigned line_length);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ namespace internal
+ {
+
+ template <typename I, typename N, typename V>
+ void
+ lines_v_thick_tests(const Image<I>& input,
+ const Neighborhood<N>& nbh, V& nlines,
+ unsigned line_length)
+ {
+ mlc_equal(mln_value(I),bool)::check();
+ mlc_bool(mln_site_(I)::dim == 2)::check();
+ mlc_is_a(V, mln::value::Symbolic)::check();
+
+ mln_precondition(exact(input).is_valid());
+ mln_precondition(exact(nbh).is_valid());
+ mln_precondition(line_length % 2);
+
+ (void) input;
+ (void) nbh;
+ (void) nlines;
+ (void) line_length;
+ }
+
+ } // end of namespace scribo::primitive::internal
+
+
+
+ template <typename I, typename N, typename V>
+ object_image(mln_ch_value(I,V))
+ lines_v_thick(const Image<I>& input,
+ const Neighborhood<N>& nbh, V& nlines,
+ unsigned line_length)
+ {
+ trace::entering("scribo::primitive::lines_v_thick");
+
+ internal::lines_v_thick_tests(input, nbh, nlines,
+ line_length);
+
+ win::vline2d win(line_length);
+
+ object_image(mln_ch_value(I,V))
+ output = lines_thick(input, nbh, nlines, win);
+
+ trace::exiting("scribo::primitive::lines_v_thick");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace scribo::extract::primitive
+
+ } // end of namespace scribo::extract
+
+} // end of namespace scribo
+
+#endif // ! SCRIBO_EXTRACT_PRIMITIVE_LINES_V_THICK_HH
+
diff --git a/scribo/extract/primitive/objects.hh b/scribo/extract/primitive/objects.hh
index cc55d72..4ac0bed 100644
--- a/scribo/extract/primitive/objects.hh
+++ b/scribo/extract/primitive/objects.hh
@@ -35,7 +35,6 @@
/// Extract objects in a binary image.
-# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
# include <mln/core/site_set/box.hh>
@@ -46,6 +45,12 @@
# include <mln/debug/println.hh>
+# include <scribo/core/object_image.hh>
+
+#include <mln/accu/bbox.hh>
+#include <mln/accu/center.hh>
+
+
namespace scribo
{
@@ -63,24 +68,12 @@ namespace scribo
/// and background to 'false'.
/// \param[in] nbh A neighborhood to be used for labeling.
/// \param[in,out] nobjects Will store the numbers of objects found.
- /// \param[in,out] bboxes Will store the objects bounding boxes.
///
/// \return An image of labeled objects.
//
template <typename I, typename N, typename V>
inline
- mln_ch_value(I,V)
- objects(const Image<I>& input,
- const Neighborhood<N>& nbh, V& nobjects,
- util::array< box<mln_site(I)> >& bboxes);
-
-
- /// Extract objects in a binary image.
- /// \overload
- //
- template <typename I, typename N, typename V>
- inline
- mln_ch_value(I,V)
+ object_image(mln_ch_value(I,V))
objects(const Image<I>& input,
const Neighborhood<N>& nbh, V& nobjects);
@@ -112,27 +105,7 @@ namespace scribo
template <typename I, typename N, typename V>
inline
- mln_ch_value(I,V)
- objects(const Image<I>& input,
- const Neighborhood<N>& nbh, V& nobjects,
- util::array< box<mln_site(I)> >& bboxes)
- {
- trace::entering("scribo::objects");
-
- internal::objects_tests(input, nbh, nobjects);
-
- mln_ch_value(I,V) object = objects(input, nbh, nobjects);
-
- bboxes = labeling::compute(accu::meta::bbox(), lbl, nobjects);
-
- trace::exiting("scribo::objects");
- return output;
- }
-
-
- template <typename I, typename N, typename V>
- inline
- mln_ch_value(I,V)
+ object_image(mln_ch_value(I,V))
objects(const Image<I>& input,
const Neighborhood<N>& nbh, V& nobjects)
{
@@ -140,7 +113,9 @@ namespace scribo
internal::objects_tests(input, nbh, nobjects);
- mln_ch_value(I,V) object = labeling::blobs(input, nbh, nobjects);
+ mln_ch_value(I,V) objects = labeling::blobs(input, nbh, nobjects);
+
+ object_image(mln_ch_value(I,V)) output(objects, nobjects);
trace::exiting("scribo::objects");
return output;
diff --git a/scribo/table/extract.hh b/scribo/table/extract.hh
index ebe4955..32f8965 100644
--- a/scribo/table/extract.hh
+++ b/scribo/table/extract.hh
@@ -40,7 +40,8 @@
# include <scribo/table/rebuild.hh>
# include <scribo/table/erase.hh>
-# include <scribo/table/extract_lines_with_rank.hh>
+# include <scribo/extract/primitive/lines_h_discontinued.hh>
+# include <scribo/extract/primitive/lines_v_discontinued.hh>
# include <scribo/make/debug_filename.hh>
@@ -83,20 +84,19 @@ namespace scribo
mln_precondition(input.is_valid());
mlc_equal(mln_value(I), bool)::check();
- typedef util::array< box<mln_site(I)> > boxarray_t;
- typedef util::couple<boxarray_t, boxarray_t> tblboxes_t;
-
- win::line<mln_grid(I::site), 0, mln_coord(I::site)> vline(51);
- win::line<mln_grid(I::site), 1, mln_coord(I::site)> hline(51);
- tblboxes_t lineboxes
- = table::extract_lines_with_rank(input, c8(), ncells,
- vline, hline, 6, 6);
+ V nhlines, nvlines;
+ object_image(mln_ch_value(I,V))
+ hlines = extract::primitive::lines_h_discontinued(input, c8(), nhlines, 51, 6),
+ vlines = extract::primitive::lines_v_discontinued(input, c8(), nvlines, 51, 6);
typedef mln::util::couple<mln_ch_value(I,V),
util::couple<util::array<box<mln_site(I)> >,
util::array<box<mln_site(I)> > > >
tables_t;
- tables_t tables = scribo::table::rebuild(input, lineboxes, 30, ncells);
+ tables_t tables
+ = scribo::table::rebuild(input,
+ mln::make::couple(vlines.bboxes(), hlines.bboxes()),
+ 30, ncells);
trace::exiting("scribo::table::extract");
return tables;
diff --git a/scribo/table/extract_lines_with_opening.hh b/scribo/table/extract_lines_with_opening.hh
deleted file mode 100644
index c3454db..0000000
--- a/scribo/table/extract_lines_with_opening.hh
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
-// (LRDE)
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-
-#ifndef SCRIBO_TABLE_EXTRACT_LINES_WITH_OPENING_HH
-# define SCRIBO_TABLE_EXTRACT_LINES_WITH_OPENING_HH
-
-/// \file scribo/table/extract_lines_with_opening.hh
-///
-/// Extract table lines using a morphological opening filter.
-
-
-# include <mln/core/concept/image.hh>
-# include <mln/core/concept/window.hh>
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/site_set/box.hh>
-
-# include <mln/morpho/erosion.hh>
-
-# include <mln/accu/bbox.hh>
-
-# include <mln/util/array.hh>
-# include <mln/util/couple.hh>
-
-# include <scribo/core/macros.hh>
-# include <scribo/core/component_bboxes.hh>
-
-namespace scribo
-{
-
- namespace table
- {
-
- using namespace mln;
-
- /// Find table bboxes thanks to a opening filter.
- /*!
- *
- * \param[in] input_ A binary image.
- * \param[in] nbh_ The neighborhood used for labeling image components.
- * \param[in] label_type Type used for labeling.
- * \param[in] vwin_ Window used to extract the vertical lines in a morphological
- * opening
- * \param[in] hwin_ Window used to extract the horizontal lines in a morphological
- * opening
- *
- * \return pair of array of bounding boxes. The first array holds the
- * vertical lines bounding boxes and the second one the
- * horizontal lines bounding boxes.
- */
- template <typename I, typename N, typename V, typename VW, typename HW>
- util::couple<util::array<box<mln_site(I)> >,
- util::array<box<mln_site(I)> > >
- extract_lines_with_opening(const Image<I>& input_,
- const Neighborhood<N>& nbh_, const V& label_type,
- const Window<VW>& vwin_, const Window<HW>& hwin_);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename I, typename N, typename V, typename VW, typename HW>
- inline
- util::couple<util::array<box<mln_site(I)> >,
- util::array<box<mln_site(I)> > >
- extract_lines_with_opening(const Image<I>& input_,
- const Neighborhood<N>& nbh_, const V& label_type,
- const Window<VW>& vwin_, const Window<HW>& hwin_)
- {
- trace::entering("scribo::table::extract_lines_with_opening");
-
- mlc_equal(mln_value(I),bool)::check();
- mlc_is_a(V, mln::value::Symbolic)::check();
-
- const I& input = exact(input_);
- const N& nbh = exact(nbh_);
- const VW& vwin = exact(vwin_);
- const HW& hwin = exact(hwin_);
-
- mln_precondition(input.is_valid());
- mln_precondition(nbh.is_valid());
- mln_precondition(vwin.is_valid());
- mln_precondition(hwin.is_valid());
-
- typedef util::array<box<mln_site(I)> > boxes_t;
-
- V ncomps;
-
- // Vertical lines
- mln_ch_value(I,bool) vfilter = morpho::erosion(input, vwin);
- boxes_t vboxes = component_bboxes(vfilter, nbh, ncomps).first();
- for_all_components(i, vboxes)
- {
- vboxes[i].enlarge(0, vwin.length() / 2);
- vboxes[i].crop_wrt(input.domain());
- }
-
- // Horizontal lines.
- mln_ch_value(I,bool) hfilter = morpho::erosion(input, hwin);
- boxes_t hboxes = component_bboxes(hfilter, nbh, ncomps).first();
- for_all_components(i, hboxes)
- {
- hboxes[i].enlarge(1, hwin.length() / 2);
- hboxes[i].crop_wrt(input.domain());
- }
-
- trace::exiting("scribo::table::extract_lines_with_opening");
- return mln::make::couple(vboxes, hboxes);
- }
-
-# endif // !MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::table
-
-} // end of namespace scribo
-
-#endif // ! SCRIBO_TABLE_EXTRACT_LINES_WITH_OPENING_HH
diff --git a/scribo/table/extract_lines_with_rank.hh b/scribo/table/extract_lines_with_rank.hh
deleted file mode 100644
index c6eb1fa..0000000
--- a/scribo/table/extract_lines_with_rank.hh
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
-// (LRDE)
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-
-#ifndef SCRIBO_TABLE_EXTRACT_LINES_WITH_RANK_HH
-# define SCRIBO_TABLE_EXTRACT_LINES_WITH_RANK_HH
-
-/// \file scribo/table/extract_lines_with_rank.hh
-///
-/// Extract table lines using a rank filter.
-
-
-# include <mln/core/concept/image.hh>
-# include <mln/core/concept/window.hh>
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/site_set/box.hh>
-
-# include <mln/morpho/rank_filter.hh>
-
-# include <mln/accu/bbox.hh>
-
-# include <mln/util/array.hh>
-# include <mln/util/couple.hh>
-
-# include <scribo/core/macros.hh>
-# include <scribo/core/component_bboxes.hh>
-
-namespace scribo
-{
-
- namespace table
- {
-
- using namespace mln;
-
- /// Find table bboxes thanks to a rank filter.
- /*!
- *
- * \param[in] input_ A binary image.
- * \param[in] nbh_ The neighborhood used for labeling image components.
- * \param[in] label_type The label type used for labeling.
- * \param[in] vwin_ Window used to extract the vertical lines in the rank
- * filter.
- * \param[in] hwin_ Window used to extract the horizontal lines in the rank
- * filter.
- * \param[in] vrank_k Rank used for vertical lines filtering.
- * \param[in] hrank_k Rank used for horizontal lines filtering.
- *
- * \return pair of array of bounding boxes. The first array holds the
- * vertical lines bounding boxes and the second one the
- * horizontal lines bounding boxes.
- */
- template <typename I, typename N, typename V, typename VW, typename HW>
- util::couple<util::array<box<mln_site(I)> >,
- util::array<box<mln_site(I)> > >
- extract_lines_with_rank(const Image<I>& input_,
- const Neighborhood<N>& nbh_, const V& label_type,
- const Window<VW>& vwin_, const Window<HW>& hwin_,
- unsigned vrank_k, unsigned hrank_k);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename I, typename N, typename V, typename VW, typename HW>
- inline
- util::couple<util::array<box<mln_site(I)> >,
- util::array<box<mln_site(I)> > >
- extract_lines_with_rank(const Image<I>& input_,
- const Neighborhood<N>& nbh_, const V& label_type,
- const Window<VW>& vwin_, const Window<HW>& hwin_,
- unsigned vrank_k, unsigned hrank_k)
- {
- trace::entering("scribo::table::extract_lines_with_rank");
-
- mlc_equal(mln_value(I),bool)::check();
- mlc_is_a(V, mln::value::Symbolic)::check();
-
- const I& input = exact(input_);
- const N& nbh = exact(nbh_);
- const VW& vwin = exact(vwin_);
- const HW& hwin = exact(hwin_);
- (void) label_type;
-
- mln_precondition(input.is_valid());
- mln_precondition(nbh.is_valid());
- mln_precondition(vwin.is_valid());
- mln_precondition(hwin.is_valid());
-
- typedef util::array<box<mln_site(I)> > boxes_t;
-
- V nbboxes;
-
- // Vertical lines
- mln_ch_value(I,bool) vfilter = morpho::rank_filter(input, vwin, vrank_k);
- boxes_t vboxes = component_bboxes(vfilter, nbh, nbboxes).first();
- for_all_components(i, vboxes)
- {
- vboxes[i].enlarge(0, vwin.length() / 2);
- vboxes[i].crop_wrt(input.domain());
- }
-
- // Horizontal lines.
- mln_ch_value(I,bool) hfilter = morpho::rank_filter(input, hwin, hrank_k);
- boxes_t hboxes = component_bboxes(hfilter, nbh, nbboxes).first();
- for_all_components(i, hboxes)
- {
- hboxes[i].enlarge(1, hwin.length() / 2);
- hboxes[i].crop_wrt(input.domain());
- }
-
- trace::exiting("scribo::table::extract_lines_with_rank");
- return mln::make::couple(vboxes, hboxes);
- }
-
-# endif // !MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::table
-
-} // end of namespace scribo
-
-#endif // ! SCRIBO_TABLE_EXTRACT_LINES_WITH_RANK_HH
diff --git a/scribo/text/extract_bboxes.hh b/scribo/text/extract_bboxes.hh
deleted file mode 100644
index 8908677..0000000
--- a/scribo/text/extract_bboxes.hh
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
-// (LRDE)
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-
-#ifndef SCRIBO_TEXT_GROUPING_EXTRACT_BBOXES_HH
-# define SCRIBO_TEXT_GROUPING_EXTRACT_BBOXES_HH
-
-/// \file scribo/text/extract_bboxes.hh
-///
-/// Extract text bounding boxes from a binary image.
-
-# include <mln/core/concept/image.hh>
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/site_set/box.hh>
-# include <mln/labeling/blobs.hh>
-# include <mln/labeling/compute.hh>
-# include <mln/util/array.hh>
-
-# include <scribo/core/component_bboxes.hh>
-# include <scribo/util/text.hh>
-# include <scribo/make/text.hh>
-
-namespace scribo
-{
-
- namespace text
- {
-
- using namespace mln;
-
- /// Extract text bounding boxes from a binary image.
- ///
- /// \param[in] input_ A binary imag.
- /// \param[in] nbh_ The neighborhood used for labeling.
- /// \param[in,out] nbboxes Will hold the number of bounding boxes at
- /// the end of the routine.
- ///
- /// \return an array of bounding boxes. The first bounding box is
- /// the background's.
- template <typename I, typename N, typename V>
- scribo::util::text<mln_ch_value(I,V)>
- extract_bboxes(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nbboxes);
-
-# ifndef MLN_INCLUDE_ONLY
-
-
- template <typename I, typename N, typename V>
- inline
- scribo::util::text<mln_ch_value(I,V)>
- extract_bboxes(const Image<I>& input_,
- const Neighborhood<N>& nbh_, V& nbboxes)
- {
- trace::entering("scribo::text::extract_bboxes");
-
- const I& input = exact(input_);
- const N& nbh = exact(nbh_);
-
- mlc_equal(mln_value(I), bool)::check();
- mln_precondition(input.is_valid());
- mln_precondition(nbh.is_valid());
-
- typedef mln::util::array< box<mln_site(I)> > bboxes_t;
- typedef mln::util::couple<bboxes_t, mln_ch_value(I,V)> bboxes_and_lbl_t;
- bboxes_and_lbl_t bboxes_and_lbl = component_bboxes(input, nbh, nbboxes);
-
- trace::exiting("scribo::text::extract_bboxes");
- return scribo::make::text(bboxes_and_lbl.first(),
- bboxes_and_lbl.second(), nbboxes);
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace scribo::text
-
-} // end of namespace scribo
-
-#endif // ! SCRIBO_TEXT_GROUPING_EXTRACT_BBOXES_HH
diff --git a/scribo/text/grouping/group_from_double_link.hh b/scribo/text/grouping/group_from_double_link.hh
index 7caac87..4ed5d74 100644
--- a/scribo/text/grouping/group_from_double_link.hh
+++ b/scribo/text/grouping/group_from_double_link.hh
@@ -66,16 +66,16 @@ namespace scribo
/// Group text bounding boxes from left and right links and validate
/// These links. A link must exist in both ways to be validated.
/*!
- ** \param[in] text The Lines of text.
+ ** \param[in] objects The Lines of text.
** \param[in] left_link The left neighbor of each line of text.
** \param[in] right_link The right neighbor of each line of text.
**
** \return New lines of text. Some of the lines of \p text may have
** been grouped.
*/
- template <typename I>
- scribo::util::text<I>
- group_from_double_link(const scribo::util::text<I>& text,
+ template <typename L>
+ object_image(L)
+ group_from_double_link(const object_image(L)& objects,
const mln::util::array<unsigned>& left_link,
const mln::util::array<unsigned>& right_link);
@@ -84,10 +84,10 @@ namespace scribo
# ifndef MLN_INCLUDE_ONLY
- template <typename I>
+ template <typename L>
inline
- scribo::util::text<I>
- group_from_double_link(const scribo::util::text<I>& text,
+ object_image(L)
+ group_from_double_link(const object_image(L)& objects,
const mln::util::array<unsigned>& left_link,
const mln::util::array<unsigned>& right_link)
{
@@ -95,12 +95,9 @@ namespace scribo
mln_precondition(left_link.nelements() == right_link.nelements());
- mln::util::array< accu::bbox<mln_site(I)> > tboxes;
- tboxes.resize(text.bboxes().nelements());
-
mln::util::array<unsigned> parent(left_link.nelements());
internal::init_link_array(parent);
- for_all_components(i, text.bboxes())
+ for_all_ncomponents(i, objects.nlabels())
{
mln::util::couple<bool, unsigned>
nbh = internal::is_link_valid(left_link, right_link, i);
@@ -114,19 +111,15 @@ namespace scribo
}
}
- for_all_elements(i, parent)
for (unsigned i = parent.nelements() - 1; i < parent.nelements(); --i)
- {
parent[i] = parent[parent[i]];
- tboxes[parent[i]].take(text.bbox(i));
- }
- fun::i2v::array<unsigned> f;
- convert::from_to(parent, f);
+ object_image(L) output;
+ output.init_from_(objects);
+ output.relabel(parent);
- scribo::util::text<I> result = make::text(text, f);
trace::exiting("scribo::text::grouping::group_from_double_link");
- return result;
+ return output;
}
diff --git a/scribo/text/grouping/group_from_graph.hh b/scribo/text/grouping/group_from_graph.hh
index 3c6ac3a..d28e047 100644
--- a/scribo/text/grouping/group_from_graph.hh
+++ b/scribo/text/grouping/group_from_graph.hh
@@ -46,6 +46,7 @@
# include <mln/fun/i2v/array.hh>
# include <mln/util/array.hh>
+# include <mln/util/graph_ids.hh>
# include <scribo/core/macros.hh>
# include <scribo/util/text.hh>
@@ -83,15 +84,14 @@ namespace scribo
/// Functor to be passed to depth_first_search.
/// Map each component vertex with its representative vertex id.
template <typename V>
- struct map_vertex_to_component_id_functor
+ struct map_vertex_to_representative_id_functor
{
/// Initialize the functor.
template <typename G>
void init(const Graph<G>& g)
{
- vertextocomp.resize(exact(g).v_nmax(), mln_max(V));
- ncomp = 0;
+ vertextorep.resize(exact(g).v_nmax(), mln_max(V));
}
/// All components have been processed.
@@ -100,35 +100,40 @@ namespace scribo
/// Starting to treat a new component.
void next_component()
- { ++ncomp; }
+ {}
/// A vertex with id \p id has been found in the current
/// component.
- void new_component_from_vertex(unsigned id)
- { vertextocomp(id) = ncomp; }
+ void new_component_from_vertex(const mln::util::vertex_id_t& id)
+ {
+ current_ = id;
+ vertextorep(id) = id;
+ }
/// A new neighbor with id \p id have been found for the
/// current vertex.
- void added_to_queue(unsigned id)
- { new_component_from_vertex(id); }
+ void added_to_queue(const mln::util::vertex_id_t&)
+ {}
/// Starting to process a new vertex.
- void process_vertex(unsigned)
- {}
+ void process_vertex(const mln::util::vertex_id_t& id)
+ {
+ vertextorep(id) = current_;
+ }
/// Does the vertex with id \p id have been already treated?
- bool to_be_treated(unsigned id)
- { return vertextocomp(id) == mln_max(V); }
+ bool to_be_treated(const mln::util::vertex_id_t& id)
+ { return vertextorep(id) == mln_max(V); }
/// Does the neighbor vertex \p id have been already treated?
- bool to_be_queued(unsigned id)
+ bool to_be_queued(const mln::util::vertex_id_t& id)
{ return to_be_treated(id); }
/// The number of components found.
- unsigned ncomp;
+ mln::util::vertex_id_t current_;
/// Map a verted id to its component id.
- fun::i2v::array<V> vertextocomp;
+ fun::i2v::array<V> vertextorep;
};
} // end of namespace scribo::text::grouping::internal
@@ -147,36 +152,13 @@ namespace scribo
mln_assertion(g.is_valid());
- internal::map_vertex_to_component_id_functor<mln_value(I)> f;
+ internal::map_vertex_to_representative_id_functor<mln_value(I)> f;
canvas::browsing::depth_first_search(g, f);
-// mln::util::array< accu::bbox<mln_site(I)> > tboxes;
-// tboxes.resize(text.nbboxes().next());
-// for_all_components(i, text.bboxes())
-// tboxes[f.vertextocomp(i)].take(text.bbox(i));
-//
-// // Update bounding boxes.
-// mln::util::array<box<mln_site(I)> > bresult;
-// // Component 0 - the background has not valid bboxes.
-// bresult.append(box<mln_site(I)>());
-// for_all_components(i, text.bboxes())
-// if (tboxes[i].is_valid())
-// bresult.append(tboxes[i].to_result());
-//
-// mln_assertion(bresult.nelements() == f.ncomp);
-//
-// // Update label image.
-// mln_value(I) new_nbboxes;
-// I new_lbl = labeling::relabel(text.label_image(),
-// text.nbboxes(),
-// f.vertextocomp);
-//
-// mln_assertion(new_nbboxes.next() == bresult.nelements());
+ scribo::util::text<I> output = scribo::make::text(text, f.vertextorep);
trace::exiting("scribo::text::grouping::group_from_graph");
- /// FIXME: construct a new util::text from the old one.
-// return scribo::make::text(bresult, new_lbl, new_nbboxes);
- return scribo::make::text(text, f.vertextocomp);
+ return output;
}
diff --git a/scribo/text/grouping/group_with_several_left_links.hh b/scribo/text/grouping/group_with_several_left_links.hh
index 666a283..ce113b2 100644
--- a/scribo/text/grouping/group_with_several_left_links.hh
+++ b/scribo/text/grouping/group_with_several_left_links.hh
@@ -64,7 +64,7 @@ namespace scribo
template <typename L>
inline
mln::util::array<unsigned>
- group_with_several_left_links(const scribo::util::text<L>& text,
+ group_with_several_left_links(const object_image(L)& objects,
unsigned neighb_max_distance);
# ifndef MLN_INCLUDE_ONLY
@@ -72,21 +72,25 @@ namespace scribo
template <typename L>
inline
mln::util::array<unsigned>
- group_with_several_left_links(const scribo::util::text<L>& text,
+ group_with_several_left_links(const object_image(L)& objects,
unsigned neighb_max_distance)
{
trace::entering("scribo::text::grouping::group_with_several_left_links");
- mln_precondition(text.is_valid());
+ mln_precondition(objects.is_valid());
mln::util::array<unsigned>
- link_1(text.nbboxes().next()), link_2(text.nbboxes().next()),
- link_3(text.nbboxes().next()), final_link(text.nbboxes().next());
+ link_1(objects.nlabels().next()), link_2(objects.nlabels().next()),
+ link_3(objects.nlabels().next()), final_link(objects.nlabels().next());
internal::init_link_array(link_1);
internal::init_link_array(link_2);
internal::init_link_array(link_3);
- for_all_ncomponents(i, text.nbboxes())
+ mln::util::array<mln_result(accu::center<mln_psite(L)>)>
+ mass_centers = labeling::compute(accu::meta::center(),
+ objects, objects.nlabels());
+
+ for_all_ncomponents(i, objects.nlabels())
{
// -------
// <------X |
@@ -97,27 +101,27 @@ namespace scribo
// | |
// <------X |
// -------
- unsigned midcol = (text.bbox(i).pmax().col()
- - text.bbox(i).pmin().col()) / 2;
+ unsigned midcol = (objects.bbox(i).pmax().col()
+ - objects.bbox(i).pmin().col()) / 2;
int dmax = midcol + neighb_max_distance;
- mln_site(L) c = text.bbox(i).center();
+ mln_site(L) c = objects.bbox(i).center();
/// Left link from the top anchor.
mln_site(L) a1 = c;
- a1.row() = text.bbox(i).pmin().row() + (c.row() - text.bbox(i).pmin().row()) / 4;
- internal::find_left_link(text, link_1, i, dmax, a1);
+ a1.row() = objects.bbox(i).pmin().row() + (c.row() - objects.bbox(i).pmin().row()) / 4;
+ internal::find_left_link(objects, link_1, i, dmax, a1);
/// Left link from the central site
- internal::find_left_link(text, link_2, i, dmax, text.mass_center(i));
+ internal::find_left_link(objects, link_2, i, dmax, mass_centers[i]);
/// Left link from the bottom anchor.
mln_site(L) a2 = c;
- a2.row() = text.bbox(i).pmax().row() - (c.row() - text.bbox(i).pmin().row()) / 4;
- internal::find_left_link(text, link_3, i, dmax, a2);
+ a2.row() = objects.bbox(i).pmax().row() - (c.row() - objects.bbox(i).pmin().row()) / 4;
+ internal::find_left_link(objects, link_3, i, dmax, a2);
}
- for_all_ncomponents(i, text.nbboxes())
+ for_all_ncomponents(i, objects.nlabels())
{
if (link_2[i] != i)
final_link[i] = link_2[i];
diff --git a/scribo/text/grouping/group_with_several_right_links.hh b/scribo/text/grouping/group_with_several_right_links.hh
index f7d38a7..05c6e52 100644
--- a/scribo/text/grouping/group_with_several_right_links.hh
+++ b/scribo/text/grouping/group_with_several_right_links.hh
@@ -64,29 +64,34 @@ namespace scribo
template <typename L>
inline
mln::util::array<unsigned>
- group_with_several_right_links(const scribo::util::text<L>& text,
- unsigned neighb_max_distance);
+ group_with_several_right_links(const object_image(L)& objects,
+ unsigned neighb_max_distance);
# ifndef MLN_INCLUDE_ONLY
template <typename L>
inline
mln::util::array<unsigned>
- group_with_several_right_links(const scribo::util::text<L>& text,
- unsigned neighb_max_distance)
+ group_with_several_right_links(const object_image(L)& objects,
+ unsigned neighb_max_distance)
{
trace::entering("scribo::text::grouping::group_with_several_right_links");
- mln_precondition(text.is_valid());
+ mln_precondition(objects.is_valid());
mln::util::array<unsigned>
- link_1(text.nbboxes().next()), link_2(text.nbboxes().next()),
- link_3(text.nbboxes().next()), final_link(text.nbboxes().next());
+ link_1(objects.nlabels().next()), link_2(objects.nlabels().next()),
+ link_3(objects.nlabels().next()), final_link(objects.nlabels().next());
internal::init_link_array(link_1);
internal::init_link_array(link_2);
internal::init_link_array(link_3);
- for_all_ncomponents(i, text.nbboxes())
+ mln::util::array<mln_result(accu::center<mln_psite(L)>)>
+ mass_centers = labeling::compute(accu::meta::center(),
+ objects, objects.nlabels());
+
+
+ for_all_ncomponents(i, objects.nlabels())
{
// -------
// | X------->
@@ -97,27 +102,27 @@ namespace scribo
// | |
// | X------->
// -------
- unsigned midcol = (text.bbox(i).pmax().col()
- - text.bbox(i).pmin().col()) / 2;
+ unsigned midcol = (objects.bbox(i).pmax().col()
+ - objects.bbox(i).pmin().col()) / 2;
int dmax = midcol + neighb_max_distance;
- mln_site(L) c = text.bbox(i).center();
+ mln_site(L) c = objects.bbox(i).center();
/// Right link from the top anchor.
mln_site(L) a1 = c;
- a1.row() = text.bbox(i).pmin().row() + (c.row() - text.bbox(i).pmin().row()) / 4;
- internal::find_right_link(text, link_1, i, dmax, a1);
+ a1.row() = objects.bbox(i).pmin().row() + (c.row() - objects.bbox(i).pmin().row()) / 4;
+ internal::find_right_link(objects, link_1, i, dmax, a1);
/// Right link from the central site
- internal::find_right_link(text, link_2, i, dmax, text.mass_center(i));
+ internal::find_right_link(objects, link_2, i, dmax, mass_centers[i]);
/// Right link from the bottom anchor.
mln_site(L) a2 = c;
- a2.row() = text.bbox(i).pmax().row() - (c.row() - text.bbox(i).pmin().row()) / 4;
- internal::find_right_link(text, link_3, i, dmax, a2);
+ a2.row() = objects.bbox(i).pmax().row() - (c.row() - objects.bbox(i).pmin().row()) / 4;
+ internal::find_right_link(objects, link_3, i, dmax, a2);
}
- for_all_ncomponents(i, text.nbboxes())
+ for_all_ncomponents(i, objects.nlabels())
{
if (link_2[i] != i)
final_link[i] = link_2[i];
diff --git a/scribo/text/grouping/internal/find_left_link.hh b/scribo/text/grouping/internal/find_left_link.hh
index e4fed4f..f598115 100644
--- a/scribo/text/grouping/internal/find_left_link.hh
+++ b/scribo/text/grouping/internal/find_left_link.hh
@@ -59,14 +59,14 @@ namespace scribo
/// Find the left neighbor of a line of text if exists.
///
- /// \param text The lines of text.
+ /// \param objects An image of objects.
/// \param left_link The left neighbors.
/// \param current_comp A text line id.
/// \param dmax The maximum lookup distance.
/// \param c The lookup start point.
template <typename L>
void
- find_left_link(const scribo::util::text<L>& text,
+ find_left_link(const object_image(L)& objects,
mln::util::array<unsigned>& left_link,
unsigned current_comp,
int dmax,
@@ -76,7 +76,7 @@ namespace scribo
template <typename L>
void
- find_left_link(const scribo::util::text<L>& text,
+ find_left_link(const object_image(L)& objects,
mln::util::array<unsigned>& left_link,
unsigned current_comp,
int dmax,
@@ -86,16 +86,14 @@ namespace scribo
/// First site on the right of the central site
mln_site(L) p = c + left;
- const L& lbl = text.label_image();
-
- while (lbl.domain().has(p) // Not outside image domain
- && (lbl(p) == literal::zero // Is the background
- || lbl(p) == current_comp // Is the current component
- || left_link[lbl(p)] == current_comp) // Creates a loop
+ while (objects.domain().has(p) // Not outside image domain
+ && (objects(p) == literal::zero // Is the background
+ || objects(p) == current_comp // Is the current component
+ || left_link[objects(p)] == current_comp) // Creates a loop
&& math::abs(p.col() - c.col()) < dmax) // Not to far
--p.col();
- update_link_array(lbl, left_link, p, c, current_comp, dmax);
+ update_link_array(objects, left_link, p, c, current_comp, dmax);
}
# endif // MLN_INCLUDE_ONLY
diff --git a/scribo/text/grouping/internal/find_right_link.hh b/scribo/text/grouping/internal/find_right_link.hh
index 768861b..3f137c5 100644
--- a/scribo/text/grouping/internal/find_right_link.hh
+++ b/scribo/text/grouping/internal/find_right_link.hh
@@ -66,7 +66,7 @@ namespace scribo
/// \param c The lookup start point.
template <typename L>
void
- find_right_link(const scribo::util::text<L>& text,
+ find_right_link(const object_image(L)& text,
mln::util::array<unsigned>& right_link,
unsigned current_comp,
int dmax,
@@ -76,7 +76,7 @@ namespace scribo
template <typename L>
void
- find_right_link(const scribo::util::text<L>& text,
+ find_right_link(const object_image(L)& objects,
mln::util::array<unsigned>& right_link,
unsigned current_comp,
int dmax,
@@ -86,16 +86,14 @@ namespace scribo
/// First site on the right of the central site
mln_site(L) p = c + right;
- const L& lbl = text.label_image();
-
- while (lbl.domain().has(p) // Not outside image domain
- && (lbl(p) == literal::zero // Is the background
- || lbl(p) == current_comp // Is the current component
- || right_link[lbl(p)] == current_comp) // Creates a loop
+ while (objects.domain().has(p) // Not outside image domain
+ && (objects(p) == literal::zero // Is the background
+ || objects(p) == current_comp // Is the current component
+ || right_link[objects(p)] == current_comp) // Creates a loop
&& math::abs(p.col() - c.col()) < dmax) // Not too far
++p.col();
- update_link_array(lbl, right_link, p, c, current_comp, dmax);
+ update_link_array(objects, right_link, p, c, current_comp, dmax);
}
# endif // MLN_INCLUDE_ONLY
diff --git a/scribo/text/recognition.hh b/scribo/text/recognition.hh
index 287be34..8cfd20e 100644
--- a/scribo/text/recognition.hh
+++ b/scribo/text/recognition.hh
@@ -86,7 +86,7 @@ namespace scribo
/// \return An image of characters.
template <typename L>
mln_ch_value(L,char)
- recognition(const scribo::util::text<L>& text,
+ recognition(const object_image(L)& objects,
const char *language);
@@ -96,17 +96,17 @@ namespace scribo
template <typename L>
mln_ch_value(L,char)
- recognition(const scribo::util::text<L>& text,
+ recognition(const object_image(L)& objects,
const char *language)
{
trace::entering("scribo::text::recognition");
- mln_precondition(text.is_valid());
+ mln_precondition(objects.is_valid());
// Initialize Tesseract.
TessBaseAPI::InitWithLanguage(NULL, NULL, language, NULL, false, 0, NULL);
- mln_ch_value(L,char) txt(text.label_image().domain());
+ mln_ch_value(L,char) txt(objects.domain());
data::fill(txt, ' ');
typedef mln_ch_value(L,bool) I;
@@ -118,35 +118,40 @@ namespace scribo
w_window2d_int dmap_win = mln::make::w_window2d_int(vals);
/// Use text bboxes with Tesseract
- for_all_components(i, text.bboxes())
+ for_all_ncomponents(i, objects.nlabels())
{
- I text_ima(text.bbox(i));
+ I text_ima(objects.bbox(i));
data::fill(text_ima, false);
- data::fill((text_ima | (pw::value(text.label_image()) == pw::cst(i))).rw(),
+ data::fill((text_ima | (pw::value(objects) == pw::cst(i))).rw(),
true);
/// Improve text quality.
+
+ /// text_ima_cleand domain is larger than text_ima's.
I text_ima_cleaned = text::clean(text_ima, dmap_win);
border::resize(text_ima_cleaned, 0); // Make sure there is no border.
// Recognize characters.
char* s = TessBaseAPI::TesseractRect(
(unsigned char*) text_ima_cleaned.buffer(),
- sizeof (bool), // Pixel size.
- text_ima.ncols() * sizeof (bool), // Row_offset
- 0, // Left
- 0, // Top
- text_ima.ncols(), // n cols
- text_ima.nrows()); // n rows
+ sizeof (bool), // Pixel size.
+ text_ima_cleaned.ncols() * sizeof (bool), // Row_offset
+ 0, // Left
+ 0, // Top
+ text_ima_cleaned.ncols(), // n cols
+ text_ima_cleaned.nrows()); // n rows
- mln_site(L) p = text.bbox(i).center();
- p.col() -= (text.bbox(i).pmax().col()
- - text.bbox(i).pmin().col()) / 2;
+ mln_site(L) p = objects.bbox(i).center();
+ p.col() -= (objects.bbox(i).pmax().col()
+ - objects.bbox(i).pmin().col()) / 2;
if (s != 0)
+ {
+ std::cout << s << std::endl;
mln::debug::put_word(txt, p, s);
+ }
// The string has been allocated by Tesseract. We must free it.
free(s);
--
1.5.6.5
1
0
* doc/Doxyfile.in: Enable JAVADOC_AUTOBRIEF.
* doc/groups/images.hh: create a new modules for morphers.
* tests/unit_test/unit-tests.mk,
* headers.mk: update auto-generated lists.
* mln/convert/from_to.hxx,
* mln/value/label.hh: add from_to overload for conversion from
label<n> to bool.
* mln/core/image/bgraph_image.hh,
* mln/core/image/complex_image.hh,
* mln/core/image/edge_image.hh,
* mln/core/image/flat_image.hh,
* mln/core/image/image1d.hh,
* mln/core/image/image2d.hh,
* mln/core/image/image3d.hh,
* mln/io/pbm/all.hh,
* mln/pw/image.hh: update doc.
* mln/core/macros.hh: fix mln_box macro.
* mln/labeling/colorize.hh: do not call next() member on label type.
* mln/make/relabelfun.hh: image value type does not need to be a
label type anymore.
* mln/subsampling/subsampling.hh: fix invalid use of mln_coord.
* mln/tag/init.hh: cleanup.
* mln/util/array.hh: fix infinite recursion.
* mln/util/eat.hh,
* mln/util/ignore.hh,
* mln/util/nil.hh,
* mln/util/tracked_ptr.hh,
* mln/util/yes.hh: Add these objects in util module.
* apps/statues/trimesh/misc.hh: avoid warnings.
* mln/core/image/all.hh: fix includes.
* mln/core/site_set/p_transformed.hh: rename transform routine to
ptransform (name conflict with a namespace).
* mln/morpho/tree/propagate_representative.hh: add missing includes.
* tests/transformation/rotate.cc: fix reference image.
---
milena/ChangeLog | 55 ++++++++
milena/apps/statues/trimesh/misc.hh | 18 ++--
milena/doc/Doxyfile.in | 2 +-
milena/doc/groups/images.hh | 7 +
milena/headers.mk | 75 +++++++-----
milena/mln/convert/from_to.hxx | 3 +
milena/mln/core/image/all.hh | 1 -
milena/mln/core/image/bgraph_image.hh | 3 +
milena/mln/core/image/complex_image.hh | 2 +-
milena/mln/core/image/edge_image.hh | 1 +
milena/mln/core/image/flat_image.hh | 2 +-
milena/mln/core/image/image1d.hh | 3 +-
milena/mln/core/image/image2d.hh | 3 +-
milena/mln/core/image/image3d.hh | 3 +-
milena/mln/core/macros.hh | 4 +-
milena/mln/core/site_set/p_transformed.hh | 11 +-
milena/mln/io/pbm/all.hh | 10 +-
milena/mln/labeling/colorize.hh | 2 +-
milena/mln/make/relabelfun.hh | 63 +++++-----
milena/mln/morpho/tree/propagate_representative.hh | 60 ++++++----
milena/mln/pw/image.hh | 3 +-
milena/mln/subsampling/subsampling.hh | 5 +-
milena/mln/tag/init.hh | 39 +++---
milena/mln/util/array.hh | 2 +-
milena/mln/util/eat.hh | 17 ++--
milena/mln/util/ignore.hh | 18 ++--
milena/mln/util/nil.hh | 17 ++--
milena/mln/util/tracked_ptr.hh | 30 ++---
milena/mln/util/yes.hh | 22 ++--
milena/mln/value/label.hh | 13 ++
milena/tests/transformation/rotate.cc | 3 +-
milena/tests/unit_test/unit-tests.mk | 132 +++++++++++---------
32 files changed, 378 insertions(+), 251 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index c68baff..25652da 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,60 @@
2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Small fixes.
+
+ * doc/Doxyfile.in: Enable JAVADOC_AUTOBRIEF.
+
+ * doc/groups/images.hh: create a new modules for morphers.
+
+ * tests/unit_test/unit-tests.mk,
+ * headers.mk: update auto-generated lists.
+
+ * mln/convert/from_to.hxx,
+ * mln/value/label.hh: add from_to overload for conversion from
+ label<n> to bool.
+
+ * mln/core/image/bgraph_image.hh,
+ * mln/core/image/complex_image.hh,
+ * mln/core/image/edge_image.hh,
+ * mln/core/image/flat_image.hh,
+ * mln/core/image/image1d.hh,
+ * mln/core/image/image2d.hh,
+ * mln/core/image/image3d.hh,
+ * mln/io/pbm/all.hh,
+ * mln/pw/image.hh: update doc.
+
+ * mln/core/macros.hh: fix mln_box macro.
+
+ * mln/labeling/colorize.hh: do not call next() member on label type.
+
+ * mln/make/relabelfun.hh: image value type does not need to be a
+ label type anymore.
+
+ * mln/subsampling/subsampling.hh: fix invalid use of mln_coord.
+
+ * mln/tag/init.hh: cleanup.
+
+ * mln/util/array.hh: fix infinite recursion.
+
+ * mln/util/eat.hh,
+ * mln/util/ignore.hh,
+ * mln/util/nil.hh,
+ * mln/util/tracked_ptr.hh,
+ * mln/util/yes.hh: Add these objects in util module.
+
+ * apps/statues/trimesh/misc.hh: avoid warnings.
+
+ * mln/core/image/all.hh: fix includes.
+
+ * mln/core/site_set/p_transformed.hh: rename transform routine to
+ ptransform (name conflict with a namespace).
+
+ * mln/morpho/tree/propagate_representative.hh: add missing includes.
+
+ * tests/transformation/rotate.cc: fix reference image.
+
+2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Add world::binary_2d::enlarge.
* mln/world/binary_2d/enlarge.hh: new routine.
diff --git a/milena/apps/statues/trimesh/misc.hh b/milena/apps/statues/trimesh/misc.hh
index d72477d..ae7c033 100644
--- a/milena/apps/statues/trimesh/misc.hh
+++ b/milena/apps/statues/trimesh/misc.hh
@@ -73,7 +73,7 @@ namespace mln
/** \brief Perform LDL^T decomposition of a symmetric positive
definite matrix. Like Cholesky, but no square roots.
Overwrites lower triangle of matrix.
-
+
From Trimesh's ldltdc routine. */
template <unsigned N, typename T>
inline
@@ -81,14 +81,14 @@ namespace mln
ldlt_decomp(mat<N, N, T>& A, vec<N, T>& rdiag)
{
vec<N - 1, T> v;
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
- for (int k = 0; k < i; ++k)
+ for (unsigned k = 0; k < i; ++k)
v[k] = A(i, k) * rdiag[k];
- for (int j = i; j < N; ++j)
+ for (unsigned j = i; j < N; ++j)
{
T sum = A(i, j);
- for (int k = 0; k < i; k++)
+ for (unsigned k = 0; k < i; k++)
sum -= v[k] * A(j, k);
if (i == j)
{
@@ -117,14 +117,14 @@ namespace mln
for (unsigned i = 0; i < N; ++i)
{
T sum = B[i];
- for (int k = 0; k < i; ++k)
+ for (unsigned k = 0; k < i; ++k)
sum -= A(i, k) * x[k];
x[i] = sum * rdiag[i];
}
for (int i = N - 1; i >= 0; --i)
{
T sum = 0;
- for (int k = i + 1; k < N; ++k)
+ for (unsigned k = i + 1; k < N; ++k)
sum += A(k, i) * x[k];
x[i] -= sum * rdiag[i];
}
@@ -623,7 +623,9 @@ namespace mln
// Least squares solution.
vec3f diag;
+#ifndef NDEBUG
bool ldlt_decomp_sucess_p = algebra::ldlt_decomp(w, diag);
+#endif // ! NDEBUG
mln_assertion(ldlt_decomp_sucess_p);
algebra::ldlt_solve(w, diag, m, m);
@@ -639,7 +641,7 @@ namespace mln
curv2(p[j]) += wt * c2;
}
}
-
+
/*-------------------------------------------------------------.
| Compute principal directions and curvatures at each vertex. |
`-------------------------------------------------------------*/
diff --git a/milena/doc/Doxyfile.in b/milena/doc/Doxyfile.in
index cedcbc1..0abb0fc 100644
--- a/milena/doc/Doxyfile.in
+++ b/milena/doc/Doxyfile.in
@@ -18,7 +18,7 @@ STRIP_FROM_PATH = @top_srcdir@/milena \
@top_builddir@/milena
STRIP_FROM_INC_PATH =
SHORT_NAMES = YES
-JAVADOC_AUTOBRIEF = NO
+JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
diff --git a/milena/doc/groups/images.hh b/milena/doc/groups/images.hh
index c248cbb..438410b 100644
--- a/milena/doc/groups/images.hh
+++ b/milena/doc/groups/images.hh
@@ -12,6 +12,13 @@
* \ingroup modimage
*/
+/*! \defgroup modimagemorpher Image morphers
+ *
+ * \brief Morpher on both image values and domain.
+ *
+ * \ingroup modimage
+ */
+
/*! \defgroup modimagevaluemorpher Values morphers
*
* \brief Morpher on image values.
diff --git a/milena/headers.mk b/milena/headers.mk
index a040f8d..b9d8ea3 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -253,65 +253,69 @@ mln/core/grids.hh \
mln/core/image/all.hh \
mln/core/image/bgraph_image.hh \
mln/core/image/bgraph_psite.hh \
-mln/core/image/cast_image.hh \
mln/core/image/ch_piter.hh \
mln/core/image/complex_image.hh \
mln/core/image/complex_neighborhood_piter.hh \
mln/core/image/complex_neighborhoods.hh \
mln/core/image/complex_window_piter.hh \
mln/core/image/complex_windows.hh \
-mln/core/image/decorated_image.hh \
mln/core/image/dmorph/all.hh \
+mln/core/image/dmorph/extended.hh \
+mln/core/image/dmorph/extension_fun.hh \
+mln/core/image/dmorph/extension_ima.hh \
+mln/core/image/dmorph/extension_val.hh \
+mln/core/image/dmorph/hexa.hh \
+mln/core/image/dmorph/hexa_piter.hh \
+mln/core/image/dmorph/image2d_h.hh \
+mln/core/image/dmorph/image_if.hh \
+mln/core/image/dmorph/p2p_image.hh \
+mln/core/image/dmorph/slice_image.hh \
+mln/core/image/dmorph/sub_image.hh \
+mln/core/image/dmorph/sub_image_if.hh \
mln/core/image/dmorph/transformed_image.hh \
+mln/core/image/dmorph/unproject_image.hh \
mln/core/image/edge_image.hh \
mln/core/image/essential.hh \
-mln/core/image/extended.hh \
-mln/core/image/extension_fun.hh \
-mln/core/image/extension_ima.hh \
-mln/core/image/extension_val.hh \
mln/core/image/flat_image.hh \
-mln/core/image/fun_image.hh \
mln/core/image/graph_elt_neighborhood.hh \
mln/core/image/graph_elt_neighborhood_if.hh \
mln/core/image/graph_elt_window.hh \
mln/core/image/graph_elt_window_if.hh \
mln/core/image/graph_window_if_piter.hh \
mln/core/image/graph_window_piter.hh \
-mln/core/image/hexa.hh \
-mln/core/image/hexa_piter.hh \
mln/core/image/image1d.hh \
mln/core/image/image2d.hh \
-mln/core/image/image2d_h.hh \
mln/core/image/image3d.hh \
-mln/core/image/image_if.hh \
-mln/core/image/interpolated.hh \
-mln/core/image/lazy_image.hh \
+mln/core/image/imorph/all.hh \
+mln/core/image/imorph/decorated_image.hh \
+mln/core/image/imorph/interpolated.hh \
+mln/core/image/imorph/labeled_image.hh \
+mln/core/image/imorph/lazy_image.hh \
+mln/core/image/imorph/plain.hh \
+mln/core/image/imorph/safe.hh \
+mln/core/image/imorph/tr_image.hh \
mln/core/image/mono_obased_rle_encode.hh \
mln/core/image/mono_obased_rle_image.hh \
mln/core/image/mono_rle_encode.hh \
mln/core/image/mono_rle_image.hh \
+mln/core/image/morph/all.hh \
+mln/core/image/morph/t_image.hh \
mln/core/image/obased_rle_encode.hh \
mln/core/image/obased_rle_image.hh \
-mln/core/image/p2p_image.hh \
-mln/core/image/plain.hh \
mln/core/image/rle_encode.hh \
mln/core/image/rle_image.hh \
-mln/core/image/safe.hh \
-mln/core/image/slice_image.hh \
mln/core/image/sparse_encode.hh \
mln/core/image/sparse_image.hh \
-mln/core/image/sub_image.hh \
-mln/core/image/sub_image_if.hh \
-mln/core/image/t_image.hh \
-mln/core/image/thru_morpher.hh \
-mln/core/image/thrubin_morpher.hh \
-mln/core/image/tr_image.hh \
mln/core/image/tr_mesh.hh \
-mln/core/image/unproject_image.hh \
mln/core/image/value_enc_image.hh \
mln/core/image/value_encode.hh \
mln/core/image/vertex_image.hh \
-mln/core/image/violent_cast_image.hh \
+mln/core/image/vmorph/all.hh \
+mln/core/image/vmorph/cast_image.hh \
+mln/core/image/vmorph/fun_image.hh \
+mln/core/image/vmorph/thru_image.hh \
+mln/core/image/vmorph/thrubin_image.hh \
+mln/core/image/vmorph/violent_cast_image.hh \
mln/core/internal/box_impl.hh \
mln/core/internal/check/image_all.hh \
mln/core/internal/check/image_fastest.hh \
@@ -441,6 +445,7 @@ mln/debug/println_with_border.spe.hh \
mln/debug/put_word.hh \
mln/debug/quiet.hh \
mln/debug/slices_2d.hh \
+mln/debug/superpose.hh \
mln/display/all.hh \
mln/display/essential.hh \
mln/draw/all.hh \
@@ -512,7 +517,6 @@ mln/fun/meta/essential.hh \
mln/fun/meta/first.hh \
mln/fun/meta/green.hh \
mln/fun/meta/hue.hh \
-mln/fun/meta/inty.hh \
mln/fun/meta/lum.hh \
mln/fun/meta/red.hh \
mln/fun/meta/sat.hh \
@@ -527,6 +531,7 @@ mln/fun/p2b/essential.hh \
mln/fun/p2b/has.hh \
mln/fun/p2b/tautology.hh \
mln/fun/p2p/all.hh \
+mln/fun/p2p/fold.hh \
mln/fun/p2p/mirror.hh \
mln/fun/p2p/translation.hh \
mln/fun/p2v/all.hh \
@@ -554,18 +559,17 @@ mln/fun/v2v/abs.hh \
mln/fun/v2v/all.hh \
mln/fun/v2v/cast.hh \
mln/fun/v2v/ch_function_value.hh \
+mln/fun/v2v/component.hh \
mln/fun/v2v/convert.hh \
mln/fun/v2v/dec.hh \
mln/fun/v2v/enc.hh \
mln/fun/v2v/essential.hh \
-mln/fun/v2v/hsi_to_rgb.hh \
mln/fun/v2v/hsl_to_rgb.hh \
mln/fun/v2v/id.hh \
mln/fun/v2v/inc.hh \
mln/fun/v2v/linear.hh \
mln/fun/v2v/norm.hh \
mln/fun/v2v/projection.hh \
-mln/fun/v2v/rgb_to_hsi.hh \
mln/fun/v2v/rgb_to_hsl.hh \
mln/fun/v2v/saturate.hh \
mln/fun/v2v/wrap.hh \
@@ -644,6 +648,7 @@ mln/histo/array.hh \
mln/histo/compute.hh \
mln/histo/compute.spe.hh \
mln/histo/essential.hh \
+mln/histo/point_from_value.hh \
mln/io/abort.hh \
mln/io/all.hh \
mln/io/cloud/all.hh \
@@ -686,6 +691,7 @@ mln/io/ppm/load.hh \
mln/io/ppm/save.hh \
mln/io/tiff/all.hh \
mln/io/tiff/load.hh \
+mln/io/tiff/save.hh \
mln/io/txt/all.hh \
mln/io/txt/save.hh \
mln/labeling/all.hh \
@@ -955,7 +961,16 @@ mln/morpho/tree/all.hh \
mln/morpho/tree/compute_attribute_image.hh \
mln/morpho/tree/compute_parent.hh \
mln/morpho/tree/data.hh \
+mln/morpho/tree/filter/all.hh \
+mln/morpho/tree/filter/direct.hh \
+mln/morpho/tree/filter/filter.hh \
+mln/morpho/tree/filter/max.hh \
+mln/morpho/tree/filter/min.hh \
+mln/morpho/tree/filter/subtractive.hh \
mln/morpho/tree/max.hh \
+mln/morpho/tree/propagate_if.hh \
+mln/morpho/tree/propagate_node.hh \
+mln/morpho/tree/propagate_representative.hh \
mln/morpho/tree/utils.hh \
mln/morpho/watershed/all.hh \
mln/morpho/watershed/flooding.hh \
@@ -1215,7 +1230,6 @@ mln/value/gl8.hh \
mln/value/glf.hh \
mln/value/graylevel.hh \
mln/value/graylevel_f.hh \
-mln/value/hsi.hh \
mln/value/hsl.hh \
mln/value/int_s.hh \
mln/value/int_s16.hh \
@@ -1256,7 +1270,6 @@ mln/value/sign.hh \
mln/value/stack.hh \
mln/value/super_value.hh \
mln/value/viter.hh \
-mln/version.hh \
mln/win/all.hh \
mln/win/backdiag2d.hh \
mln/win/ball.hh \
@@ -1280,6 +1293,8 @@ mln/win/sym.hh \
mln/win/vline2d.hh \
mln/world/all.hh \
mln/world/binary_2d/all.hh \
+mln/world/binary_2d/enlarge.hh \
+mln/world/binary_2d/enlarge_hq2x.hh \
mln/world/binary_2d/projected_histo.hh \
mln/world/binary_2d/subsample.hh \
mln/world/inter_pixel/all.hh \
diff --git a/milena/mln/convert/from_to.hxx b/milena/mln/convert/from_to.hxx
index ca6eb81..9ad0de8 100644
--- a/milena/mln/convert/from_to.hxx
+++ b/milena/mln/convert/from_to.hxx
@@ -173,6 +173,9 @@ namespace mln
template <unsigned n>
void from_to_(const value::int_u<n>& from, value::label<n>& to_);
+ template <unsigned n>
+ void from_to_(const value::label<n>& from, bool& to_);
+
// int_u<n> -> label<m> with n < m
template <unsigned n, unsigned m>
void
diff --git a/milena/mln/core/image/all.hh b/milena/mln/core/image/all.hh
index c973d55..5597041 100644
--- a/milena/mln/core/image/all.hh
+++ b/milena/mln/core/image/all.hh
@@ -63,7 +63,6 @@
# include <mln/core/image/image3d.hh>
# include <mln/core/image/sparse_encode.hh>
# include <mln/core/image/sparse_image.hh>
-# include <mln/core/image/t_image.hh>
# include <mln/core/image/tr_mesh.hh>
# include <mln/core/image/vertex_image.hh>
diff --git a/milena/mln/core/image/bgraph_image.hh b/milena/mln/core/image/bgraph_image.hh
index a59c1de..153a96a 100644
--- a/milena/mln/core/image/bgraph_image.hh
+++ b/milena/mln/core/image/bgraph_image.hh
@@ -93,6 +93,9 @@ namespace mln
} // end of namespace mln::trait
/// Kind of image based on a boost graph structure.
+ ///
+ /// \ingroup modimageconcrete
+ //
template <typename P, typename V>
struct bgraph_image :
public internal::image_primary< V, p_bgraph<P>, bgraph_image<P, V> >
diff --git a/milena/mln/core/image/complex_image.hh b/milena/mln/core/image/complex_image.hh
index 98d00c5..4521722 100644
--- a/milena/mln/core/image/complex_image.hh
+++ b/milena/mln/core/image/complex_image.hh
@@ -115,7 +115,7 @@ namespace mln
} // end of namespace mln::trait
- /// \brief Image based on a complex.
+ /// Image based on a complex.
///
/// Values attached to each face of the complex.
///
diff --git a/milena/mln/core/image/edge_image.hh b/milena/mln/core/image/edge_image.hh
index 3c71bb8..7850db2 100644
--- a/milena/mln/core/image/edge_image.hh
+++ b/milena/mln/core/image/edge_image.hh
@@ -121,6 +121,7 @@ namespace mln
/// \brief Image based on graph edges.
///
/// \ingroup modimageconcrete
+ //
template <typename P, typename V, typename G = util::graph>
class edge_image
: public pw::internal::image_base<fun::i2v::array<V>,
diff --git a/milena/mln/core/image/flat_image.hh b/milena/mln/core/image/flat_image.hh
index 5d5beab..b4cb111 100644
--- a/milena/mln/core/image/flat_image.hh
+++ b/milena/mln/core/image/flat_image.hh
@@ -100,7 +100,7 @@ namespace mln
- /// \brief Image with a single value.
+ /// Image with a single value.
///
/// \ingroup modimageconcrete
//
diff --git a/milena/mln/core/image/image1d.hh b/milena/mln/core/image/image1d.hh
index c137f17..3c5e47a 100644
--- a/milena/mln/core/image/image1d.hh
+++ b/milena/mln/core/image/image1d.hh
@@ -145,13 +145,14 @@ namespace mln
- /// \brief Basic 1D image class.
+ /// Basic 1D image class.
///
/// The parameter \c T is the type of pixel values. This image class
/// stores data in memory and has a virtual border with constant
/// thickness before and after data.
///
/// \ingroup modimageconcrete
+ //
template <typename T>
struct image1d :
public internal::image_primary< T, box1d, image1d<T> >
diff --git a/milena/mln/core/image/image2d.hh b/milena/mln/core/image/image2d.hh
index f5d30cc..f8579a9 100644
--- a/milena/mln/core/image/image2d.hh
+++ b/milena/mln/core/image/image2d.hh
@@ -126,13 +126,14 @@ namespace mln
- /// \brief Basic 2D image class.
+ /// Basic 2D image class.
///
/// The parameter \c T is the type of pixel values. This image class
/// stores data in memory and has a virtual border with constant
/// thickness around data.
///
/// \ingroup modimageconcrete
+ //
template <typename T>
class image2d : public internal::image_primary< T, mln::box2d, image2d<T> >
{
diff --git a/milena/mln/core/image/image3d.hh b/milena/mln/core/image/image3d.hh
index a0bdb5d..19fc774 100644
--- a/milena/mln/core/image/image3d.hh
+++ b/milena/mln/core/image/image3d.hh
@@ -120,13 +120,14 @@ namespace mln
- /// \brief Basic 3D image class.
+ /// Basic 3D image class.
///
/// The parameter \c T is the type of pixel values. This image class
/// stores data in memory and has a virtual border with constant
/// thickness around data.
///
/// \ingroup modimageconcrete
+ //
template <typename T>
struct image3d : public internal::image_primary< T, box3d, image3d<T> >
{
diff --git a/milena/mln/core/macros.hh b/milena/mln/core/macros.hh
index 75ab5f0..51c32dd 100644
--- a/milena/mln/core/macros.hh
+++ b/milena/mln/core/macros.hh
@@ -81,8 +81,8 @@
/// Shortcuts to access the box type associated to T.
/// \{
-# define mln_box(T) typename T::box
-# define mln_box_(T) T::box
+# define mln_box(T) typename mln::box<mln_psite(T)>
+# define mln_box_(T) mln::box<mln_psite(T)>
/// \}
diff --git a/milena/mln/core/site_set/p_transformed.hh b/milena/mln/core/site_set/p_transformed.hh
index 563c69b..0e3efe7 100644
--- a/milena/mln/core/site_set/p_transformed.hh
+++ b/milena/mln/core/site_set/p_transformed.hh
@@ -64,10 +64,12 @@ namespace mln
///
/// \param[in] s A site set.
/// \param[in] f A function from site to site.
+ ///
/// \return The transformed site set.
+ //
template <typename S, typename F>
p_transformed<S, F>
- transform(const Site_Set<S>& s, const Function_v2v<F>& f);
+ ptransform(const Site_Set<S>& s, const Function_v2v<F>& f);
@@ -77,6 +79,7 @@ namespace mln
///
/// Parameter \c S is a site set type; parameter F is a function
/// from site to site.
+ //
template <typename S, typename F>
class p_transformed
: public internal::site_set_base_< mln_psite(S), p_transformed<S,F> >,
@@ -114,7 +117,7 @@ namespace mln
bool is_valid() const;
- /// Test if \p p belongs to the subset.
+ /// Test if \p p belongs to the subset.
bool has(const psite& p) const;
@@ -141,7 +144,7 @@ namespace mln
template <typename S, typename F>
inline
p_transformed<S, F>
- transform(const Site_Set<S>& s, const Function_v2v<F>& f)
+ ptransform(const Site_Set<S>& s, const Function_v2v<F>& f)
{
mlc_equal(mln_result(F), mln_psite(S))::check();
p_transformed<S, F> tmp(exact(s), exact(f));
@@ -156,7 +159,7 @@ namespace mln
p_transformed<S,F>::p_transformed()
{
}
-
+
template <typename S, typename F>
inline
p_transformed<S,F>::p_transformed(const S& s, const F& f)
diff --git a/milena/mln/io/pbm/all.hh b/milena/mln/io/pbm/all.hh
index 27afa57..afd7922 100644
--- a/milena/mln/io/pbm/all.hh
+++ b/milena/mln/io/pbm/all.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_IO_PBM_ALL_HH
# define MLN_IO_PBM_ALL_HH
-/*! \file mln/io/pbm/all.hh
- *
- * \brief File that includes all pbm io materials.
- */
+/// \file mln/io/pbm/all.hh
+///
+/// File that includes all pbm io materials.
namespace mln
diff --git a/milena/mln/labeling/colorize.hh b/milena/mln/labeling/colorize.hh
index 49b1f63..db2a415 100644
--- a/milena/mln/labeling/colorize.hh
+++ b/milena/mln/labeling/colorize.hh
@@ -120,7 +120,7 @@ namespace mln
// mlc_is_a(mln_value(L), mln::value::Symbolic)::check();
(void) value;
- unsigned label_count = nlabels.next();
+ unsigned label_count = static_cast<unsigned>(nlabels) + 1;
static fun::i2v::array<V> f(0);
int diff_size = f.size() - label_count;
if (diff_size < 0)
diff --git a/milena/mln/make/relabelfun.hh b/milena/mln/make/relabelfun.hh
index 11fe1fe..efa5acf 100644
--- a/milena/mln/make/relabelfun.hh
+++ b/milena/mln/make/relabelfun.hh
@@ -46,78 +46,77 @@ namespace mln
/// Create a i2v function from a v2b function.
/// This function can be used to relabel a labeled image.
///
- /// \param[in] fv2b A v2b function.
- /// \param[in] nlabels The number of labels.
- /// \param[in] new_nlabels The number of labels after relabeling.
+ /// \param[in] fv2b A v2b function.
+ /// \param[in] nlabels The number of labels.
+ /// \param[in] new_nlabels The number of labels after relabeling.
///
/// \return a i2v function.
///
/// \sa mln::labeling::relabel
- template <unsigned n, typename F>
- fun::i2v::array< value::label<n> >
+ template <typename V, typename F>
+ fun::i2v::array<V>
relabelfun(const Function_v2b<F>& fv2b,
- const value::label<n>& nlabels,
- value::label<n>& new_nlabels);
+ const V& nlabels,
+ V& new_nlabels);
/// Create a i2v function from a v2v function.
/// This function can be used to relabel a labeled image.
///
- /// \param[in] fv2v A v2v function.
- /// \param[in] nlabels The number of labels.
- /// \param[in] new_nlabels The number of labels after relabeling.
+ /// \param[in] fv2v A v2v function. This function maps an id to
+ /// an already existing one.
+ /// \param[in] nlabels The number of labels.
+ /// \param[in] new_nlabels The number of labels after relabeling.
///
/// \return a i2v function.
///
/// \sa mln::labeling::relabel
- template <unsigned n, typename F>
- fun::i2v::array< value::label<n> >
+ template <typename V, typename F>
+ fun::i2v::array<V>
relabelfun(const Function_v2v<F>& fv2v,
- const value::label<n>& nlabels,
- value::label<n>& new_nlabels);
+ const V& nlabels,
+ V& new_nlabels);
# ifndef MLN_INCLUDE_ONLY
- template <unsigned n, typename F>
+ template <typename V, typename F>
inline
- fun::i2v::array< value::label<n> >
+ fun::i2v::array<V>
relabelfun(const Function_v2b<F>& fv2b_,
- const value::label<n>& nlabels,
- value::label<n>& new_nlabels)
+ const V& nlabels,
+ V& new_nlabels)
{
trace::entering("make::relabelfun");
const F& fv2b = exact(fv2b_);
- value::label<n> tmp_nlabels = literal::zero;
- typedef value::label<n> label_t;
- fun::i2v::array<label_t> fi2v(nlabels.next(), literal::zero);
- for (label_t i = 1; i <= nlabels; ++i)
+ unsigned nlabels_i = static_cast<unsigned>(nlabels) + 1;
+ V tmp_nlabels = literal::zero;
+ fun::i2v::array<V> fi2v(nlabels_i, literal::zero);
+ for (V i = 1; i < nlabels_i; ++i)
if (fv2b(i))
- {
fi2v(i) = ++tmp_nlabels;
- }
new_nlabels = tmp_nlabels;
trace::exiting("make::relabelfun");
return fi2v;
}
- template <unsigned n, typename F>
+ template <typename V, typename F>
inline
- fun::i2v::array< value::label<n> >
+ fun::i2v::array<V>
relabelfun(const Function_v2v<F>& fv2v_,
- const value::label<n>& nlabels,
- value::label<n>& new_nlabels)
+ const V& nlabels,
+ V& new_nlabels)
{
trace::entering("make::relabelfun");
const F& fv2v = exact(fv2v_);
- value::label<n> tmp_nlabels = literal::zero;
- typedef value::label<n> label_t;
- fun::i2v::array<label_t> fi2v(nlabels.next(), literal::zero);
- for (label_t i = 1; i < nlabels.next(); ++i)
+ unsigned nlabels_i = static_cast<unsigned>(nlabels) + 1;
+ V tmp_nlabels = literal::zero;
+ fun::i2v::array<V> fi2v(nlabels_i, literal::zero);
+ for (V i = 1; i < nlabels_i; ++i)
if (fi2v(fv2v(i)) == literal::zero)
{
fi2v(fv2v(i)) = ++tmp_nlabels;
diff --git a/milena/mln/morpho/tree/propagate_representative.hh b/milena/mln/morpho/tree/propagate_representative.hh
index 92eb0e9..6ccd18a 100644
--- a/milena/mln/morpho/tree/propagate_representative.hh
+++ b/milena/mln/morpho/tree/propagate_representative.hh
@@ -26,24 +26,33 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_MORPHO_TREE_PROPAGATE_REPRESENTATIVE_HH_
-# define MLN_MORPHO_TREE_PROPAGATE_REPRESENTATIVE_HH_
+#ifndef MLN_MORPHO_TREE_PROPAGATE_REPRESENTATIVE_HH
+# define MLN_MORPHO_TREE_PROPAGATE_REPRESENTATIVE_HH
/// \file mln/morpho/tree/propagate_representative.hh
///
/// Component tree routines.
-namespace mln{
- namespace morpho {
- namespace tree {
-
- /**
- ** Propagate the representative node's value to
- ** non-representative points of the component.
- **
- ** @param t Component tree.
- ** @param f_ Value image.
- */
+
+# include <mln/core/concept/image.hh>
+# include <mln/morpho/tree/data.hh>
+
+
+namespace mln
+{
+
+ namespace morpho
+ {
+
+ namespace tree
+ {
+
+ /// Propagate the representative node's value to
+ /// non-representative points of the component.
+ ///
+ /// \param t Component tree.
+ /// \param f_ Value image.
+ //
template <typename T, typename F>
void
propagate_representative(const T& t, Image<F>& f_);
@@ -52,25 +61,32 @@ namespace mln{
# ifndef MLN_INCLUDE_ONLY
+
template <typename T, typename F>
inline
void
propagate_representative(const T& t, Image<F>& f_)
{
F a = exact(f_);
+ mln_precondition(a.is_valid());
+
mln_up_site_piter(T) p(t);
for_all(p)
if (! t.is_a_node(p))
- {
- mln_assertion(t.is_a_node(t.parent(p)));
- a(p) = a(t.parent(p));
- }
+ {
+ mln_assertion(t.is_a_node(t.parent(p)));
+ a(p) = a(t.parent(p));
+ }
}
-# endif /* !MLN_INCLUDE_ONLY */
- }
- }
-}
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace mln::morpho::tree
+
+ } // end of namespace mln::morpho
+
+} // end of namespace mln
-#endif /* !MLN_MORPHO_TREE_PROPAGATE_REPRESENTATIVE_HH_ */
+#endif // ! MLN_MORPHO_TREE_PROPAGATE_REPRESENTATIVE_HH
diff --git a/milena/mln/pw/image.hh b/milena/mln/pw/image.hh
index 9bd6b87..5d5adef 100644
--- a/milena/mln/pw/image.hh
+++ b/milena/mln/pw/image.hh
@@ -84,7 +84,8 @@ namespace mln
namespace pw
{
- /// \brief A generic point-wise image implementation.
+ /// A generic point-wise image implementation.
+ ///
/// Parameter \p F is a function restricting the domain.
/// Parameter \p S is the domain type.
///
diff --git a/milena/mln/subsampling/subsampling.hh b/milena/mln/subsampling/subsampling.hh
index fee6f97..21eaad9 100644
--- a/milena/mln/subsampling/subsampling.hh
+++ b/milena/mln/subsampling/subsampling.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -62,7 +63,7 @@ namespace mln
mln_concrete(image2d<T>)
subsampling_(const image2d<T>& input,
const mln_deduce(image2d<T>, site, delta)& first_p,
- const mln_coord(image2d<T>)& gap)
+ const mln_deduce(image2d<T>, site, coord)& gap)
{
trace::entering("subsampling::impl::subsampling_");
mln_concrete(image2d<T>) output(geom::nrows(input) / gap,
diff --git a/milena/mln/tag/init.hh b/milena/mln/tag/init.hh
index e6921a7..21bd0b2 100644
--- a/milena/mln/tag/init.hh
+++ b/milena/mln/tag/init.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_TAG_INIT_HH
# define MLN_TAG_INIT_HH
-/*! \file mln/tag/init.hh
- *
- * \brief Definition of tags used in the mln::init mechanism.
- */
+/// \file mln/tag/init.hh
+///
+/// Definition of tags used in the mln::init mechanism.
namespace mln
@@ -40,28 +40,29 @@ namespace mln
namespace tag
{
- struct image_t {};
- struct domain_t {};
+
struct bbox_t {};
struct border_t {};
+ struct domain_t {};
struct extension_t {};
struct function_t {};
+ struct image_t {};
- extern const image_t& image;
- extern const domain_t& domain;
- extern const bbox_t& bbox;
- extern const border_t& border;
- extern const extension_t& extension;
- extern const function_t& function;
+ extern bbox_t bbox;
+ extern border_t border;
+ extern domain_t domain;
+ extern extension_t extension;
+ extern function_t function;
+ extern image_t image;
# ifndef MLN_INCLUDE_ONLY
- const image_t& image = image_t();
- const domain_t& domain = domain_t();
- const bbox_t& bbox = bbox_t();
- const border_t& border = border_t();
- const extension_t& extension = extension_t();
- const function_t& function = function_t();
+ bbox_t bbox;
+ border_t border;
+ domain_t domain;
+ extension_t extension;
+ function_t function;
+ image_t image;
# endif // !MLN_INCLUDE_ONLY
diff --git a/milena/mln/util/array.hh b/milena/mln/util/array.hh
index fd1f85b..4ffdf2d 100644
--- a/milena/mln/util/array.hh
+++ b/milena/mln/util/array.hh
@@ -507,7 +507,7 @@ namespace mln
typename array<T>::mutable_result
array<T>::operator()(unsigned i)
{
- return (*this)(i);
+ return (*this)[i];
}
template <typename T>
diff --git a/milena/mln/util/eat.hh b/milena/mln/util/eat.hh
index 27a53d6..569a9ad 100644
--- a/milena/mln/util/eat.hh
+++ b/milena/mln/util/eat.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_UTIL_EAT_HH
# define MLN_UTIL_EAT_HH
-/*! \file mln/util/eat.hh
- *
- * \brief Definition of an "eater" object.
- */
+/// \file mln/util/eat.hh
+///
+/// Definition of an "eater" object.
# include <mln/core/concept/object.hh>
@@ -42,9 +42,10 @@ namespace mln
namespace util
{
- /*! \brief Eat structure.
- *
- */
+ /// Eat structure.
+ ///
+ /// \ingroup modutil
+ //
struct eat : public Object< eat >
{
eat();
diff --git a/milena/mln/util/ignore.hh b/milena/mln/util/ignore.hh
index 2fd547e..32a6b25 100644
--- a/milena/mln/util/ignore.hh
+++ b/milena/mln/util/ignore.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_UTIL_IGNORE_HH
# define MLN_UTIL_IGNORE_HH
-/*! \file mln/util/ignore.hh
- *
- * \brief Definition of an "ignorer" object.
- */
+/// \file mln/util/ignore.hh
+///
+/// Definition of an "ignorer" object.
# include <mln/core/concept/object.hh>
@@ -42,9 +42,10 @@ namespace mln
namespace util
{
- /*! \brief Ignore structure.
- *
- */
+ /// Ignore structure.
+ ///
+ /// \ingroup modutil
+ //
struct ignore : public Object< ignore >
{
ignore();
@@ -53,6 +54,7 @@ namespace mln
operator T() const;
};
+
# ifndef MLN_INCLUDE_ONLY
// ignore
diff --git a/milena/mln/util/nil.hh b/milena/mln/util/nil.hh
index 43d73ef..9633994 100644
--- a/milena/mln/util/nil.hh
+++ b/milena/mln/util/nil.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_UTIL_NIL_HH
# define MLN_UTIL_NIL_HH
-/*! \file mln/util/nil.hh
- *
- * \brief Definition of an "niler" object.
- */
+/// \file mln/util/nil.hh
+///
+/// Definition of an "niler" object.
# include <mln/core/concept/object.hh>
@@ -42,9 +42,10 @@ namespace mln
namespace util
{
- /*! \brief Nil structure.
- *
- */
+ /// \brief Nil structure.
+ ///
+ /// \ingroup modutil
+ //
struct nil : public Object< nil >
{
nil();
diff --git a/milena/mln/util/tracked_ptr.hh b/milena/mln/util/tracked_ptr.hh
index 0148880..25c0ea3 100644
--- a/milena/mln/util/tracked_ptr.hh
+++ b/milena/mln/util/tracked_ptr.hh
@@ -32,8 +32,6 @@
/// \file mln/util/tracked_ptr.hh
///
/// Definition of a smart pointer for shared data with tracking.
-///
-/// \todo Split defs from decls.
# include <set>
# include <iostream>
@@ -48,6 +46,10 @@ namespace mln
namespace util
{
+ /// Smart pointer for shared data with tracking.
+ ///
+ /// \ingroup modutil
+ //
template <typename T>
struct tracked_ptr
{
@@ -73,14 +75,13 @@ namespace mln
/// \invariant Pointer proxy exists.
T* operator->();
- /// Ctor.
+ /// Constructors.
+ /// @{
tracked_ptr();
-
- /// Ctor.
tracked_ptr(T* ptr);
-
- /// Cpy ctor.
+ /// Copy constructor.
tracked_ptr(const tracked_ptr<T>& rhs);
+ /// @}
/// Assignment.
tracked_ptr<T>& operator=(const tracked_ptr<T>& rhs);
@@ -88,7 +89,7 @@ namespace mln
/// Assignment.
tracked_ptr<T>& operator=(T* ptr);
- /// Dtor.
+ /// Destructor.
~tracked_ptr();
bool run_() const;
@@ -111,7 +112,6 @@ namespace mln
}
template <typename T>
- /// Negation (for arithmetical tests).
inline
bool tracked_ptr<T>::operator !() const
{
@@ -120,9 +120,6 @@ namespace mln
}
template <typename T>
- /// Mimics the behavior of op-> for a pointer in the const case.
- ///
- /// \invariant Pointer proxy exists.
inline
const T* tracked_ptr<T>::operator->() const
{
@@ -132,9 +129,6 @@ namespace mln
}
template <typename T>
- /// \brief Mimics the behavior of op-> for a pointer in the mutable case.
- ///
- /// \invariant Pointer proxy exists.
inline
T* tracked_ptr<T>::operator->()
{
@@ -144,7 +138,6 @@ namespace mln
}
template <typename T>
- /// Ctor.
inline
tracked_ptr<T>::tracked_ptr() :
ptr_(0),
@@ -154,7 +147,6 @@ namespace mln
}
template <typename T>
- /// Ctor.
inline
tracked_ptr<T>::tracked_ptr(T* ptr) :
ptr_(ptr)
@@ -172,7 +164,6 @@ namespace mln
}
template <typename T>
- /// Cpy ctor.
inline
tracked_ptr<T>::tracked_ptr(const tracked_ptr<T>& rhs) :
ptr_(rhs.ptr_),
@@ -185,7 +176,6 @@ namespace mln
}
template <typename T>
- /// Assignment.
inline
tracked_ptr<T>& tracked_ptr<T>::operator=(const tracked_ptr<T>& rhs)
{
@@ -204,7 +194,6 @@ namespace mln
}
template <typename T>
- /// Assignment.
inline
tracked_ptr<T>& tracked_ptr<T>::operator=(T* ptr)
{
@@ -226,7 +215,6 @@ namespace mln
return *this;
}
- /// Dtor.
template <typename T>
inline
tracked_ptr<T>::~tracked_ptr()
diff --git a/milena/mln/util/yes.hh b/milena/mln/util/yes.hh
index c460c42..44f15f8 100644
--- a/milena/mln/util/yes.hh
+++ b/milena/mln/util/yes.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,10 @@
#ifndef MLN_UTIL_YES_HH
# define MLN_UTIL_YES_HH
-/*! \file mln/util/yes.hh
- *
- * \brief Definition of an object that always says "yes".
- */
+/// \file mln/util/yes.hh
+///
+/// Definition of an object that always says "yes".
+
# include <mln/core/concept/object.hh>
# include <mln/core/routine/ops.hh>
@@ -40,7 +41,7 @@
namespace mln
{
- // Fwd decl.
+ // Forward declaration.
namespace util { struct yes; }
@@ -64,16 +65,17 @@ namespace mln
{
typedef util::yes ret;
};
-
+
} // end of namespace mln::trait
namespace util
{
- /*! \brief Yes structure.
- *
- */
+ /// Object that always says "yes".
+ ///
+ /// \ingroup modutil
+ //
struct yes : public Object< yes >
{
yes();
diff --git a/milena/mln/value/label.hh b/milena/mln/value/label.hh
index 054524a..dd61b33 100644
--- a/milena/mln/value/label.hh
+++ b/milena/mln/value/label.hh
@@ -108,6 +108,11 @@ namespace mln
void
from_to_(const value::int_u<n>& from, value::label<m>& to_);
+ // label -> bool.
+ template <unsigned n>
+ void
+ from_to_(const value::label<n>& from, bool& to_);
+
} // end of namespace mln::convert::over_load
} // end of namespace mln::convert
@@ -213,6 +218,14 @@ namespace mln
to_ = from;
}
+ template <unsigned n>
+ inline
+ void
+ from_to_(const value::label<n>& from, bool& to_)
+ {
+ to_ = (from != literal::zero);
+ }
+
} // end of namespace mln::convert::over_load
} // end of namespace mln::convert
diff --git a/milena/tests/transformation/rotate.cc b/milena/tests/transformation/rotate.cc
index d0dfaee..274c47c 100644
--- a/milena/tests/transformation/rotate.cc
+++ b/milena/tests/transformation/rotate.cc
@@ -34,13 +34,12 @@
# include <mln/make/image.hh>
# include <mln/level/compare.hh>
-
int main()
{
using namespace mln;
bool ref_values[][5] = { { 0, 1, 0, 0, 0 },
- { 0, 0, 1, 0, 0 },
+ { 0, 1, 1, 0, 0 },
{ 0, 0, 1, 1, 0 },
{ 0, 0, 0, 1, 1 },
{ 0, 0, 0, 0, 1 } };
diff --git a/milena/tests/unit_test/unit-tests.mk b/milena/tests/unit_test/unit-tests.mk
index 16e30b4..8c856aa 100644
--- a/milena/tests/unit_test/unit-tests.mk
+++ b/milena/tests/unit_test/unit-tests.mk
@@ -231,65 +231,69 @@ mln_core_grids \
mln_core_image_all \
mln_core_image_bgraph_image \
mln_core_image_bgraph_psite \
-mln_core_image_cast_image \
mln_core_image_ch_piter \
mln_core_image_complex_image \
mln_core_image_complex_neighborhood_piter \
mln_core_image_complex_neighborhoods \
mln_core_image_complex_window_piter \
mln_core_image_complex_windows \
-mln_core_image_decorated_image \
mln_core_image_dmorph_all \
+mln_core_image_dmorph_extended \
+mln_core_image_dmorph_extension_fun \
+mln_core_image_dmorph_extension_ima \
+mln_core_image_dmorph_extension_val \
+mln_core_image_dmorph_hexa \
+mln_core_image_dmorph_hexa_piter \
+mln_core_image_dmorph_image2d_h \
+mln_core_image_dmorph_image_if \
+mln_core_image_dmorph_p2p_image \
+mln_core_image_dmorph_slice_image \
+mln_core_image_dmorph_sub_image \
+mln_core_image_dmorph_sub_image_if \
mln_core_image_dmorph_transformed_image \
+mln_core_image_dmorph_unproject_image \
mln_core_image_edge_image \
mln_core_image_essential \
-mln_core_image_extended \
-mln_core_image_extension_fun \
-mln_core_image_extension_ima \
-mln_core_image_extension_val \
mln_core_image_flat_image \
-mln_core_image_fun_image \
mln_core_image_graph_elt_neighborhood \
mln_core_image_graph_elt_neighborhood_if \
mln_core_image_graph_elt_window \
mln_core_image_graph_elt_window_if \
mln_core_image_graph_window_if_piter \
mln_core_image_graph_window_piter \
-mln_core_image_hexa \
-mln_core_image_hexa_piter \
mln_core_image_image1d \
mln_core_image_image2d \
-mln_core_image_image2d_h \
mln_core_image_image3d \
-mln_core_image_image_if \
-mln_core_image_interpolated \
-mln_core_image_lazy_image \
+mln_core_image_imorph_all \
+mln_core_image_imorph_decorated_image \
+mln_core_image_imorph_interpolated \
+mln_core_image_imorph_labeled_image \
+mln_core_image_imorph_lazy_image \
+mln_core_image_imorph_plain \
+mln_core_image_imorph_safe \
+mln_core_image_imorph_tr_image \
mln_core_image_mono_obased_rle_encode \
mln_core_image_mono_obased_rle_image \
mln_core_image_mono_rle_encode \
mln_core_image_mono_rle_image \
+mln_core_image_morph_all \
+mln_core_image_morph_t_image \
mln_core_image_obased_rle_encode \
mln_core_image_obased_rle_image \
-mln_core_image_p2p_image \
-mln_core_image_plain \
mln_core_image_rle_encode \
mln_core_image_rle_image \
-mln_core_image_safe \
-mln_core_image_slice_image \
mln_core_image_sparse_encode \
mln_core_image_sparse_image \
-mln_core_image_sub_image \
-mln_core_image_sub_image_if \
-mln_core_image_t_image \
-mln_core_image_thru_morpher \
-mln_core_image_thrubin_morpher \
-mln_core_image_tr_image \
mln_core_image_tr_mesh \
-mln_core_image_unproject_image \
mln_core_image_value_enc_image \
mln_core_image_value_encode \
mln_core_image_vertex_image \
-mln_core_image_violent_cast_image \
+mln_core_image_vmorph_all \
+mln_core_image_vmorph_cast_image \
+mln_core_image_vmorph_fun_image \
+mln_core_image_vmorph_thru_image \
+mln_core_image_vmorph_thrubin_image \
+mln_core_image_vmorph_violent_cast_image \
mln_core_internal_box_impl \
mln_core_internal_check_image_all \
mln_core_internal_check_image_fastest \
@@ -413,6 +417,7 @@ mln_debug_println_with_border \
mln_debug_put_word \
mln_debug_quiet \
mln_debug_slices_2d \
+mln_debug_superpose \
mln_display_all \
mln_display_essential \
mln_draw_all \
@@ -484,7 +489,6 @@ mln_fun_meta_essential \
mln_fun_meta_first \
mln_fun_meta_green \
mln_fun_meta_hue \
-mln_fun_meta_inty \
mln_fun_meta_lum \
mln_fun_meta_red \
mln_fun_meta_sat \
@@ -499,6 +503,7 @@ mln_fun_p2b_essential \
mln_fun_p2b_has \
mln_fun_p2b_tautology \
mln_fun_p2p_all \
+mln_fun_p2p_fold \
mln_fun_p2p_mirror \
mln_fun_p2p_translation \
mln_fun_p2v_all \
@@ -526,18 +531,17 @@ mln_fun_v2v_abs \
mln_fun_v2v_all \
mln_fun_v2v_cast \
mln_fun_v2v_ch_function_value \
+mln_fun_v2v_component \
mln_fun_v2v_convert \
mln_fun_v2v_dec \
mln_fun_v2v_enc \
mln_fun_v2v_essential \
-mln_fun_v2v_hsi_to_rgb \
mln_fun_v2v_hsl_to_rgb \
mln_fun_v2v_id \
mln_fun_v2v_inc \
mln_fun_v2v_linear \
mln_fun_v2v_norm \
mln_fun_v2v_projection \
-mln_fun_v2v_rgb_to_hsi \
mln_fun_v2v_rgb_to_hsl \
mln_fun_v2v_saturate \
mln_fun_v2v_wrap \
@@ -615,6 +619,7 @@ mln_histo_all \
mln_histo_array \
mln_histo_compute \
mln_histo_essential \
+mln_histo_point_from_value \
mln_io_abort \
mln_io_all \
mln_io_cloud_all \
@@ -657,6 +662,7 @@ mln_io_ppm_load \
mln_io_ppm_save \
mln_io_tiff_all \
mln_io_tiff_load \
+mln_io_tiff_save \
mln_io_txt_all \
mln_io_txt_save \
mln_labeling_all \
@@ -1190,7 +1196,6 @@ mln_value_gl8 \
mln_value_glf \
mln_value_graylevel \
mln_value_graylevel_f \
-mln_value_hsi \
mln_value_hsl \
mln_value_int_s \
mln_value_int_s16 \
@@ -1231,7 +1236,6 @@ mln_value_sign \
mln_value_stack \
mln_value_super_value \
mln_value_viter \
-mln_version \
mln_win_all \
mln_win_backdiag2d \
mln_win_ball \
@@ -1255,6 +1259,8 @@ mln_win_sym \
mln_win_vline2d \
mln_world_all \
mln_world_binary_2d_all \
+mln_world_binary_2d_enlarge \
+mln_world_binary_2d_enlarge_hq2x \
mln_world_binary_2d_projected_histo \
mln_world_binary_2d_subsample \
mln_world_inter_pixel_all \
@@ -1503,65 +1509,69 @@ mln_core_grids_SOURCES = mln_core_grids.cc
mln_core_image_all_SOURCES = mln_core_image_all.cc
mln_core_image_bgraph_image_SOURCES = mln_core_image_bgraph_image.cc
mln_core_image_bgraph_psite_SOURCES = mln_core_image_bgraph_psite.cc
-mln_core_image_cast_image_SOURCES = mln_core_image_cast_image.cc
mln_core_image_ch_piter_SOURCES = mln_core_image_ch_piter.cc
mln_core_image_complex_image_SOURCES = mln_core_image_complex_image.cc
mln_core_image_complex_neighborhood_piter_SOURCES = mln_core_image_complex_neighborhood_piter.cc
mln_core_image_complex_neighborhoods_SOURCES = mln_core_image_complex_neighborhoods.cc
mln_core_image_complex_window_piter_SOURCES = mln_core_image_complex_window_piter.cc
mln_core_image_complex_windows_SOURCES = mln_core_image_complex_windows.cc
-mln_core_image_decorated_image_SOURCES = mln_core_image_decorated_image.cc
mln_core_image_dmorph_all_SOURCES = mln_core_image_dmorph_all.cc
+mln_core_image_dmorph_extended_SOURCES = mln_core_image_dmorph_extended.cc
+mln_core_image_dmorph_extension_fun_SOURCES = mln_core_image_dmorph_extension_fun.cc
+mln_core_image_dmorph_extension_ima_SOURCES = mln_core_image_dmorph_extension_ima.cc
+mln_core_image_dmorph_extension_val_SOURCES = mln_core_image_dmorph_extension_val.cc
+mln_core_image_dmorph_hexa_SOURCES = mln_core_image_dmorph_hexa.cc
+mln_core_image_dmorph_hexa_piter_SOURCES = mln_core_image_dmorph_hexa_piter.cc
+mln_core_image_dmorph_image2d_h_SOURCES = mln_core_image_dmorph_image2d_h.cc
+mln_core_image_dmorph_image_if_SOURCES = mln_core_image_dmorph_image_if.cc
+mln_core_image_dmorph_p2p_image_SOURCES = mln_core_image_dmorph_p2p_image.cc
+mln_core_image_dmorph_slice_image_SOURCES = mln_core_image_dmorph_slice_image.cc
+mln_core_image_dmorph_sub_image_SOURCES = mln_core_image_dmorph_sub_image.cc
+mln_core_image_dmorph_sub_image_if_SOURCES = mln_core_image_dmorph_sub_image_if.cc
mln_core_image_dmorph_transformed_image_SOURCES = mln_core_image_dmorph_transformed_image.cc
+mln_core_image_dmorph_unproject_image_SOURCES = mln_core_image_dmorph_unproject_image.cc
mln_core_image_edge_image_SOURCES = mln_core_image_edge_image.cc
mln_core_image_essential_SOURCES = mln_core_image_essential.cc
-mln_core_image_extended_SOURCES = mln_core_image_extended.cc
-mln_core_image_extension_fun_SOURCES = mln_core_image_extension_fun.cc
-mln_core_image_extension_ima_SOURCES = mln_core_image_extension_ima.cc
-mln_core_image_extension_val_SOURCES = mln_core_image_extension_val.cc
mln_core_image_flat_image_SOURCES = mln_core_image_flat_image.cc
-mln_core_image_fun_image_SOURCES = mln_core_image_fun_image.cc
mln_core_image_graph_elt_neighborhood_SOURCES = mln_core_image_graph_elt_neighborhood.cc
mln_core_image_graph_elt_neighborhood_if_SOURCES = mln_core_image_graph_elt_neighborhood_if.cc
mln_core_image_graph_elt_window_SOURCES = mln_core_image_graph_elt_window.cc
mln_core_image_graph_elt_window_if_SOURCES = mln_core_image_graph_elt_window_if.cc
mln_core_image_graph_window_if_piter_SOURCES = mln_core_image_graph_window_if_piter.cc
mln_core_image_graph_window_piter_SOURCES = mln_core_image_graph_window_piter.cc
-mln_core_image_hexa_SOURCES = mln_core_image_hexa.cc
-mln_core_image_hexa_piter_SOURCES = mln_core_image_hexa_piter.cc
mln_core_image_image1d_SOURCES = mln_core_image_image1d.cc
mln_core_image_image2d_SOURCES = mln_core_image_image2d.cc
-mln_core_image_image2d_h_SOURCES = mln_core_image_image2d_h.cc
mln_core_image_image3d_SOURCES = mln_core_image_image3d.cc
-mln_core_image_image_if_SOURCES = mln_core_image_image_if.cc
-mln_core_image_interpolated_SOURCES = mln_core_image_interpolated.cc
-mln_core_image_lazy_image_SOURCES = mln_core_image_lazy_image.cc
+mln_core_image_imorph_all_SOURCES = mln_core_image_imorph_all.cc
+mln_core_image_imorph_decorated_image_SOURCES = mln_core_image_imorph_decorated_image.cc
+mln_core_image_imorph_interpolated_SOURCES = mln_core_image_imorph_interpolated.cc
+mln_core_image_imorph_labeled_image_SOURCES = mln_core_image_imorph_labeled_image.cc
+mln_core_image_imorph_lazy_image_SOURCES = mln_core_image_imorph_lazy_image.cc
+mln_core_image_imorph_plain_SOURCES = mln_core_image_imorph_plain.cc
+mln_core_image_imorph_safe_SOURCES = mln_core_image_imorph_safe.cc
+mln_core_image_imorph_tr_image_SOURCES = mln_core_image_imorph_tr_image.cc
mln_core_image_mono_obased_rle_encode_SOURCES = mln_core_image_mono_obased_rle_encode.cc
mln_core_image_mono_obased_rle_image_SOURCES = mln_core_image_mono_obased_rle_image.cc
mln_core_image_mono_rle_encode_SOURCES = mln_core_image_mono_rle_encode.cc
mln_core_image_mono_rle_image_SOURCES = mln_core_image_mono_rle_image.cc
+mln_core_image_morph_all_SOURCES = mln_core_image_morph_all.cc
+mln_core_image_morph_t_image_SOURCES = mln_core_image_morph_t_image.cc
mln_core_image_obased_rle_encode_SOURCES = mln_core_image_obased_rle_encode.cc
mln_core_image_obased_rle_image_SOURCES = mln_core_image_obased_rle_image.cc
-mln_core_image_p2p_image_SOURCES = mln_core_image_p2p_image.cc
-mln_core_image_plain_SOURCES = mln_core_image_plain.cc
mln_core_image_rle_encode_SOURCES = mln_core_image_rle_encode.cc
mln_core_image_rle_image_SOURCES = mln_core_image_rle_image.cc
-mln_core_image_safe_SOURCES = mln_core_image_safe.cc
-mln_core_image_slice_image_SOURCES = mln_core_image_slice_image.cc
mln_core_image_sparse_encode_SOURCES = mln_core_image_sparse_encode.cc
mln_core_image_sparse_image_SOURCES = mln_core_image_sparse_image.cc
-mln_core_image_sub_image_SOURCES = mln_core_image_sub_image.cc
-mln_core_image_sub_image_if_SOURCES = mln_core_image_sub_image_if.cc
-mln_core_image_t_image_SOURCES = mln_core_image_t_image.cc
-mln_core_image_thru_morpher_SOURCES = mln_core_image_thru_morpher.cc
-mln_core_image_thrubin_morpher_SOURCES = mln_core_image_thrubin_morpher.cc
-mln_core_image_tr_image_SOURCES = mln_core_image_tr_image.cc
mln_core_image_tr_mesh_SOURCES = mln_core_image_tr_mesh.cc
-mln_core_image_unproject_image_SOURCES = mln_core_image_unproject_image.cc
mln_core_image_value_enc_image_SOURCES = mln_core_image_value_enc_image.cc
mln_core_image_value_encode_SOURCES = mln_core_image_value_encode.cc
mln_core_image_vertex_image_SOURCES = mln_core_image_vertex_image.cc
-mln_core_image_violent_cast_image_SOURCES = mln_core_image_violent_cast_image.cc
+mln_core_image_vmorph_all_SOURCES = mln_core_image_vmorph_all.cc
+mln_core_image_vmorph_cast_image_SOURCES = mln_core_image_vmorph_cast_image.cc
+mln_core_image_vmorph_fun_image_SOURCES = mln_core_image_vmorph_fun_image.cc
+mln_core_image_vmorph_thru_image_SOURCES = mln_core_image_vmorph_thru_image.cc
+mln_core_image_vmorph_thrubin_image_SOURCES = mln_core_image_vmorph_thrubin_image.cc
+mln_core_image_vmorph_violent_cast_image_SOURCES = mln_core_image_vmorph_violent_cast_image.cc
mln_core_internal_box_impl_SOURCES = mln_core_internal_box_impl.cc
mln_core_internal_check_image_all_SOURCES = mln_core_internal_check_image_all.cc
mln_core_internal_check_image_fastest_SOURCES = mln_core_internal_check_image_fastest.cc
@@ -1685,6 +1695,7 @@ mln_debug_println_with_border_SOURCES = mln_debug_println_with_border.cc
mln_debug_put_word_SOURCES = mln_debug_put_word.cc
mln_debug_quiet_SOURCES = mln_debug_quiet.cc
mln_debug_slices_2d_SOURCES = mln_debug_slices_2d.cc
+mln_debug_superpose_SOURCES = mln_debug_superpose.cc
mln_display_all_SOURCES = mln_display_all.cc
mln_display_essential_SOURCES = mln_display_essential.cc
mln_draw_all_SOURCES = mln_draw_all.cc
@@ -1756,7 +1767,6 @@ mln_fun_meta_essential_SOURCES = mln_fun_meta_essential.cc
mln_fun_meta_first_SOURCES = mln_fun_meta_first.cc
mln_fun_meta_green_SOURCES = mln_fun_meta_green.cc
mln_fun_meta_hue_SOURCES = mln_fun_meta_hue.cc
-mln_fun_meta_inty_SOURCES = mln_fun_meta_inty.cc
mln_fun_meta_lum_SOURCES = mln_fun_meta_lum.cc
mln_fun_meta_red_SOURCES = mln_fun_meta_red.cc
mln_fun_meta_sat_SOURCES = mln_fun_meta_sat.cc
@@ -1771,6 +1781,7 @@ mln_fun_p2b_essential_SOURCES = mln_fun_p2b_essential.cc
mln_fun_p2b_has_SOURCES = mln_fun_p2b_has.cc
mln_fun_p2b_tautology_SOURCES = mln_fun_p2b_tautology.cc
mln_fun_p2p_all_SOURCES = mln_fun_p2p_all.cc
+mln_fun_p2p_fold_SOURCES = mln_fun_p2p_fold.cc
mln_fun_p2p_mirror_SOURCES = mln_fun_p2p_mirror.cc
mln_fun_p2p_translation_SOURCES = mln_fun_p2p_translation.cc
mln_fun_p2v_all_SOURCES = mln_fun_p2v_all.cc
@@ -1798,18 +1809,17 @@ mln_fun_v2v_abs_SOURCES = mln_fun_v2v_abs.cc
mln_fun_v2v_all_SOURCES = mln_fun_v2v_all.cc
mln_fun_v2v_cast_SOURCES = mln_fun_v2v_cast.cc
mln_fun_v2v_ch_function_value_SOURCES = mln_fun_v2v_ch_function_value.cc
+mln_fun_v2v_component_SOURCES = mln_fun_v2v_component.cc
mln_fun_v2v_convert_SOURCES = mln_fun_v2v_convert.cc
mln_fun_v2v_dec_SOURCES = mln_fun_v2v_dec.cc
mln_fun_v2v_enc_SOURCES = mln_fun_v2v_enc.cc
mln_fun_v2v_essential_SOURCES = mln_fun_v2v_essential.cc
-mln_fun_v2v_hsi_to_rgb_SOURCES = mln_fun_v2v_hsi_to_rgb.cc
mln_fun_v2v_hsl_to_rgb_SOURCES = mln_fun_v2v_hsl_to_rgb.cc
mln_fun_v2v_id_SOURCES = mln_fun_v2v_id.cc
mln_fun_v2v_inc_SOURCES = mln_fun_v2v_inc.cc
mln_fun_v2v_linear_SOURCES = mln_fun_v2v_linear.cc
mln_fun_v2v_norm_SOURCES = mln_fun_v2v_norm.cc
mln_fun_v2v_projection_SOURCES = mln_fun_v2v_projection.cc
-mln_fun_v2v_rgb_to_hsi_SOURCES = mln_fun_v2v_rgb_to_hsi.cc
mln_fun_v2v_rgb_to_hsl_SOURCES = mln_fun_v2v_rgb_to_hsl.cc
mln_fun_v2v_saturate_SOURCES = mln_fun_v2v_saturate.cc
mln_fun_v2v_wrap_SOURCES = mln_fun_v2v_wrap.cc
@@ -1887,6 +1897,7 @@ mln_histo_all_SOURCES = mln_histo_all.cc
mln_histo_array_SOURCES = mln_histo_array.cc
mln_histo_compute_SOURCES = mln_histo_compute.cc
mln_histo_essential_SOURCES = mln_histo_essential.cc
+mln_histo_point_from_value_SOURCES = mln_histo_point_from_value.cc
mln_io_abort_SOURCES = mln_io_abort.cc
mln_io_all_SOURCES = mln_io_all.cc
mln_io_cloud_all_SOURCES = mln_io_cloud_all.cc
@@ -1929,6 +1940,7 @@ mln_io_ppm_load_SOURCES = mln_io_ppm_load.cc
mln_io_ppm_save_SOURCES = mln_io_ppm_save.cc
mln_io_tiff_all_SOURCES = mln_io_tiff_all.cc
mln_io_tiff_load_SOURCES = mln_io_tiff_load.cc
+mln_io_tiff_save_SOURCES = mln_io_tiff_save.cc
mln_io_txt_all_SOURCES = mln_io_txt_all.cc
mln_io_txt_save_SOURCES = mln_io_txt_save.cc
mln_labeling_all_SOURCES = mln_labeling_all.cc
@@ -2462,7 +2474,6 @@ mln_value_gl8_SOURCES = mln_value_gl8.cc
mln_value_glf_SOURCES = mln_value_glf.cc
mln_value_graylevel_SOURCES = mln_value_graylevel.cc
mln_value_graylevel_f_SOURCES = mln_value_graylevel_f.cc
-mln_value_hsi_SOURCES = mln_value_hsi.cc
mln_value_hsl_SOURCES = mln_value_hsl.cc
mln_value_int_s_SOURCES = mln_value_int_s.cc
mln_value_int_s16_SOURCES = mln_value_int_s16.cc
@@ -2503,7 +2514,6 @@ mln_value_sign_SOURCES = mln_value_sign.cc
mln_value_stack_SOURCES = mln_value_stack.cc
mln_value_super_value_SOURCES = mln_value_super_value.cc
mln_value_viter_SOURCES = mln_value_viter.cc
-mln_version_SOURCES = mln_version.cc
mln_win_all_SOURCES = mln_win_all.cc
mln_win_backdiag2d_SOURCES = mln_win_backdiag2d.cc
mln_win_ball_SOURCES = mln_win_ball.cc
@@ -2527,6 +2537,8 @@ mln_win_sym_SOURCES = mln_win_sym.cc
mln_win_vline2d_SOURCES = mln_win_vline2d.cc
mln_world_all_SOURCES = mln_world_all.cc
mln_world_binary_2d_all_SOURCES = mln_world_binary_2d_all.cc
+mln_world_binary_2d_enlarge_SOURCES = mln_world_binary_2d_enlarge.cc
+mln_world_binary_2d_enlarge_hq2x_SOURCES = mln_world_binary_2d_enlarge_hq2x.cc
mln_world_binary_2d_projected_histo_SOURCES = mln_world_binary_2d_projected_histo.cc
mln_world_binary_2d_subsample_SOURCES = mln_world_binary_2d_subsample.cc
mln_world_inter_pixel_all_SOURCES = mln_world_inter_pixel_all.cc
--
1.5.6.5
1
0