Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* oln/convol/fast_gaussian.hh: Add reference.
* oln/convol/fast_gaussian.hxx: Correct algorithm for tiny sigma.
+2004-03-29 Giovanni Palma <giovanni(a)lrde.epita.fr>
+
* tests/convol/tests/md5_convol_fast_gaussian_hh5: Correct test.
* tests/convol/tests/md5_convol_fast_gaussian_hh4: Likewise.
* tests/convol/tests/md5_convol_fast_gaussian_hh3: Likewise.
Index: olena/oln/convol/fast_gaussian.hh
--- olena/oln/convol/fast_gaussian.hh Mon, 29 Mar 2004 15:45:23 +0200 palma_g (oln/26_fast_gauss 1.6.1.6.1.8 640)
+++ olena/oln/convol/fast_gaussian.hh Mon, 29 Mar 2004 16:36:57 +0200 palma_g (oln/26_fast_gauss 1.6.1.6.1.8 640)
@@ -55,7 +55,8 @@
** \brief Gaussian filter.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param C Exact type of the conversion object.
** \param B Base type of the conversion object.
@@ -80,7 +81,8 @@
** \brief Derivative gaussian filter.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param C Exact type of the conversion object.
** \param B Base type of the conversion object.
@@ -106,7 +108,8 @@
** \brief Second derivative gaussian filter.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param C Exact type of the conversion object.
** \param B Base type of the conversion object.
@@ -135,7 +138,8 @@
** \brief Gaussian filter with a default conversion.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param I Exact type of the image.
** \param BE Exact type of the behavior.
@@ -182,7 +186,8 @@
** \brief Derivative gaussian filter with a default conversion.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param I Exact type of the image.
** \param BE Exact type of the behavior.
@@ -228,7 +233,8 @@
** \brief Second derivative gaussian filter with a default conversion.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param I Exact type of the image.
** \param BE Exact type of the behavior.
@@ -278,7 +284,8 @@
** default behavior.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.\n
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).\n
**
** \warning The content of the border is the mirror of the
** image.
@@ -325,7 +332,8 @@
** and a default behavior.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \warning The content of the border is the mirror of the
** image.
@@ -374,7 +382,8 @@
** conversion and a default behavior.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \warning The content of the border is the mirror of the
** image.
Index: olena/oln/convol/fast_gaussian.hxx
--- olena/oln/convol/fast_gaussian.hxx Mon, 29 Mar 2004 15:45:23 +0200 palma_g (oln/25_fast_gauss 1.7.1.8.1.10 640)
+++ olena/oln/convol/fast_gaussian.hxx Mon, 29 Mar 2004 16:33:41 +0200 palma_g (oln/25_fast_gauss 1.7.1.8.1.10 640)
@@ -306,6 +306,10 @@
for_all(it)
work_img[it] = ntg::cast::force<ntg::float_s>(in[it]);
+ // On tiny sigma, Derich algorithm doesn't work.
+ // It is the same thing that to convolve with a Dirac.
+ if (sigma > 0.006)
+ {
/* FIXME: relation between sigma and the border shouldn't
be linear, so when sigma is big enougth, the signal may
be parasitized by the non signal values.
@@ -313,7 +317,7 @@
behavior.adapt_border(work_img, ntg::cast::round<coord>(5 * sigma));
gaussian_<I::dim>::doit(work_img, coef);
-
+ }
/* Convert the result image to the user-requested datatype.
FIXME: We are making an unnecessary copy in case the
user expects a ntg::float_s image. */
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
OUPS !!!!
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/morpher/slicing_morpher.hh: Minor fix.
Index: olena/oln/morpher/slicing_morpher.hh
--- olena/oln/morpher/slicing_morpher.hh Mon, 29 Mar 2004 09:33:48 +0200 odou_s (oln/m/42_slicing_mo 1.1 600)
+++ olena/oln/morpher/slicing_morpher.hh Mon, 29 Mar 2004 11:21:41 +0200 odou_s (oln/m/42_slicing_mo 1.1 600)
@@ -85,12 +85,16 @@
/// Return a size of N-1 dimension.
oln::image1d_size* image_size_dec(const oln::image2d_size& image_size)
{
+ // We can't use typedef here because image2d_size and image3d_size don't have
+ // the same number of arguments.
return new oln::image1d_size(image_size.ncols(), image_size.border());
}
/// Return a size of N-1 dimension.
oln::image2d_size* image_size_dec(const oln::image3d_size& image_size)
{
+ // We can't use typedef here because image2d_size and image3d_size don't have
+ // the same number of arguments.
return new oln::image2d_size(image_size.nrows(), image_size.ncols(), image_size.border());
}
@@ -158,6 +162,7 @@
~super_slicing_morpher()
{
delete size_;
+ delete impl_;
}
/*!
--
Simon Odou
simon(a)lrde.epita.fr
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/morpher/iter_morpher.hh: To have a specific default iterator.
Index: olena/oln/morpher/iter_morpher.hh
--- olena/oln/morpher/iter_morpher.hh Mon, 29 Mar 2004 09:31:08 +0200 odou_s ()
+++ olena/oln/morpher/iter_morpher.hh Mon, 29 Mar 2004 06:15:32 +0200 odou_s (oln/m/41_iter_morph 644)
@@ -0,0 +1,196 @@
+// Copyright (C) 2004 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, 59 Temple Place - Suite 330, 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 ITER_MORPHER_HH
+# define ITER_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class SrcType, class IterType, class Exact = mlc::final>
+ struct iter_morpher;
+
+ } // end of namespace morpher
+
+ /// Inherits identification's informations about the iter morpher.
+ template <class SrcType, class IterType, class Exact>
+ struct image_id< morpher::iter_morpher<SrcType, IterType, Exact> > : public image_id<SrcType>
+ {};
+
+ /// Inherits identification's informations about the const iter morpher.
+ template <class SrcType, class IterType, class Exact>
+ struct image_id< morpher::iter_morpher<const SrcType, IterType, Exact> > : public image_id<SrcType>
+ {};
+
+ /// Traits for iter morpher.
+ template <class SrcType, class IterType>
+ struct image_traits < morpher::iter_morpher<SrcType, IterType> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(SrcType),
+ morpher::iter_morpher<SrcType, IterType> > >
+ {
+ typedef IterType iter_type;
+ };
+
+ /// Traits for const iter morpher.
+ template <class SrcType, class IterType>
+ struct image_traits < morpher::iter_morpher<const SrcType, IterType> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(SrcType),
+ morpher::iter_morpher<const SrcType, IterType> > >
+ {
+ typedef IterType iter_type;
+ };
+
+ namespace morpher {
+
+ template <class SrcType, class IterType, class Exact>
+ struct iter_morpher
+ : public abstract::generic_morpher< SrcType, SrcType, iter_morpher<SrcType, IterType, Exact> >
+ {
+ /// The type of the object instantiated. iter morpher can be derived.
+ typedef typename image_id< iter_morpher<SrcType, IterType, Exact> >::exact_type exact_type;
+ typedef iter_morpher<SrcType, IterType, Exact> self_type;
+ typedef IterType iter_type;
+ typedef abstract::generic_morpher< SrcType, SrcType, iter_morpher<SrcType, IterType, Exact> > super_type;
+
+ /// Construct the iter morpher with an image \a ima.
+ iter_morpher(const SrcType &ima)
+ : super_type(ima)
+ {}
+
+ /// Construct the iter morpher with another iter morpher.
+ iter_morpher(const self_type& r)
+ : super_type(r.get_ima())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ iter_morpher() {}
+
+ /*! Perform a shallow copy from the decorated image of \a rhs
+ ** to the current decorated image. The points will be shared
+ ** by the two images.
+ */
+ self_type&
+ assign(self_type& rhs)
+ {
+ oln_iter_type(SrcType) it(rhs);
+
+ for_all(it)
+ this->at(it) = rhs[it];
+ return this->exact();
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "iter_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /// The specialized version for `const' declared images.
+ template <class SrcType, class IterType, class Exact>
+ struct iter_morpher<const SrcType, IterType, Exact>
+ : public abstract::generic_morpher< SrcType, SrcType, iter_morpher<const SrcType, IterType, Exact> >
+ {
+ /// The type of the object instantiated. iter morpher can be derived.
+ typedef typename image_id< iter_morpher<SrcType, IterType, Exact> >::exact_type exact_type;
+ typedef iter_morpher<const SrcType, IterType, Exact> self_type;
+ typedef IterType iter_type;
+ typedef abstract::generic_morpher<SrcType, SrcType, iter_morpher<const SrcType, IterType, Exact> > super_type;
+
+ /// Construct the iter morpher with an image \a ima.
+ iter_morpher(const SrcType &ima)
+ : super_type(ima)
+ {}
+
+ /// Construct the iter morpher with another iter morpher.
+ iter_morpher(const iter_morpher<const SrcType, IterType>& r)
+ : super_type(r.get_ima()) {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ iter_morpher()
+ {}
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "iter_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /*!
+ ** \brief Instantiate a temporary read-only iter morpher.
+ **
+ ** The image will be viewed according to its iterator type.
+ ** For example, the foo function will print the size of the picture
+ ** (the bkd_iter_type is used transparently).
+ **
+ ** \code
+ ** #include <oln/morpher/iter_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** template <class E>
+ ** void foo(const oln::abstract::image<E>& img)
+ ** {
+ ** oln_iter_type(oln::abstract::image<E>) it(img);
+ ** for_all(it)
+ ** {
+ ** std::cout << it.row() << " " << it.col() << std::endl;
+ ** break;
+ ** }
+ ** }
+ ** int main()
+ ** {
+ ** const oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** assert(imc.has_impl());
+ ** foo(oln::morpher::iter_morph<oln_bkd_iter_type_(oln::image2d<ntg::rgb_8>)>(imc));
+ ** }
+ ** \endcode
+ */
+ template <class IterType, class I>
+ const iter_morpher<I, IterType> iter_morph(I &ima)
+ {
+ return iter_morpher<I, IterType>(ima);
+ }
+
+ } // End of namespace morpher.
+
+} // End of namespace oln.
+
+#endif // !ITER_MORPHER
--
Simon Odou
simon(a)lrde.epita.fr
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/morpher/piece_morpher.hh: To use a piece of image like a real one.
* oln/core/abstract/image_with_impl.hh:
* oln/core/point2d.hh: Able to construct a point2d from a point1d.
* oln/core/point2d.hxx: Likewise.
* oln/core/point3d.hh: Able to construct a point3d from a point2d.
* oln/core/point3d.hxx: Likewise.
* oln/core/abstract/image_with_dim.hh: Fix a bug.
* oln/core/abstract/image_with_impl.hh: Fix (same).
Index: olena/oln/core/point2d.hh
--- olena/oln/core/point2d.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/c/30_point2d.hh 1.13 600)
+++ olena/oln/core/point2d.hh Mon, 29 Mar 2004 05:38:52 +0200 odou_s (oln/c/30_point2d.hh 1.13 600)
@@ -75,6 +75,10 @@
point2d(coord row, coord col);
+ /// The coordinates of the point2d are set to \a p and \a col.
+
+ point2d(const point1d& p, coord col);
+
/// Return Give the value of the point2d row coordinate.
coord
Index: olena/oln/core/point2d.hxx
--- olena/oln/core/point2d.hxx Mon, 19 Jan 2004 18:35:23 +0100 astrid (oln/c/29_point2d.hx 1.6 640)
+++ olena/oln/core/point2d.hxx Mon, 29 Mar 2004 05:39:17 +0200 odou_s (oln/c/29_point2d.hx 1.6 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2004 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
@@ -48,6 +48,13 @@
nth(1) = col;
}
+ inline
+ point2d::point2d(const point1d& p, coord row)
+ {
+ nth(0) = row;
+ nth(1) = p.col();
+ }
+
inline coord
point2d::row() const
{
Index: olena/oln/core/point3d.hh
--- olena/oln/core/point3d.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/c/28_point3d.hh 1.15 600)
+++ olena/oln/core/point3d.hh Mon, 29 Mar 2004 05:40:21 +0200 odou_s (oln/c/28_point3d.hh 1.15 600)
@@ -80,6 +80,10 @@
point3d(coord slice, coord row, coord col);
+ /// The coordinates of the point3d are set to \a p, and \a slice.
+
+ point3d(const point2d& p, coord slice);
+
/// Return the value of the point3d slice coordinate.
coord
Index: olena/oln/core/point3d.hxx
--- olena/oln/core/point3d.hxx Mon, 28 Jul 2003 14:14:03 +0200 david (oln/c/27_point3d.hx 1.5 640)
+++ olena/oln/core/point3d.hxx Mon, 29 Mar 2004 05:39:24 +0200 odou_s (oln/c/27_point3d.hx 1.5 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2004 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
@@ -51,6 +51,14 @@
nth(2) = col;
}
+ inline
+ point3d::point3d(const point2d& p, coord slice)
+ {
+ nth(0) = slice;
+ nth(1) = p.row();
+ nth(2) = p.col();
+ }
+
inline coord
point3d::slice() const
{
Index: olena/oln/core/abstract/image_with_dim.hh
--- olena/oln/core/abstract/image_with_dim.hh Sun, 14 Mar 2004 19:03:34 +0100 van-vl_n (oln/t/26_image_with 1.21 600)
+++ olena/oln/core/abstract/image_with_dim.hh Mon, 29 Mar 2004 00:47:04 +0200 odou_s (oln/t/26_image_with 1.21 600)
@@ -325,7 +325,7 @@
coord
nrows() const
{
- return this->size().nrows();
+ return this->exact().size().nrows();
}
@@ -334,7 +334,7 @@
coord
ncols() const
{
- return this->size().ncols();
+ return this->exact().size().ncols();
}
/*! \brief Return the value stored at \a row, \a col
Index: olena/oln/core/abstract/image_with_impl.hh
--- olena/oln/core/abstract/image_with_impl.hh Fri, 26 Mar 2004 12:53:24 +0100 thivol_d (oln/t/27_image_with 1.14.1.10 640)
+++ olena/oln/core/abstract/image_with_impl.hh Mon, 29 Mar 2004 00:51:00 +0200 odou_s (oln/t/27_image_with 1.14.1.10 640)
@@ -145,6 +145,17 @@
return impl_;
}
+ /*!
+ ** \brief Get the size of the image.
+ ** \return The size.
+ */
+ const size_type&
+ size() const
+ {
+ assertion(has_impl());
+ return this->exact().impl()->size();
+ }
+
/// Return the core data of the image.
impl_type*
Index: olena/oln/morpher/piece_morpher.hh
--- olena/oln/morpher/piece_morpher.hh Mon, 29 Mar 2004 09:25:14 +0200 odou_s ()
+++ olena/oln/morpher/piece_morpher.hh Mon, 29 Mar 2004 09:15:56 +0200 odou_s (oln/m/40_piece_morp 644)
@@ -0,0 +1,314 @@
+// Copyright (C) 2004 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, 59 Temple Place - Suite 330, 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 PIECE_MORPHER_HH
+# define PIECE_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class I, class Exact = mlc::final>
+ struct piece_morpher;
+
+ } // end of namespace morpher
+
+ /// Inherits identification's informations about the piece morpher.
+ template <class I, class Exact>
+ struct image_id< morpher::piece_morpher<I, Exact> > : public image_id<I>
+ {};
+
+ /// Inherits identification's informations about the const piece morpher.
+ template <class I, class Exact>
+ struct image_id< morpher::piece_morpher<const I, Exact> > : public image_id<I>
+ {};
+
+ /// Traits for piece morpher.
+ template <class I>
+ struct image_traits < morpher::piece_morpher<I> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(I),
+ morpher::piece_morpher<I> > >
+ {};
+
+ /// Traits for const piece morpher.
+ template <class I>
+ struct image_traits < morpher::piece_morpher<const I> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(I),
+ morpher::piece_morpher<const I> > >
+ {};
+
+
+ namespace morpher {
+
+ /// Abstract piece morpher class used for code factorization.
+ template <class SrcType, class Exact>
+ class super_piece_morpher : public abstract::generic_morpher<SrcType, SrcType, Exact>
+ {
+ public:
+
+ typedef abstract::generic_morpher<SrcType, SrcType, Exact> super_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+
+ protected:
+
+ /*!
+ ** \brief Default constructor.
+ ** \arg ima will be the image.
+ ** \arg p The reference point.
+ ** \arg s The size of the piece of image.
+ **
+ ** One can not use this constructor to instantiate this class
+ ** since it is protected.
+ */
+ super_piece_morpher(const SrcType &ima, const dpoint_type& p,
+ const size_type& s)
+ : super_type(ima), size_(s), p_(p)
+ {}
+
+ const size_type size_; ///< The size of the piece of picture.
+ const dpoint_type p_; ///< The reference point of the piece of picture.
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ super_piece_morpher() : size_(size_) {}
+
+ public:
+
+ /// Return the size (different from the original picture).
+ const size_type size() const
+ {
+ return size_;
+ }
+
+ /// Return the reference point.
+ const dpoint_type ref_point() const
+ {
+ return p_;
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "super_piece_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /*!
+ ** \brief The default piece morpher class.
+ **
+ ** Using this class, a piece of picture is a picture.
+ **
+ ** \see oln::morpher::abstract::generic_morpher
+ ** \see oln::morpher::piece_morph
+ */
+ template <class SrcType, class Exact>
+ struct piece_morpher
+ : public super_piece_morpher<SrcType, piece_morpher<SrcType, Exact> >
+ {
+ /// The type of the object instantiated. piece morpher can be derived.
+ typedef typename image_id<piece_morpher<SrcType, Exact> >::exact_type exact_type;
+ typedef piece_morpher<SrcType, Exact> self_type;
+ typedef super_piece_morpher<SrcType, piece_morpher<SrcType, Exact> > super_type;
+
+ typedef oln_point_type(SrcType) point_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+ typedef oln_value_type(SrcType) value_type;
+
+ /// Construct the piece morpher with an image \a ima.
+ piece_morpher(const SrcType &ima, const dpoint_type p,
+ const size_type s)
+ : super_type(ima, p, s)
+ {}
+
+ /// Construct the piece morpher with another piece morpher.
+ piece_morpher(const self_type& r)
+ : super_type(r.get_ima(), r.ref_point(), r.size())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ piece_morpher()
+ {}
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ value_type& at(const point_type& p)
+ {
+ return const_cast<value_type &>(this->ima_)[p + p_];
+ }
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ const value_type at(const point_type& p) const
+ {
+ return this->ima_[p + p_];
+ }
+
+ /*! Perform a shallow copy from the decorated image of \a rhs
+ ** to the current decorated image. The points will be shared
+ ** by the two images.
+ */
+ self_type&
+ assign(self_type& rhs)
+ {
+ oln_iter_type(SrcType) it(rhs);
+
+ for_all(it)
+ this->at(it) = rhs[it];
+ return this->exact();
+ }
+
+ /*!
+ ** \brief This operator= assigns rhs to the current image.
+ */
+ self_type&
+ operator=(SrcType& rhs)
+ {
+ return this->exact().assign(rhs);
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "piece_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /// The specialized version for `const' declared images.
+ template <class SrcType, class Exact>
+ struct piece_morpher<const SrcType, Exact>
+ : public super_piece_morpher< SrcType, piece_morpher<const SrcType, Exact> >
+ {
+ /// The type of the object instantiated. piece morpher can be derived.
+ typedef typename image_id<piece_morpher<SrcType, Exact> >::exact_type exact_type;
+ typedef piece_morpher<const SrcType, Exact> self_type;
+ typedef super_piece_morpher<SrcType, piece_morpher<const SrcType, Exact> > super_type;
+
+ typedef oln_point_type(SrcType) point_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+ typedef oln_value_type(SrcType) value_type;
+
+ /*!
+ ** \brief Construct a piece morpher.
+ ** \arg ima The image.
+ ** \arg p The reference point.
+ ** \arg s The size.
+ */
+ piece_morpher(const SrcType &ima, const dpoint_type p,
+ const size_type s)
+ : super_type(ima, p, s)
+ {}
+
+ /// Construct a piece morpher from another one.
+ piece_morpher(const self_type& r)
+ : super_type(r.get_ima(), r.ref_point(), r.size())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ piece_morpher() {}
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ const value_type at(const point_type &p) const
+ {
+ return this->ima_[p + p_];
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "piece_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+
+ /*!
+ ** \brief Instantiate a temporary read-only piece morpher.
+ ** \arg ima The image.
+ ** \arg p The reference's point.
+ ** \arg s The size of the window.
+ **
+ ** A piece of the image will be viewed.
+ **
+ ** \code
+ ** #include <oln/morpher/piece_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** oln::save(oln::morpher::piece_morph(imc,
+ ** oln::dpoint2d(246, 244),
+ ** oln::image2d_size(30, 60, imc.border())),
+ ** IMG_OUT "oln_morpher_piece_morpher.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena_ppm.png
+ ** \image latex lena_ppm.png
+ ** =>
+ ** \image html oln_morpher_piece_morpher.png
+ ** \image latex oln_morpher_piece_morpher.png
+ */
+ template <class I, class PointType, class SizeType>
+ const piece_morpher<I> piece_morph(I &ima, const PointType p, const SizeType s)
+ {
+ return piece_morpher<I>(ima, p, s);
+ }
+
+
+ } // end namespace morpher
+
+} // end namespace oln
+
+#endif // !PIECE_MORPHER
--
Simon Odou
simon(a)lrde.epita.fr
I uncommented some lines in attributes.hh. Why were they
commented?
olena/tests/convol does not pass make check (due to errors
in the gaussian).
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/utils/histogram.hh: Change the return type
of `at' method to const value_type.
* olena/oln/morpho/attributes.hh: Uncomment some lines.
* olena/oln/convol/nagao.hh: Correct comments.
* olena/oln/convol/nagao.hxx: Likewise.
* olena/oln/utils/se_stat.hh: Likewise.
* olena/oln/utils/se_stat.hxx: Likewise.
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Fri, 19 Mar 2004 11:53:50 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.11 640)
+++ olena/oln/utils/histogram.hh Sat, 27 Mar 2004 15:51:26 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.11 640)
@@ -122,7 +122,7 @@
this->exact().clear_impl();
}
/// Read the number of occurrence of \a v.
- const cpt_type&
+ const cpt_type
operator[](const value_type &v)const
{
return this->exact().at(v);
@@ -256,7 +256,7 @@
}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const T &v)const
{
return img_[v2p_(v)];
@@ -404,7 +404,7 @@
min_(ntg_min_val(value_type)), max_(ntg_max_val(value_type)) {}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const value_type& i) const
{
adjust(i);
@@ -503,7 +503,7 @@
upper_type(input, v2p), min_(ntg_min_val(value_type)) {}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const value_type& i) const
{
return img_[v2p_(i)];
@@ -594,7 +594,7 @@
upper_type(input, v2p),max_(ntg_max_val(value_type)) {}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const value_type& i) const
{
return img_[v2p_(i)];
Index: olena/oln/morpho/attributes.hh
--- olena/oln/morpho/attributes.hh Thu, 25 Mar 2004 15:00:37 +0100
palma_g (oln/j/45_attributes 1.10 644)
+++ olena/oln/morpho/attributes.hh Sat, 27 Mar 2004 15:51:59 +0100
van-vl_n (oln/j/45_attributes 1.10 644)
@@ -1213,11 +1213,11 @@
**
** \arg p Point to consider in the image.
*/
- dist_type(//const im_type&,
+ dist_type(const im_type&,
const point_type &p,
- const env_type &) //:
- // value_(ntg_zero_val(value_type)),
- //center_(p)
+ const env_type &):
+ value_(ntg_zero_val(value_type)),
+ center_(p)
{
};
Index: olena/oln/convol/nagao.hh
--- olena/oln/convol/nagao.hh Fri, 26 Mar 2004 20:56:28 +0100 van-vl_n
(oln/m/22_nagao.hh 1.1 600)
+++ olena/oln/convol/nagao.hh Sat, 27 Mar 2004 15:48:41 +0100 van-vl_n
(oln/m/22_nagao.hh 1.1 600)
@@ -127,7 +127,7 @@
/*! A Nagao filter generalized.
**
- ** Each point in the input correspond to the mean of the
+ ** Each point in the input corresponds to the mean of the
** window in which has the smallest variance.
**
** \paran in Input image.
Index: olena/oln/utils/se_stat.hh
--- olena/oln/utils/se_stat.hh Fri, 26 Mar 2004 20:56:28 +0100 van-vl_n
(oln/m/23_se_stat.hh 1.1 644)
+++ olena/oln/utils/se_stat.hh Sat, 27 Mar 2004 15:50:13 +0100 van-vl_n
(oln/m/23_se_stat.hh 1.1 644)
@@ -96,16 +96,16 @@
** \param Sum type used to compute the sum and the average.
** \param Var type used to compute the variance.
**
- ** \note There is two parameters because for vectorial types the sum
+ ** \note There are two parameters because for vectorial types the sum
** is usually a vector, and the variance a non vectorial type.
*/
template <typename Sum = ntg::float_s, typename Var = ntg::float_s>
class se_stat
{
public:
- /// type of used to sum the value (usually floating point values)
+ /// type of used to sum values (usually floating point values)
typedef Sum sum_type;
- /// type of used for the variance (usually floating point values)
+ /// type of the variance (usually floating point values)
typedef Var variance_type;
/*! Build a se stat.
@@ -121,7 +121,7 @@
compute(im, p, s);
}
- /// Computes the mean and the variance.
+ /// Compute the mean and the variance.
template <class I, class S>
se_stat &
compute(const oln::abstract::image<I> &im,
Index: olena/oln/utils/se_stat.hxx
--- olena/oln/utils/se_stat.hxx Fri, 26 Mar 2004 20:56:28 +0100 van-vl_n
(oln/m/24_se_stat.hx 1.1 644)
+++ olena/oln/utils/se_stat.hxx Sat, 27 Mar 2004 15:50:23 +0100 van-vl_n
(oln/m/24_se_stat.hx 1.1 644)
@@ -32,7 +32,7 @@
namespace oln {
namespace utils {
- /// Computes the mean and the variance.
+ /// Compute the mean and the variance.
template <typename Sum, typename Var>
template <class I, class S>
inline se_stat<Sum, Var> &