
I've got an error since last 2 patchs : error: no matching function for call to 'init_(oln::box2d*, const oln::image2d<int>&)' We look at it with nico but didn't manage to fix. Index: ChangeLog from Ugo Jardonnet <ugo.jardonnet@lrde.epita.fr> Morpho : Elementary versions. * oln/morpho/elementary_gradient.hh: New. * oln/morpho/elementary_gradient_external.hh: New. * oln/morpho/elementary_laplace.hh: New. * oln/morpho/gradient_internal.hh: . * oln/morpho/gradient.hh: . * oln/morpho/gradient_external.hh: . * oln/morpho/laplace.hh: . * oln/morpho/erosion.hh: . * oln/morpho/elementary_gradient_internal.hh: New. * oln/core/2d/image2d.hh: . core/2d/image2d.hh | 3 - morpho/elementary_gradient.hh | 84 +++++++++++++++++++++++++++++++++ morpho/elementary_gradient_external.hh | 83 ++++++++++++++++++++++++++++++++ morpho/elementary_gradient_internal.hh | 83 ++++++++++++++++++++++++++++++++ morpho/elementary_laplace.hh | 84 +++++++++++++++++++++++++++++++++ morpho/erosion.hh | 6 +- morpho/gradient.hh | 25 +++++---- morpho/gradient_external.hh | 29 +++++------ morpho/gradient_internal.hh | 28 +++++------ morpho/laplace.hh | 23 +++++---- 10 files changed, 395 insertions(+), 53 deletions(-) Index: oln/morpho/elementary_gradient.hh --- oln/morpho/elementary_gradient.hh (revision 0) +++ oln/morpho/elementary_gradient.hh (revision 0) @@ -0,0 +1,84 @@ +// Copyright (C) 2007 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 +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_MORPHO_ELEMENTARY_GRADIENT_HH +# define OLN_MORPHO_ELEMENTARY_GRADIENT_HH + +#include <oln/morpho/elementary_erosion.hh> +#include <oln/morpho/elementary_dilation.hh> +#include <oln/arith/minus.hh> + +namespace oln +{ + + namespace morpho + { + + // Fwd decl. + + template <typename I> + oln_plain(I) + elementary_gradient(const Image_with_Nbh<I>& input); + + +# ifndef OLN_INCLUDE_ONLY + + namespace impl + { + + // Generic version. + + template <typename I> + oln_plain(I) + elementary_gradient_(const Image_with_Nbh<I>& input) + { + return elementary_dilation(input) - elementary_erosion(input); + } + + + // FIXME: Add a fast version. + + } // end of namespace oln::morpho::impl + + + // Facade. + + template <typename I> + oln_plain(I) + elementary_gradient(const Image_with_Nbh<I>& input) + { + return impl::elementary_gradient_(exact(input)); + } + +# endif // ! OLN_INCLUDE_ONLY + + } // end of namespace oln::morpho + +} // end of namespace oln + + +#endif // ! OLN_MORPHO_ELEMENTARY_GRADIENT_HH Index: oln/morpho/elementary_gradient_external.hh --- oln/morpho/elementary_gradient_external.hh (revision 0) +++ oln/morpho/elementary_gradient_external.hh (revision 0) @@ -0,0 +1,83 @@ +// Copyright (C) 2007 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 +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_MORPHO_EXTERNAL_GRADIENT_HH +# define OLN_MORPHO_EXTERNAL_GRADIENT_HH + +#include <oln/morpho/elementary_dilation.hh> +#include <oln/arith/minus.hh> + +namespace oln +{ + + namespace morpho + { + + // Fwd decl. + + template <typename I> + oln_plain(I) + elementary_gradient_external(const Image_with_Nbh<I>& input); + + +# ifndef OLN_INCLUDE_ONLY + + namespace impl + { + + // Generic version. + + template <typename I> + oln_plain(I) + elementary_gradient_external_(const Image_with_Nbh<I>& input) + { + return elementary_dilation(input) - input; + } + + + // FIXME: Add a fast version. + + } // end of namespace oln::morpho::impl + + + // Facade. + + template <typename I> + oln_plain(I) + elementary_gradient_external(const Image_with_Nbh<I>& input) + { + return impl::elementary_gradient_external_(exact(input)); + } + +# endif // ! OLN_INCLUDE_ONLY + + } // end of namespace oln::morpho + +} // end of namespace oln + + +#endif // ! OLN_MORPHO_EXTERNAL_GRADIENT_HH Index: oln/morpho/elementary_laplace.hh --- oln/morpho/elementary_laplace.hh (revision 0) +++ oln/morpho/elementary_laplace.hh (revision 0) @@ -0,0 +1,84 @@ +// Copyright (C) 2007 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 +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_MORPHO_ELEMENTARY_LAPLACE_HH +# define OLN_MORPHO_ELEMENTARY_LAPLACE_HH + +#include <oln/morpho/elementary_gradient_external.hh> +#include <oln/morpho/elementary_gradient_internal.hh> +#include <oln/arith/minus.hh> + +namespace oln +{ + + namespace morpho + { + + // Fwd decl. + + template <typename I> + oln_plain(I) + elementary_laplace(const Image_with_Nbh<I>& input); + + +# ifndef OLN_INCLUDE_ONLY + + namespace impl + { + + // Generic version. + + template <typename I> + oln_plain(I) + elementary_laplace_(const Image_with_Nbh<I>& input) + { + return elementary_gradient_external(input) - elementary_gradient_internal(input); + } + + + // FIXME: Add a fast version. + + } // end of namespace oln::morpho::impl + + + // Facade. + + template <typename I> + oln_plain(I) + elementary_laplace(const Image_with_Nbh<I>& input) + { + return impl::elementary_laplace_(exact(input)); + } + +# endif // ! OLN_INCLUDE_ONLY + + } // end of namespace oln::morpho + +} // end of namespace oln + + +#endif // ! OLN_MORPHO_ELEMENTARY_LAPLACE_HH Index: oln/morpho/gradient_internal.hh --- oln/morpho/gradient_internal.hh (revision 905) +++ oln/morpho/gradient_internal.hh (working copy) @@ -25,10 +25,10 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef OLN_MORPHO_INSIDE_GRADIENT_HH -# define OLN_MORPHO_INSIDE_GRADIENT_HH +#ifndef OLN_MORPHO_GRADIENT_INTERNAL_HH +# define OLN_MORPHO_GRADIENT_INTERNAL_HH -#include <oln/morpho/elementary_erosion.hh> +#include <oln/morpho/erosion.hh> #include <oln/arith/minus.hh> namespace oln @@ -39,9 +39,10 @@ // Fwd decl. - template <typename I> + template <typename I, typename W> oln_plain(I) - inside_gradient(const Image_with_Nbh<I>& input); + gradient_internal(const Image<I>& input, + const Window<W>& win); # ifndef OLN_INCLUDE_ONLY @@ -51,26 +52,27 @@ // Generic version. - template <typename I> + template <typename I, typename W> oln_plain(I) - inside_gradient_(const Image_with_Nbh<I>& input) + gradient_internal_(const Image<I>& input, + const Window<W>& win) { - return input - elementary_erosion(input); + return input - erosion(input, win); } - // FIXME: Add a fast version. } // end of namespace oln::morpho::impl // Facade. - template <typename I> + template <typename I, typename W> oln_plain(I) - inside_gradient(const Image_with_Nbh<I>& input) + gradient_internal(const Image<I>& input, + const Window<W>& win) { - return impl::inside_gradient_(exact(input)); + return impl::gradient_internal_(exact(input), win); } # endif // ! OLN_INCLUDE_ONLY @@ -80,4 +82,4 @@ } // end of namespace oln -#endif // ! OLN_MORPHO_INSIDE_GRADIENT_HH +#endif // ! OLN_MORPHO_GRADIENT_INTERNAL_HH Index: oln/morpho/gradient.hh --- oln/morpho/gradient.hh (revision 905) +++ oln/morpho/gradient.hh (working copy) @@ -28,8 +28,8 @@ #ifndef OLN_MORPHO_GRADIENT_HH # define OLN_MORPHO_GRADIENT_HH -#include <oln/morpho/elementary_erosion.hh> -#include <oln/morpho/elementary_dilation.hh> +#include <oln/morpho/erosion.hh> +#include <oln/morpho/dilation.hh> #include <oln/arith/minus.hh> namespace oln @@ -40,9 +40,10 @@ // Fwd decl. - template <typename I> + template <typename I, typename W> oln_plain(I) - gradient(const Image_with_Nbh<I>& input); + gradient(const Image<I>& input, + const Window<W>& win); # ifndef OLN_INCLUDE_ONLY @@ -52,26 +53,26 @@ // Generic version. - template <typename I> + template <typename I, typename W> oln_plain(I) - gradient_(const Image_with_Nbh<I>& input) + gradient_(const Image<I>& input, + const Window<W>& win) { - return elementary_dilation(input) - elementary_erosion(input); + return dilation(input, win) - erosion(input, win); } - // FIXME: Add a fast version. - } // end of namespace oln::morpho::impl // Facade. - template <typename I> + template <typename I, typename W> oln_plain(I) - gradient(const Image_with_Nbh<I>& input) + gradient(const Image<I>& input, + const Window<W>& win) { - return impl::gradient_(exact(input)); + return impl::gradient_(exact(input), win); } # endif // ! OLN_INCLUDE_ONLY Index: oln/morpho/gradient_external.hh --- oln/morpho/gradient_external.hh (revision 905) +++ oln/morpho/gradient_external.hh (working copy) @@ -25,10 +25,10 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef OLN_MORPHO_EXTERNAL_GRADIENT_HH -# define OLN_MORPHO_EXTERNAL_GRADIENT_HH +#ifndef OLN_MORPHO_GRADIENT_EXTERNAL_HH +# define OLN_MORPHO_GRADIENT_EXTERNAL_HH -#include <oln/morpho/elementary_dilation.hh> +#include <oln/morpho/dilation.hh> #include <oln/arith/minus.hh> namespace oln @@ -39,9 +39,10 @@ // Fwd decl. - template <typename I> + template <typename I, typename W> oln_plain(I) - external_gradient(const Image_with_Nbh<I>& input); + gradient_external(const Image<I>& input, + const Window<W>& win); # ifndef OLN_INCLUDE_ONLY @@ -51,26 +52,26 @@ // Generic version. - template <typename I> + template <typename I, typename W> oln_plain(I) - external_gradient_(const Image_with_Nbh<I>& input) + gradient_external_(const Image<I>& input, + const Window<W>& win) { - return elementary_dilation(input) - input; + return dilation(input, win) - input; } - // FIXME: Add a fast version. - } // end of namespace oln::morpho::impl // Facade. - template <typename I> + template <typename I, typename W> oln_plain(I) - external_gradient(const Image_with_Nbh<I>& input) + gradient_external(const Image<I>& input, + const Window<W>& win) { - return impl::external_gradient_(exact(input)); + return impl::gradient_external_(exact(input), win); } # endif // ! OLN_INCLUDE_ONLY @@ -80,4 +81,4 @@ } // end of namespace oln -#endif // ! OLN_MORPHO_EXTERNAL_GRADIENT_HH +#endif // ! OLN_MORPHO_GRADIENT_EXTERNAL_HH Index: oln/morpho/laplace.hh --- oln/morpho/laplace.hh (revision 905) +++ oln/morpho/laplace.hh (working copy) @@ -28,8 +28,8 @@ #ifndef OLN_MORPHO_LAPLACE_HH # define OLN_MORPHO_LAPLACE_HH -#include <oln/morpho/gradient_external.hh> -#include <oln/morpho/gradient_internal.hh> +#include <oln/morpho/elementary_gradient_external.hh> +#include <oln/morpho/elementary_gradient_internal.hh> #include <oln/arith/minus.hh> namespace oln @@ -40,9 +40,10 @@ // Fwd decl. - template <typename I> + template <typename I, typename W> oln_plain(I) - laplace(const Image_with_Nbh<I>& input); + laplace(const Image<I>& input, + const Window<W>& win); # ifndef OLN_INCLUDE_ONLY @@ -52,11 +53,12 @@ // Generic version. - template <typename I> + template <typename I, typename W> oln_plain(I) - laplace_(const Image_with_Nbh<I>& input) + laplace_(const Image<I>& input, + const Window<W>& win) { - return external_gradient(input) - inside_gradient(input); + return gradient_external(input, win) - gradient_internal(input, win); } @@ -67,11 +69,12 @@ // Facade. - template <typename I> + template <typename I, typename W> oln_plain(I) - laplace(const Image_with_Nbh<I>& input) + laplace(const Image<I>& input, + const Window<W>& win) { - return impl::laplace_(exact(input)); + return impl::laplace_(exact(input), win); } # endif // ! OLN_INCLUDE_ONLY Index: oln/morpho/erosion.hh --- oln/morpho/erosion.hh (revision 905) +++ oln/morpho/erosion.hh (working copy) @@ -30,7 +30,7 @@ #include <oln/level/apply_local.hh> #include <oln/border/fill.hh> -#include <oln/accumulator/max.hh> +#include <oln/accumulator/min.hh> namespace oln { @@ -56,7 +56,7 @@ oln_plain(I) erosion_(const Image<I>& input, const Window<W>& win) { - border::fill(input, oln_min(oln_value(I))); + border::fill(input, oln_max(oln_value(I))); accumulator::min_<oln_value(I)> min; return level::apply_local(min, input, win); } @@ -66,7 +66,7 @@ erosion_on_set_(const Image<I>&, const I& input) { - border::fill(input, oln_min(oln_value(I))); + border::fill(input, true); accumulator::and_<oln_value(I)> accu_and; return level::apply_local(accu_and, input); } Index: oln/morpho/elementary_gradient_internal.hh --- oln/morpho/elementary_gradient_internal.hh (revision 0) +++ oln/morpho/elementary_gradient_internal.hh (revision 0) @@ -0,0 +1,83 @@ +// Copyright (C) 2007 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 +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_MORPHO_ELEMENTARY_GRADIENT_INTERNAL_HH +# define OLN_MORPHO_ELEMENTARY_GRADIENT_INTERNAL_HH + +#include <oln/morpho/elementary_erosion.hh> +#include <oln/arith/minus.hh> + +namespace oln +{ + + namespace morpho + { + + // Fwd decl. + + template <typename I> + oln_plain(I) + elementary_gradient_internal(const Image_with_Nbh<I>& input); + + +# ifndef OLN_INCLUDE_ONLY + + namespace impl + { + + // Generic version. + + template <typename I> + oln_plain(I) + elementary_gradient_internal_(const Image_with_Nbh<I>& input) + { + return input - elementary_erosion(input); + } + + + // FIXME: Add a fast version. + + } // end of namespace oln::morpho::impl + + + // Facade. + + template <typename I> + oln_plain(I) + elementary_gradient_internal(const Image_with_Nbh<I>& input) + { + return impl::elementary_gradient_internal_(exact(input)); + } + +# endif // ! OLN_INCLUDE_ONLY + + } // end of namespace oln::morpho + +} // end of namespace oln + + +#endif // ! OLN_MORPHO_ELEMENTARY_GRADIENT_INTERNAL_HH Index: oln/core/2d/image2d.hh --- oln/core/2d/image2d.hh (revision 905) +++ oln/core/2d/image2d.hh (working copy) @@ -213,7 +213,8 @@ box2d b; bool box_ok = init(b, with, dat); postcondition(box_ok); - array2d_<T,int>* ptr = new array2d_<T,int>(b.pmin().row(), + array2d_<T,int>* ptr = new array2d_<T,int>(b.pmin().row(), //FIXME + //: *. b.pmin().col(), b.pmax().row(), b.pmax().col());