last-svn-commit-498-gc043808 Negate Sauvola's result.

* scribo/binarization/local_threshold.hh, * scribo/binarization/sauvola_ms.hh: Invert threshold test. * src/text_in_picture.cc: Do not negate Sauvola's output anymore. --- scribo/ChangeLog | 9 ++ scribo/scribo/binarization/local_threshold.hh | 4 +- scribo/scribo/binarization/sauvola_ms.hh | 128 ++++++++++++------------ scribo/src/text_in_picture.cc | 2 - 4 files changed, 75 insertions(+), 68 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 1f9fc04..73fea45 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,3 +1,12 @@ +2010-10-11 Guillaume Lazzara <z@lrde.epita.fr> + + Negate Sauvola's result. + + * scribo/binarization/local_threshold.hh, + * scribo/binarization/sauvola_ms.hh: Invert threshold test. + + * src/text_in_picture.cc: Do not negate Sauvola's output anymore. + 2010-10-21 Guillaume Lazzara <z@lrde.epita.fr> Small fixes in Scribo diff --git a/scribo/scribo/binarization/local_threshold.hh b/scribo/scribo/binarization/local_threshold.hh index aa53664..9d116ed 100644 --- a/scribo/scribo/binarization/local_threshold.hh +++ b/scribo/scribo/binarization/local_threshold.hh @@ -110,7 +110,7 @@ namespace scribo mln_piter(I) p(input.domain()); for_all(p) - output(p) = (input(p) >= threshold(p)); + output(p) = (input(p) <= threshold(p)); trace::exiting("scribo::binarization::impl::generic::local_threshold"); @@ -140,7 +140,7 @@ namespace scribo mln_pixter(const T) pt(threshold); mln_pixter(O) po(output); for_all_3(pi, pt, po) - po.val() = pi.val() >= pt.val(); + po.val() = pi.val() <= pt.val(); trace::exiting("scribo::binarization::impl::generic::local_threshold_fastest"); return output; diff --git a/scribo/scribo/binarization/sauvola_ms.hh b/scribo/scribo/binarization/sauvola_ms.hh index e767b86..f63a9a1 100644 --- a/scribo/scribo/binarization/sauvola_ms.hh +++ b/scribo/scribo/binarization/sauvola_ms.hh @@ -330,20 +330,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1f; ptr__in += delta1f; } @@ -354,20 +354,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1b; ptr__in += delta1b; } @@ -378,20 +378,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1f; ptr__in += delta1f; } @@ -403,20 +403,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1c; ptr__in += delta1c; } @@ -432,20 +432,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1f; ptr__in += delta1f; } @@ -456,20 +456,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1b; ptr__in += delta1b; } @@ -480,20 +480,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1f; ptr__in += delta1f; } @@ -504,20 +504,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1d; ptr__in += delta1d; } @@ -533,20 +533,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1f; ptr__in += delta1f; } @@ -557,20 +557,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1b; ptr__in += delta1b; } @@ -581,20 +581,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1f; ptr__in += delta1f; } @@ -605,20 +605,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1c; ptr__in += delta1c; } @@ -634,20 +634,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1f; ptr__in += delta1f; } @@ -658,20 +658,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1b; ptr__in += delta1b; } @@ -682,20 +682,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1f; ptr__in += delta1f; } @@ -706,20 +706,20 @@ namespace scribo { for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1; ptr__in += delta1; } for (unsigned j = 1; j < s; ++j) { - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ++ptr__out; ++ptr__in; } - *ptr__out = *ptr__in >= threshold; + *ptr__out = *ptr__in <= threshold; ptr__out += delta1e; ptr__in += delta1e; } } diff --git a/scribo/src/text_in_picture.cc b/scribo/src/text_in_picture.cc index 8f530db..5cb9a9d 100644 --- a/scribo/src/text_in_picture.cc +++ b/scribo/src/text_in_picture.cc @@ -298,8 +298,6 @@ int main(int argc, char* argv[]) #endif // !NOUT - logical::not_inplace(input); - // if (debug) // io::pbm::save(input, "input.pbm"); t_ = timer_; -- 1.5.6.5
participants (1)
-
Guillaume Lazzara