
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2008-04-09 Etienne FOLIO <folio@lrde.epita.fr> Some stuff for tests. * mln/trait/ch_value.hh: New specialization for functions. * sandbox/folio/psn.cc: Some test stuff. --- mln/trait/ch_value.hh | 7 +++++++ sandbox/folio/psn.cc | 33 +++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-) Index: trunk/milena/mln/trait/ch_value.hh =================================================================== --- trunk/milena/mln/trait/ch_value.hh (revision 1848) +++ trunk/milena/mln/trait/ch_value.hh (revision 1849) @@ -133,6 +133,13 @@ typedef typename image_from_mesh< mesh, V >::ret ret; }; + template < template <class, class> class M, typename I, typename F, + typename V > + struct ch_value_< M< tag::image_<I>, tag::function_<F> >, V > + { + typedef M< mln_ch_value(I, V), F > ret; + }; + } // end of namespace mln::trait::impl Index: trunk/milena/sandbox/folio/psn.cc =================================================================== --- trunk/milena/sandbox/folio/psn.cc (revision 1848) +++ trunk/milena/sandbox/folio/psn.cc (revision 1849) @@ -182,6 +182,10 @@ #include <mln/level/stretch.hh> #include <mln/value/int_u8.hh> +#include <mln/core/sub_image.hh> +#include <mln/core/image_if.hh> +#include <mln/pw/value.hh> + int main() { using namespace mln; @@ -193,19 +197,28 @@ // 0, 0, 0, 0, 0, // 0, 0, 0, 0, 0 }; -// level::fill(ima, vals); -// debug::println(ima); - - image2d<bool> ima = io::pbm::load("../../img/c01.pbm"); + image2d<bool> ima(3,3); + bool vals[] = { 1, 0, 0, + 0, 0, 0, + 0, 0, 0}; + level::fill(ima, vals); + + image2d<bool> msk(3,3); + bool rest[] = { 1, 0, 1, + 1, 0, 1, + 1, 1, 1}; + level::fill(msk, rest); image2d<unsigned> out; - out = dt::psn(ima, c4()); + out = dt::psn(ima | pw::value(msk), c4()); + + debug::println(ima | pw::value(msk)); + debug::println(out); - image2d<value::int_u8> out2(out.domain()); - level::stretch(out, out2); +// image2d<bool> ima = io::pbm::load("../../img/c01.pbm"); - io::pgm::save(out2, "out.pgm"); +// image2d<value::int_u8> out2(out.domain()); +// level::stretch(out, out2); -// std::cerr << "Distance:" << std::endl; -// debug::println(out); +// io::pgm::save(out2, "out.pgm"); }