
* mln/value/label.hh: do not use literal::zero. * mln/world/binary_2d/subsample.hh: revamp and add MLN_INCLUDE_ONLY guards. * tests/data/paste.cc: fix invalid path to include file. --- milena/ChangeLog | 11 +++++++++ milena/mln/value/label.hh | 2 +- milena/mln/world/binary_2d/subsample.hh | 37 +++++++++++++++++++++++++++++- milena/tests/data/paste.cc | 2 +- 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index c3d3344..bb6ae9f 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,16 @@ 2009-05-28 Guillaume Lazzara <lazzara@lrde.epita.fr> + Fix tests. + + * mln/value/label.hh: do not use literal::zero. + + * mln/world/binary_2d/subsample.hh: revamp and add MLN_INCLUDE_ONLY + guards. + + * tests/data/paste.cc: fix invalid path to include file. + +2009-05-28 Guillaume Lazzara <lazzara@lrde.epita.fr> + Set few tests as XFAIL tests. * tests/convert/Makefile.am, diff --git a/milena/mln/value/label.hh b/milena/mln/value/label.hh index dd61b33..8f874f9 100644 --- a/milena/mln/value/label.hh +++ b/milena/mln/value/label.hh @@ -223,7 +223,7 @@ namespace mln void from_to_(const value::label<n>& from, bool& to_) { - to_ = (from != literal::zero); + to_ = (from != 0u); } } // end of namespace mln::convert::over_load diff --git a/milena/mln/world/binary_2d/subsample.hh b/milena/mln/world/binary_2d/subsample.hh index 78bdbbd..7c6b19c 100644 --- a/milena/mln/world/binary_2d/subsample.hh +++ b/milena/mln/world/binary_2d/subsample.hh @@ -30,7 +30,10 @@ /// \file mln/world/binary_2d/subsample.hh /// -/// FIXME: insert comment. +/// Subsample a Boolean image. +/// +/// FIXME: not enough generic. Does not work on image having +/// the top left corner different from (0,0). # include <mln/core/image/image2d.hh> # include <mln/core/alias/dpoint2d.hh> @@ -45,10 +48,37 @@ namespace mln namespace binary_2d { - image2d<value::int_u8> subsample(image2d<bool>& input, unsigned n) + /// Subsample a Boolean image. + /// + /// \param[in] input A binary image. + /// \param[in] n Linear subsampling coefficient. + /// + /// \return A gray level image. + // + image2d<value::int_u8> + subsample(image2d<bool>& input, unsigned n); + + +# ifndef MLN_INCLUDE_ONLY + + image2d<value::int_u8> + subsample(image2d<bool>& input, unsigned n) { + trace::entering("world::binary_2d::subsample"); + + mln_precondition(input.is_valid()); + using value::int_u8; + if (n == 0) + { + image2d<value::int_u8> + output = level::convert(int_u8(), input); + + trace::exiting("world::binary_2d::subsample"); + return output; + } + const bool** ptr = new const bool*[n]; const unsigned nrows = input.nrows() / n; const unsigned ncols = input.ncols() / n; @@ -86,9 +116,12 @@ namespace mln } } + trace::exiting("world::binary_2d::subsample"); return output; } +# endif // ! MLN_INCLUDE_ONLY + } // end of namespace mln::world::binary_2d } // end of namspace mln::world diff --git a/milena/tests/data/paste.cc b/milena/tests/data/paste.cc index 54387fd..07d88fc 100644 --- a/milena/tests/data/paste.cc +++ b/milena/tests/data/paste.cc @@ -35,7 +35,7 @@ #include <mln/core/image/image3d.hh> #include <mln/pw/image.hh> #include <mln/core/image/flat_image.hh> -#include <mln/core/image/vmorphcast_image.hh> +#include <mln/core/image/vmorph/cast_image.hh> #include <mln/core/image/dmorph/image_if.hh> #include <mln/core/image/dmorph/sub_image.hh> #include <mln/core/image/dmorph/extension_val.hh> -- 1.5.6.5
participants (1)
-
Guillaume Lazzara