
* scribo/binarization/global_threshold.hh: Add a fixme. * scribo/binarization/global_threshold_auto.hh: Make the result consistent with other binarization methods. * scribo/preprocessing/deskew.hh: Use mln_min(V) as background value anymore. * src/preprocessing/preprocess.cc: Do not negate anymore. Don't pass const nlabel value. --- scribo/ChangeLog | 15 +++++++++++++++ scribo/scribo/binarization/global_threshold.hh | 5 +++++ .../scribo/binarization/global_threshold_auto.hh | 2 +- scribo/scribo/preprocessing/deskew.hh | 2 +- scribo/src/preprocessing/preprocess.cc | 9 +++------ 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 5db7b16..ee5d3d9 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,3 +1,18 @@ +2010-10-28 Guillaume Lazzara <z@lrde.epita.fr> + + Small fixes in Scribo + + * scribo/binarization/global_threshold.hh: Add a fixme. + + * scribo/binarization/global_threshold_auto.hh: Make the result + consistent with other binarization methods. + + * scribo/preprocessing/deskew.hh: Use mln_min(V) as background + value. + + * src/preprocessing/preprocess.cc: Do not negate anymore. Don't + pass const nlabel value anymore. + 2010-10-26 Guillaume Lazzara <z@lrde.epita.fr> Add tests for objects filtering routines. diff --git a/scribo/scribo/binarization/global_threshold.hh b/scribo/scribo/binarization/global_threshold.hh index ebf25c4..b90d6df 100644 --- a/scribo/scribo/binarization/global_threshold.hh +++ b/scribo/scribo/binarization/global_threshold.hh @@ -35,6 +35,11 @@ /// /// \brief Binarize an image using a global threshold value. + +/// FIXME: result is not consistent with other binarization +/// methods. The result is inverted because of the threshold functor: +/// should we invert the test in this functor? + namespace scribo { diff --git a/scribo/scribo/binarization/global_threshold_auto.hh b/scribo/scribo/binarization/global_threshold_auto.hh index babf884..a17f9da 100644 --- a/scribo/scribo/binarization/global_threshold_auto.hh +++ b/scribo/scribo/binarization/global_threshold_auto.hh @@ -152,7 +152,7 @@ namespace scribo } mln_ch_value(I, bool) output; - output = duplicate((pw::value(input) > pw::cst(threshold)) | input.domain()); + output = duplicate((pw::value(input) < pw::cst(threshold)) | input.domain()); trace::exiting("scribo::binarization::global_threshold_auto"); return output; diff --git a/scribo/scribo/preprocessing/deskew.hh b/scribo/scribo/preprocessing/deskew.hh index 234ffd6..80ea351 100644 --- a/scribo/scribo/preprocessing/deskew.hh +++ b/scribo/scribo/preprocessing/deskew.hh @@ -420,7 +420,7 @@ namespace scribo if (angle > 0.5 || angle < -0.5) output = geom::rotate(input_gl, - angle, //mln_max(mln_value(I)), - extend(input_gl, mln_max(mln_value(I))), + extend(input_gl, mln_min(mln_value(I))), mln::make::box2d(input_gl.nrows(), input_gl.ncols())); diff --git a/scribo/src/preprocessing/preprocess.cc b/scribo/src/preprocessing/preprocess.cc index 322bfef..0695450 100644 --- a/scribo/src/preprocessing/preprocess.cc +++ b/scribo/src/preprocessing/preprocess.cc @@ -34,8 +34,6 @@ #include <mln/io/pgm/load.hh> #include <mln/io/pbm/save.hh> -#include <mln/logical/not.hh> - #include <scribo/binarization/global_threshold_auto.hh> #include <scribo/preprocessing/deskew.hh> #include <scribo/filter/objects_small.hh> @@ -68,18 +66,17 @@ int main(int argc, char *argv[]) image2d<bool> input_bw = scribo::binarization::global_threshold_auto(input); - logical::not_inplace(input_bw); + value::label_16 nlabels; input_bw = scribo::filter::components_small(input_bw, c8(), - value::label_16(), 3); + nlabels, 3); input_bw = scribo::filter::components_thin(input_bw, c8(), - value::label_16(), 1); + nlabels, 1); image2d<value::int_u8> input_gl = data::convert(value::int_u8(), input_bw); input_gl = scribo::preprocessing::deskew(input_gl); input_bw = data::convert(bool(), input_gl); - logical::not_inplace(input_bw); io::pbm::save(input_bw, argv[2]); trace::exiting("main"); -- 1.5.6.5