* scribo/binarization/sauvola_ms.hh,
* scribo/canvas/integral_browsing.hh: Here.
---
scribo/ChangeLog | 7 +++++
scribo/scribo/binarization/sauvola_ms.hh | 43 ++++++++++++++++++++++++++---
scribo/scribo/canvas/integral_browsing.hh | 8 +++++-
3 files changed, 53 insertions(+), 5 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index c75eb57..4e61cec 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,12 @@
2012-08-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Improve documentation.
+
+ * scribo/binarization/sauvola_ms.hh,
+ * scribo/canvas/integral_browsing.hh: Here.
+
+2012-08-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+
* src/binarization/kim.cc: Remove debug and useless steps.
2012-08-23 Guillaume Lazzara <z(a)lrde.epita.fr>
diff --git a/scribo/scribo/binarization/sauvola_ms.hh
b/scribo/scribo/binarization/sauvola_ms.hh
index 96064e9..ba58207 100644
--- a/scribo/scribo/binarization/sauvola_ms.hh
+++ b/scribo/scribo/binarization/sauvola_ms.hh
@@ -98,7 +98,8 @@ namespace scribo
\param[in] s The scale factor used for the first subscaling.
\param[in] lambda_min_1 Size of the objects kept at scale 1.
\param[in] K Sauvola's formulae parameter.
-
+ \param[out] integral_sum_sum_2 Integral image of sum and squared
+ sum.
\p w_1 and \p lambda_min_1 are expressed according to the image
at scale 0, i.e. the original size.
@@ -107,6 +108,15 @@ namespace scribo
*/
template <typename I>
mln_ch_value(I,bool)
+ sauvola_ms(const Image<I>& input_1_, unsigned w_1,
+ unsigned s, double K,
+ image2d<mln::util::couple<double,double> >& integral_sum_sum_2);
+
+ /// \overload
+ /// The integral image is not returned.
+ //
+ template <typename I>
+ mln_ch_value(I,bool)
sauvola_ms(const Image<I>& input_1_, unsigned w_1, unsigned s, double K);
/// \overload
@@ -802,7 +812,8 @@ namespace scribo
template <typename I>
mln_ch_value(I,bool)
sauvola_ms(const Image<I>& input_1_, unsigned w_1,
- unsigned s, double K)
+ unsigned s, double K,
+ image2d<mln::util::couple<double,double> >& integral_sum_sum_2)
{
trace::entering("scribo::binarization::sauvola_ms");
@@ -853,7 +864,7 @@ namespace scribo
// Resize input and compute integral images.
typedef image2d<mln::util::couple<double,double> > integral_t;
- integral_t integral_sum_sum_2;
+// integral_t integral_sum_sum_2;
mln::util::timer t;
t.start();
@@ -1030,6 +1041,27 @@ namespace scribo
template <typename I>
mln_ch_value(I,bool)
sauvola_ms(const Image<I>& input_1_, unsigned w_1,
+ unsigned s, double K,
+ image2d<mln::util::couple<double,double> >& integral_sum_sum_2)
+ {
+ trace::entering("scribo::binarization::sauvola_ms");
+
+ mln_precondition(exact(input_1_).is_valid());
+ // Gray level images ONLY.
+ mlc_is_not_a(mln_value(I), value::Vectorial)::check();
+ mlc_is_not(mln_value(I), bool)::check();
+
+ mln_ch_value(I,bool)
+ output = impl::generic::sauvola_ms(exact(input_1_), w_1, s, K,
+ integral_sum_sum_2);
+
+ trace::exiting("scribo::binarization::sauvola_ms");
+ return output;
+ }
+
+ template <typename I>
+ mln_ch_value(I,bool)
+ sauvola_ms(const Image<I>& input_1_, unsigned w_1,
unsigned s, double K)
{
trace::entering("scribo::binarization::sauvola_ms");
@@ -1039,8 +1071,11 @@ namespace scribo
mlc_is_not_a(mln_value(I), value::Vectorial)::check();
mlc_is_not(mln_value(I), bool)::check();
+ typedef image2d<mln::util::couple<double,double> > integral_t;
+ integral_t integral_sum_sum_2;
+
mln_ch_value(I,bool)
- output = impl::generic::sauvola_ms(exact(input_1_), w_1, s, K);
+ output = sauvola_ms(exact(input_1_), w_1, s, K, integral_sum_sum_2);
trace::exiting("scribo::binarization::sauvola_ms");
return output;
diff --git a/scribo/scribo/canvas/integral_browsing.hh
b/scribo/scribo/canvas/integral_browsing.hh
index 89e0019..da13fe7 100644
--- a/scribo/scribo/canvas/integral_browsing.hh
+++ b/scribo/scribo/canvas/integral_browsing.hh
@@ -116,6 +116,12 @@ namespace scribo
for (col = col_0; col <= max_col_mid; col += step) ;
int w_right = ncols - col + w/2;
+ // tl: top left
+ // tr: top right
+ // ml: middle left
+ // mr: middle right
+ // bl: bottom left
+ // br: bottom right
Ptr
d_tl_start, d_tr_start,
b_ml_start = 0, d_ml_start = 0, b_mr_start = 0, d_mr_start = 0,
@@ -176,7 +182,7 @@ namespace scribo
for (; col <= max_col_mid; col += step)
{
// D - C
- internal::compute_stats(d_ima->first() - c_ima->first(),
+ internal::compute_stats(d_ima->first() - c_ima->first(),
d_ima->second() - c_ima->second(),
size_tc * s_2,
mean, stddev);
--
1.7.2.5