* binarization/sauvola.hh: Fix an invalid precondition.
* filter/objects_size_ratio.hh: Add a "using namespace".
* primitive/extract/lines_h_pattern.hh,
* primitive/extract/lines_v_pattern.hh: Add a parameter.
* primitive/extract/lines_pattern.hh: Add a todo.
* tests/unit_test/unit-tests.mk: Regen.
---
scribo/ChangeLog | 15 +++++++++++
scribo/binarization/sauvola.hh | 2 +-
scribo/filter/objects_size_ratio.hh | 2 +-
scribo/primitive/extract/lines_h_pattern.hh | 37 +++++++++++++++++---------
scribo/primitive/extract/lines_pattern.hh | 2 +
scribo/primitive/extract/lines_v_pattern.hh | 21 +++++++++++----
scribo/tests/unit_test/unit-tests.mk | 8 ++++++
7 files changed, 66 insertions(+), 21 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 5a27a1e..226b82d 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,18 @@
+2009-09-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Small fixes in Scribo.
+
+ * binarization/sauvola.hh: Fix an invalid precondition.
+
+ * filter/objects_size_ratio.hh: Add a "using namespace".
+
+ * primitive/extract/lines_h_pattern.hh,
+ * primitive/extract/lines_v_pattern.hh: Add a parameter.
+
+ * primitive/extract/lines_pattern.hh: Add a todo.
+
+ * tests/unit_test/unit-tests.mk: Regen.
+
2009-09-28 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix typo.
diff --git a/scribo/binarization/sauvola.hh b/scribo/binarization/sauvola.hh
index 9b719e1..b9f78f8 100644
--- a/scribo/binarization/sauvola.hh
+++ b/scribo/binarization/sauvola.hh
@@ -310,7 +310,7 @@ namespace scribo
{
trace::entering("scribo::binarization::sauvola");
- mln_precondition(I::dim == 2);
+ mln_precondition(mln_site_(I)::dim == 2);
mln_precondition(exact(input).is_valid());
typedef mln_value(I) value_t;
diff --git a/scribo/filter/objects_size_ratio.hh b/scribo/filter/objects_size_ratio.hh
index 7a68f7f..cd12b2e 100644
--- a/scribo/filter/objects_size_ratio.hh
+++ b/scribo/filter/objects_size_ratio.hh
@@ -40,7 +40,7 @@ namespace scribo
namespace filter
{
-
+ using namespace mln;
template <typename L>
object_image(L)
diff --git a/scribo/primitive/extract/lines_h_pattern.hh
b/scribo/primitive/extract/lines_h_pattern.hh
index 7716ac5..fa1823d 100644
--- a/scribo/primitive/extract/lines_h_pattern.hh
+++ b/scribo/primitive/extract/lines_h_pattern.hh
@@ -54,37 +54,48 @@ namespace scribo
///
/// \param[in] input A binary image.
/// \param[in] length The minimum line length.
+ /// \param[in] delta Distance between the object pixel and the
+ /// background pixel.
///
/// \result An image of horizontal lines.
//
template <typename I>
mln_concrete(I)
- lines_h_pattern(const Image<I>& input, unsigned length);
+ lines_h_pattern(const Image<I>& input, unsigned length, unsigned delta);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
mln_concrete(I)
- lines_h_pattern(const Image<I>& input, unsigned length)
+ lines_h_pattern(const Image<I>& input, unsigned length, unsigned delta)
{
mlc_is(mln_value(I), bool)::check();
mln_precondition(exact(input).is_valid());
mln_precondition(length % 2 == 1);
- bool win_def[7][1] = { {1},
- {0},
- {0},
- {0},
- {0},
- {0},
- {1} };
-
- window2d win;
- convert::from_to(win_def, win);
+// bool win_def[7][1] = { {1},
+// {0},
+// {0},
+// {0},
+// {0},
+// {0},
+// {1} };
+
+// window2d win;
+// convert::from_to(win_def, win);
+
+ // FIXME: not generic.
+ window2d win;
+ mln_deduce(I, site, dpsite)
+ dp1(-delta, 0),
+ dp2( delta, 0);
+ win.insert(dp1);
+ win.insert(dp2);
//FIXME: Add reconstruction instead of this arbitrary dilation.
- win::hline2d hwin(length/2 + 2);
+ win::hline2d hwin(length/2 + 2);
+// win::hline2d hwin(length);
return morpho::dilation(lines_pattern(input, length, 1, win), hwin);
// return lines_pattern(input, length, 1, win);
}
diff --git a/scribo/primitive/extract/lines_pattern.hh
b/scribo/primitive/extract/lines_pattern.hh
index cd2b558..6a69a4a 100644
--- a/scribo/primitive/extract/lines_pattern.hh
+++ b/scribo/primitive/extract/lines_pattern.hh
@@ -29,6 +29,8 @@
/// \file
///
/// Extract lines matching a specific pattern.
+///
+/// \todo Make a more generic canvas.
# include <mln/core/concept/image.hh>
# include <mln/core/alias/window2d.hh>
diff --git a/scribo/primitive/extract/lines_v_pattern.hh
b/scribo/primitive/extract/lines_v_pattern.hh
index 29f4a54..ccd21c5 100644
--- a/scribo/primitive/extract/lines_v_pattern.hh
+++ b/scribo/primitive/extract/lines_v_pattern.hh
@@ -60,7 +60,7 @@ namespace scribo
//
template <typename I>
mln_concrete(I)
- lines_v_pattern(const Image<I>& input, unsigned length);
+ lines_v_pattern(const Image<I>& input, unsigned length, unsigned delta);
# ifndef MLN_INCLUDE_ONLY
@@ -68,17 +68,26 @@ namespace scribo
template <typename I>
mln_concrete(I)
- lines_v_pattern(const Image<I>& input, unsigned length)
+ lines_v_pattern(const Image<I>& input, unsigned length, unsigned delta)
{
mln_precondition(length % 2 == 1);
- bool win_def[1][7] = { { 1, 0, 0, 0, 0, 0, 1 } };
+// bool win_def[1][7] = { { 1, 0, 0, 0, 0, 0, 1 } };
- window2d win;
- convert::from_to(win_def, win);
+// window2d win;
+// convert::from_to(win_def, win);
+
+ // FIXME: not generic.
+ window2d win;
+ mln_deduce(I, site, dpsite)
+ dp1(0, -delta),
+ dp2(0, delta);
+ win.insert(dp1);
+ win.insert(dp2);
//FIXME: Add reconstruction instead of this arbitrary dilation.
- win::vline2d vwin(length/2 + 2);
+ win::vline2d vwin(length/2 + 2);
+// win::vline2d vwin(length);
return morpho::dilation(lines_pattern(input, length, 0, win), vwin);
// return lines_pattern(input, length, 0, win);
}
diff --git a/scribo/tests/unit_test/unit-tests.mk b/scribo/tests/unit_test/unit-tests.mk
index 6b44ef9..953f02a 100644
--- a/scribo/tests/unit_test/unit-tests.mk
+++ b/scribo/tests/unit_test/unit-tests.mk
@@ -26,6 +26,7 @@ scribo_filter_all \
scribo_filter_common_object_groups_photo \
scribo_filter_common_object_links_photo \
scribo_filter_common_objects_photo \
+scribo_filter_object_groups_size_ratio \
scribo_filter_object_groups_small \
scribo_filter_object_groups_v_thickness \
scribo_filter_object_links_bbox_h_ratio \
@@ -37,10 +38,13 @@ scribo_filter_object_links_non_aligned \
scribo_filter_object_links_non_aligned_simple \
scribo_filter_object_links_non_h_aligned \
scribo_filter_object_links_non_v_aligned \
+scribo_filter_objects_h_thin \
scribo_filter_objects_large \
+scribo_filter_objects_size_ratio \
scribo_filter_objects_small \
scribo_filter_objects_thick \
scribo_filter_objects_thin \
+scribo_filter_objects_v_thin \
scribo_fun_v2b_objects_small_filter \
scribo_make_all \
scribo_make_debug_filename \
@@ -136,6 +140,7 @@ scribo_filter_all_SOURCES = scribo_filter_all.cc
scribo_filter_common_object_groups_photo_SOURCES =
scribo_filter_common_object_groups_photo.cc
scribo_filter_common_object_links_photo_SOURCES =
scribo_filter_common_object_links_photo.cc
scribo_filter_common_objects_photo_SOURCES = scribo_filter_common_objects_photo.cc
+scribo_filter_object_groups_size_ratio_SOURCES =
scribo_filter_object_groups_size_ratio.cc
scribo_filter_object_groups_small_SOURCES = scribo_filter_object_groups_small.cc
scribo_filter_object_groups_v_thickness_SOURCES =
scribo_filter_object_groups_v_thickness.cc
scribo_filter_object_links_bbox_h_ratio_SOURCES =
scribo_filter_object_links_bbox_h_ratio.cc
@@ -147,10 +152,13 @@ scribo_filter_object_links_non_aligned_SOURCES =
scribo_filter_object_links_non_
scribo_filter_object_links_non_aligned_simple_SOURCES =
scribo_filter_object_links_non_aligned_simple.cc
scribo_filter_object_links_non_h_aligned_SOURCES =
scribo_filter_object_links_non_h_aligned.cc
scribo_filter_object_links_non_v_aligned_SOURCES =
scribo_filter_object_links_non_v_aligned.cc
+scribo_filter_objects_h_thin_SOURCES = scribo_filter_objects_h_thin.cc
scribo_filter_objects_large_SOURCES = scribo_filter_objects_large.cc
+scribo_filter_objects_size_ratio_SOURCES = scribo_filter_objects_size_ratio.cc
scribo_filter_objects_small_SOURCES = scribo_filter_objects_small.cc
scribo_filter_objects_thick_SOURCES = scribo_filter_objects_thick.cc
scribo_filter_objects_thin_SOURCES = scribo_filter_objects_thin.cc
+scribo_filter_objects_v_thin_SOURCES = scribo_filter_objects_v_thin.cc
scribo_fun_v2b_objects_small_filter_SOURCES = scribo_fun_v2b_objects_small_filter.cc
scribo_make_all_SOURCES = scribo_make_all.cc
scribo_make_debug_filename_SOURCES = scribo_make_debug_filename.cc
--
1.5.6.5