Commit 31216d34 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Small fixes.

	* binarization/sauvola_threshold_image.hh: Add ifdefs.

	* core/object_groups.hh: Fix a wrong assertion.

	* postprocessing/fill_object_holes.hh: Disable debug output.

	* preprocessing/denoise_bg.hh: Do not negate the image anymore.
parent db55e631
2010-06-03 Guillaume Lazzara <z@lrde.epita.fr>
Small fixes.
* binarization/sauvola_threshold_image.hh: Add ifdefs.
* core/object_groups.hh: Fix a wrong assertion.
* postprocessing/fill_object_holes.hh: Disable debug output.
* preprocessing/denoise_bg.hh: Do not negate the image anymore.
2010-06-03 Guillaume Lazzara <z@lrde.epita.fr> 2010-06-03 Guillaume Lazzara <z@lrde.epita.fr>
Add the binarization tool submitted to H-DIBCO 2010. Add the binarization tool submitted to H-DIBCO 2010.
......
...@@ -127,7 +127,6 @@ namespace scribo ...@@ -127,7 +127,6 @@ namespace scribo
# endif // ! SCRIBO_SAUVOLA_DEBUG # endif // ! SCRIBO_SAUVOLA_DEBUG
/*! \brief compute Sauvola's threshold applying directly the formula. /*! \brief compute Sauvola's threshold applying directly the formula.
\param[in] m_x_y Mean value. \param[in] m_x_y Mean value.
...@@ -170,20 +169,26 @@ namespace scribo ...@@ -170,20 +169,26 @@ namespace scribo
// if (s_N < 0.1f) // if (s_N < 0.1f)
// { // {
// K_2 = 0.1f; // K_2 = 0.1f;
// # ifdef SCRIBO_SAUVOLA_DEBUG
// dbg_k = 0; // dbg_k = 0;
// dbg_s_n = s_N; // dbg_s_n = s_N;
// # endif // !SCRIBO_SAUVOLA_DEBUG
// } // }
// else if (s_N > 0.34) // else if (s_N > 0.34)
// { // {
// K_2 = 0.34; // K_2 = 0.34;
// # ifdef SCRIBO_SAUVOLA_DEBUG
// dbg_k = 255; // dbg_k = 255;
// dbg_s_n = s_N; // dbg_s_n = s_N;
// # endif // !SCRIBO_SAUVOLA_DEBUG
// } // }
// else // else
// { // {
// K_2 = s_N; // K_2 = s_N;
// # ifdef SCRIBO_SAUVOLA_DEBUG
// dbg_k = 150; // dbg_k = 150;
// dbg_s_n = s_N; // dbg_s_n = s_N;
// # endif // !SCRIBO_SAUVOLA_DEBUG
// } // }
......
...@@ -183,7 +183,7 @@ namespace scribo ...@@ -183,7 +183,7 @@ namespace scribo
bool bool
object_groups<L>::is_valid() const object_groups<L>::is_valid() const
{ {
mln_assertion(data_->components_.nelements() == (nelements())); mln_assertion(data_->components_.nelements() == (nelements() - 1));
return data_->links_.is_valid(); return data_->links_.is_valid();
} }
......
...@@ -41,7 +41,11 @@ ...@@ -41,7 +41,11 @@
# include <mln/core/routine/extend.hh> # include <mln/core/routine/extend.hh>
# include <mln/core/image/dmorph/extended.hh> # include <mln/core/image/dmorph/extended.hh>
# include <mln/data/fill.hh>
# include <mln/data/transform.hh>
# include <mln/extension/duplicate.hh> # include <mln/extension/duplicate.hh>
# include <mln/extension/adjust_fill.hh>
# include <mln/draw/box_plain.hh> # include <mln/draw/box_plain.hh>
# include <mln/util/array.hh> # include <mln/util/array.hh>
...@@ -50,6 +54,14 @@ ...@@ -50,6 +54,14 @@
# include <mln/fun/i2v/array.hh> # include <mln/fun/i2v/array.hh>
# include <mln/value/int_u16.hh>
# include <mln/labeling/blobs_and_compute.hh>
# include <mln/logical/not.hh>
# include <mln/transform/influence_zone_geodesic.hh>
# include <scribo/core/macros.hh> # include <scribo/core/macros.hh>
# include <scribo/core/object_groups.hh> # include <scribo/core/object_groups.hh>
# include <scribo/primitive/group/apply.hh> # include <scribo/primitive/group/apply.hh>
...@@ -331,7 +343,7 @@ namespace scribo ...@@ -331,7 +343,7 @@ namespace scribo
// Holes card Image // Holes card Image
std::cout << "> Holes card image" << std::endl; // std::cout << "> Holes card image" << std::endl;
L nlabels; L nlabels;
...@@ -345,7 +357,7 @@ namespace scribo ...@@ -345,7 +357,7 @@ namespace scribo
// Threshold Image // Threshold Image
std::cout << "> Threshold image" << std::endl; // std::cout << "> Threshold image" << std::endl;
I input_i = logical::not_(input); I input_i = logical::not_(input);
...@@ -363,7 +375,7 @@ namespace scribo ...@@ -363,7 +375,7 @@ namespace scribo
// Thresholding // Thresholding
std::cout << "> Thresholding" << std::endl; // std::cout << "> Thresholding" << std::endl;
I hole_mask; I hole_mask;
initialize(hole_mask, holes); initialize(hole_mask, holes);
...@@ -376,7 +388,7 @@ namespace scribo ...@@ -376,7 +388,7 @@ namespace scribo
// Cleanup // Cleanup
std::cout << "> Cleanup" << std::endl; // std::cout << "> Cleanup" << std::endl;
data::fill((output | pw::value(hole_mask)).rw(), false); data::fill((output | pw::value(hole_mask)).rw(), false);
......
...@@ -131,11 +131,11 @@ namespace scribo ...@@ -131,11 +131,11 @@ namespace scribo
util::array<unsigned> util::array<unsigned>
result = labeling::compute(accu::meta::math::count(), lbl, nlabels); result = labeling::compute(accu::meta::math::count(), lbl, nlabels);
mln::fun::i2v::array<bool> f(nlabels + 1, true); mln::fun::i2v::array<bool> f(nlabels + 1, false);
f(0) = false; f(0) = true;
for (unsigned i = 1; i <= nlabels; ++i) for (unsigned i = 1; i <= nlabels; ++i)
if (result(i) < min_card) if (result(i) < min_card)
f(i) = false; f(i) = true;
scribo::fun::v2b::label_to_bool<unsigned> relabel_f(f); scribo::fun::v2b::label_to_bool<unsigned> relabel_f(f);
mln_concrete(I) mln_concrete(I)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment