proto-1.0 197: Fix morphological dilation and closing

Hum. :) https://svn.lrde.epita.fr/svn/oln/prototypes/proto-1.0 ChangeLog | 20 ++++++++++++++++ oln/morpho/closing.hh | 43 +++++++++++++++++++++++------------ oln/morpho/dilation.hh | 4 +-- oln/morpho/erosion.hh | 2 - oln/morpho/opening.hh | 2 - tests/level/tests/extrema_components | 15 +++++------- tests/morpho/tests/closing | 5 +--- tests/morpho/tests/dilation | 5 +--- tests/morpho/tests/erosion | 5 +--- tests/morpho/tests/lower_completion | 13 +++++----- tests/morpho/tests/opening | 5 +--- 11 files changed, 75 insertions(+), 44 deletions(-) Index: olena/ChangeLog from Roland Levillain <roland@lrde.epita.fr> Fix morphological dilation and closing. * oln/morpho/dilation.hh (impl::dilation_): Fix dilation. Adjust copyright dates. * oln/morpho/closing.hh (impl::closing_): Fix closing. Handle morpho kinds. Adjust copyright dates. * oln/morpho/erosion.hh, oln/morpho/opening.hh: Adjust copyright dates. * tests/morpho/tests/closing (check), * tests/morpho/tests/dilation (check), * tests/morpho/tests/erosion (check), * tests/morpho/tests/opening (check): Fix checksums. * tests/morpho/tests/lower_completion, * tests/level/tests/extrema_components: Include Olena headers using angle bracket syntax. Index: olena/tests/morpho/tests/opening --- olena/tests/morpho/tests/opening (revision 196) +++ olena/tests/morpho/tests/opening (working copy) @@ -13,10 +13,9 @@ bool check() { // MD5 sum of object.pbm's opening result. - // FIXME: Replace this fake with the actual result. utils::key::value_type data_key[16] = - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + { 0x21, 0x52, 0x1b, 0x70, 0x84, 0x7f, 0xed, 0x96, + 0xa9, 0x83, 0x80, 0x57, 0x48, 0xa4, 0x26, 0x80 }; utils::key key(data_key); typedef image2d<ntg::bin> im_type; Index: olena/tests/morpho/tests/lower_completion --- olena/tests/morpho/tests/lower_completion (revision 196) +++ olena/tests/morpho/tests/lower_completion (working copy) @@ -1,11 +1,12 @@ // -*- C++ -*- #include "data.hh" -#include "ntg/int.hh" -#include "oln/core/2d/image2d.hh" -#include "oln/core/gen/image_with_nbh.hh" -#include "oln/io/read_image.hh" -#include "oln/morpho/lower_completion.hh" -#include "oln/ops/cmp.hh" + +#include <ntg/int.hh> +#include <oln/core/2d/image2d.hh> +#include <oln/core/gen/image_with_nbh.hh> +#include <oln/io/read_image.hh> +#include <oln/morpho/lower_completion.hh> +#include <oln/ops/cmp.hh> using namespace oln; Index: olena/tests/morpho/tests/dilation --- olena/tests/morpho/tests/dilation (revision 196) +++ olena/tests/morpho/tests/dilation (working copy) @@ -13,10 +13,9 @@ bool check() { // MD5 sum of object.pbm's erosion result. - // FIXME: Update this sum. utils::key::value_type data_key[16] = - {0xbf, 0x67, 0x3, 0xa1, 0x2d, 0x6c, 0xac, 0xe9, - 0xf3, 0x7c, 0x19, 0x4c, 0x3a, 0x3b, 0x4d, 0xaa}; + { 0x38, 0x56, 0x92, 0x53, 0xca, 0xd1, 0x32, 0x3e, + 0x99, 0xf4, 0xe7, 0x59, 0x3, 0x54, 0x2c, 0x54 }; utils::key key(data_key); typedef image2d<ntg::bin> im_type; Index: olena/tests/morpho/tests/erosion --- olena/tests/morpho/tests/erosion (revision 196) +++ olena/tests/morpho/tests/erosion (working copy) @@ -13,10 +13,9 @@ bool check() { // MD5 sum of object.pbm's erosion result. - // FIXME: Replace this fake with the actual result. utils::key::value_type data_key[16] = - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + { 0x30, 0x23, 0x4d, 0xe5, 0xd6, 0x28, 0xeb, 0x8b, + 0x18, 0x82, 0x43, 0x4b, 0xfc, 0x3f, 0x21, 0xc2 }; utils::key key(data_key); typedef image2d<ntg::bin> im_type; Index: olena/tests/morpho/tests/closing --- olena/tests/morpho/tests/closing (revision 196) +++ olena/tests/morpho/tests/closing (working copy) @@ -13,10 +13,9 @@ bool check() { // MD5 sum of object.pbm's closing result. - // FIXME: Replace this fake with the actual result. utils::key::value_type data_key[16] = - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + { 0xb, 0xec, 0x55, 0x93, 0x1c, 0x3, 0xee, 0xed, + 0x1e, 0xc5, 0x6a, 0x45, 0xa2, 0x95, 0xe3, 0xad }; utils::key key(data_key); typedef image2d<ntg::bin> im_type; Index: olena/oln/morpho/closing.hh --- olena/oln/morpho/closing.hh (revision 196) +++ olena/oln/morpho/closing.hh (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2001-2005 EPITA Research and Development Laboratory +// Copyright (C) 2001, 2002, 2003, 2004, 2005 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -41,34 +41,47 @@ - // fwd decl of facade + // Fwd decl of closing's facade. + + template<typename K, typename I, typename W> + oln_type_of(I, concrete) closing(const tag::kind<K>& kind, + const abstract::image<I>& input, + const abstract::window<W>& win); + + // Facade for classical closing. template<typename I, typename W> oln_type_of(I, concrete) closing(const abstract::image<I>& input, - const abstract::window<W>& win); + const abstract::window<W>& win) + { + return closing(tag::classical, input, win); + } namespace impl { - // generic - template<typename I, typename W> - oln_type_of(I, concrete) closing_(const abstract::image<I>& input, + template<typename K, typename I, typename W> + oln_type_of(I, concrete) closing_(const tag::kind<K>& kind, + const abstract::image<I>& input, const abstract::window<W>& win) { - entering("generic"); - oln_type_of(I, concrete) output; + entering("->generic"); + registering(input, "input"); - output = dilation(erosion(input, win), -win); + oln_type_of(I, concrete) output("output"); + output = erosion(kind, dilation(kind, input, win), -win); - exiting("generic"); + exiting("->generic"); return output; } + // add some other impls here... + } // end of namespace oln::morpho::impl @@ -77,16 +90,18 @@ /// Generic closing (facade). - template<typename I, typename W> - oln_type_of(I, concrete) closing(const abstract::image<I>& input, + template<typename K, typename I, typename W> + oln_type_of(I, concrete) closing(const tag::kind<K>& kind, + const abstract::image<I>& input, const abstract::window<W>& win) { mlc::eq<oln_type_of(I, grid), oln_wn_type_of(W, grid)>::ensure(); entering("morpho::closing"); - oln_type_of(I, concrete) output; + registering(input, "input"); - output = impl::closing_(input.exact(), win.exact()); + oln_type_of(I, concrete) output("output"); + output = impl::closing_(kind, input.exact(), win.exact()); exiting("morpho::closing"); return output; Index: olena/oln/morpho/opening.hh --- olena/oln/morpho/opening.hh (revision 196) +++ olena/oln/morpho/opening.hh (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2001-2005 EPITA Research and Development Laboratory +// Copyright (C) 2001, 2002, 2003, 2004, 2005 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms Index: olena/oln/morpho/dilation.hh --- olena/oln/morpho/dilation.hh (revision 196) +++ olena/oln/morpho/dilation.hh (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2001-2005 EPITA Research and Development Laboratory +// Copyright (C) 2001, 2002, 2004, 2005 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -77,7 +77,7 @@ oln_type_of(I, fwd_piter) p(input.size()); for_all_p (p) - output[p] = kind.min(input, p, win); + output[p] = kind.max(input, p, win); exiting("->generic"); return output; Index: olena/oln/morpho/erosion.hh --- olena/oln/morpho/erosion.hh (revision 196) +++ olena/oln/morpho/erosion.hh (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2001-2005 EPITA Research and Development Laboratory +// Copyright (C) 2001, 2002, 2003, 2004, 2005 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms Index: olena/tests/level/tests/extrema_components --- olena/tests/level/tests/extrema_components (revision 196) +++ olena/tests/level/tests/extrema_components (working copy) @@ -1,13 +1,12 @@ // -*- C++ -*- #include "data.hh" -#include "ntg/int.hh" -#include "oln/core/2d/image2d.hh" -#include "oln/core/gen/image_with_nbh.hh" -#include "oln/io/read_image.hh" -#include "oln/io/write_image.hh" -#include "oln/level/extrema_components.hh" -#include "oln/ops/cmp.hh" -#include "oln/utils/md5.hh" +#include <oln/utils/md5.hh> + +#include <ntg/int.hh> +#include <oln/core/2d/image2d.hh> +#include <oln/core/gen/image_with_nbh.hh> +#include <oln/io/read_image.hh> +#include <oln/level/extrema_components.hh> using namespace oln;
participants (1)
-
Roland Levillain