https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add some linear filters and update.
* oln/convert/to_weighted_window.hh,
* oln/core/1d/weighted_window1d.hh,
* oln/core/3d/weighted_window3d.hh,
* oln/linear/log_5x5.hh,
* oln/linear/laplacian_8_cross.hh,
* oln/linear/laplacian.hh,
* oln/linear/log_7x7.hh,
* oln/linear/laplacian_4.hh,
* oln/linear/log_17x17.hh,
* oln/linear/laplacian_8.hh,
* oln/linear/log_13x13.hh,
* oln/linear/sharpen.hh,
* oln/linear/mean.hh,
* oln/linear/mexican_hat.hh: New.
* tests/core/window2d.cc: Update.
* tests/core/3dtorle.cc: Fix.
* tests/core/neighb2d.cc: Update.
* oln/core/2d/weighted_window2d.hh: Update.
* oln/core/concept/point.hh (check__): Remove.
* oln/core/concept/dpoint.hh (check__): Remove.
* oln/core/concept/window.hh (size): New.
* oln/core/internal/dpoint_base.hh
(impl_op_plus_equal_),
(impl_op_minus_equal_),
(impl_op_minus_): Disambiguate.
* oln/core/internal/f_weighted_window.hh: Update.
* oln/core/internal/dpoints_impl.hh (size): Rename as...
(impl_size): ...this.
* oln/morpho/cc_tarjan.hh: Update.
* oln/linear/convolution.hh: Cosmetic change.
oln/convert/to_weighted_window.hh | 92 +++++++++++++++++++++++++++
oln/core/1d/weighted_window1d.hh | 110 ++++++++++++++++++++++++++++++++
oln/core/2d/weighted_window2d.hh | 6 -
oln/core/3d/weighted_window3d.hh | 112 +++++++++++++++++++++++++++++++++
oln/core/concept/dpoint.hh | 22 ------
oln/core/concept/point.hh | 19 -----
oln/core/concept/window.hh | 8 ++
oln/core/internal/dpoint_base.hh | 8 +-
oln/core/internal/dpoints_impl.hh | 4 -
oln/core/internal/f_weighted_window.hh | 23 ++++++
oln/linear/convolution.hh | 16 ++--
oln/linear/laplacian.hh | 95 +++++++++++++++++++++++++++
oln/linear/laplacian_4.hh | 84 ++++++++++++++++++++++++
oln/linear/laplacian_8.hh | 84 ++++++++++++++++++++++++
oln/linear/laplacian_8_cross.hh | 85 +++++++++++++++++++++++++
oln/linear/log_13x13.hh | 95 +++++++++++++++++++++++++++
oln/linear/log_17x17.hh | 99 +++++++++++++++++++++++++++++
oln/linear/log_5x5.hh | 87 +++++++++++++++++++++++++
oln/linear/log_7x7.hh | 89 ++++++++++++++++++++++++++
oln/linear/mean.hh | 83 ++++++++++++++++++++++++
oln/linear/mexican_hat.hh | 86 +++++++++++++++++++++++++
oln/linear/sharpen.hh | 85 +++++++++++++++++++++++++
oln/morpho/cc_tarjan.hh | 2
tests/core/3dtorle.cc | 2
tests/core/neighb2d.cc | 2
tests/core/window2d.cc | 2
26 files changed, 1335 insertions(+), 65 deletions(-)
Index: tests/core/window2d.cc
--- tests/core/window2d.cc (revision 957)
+++ tests/core/window2d.cc (working copy)
@@ -39,7 +39,7 @@
const oln::Window<W>& win)
{
oln_piter(I) p(input.points());
- oln_qiter(W) q(p, win);
+ oln_qiter(W) q(win, p);
unsigned count = 0;
for_all(p)
for_all(q)
Index: tests/core/3dtorle.cc
--- tests/core/3dtorle.cc (revision 957)
+++ tests/core/3dtorle.cc (working copy)
@@ -36,7 +36,7 @@
float my_sinus(const oln::point3d& p)
{
- return sin(p.sli() + p.row() + p.col());
+ return std::sin(float(p.sli() + p.row() + p.col()));
}
Index: tests/core/neighb2d.cc
--- tests/core/neighb2d.cc (revision 957)
+++ tests/core/neighb2d.cc (working copy)
@@ -38,7 +38,7 @@
unsigned run(const oln::Image_with_Nbh<I>& input)
{
oln_piter(I) p(input.points());
- oln_niter(I) n(p, input);
+ oln_niter(I) n(input, p);
unsigned count = 0;
for_all(p)
Index: oln/convert/to_weighted_window.hh
--- oln/convert/to_weighted_window.hh (revision 0)
+++ oln/convert/to_weighted_window.hh (revision 0)
@@ -0,0 +1,92 @@
+// 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_CONVERT_TO_WEIGHTED_WINDOW_HH
+# define OLN_CONVERT_TO_WEIGHTED_WINDOW_HH
+
+# include <oln/core/concept/image.hh>
+# include <oln/core/concept/window.hh>
+# include <oln/core/concept/function.hh>
+# include <oln/core/internal/f_weighted_window.hh>
+
+
+namespace oln
+{
+
+ namespace convert
+ {
+
+ // Fwd decl.
+
+ template <typename I>
+ oln_f_image_to_weighted_window(I)
+ to_weighted_window(const Image<I>& input);
+
+
+ template <typename F, typename W>
+ oln_f_weighted_window(oln_result(F), oln_dpoint(W))
+ to_weighted_window(const Function_p2v<F>& weight, // FIXME: should be
Function_dp2v?
+ const Window<W>& win);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ // Generic versions.
+
+ template <typename I>
+ oln_f_image_to_weighted_window(I)
+ to_weighted_window(const Image<I>& input)
+ {
+ oln_point(I) O; O.set_all(0);
+ oln_f_image_to_weighted_window(I) output;
+ oln_piter(I) p(input.points());
+ for_all(p)
+ output.take(input(p), O - p.to_point()); // FIXME: zero - p
+ return output;
+ }
+
+ template <typename F, typename W>
+ oln_f_weighted_window(oln_result(F), oln_dpoint(W))
+ to_weighted_window(const Function_p2v<F>& weight, const
Window<W>& win)
+ {
+ const F& weight_ = exact(weight);
+ oln_f_weighted_window(oln_result(F), oln_dpoint(W)) output;
+ oln_point(W) O; O.set_all(0);
+ oln_qiter(W) q(win, O);
+ for_all(q)
+ output.take(weight_(q), O - q.to_point());
+ return output;
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::convert
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CONVERT_TO_WEIGHTED_WINDOW_HH
Index: oln/core/1d/weighted_window1d.hh
--- oln/core/1d/weighted_window1d.hh (revision 0)
+++ oln/core/1d/weighted_window1d.hh (revision 0)
@@ -0,0 +1,110 @@
+// 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_CORE_1D_WEIGHTED_WINDOW1D_HH
+# define OLN_CORE_1D_WEIGHTED_WINDOW1D_HH
+
+# include <cmath>
+# include <oln/core/internal/weighted_window.hh>
+# include <oln/core/1d/dpoint1d.hh>
+
+
+
+namespace oln
+{
+
+
+ // Fwd decl.
+ template <typename W> class weighted_window1d;
+
+
+# define current weighted_window1d<W>
+# define super internal::weighted_window_< current >
+
+
+ // Super type.
+ template <typename W>
+ struct super_trait_< current >
+ {
+ typedef super ret;
+ };
+
+
+ // Virtual types.
+ template <typename W>
+ struct vtypes< current >
+ {
+ typedef W weight;
+ typedef point1d point;
+ };
+
+
+ /// Generic classical weighted_window1d class.
+
+ template <typename W>
+ class weighted_window1d : public super
+ {
+ public:
+ stc_using(weight);
+
+ weighted_window1d();
+
+ template <unsigned n>
+ void impl_fill_with(const weight (&values)[n]);
+
+ }; // end of class oln::weighted_window1d<W>
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename W>
+ weighted_window1d<W>::weighted_window1d()
+ {
+ }
+
+ template <typename W>
+ template <unsigned n>
+ void
+ weighted_window1d<W>::impl_fill_with(const weight (&values)[n])
+ {
+ precondition(n % 2 = 1);
+ int h = int(n) / 2;
+ unsigned i = 0;
+ for (int dind = -h; dind <= h; ++dind)
+ this->take(values[i++], dpoint1d(dind));
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+# undef super
+# undef current
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_1D_WEIGHTED_WINDOW1D_HH
Index: oln/core/2d/weighted_window2d.hh
--- oln/core/2d/weighted_window2d.hh (revision 957)
+++ oln/core/2d/weighted_window2d.hh (working copy)
@@ -97,11 +97,7 @@
unsigned i = 0;
for (int drow = -h; drow <= h; ++drow)
for (int dcol = -h; dcol <= h; ++dcol)
- {
- if (values[i] != 0)
- this->take(values[i], dpoint2d(drow, dcol));
- ++i;
- }
+ this->take(values[i++], dpoint2d(drow, dcol));
}
# endif // ! OLN_INCLUDE_ONLY
Index: oln/core/3d/weighted_window3d.hh
--- oln/core/3d/weighted_window3d.hh (revision 0)
+++ oln/core/3d/weighted_window3d.hh (revision 0)
@@ -0,0 +1,112 @@
+// 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_CORE_3D_WEIGHTED_WINDOW3D_HH
+# define OLN_CORE_3D_WEIGHTED_WINDOW3D_HH
+
+# include <cmath>
+# include <oln/core/internal/weighted_window.hh>
+# include <oln/core/3d/dpoint3d.hh>
+
+
+
+namespace oln
+{
+
+
+ // Fwd decl.
+ template <typename W> class weighted_window3d;
+
+
+# define current weighted_window3d<W>
+# define super internal::weighted_window_< current >
+
+
+ // Super type.
+ template <typename W>
+ struct super_trait_< current >
+ {
+ typedef super ret;
+ };
+
+
+ // Virtual types.
+ template <typename W>
+ struct vtypes< current >
+ {
+ typedef W weight;
+ typedef point3d point;
+ };
+
+
+ /// Generic classical weighted_window3d class.
+
+ template <typename W>
+ class weighted_window3d : public super
+ {
+ public:
+ stc_using(weight);
+
+ weighted_window3d();
+
+ template <unsigned n>
+ void impl_fill_with(const weight (&values)[n]);
+
+ }; // end of class oln::weighted_window3d<W>
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename W>
+ weighted_window3d<W>::weighted_window3d()
+ {
+ }
+
+ template <typename W>
+ template <unsigned n>
+ void
+ weighted_window3d<W>::impl_fill_with(const weight (&values)[n])
+ {
+ int h = int(std::pow(n, 1./3.)) / 2;
+ precondition((2 * h + 1) * (2 * h + 1) * (2 * h + 1) = n);
+ unsigned i = 0;
+ for (int dsli = -h; dsli <= h; ++dsli)
+ for (int drow = -h; drow <= h; ++drow)
+ for (int dcol = -h; dcol <= h; ++dcol)
+ this->take(values[i++], dpoint3d(dsli, drow, dcol));
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+# undef super
+# undef current
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_3D_WEIGHTED_WINDOW3D_HH
Index: oln/core/concept/point.hh
--- oln/core/concept/point.hh (revision 957)
+++ oln/core/concept/point.hh (working copy)
@@ -82,9 +82,6 @@
protected:
Point();
- private:
- void check__() const;
-
}; // end of oln::Point<Exact>
@@ -178,7 +175,6 @@
template <typename Exact>
Point<Exact>::Point()
{
- this->check__();
// FIXME: Uncomment!
// mlc::assert_defined_< oln_vtype(Exact, grid) >::check();
// mlc::assert_defined_< oln_vtype(Exact, dPoint) >::check();
@@ -186,21 +182,6 @@
// mlc::assert_defined_< oln_vtype(Exact, dim) >::check();
}
- template <typename Exact>
- void Point<Exact>::check__() const
- {
- bool (Exact::*impl_op_equal_adr)(const Exact& rhs) const = &
Exact::impl_op_equal_;
- impl_op_equal_adr = 0;
- bool (Exact::*impl_op_less_adr)(const Exact& rhs) const = &
Exact::impl_op_less_;
- impl_op_less_adr = 0;
- Exact& (Exact::*impl_op_plus_equal_adr)(const dpoint& rhs) = &
Exact::impl_op_plus_equal_;
- impl_op_plus_equal_adr = 0;
- Exact& (Exact::*impl_op_minus_equal_adr)(const dpoint& rhs) = &
Exact::impl_op_minus_equal_;
- impl_op_minus_equal_adr = 0;
- dpoint (Exact::*impl_op_minus_adr)(const Exact& rhs) const = &
Exact::impl_op_minus_;
- impl_op_minus_adr = 0;
- }
-
template <typename P>
typename P::dpoint
operator-(const Point<P>& lhs, const Point<P>& rhs)
Index: oln/core/concept/dpoint.hh
--- oln/core/concept/dpoint.hh (revision 957)
+++ oln/core/concept/dpoint.hh (working copy)
@@ -80,9 +80,6 @@
protected:
Dpoint();
- private:
- void check__() const;
-
}; // end of oln::Dpoint<Exact>
@@ -170,7 +167,6 @@
template <typename Exact>
Dpoint<Exact>::Dpoint()
{
- this->check__();
// FIXME: Uncomment!
// mlc::assert_defined_< oln_vtype(Exact, grid) >::check();
// mlc::assert_defined_< oln_vtype(Exact, point) >::check();
@@ -179,24 +175,6 @@
}
- template <typename Exact>
- void Dpoint<Exact>::check__() const
- {
- bool (Exact::*impl_op_equal_adr)(const Exact& rhs) const = &
Exact::impl_op_equal_;
- impl_op_equal_adr = 0;
- bool (Exact::*impl_op_less_adr)(const Exact& rhs) const = &
Exact::impl_op_less_;
- impl_op_less_adr = 0;
- Exact& (Exact::*impl_op_plus_equal_adr)(const Exact& rhs) = &
Exact::impl_op_plus_equal_;
- impl_op_plus_equal_adr = 0;
- Exact& (Exact::*impl_op_minus_equal_adr)(const Exact& rhs) = &
Exact::impl_op_minus_equal_;
- impl_op_minus_equal_adr = 0;
- Exact& (Exact::*impl_op_mod_equal_adr)(const Exact& rhs) = &
Exact::impl_op_mod_equal_;
- impl_op_mod_equal_adr = 0;
- Exact (Exact::*impl_op_unary_minus_adr)() const = & Exact::impl_op_unary_minus_;
- impl_op_unary_minus_adr = 0;
- }
-
-
/// \{
/// Operators.
Index: oln/core/concept/window.hh
--- oln/core/concept/window.hh (revision 957)
+++ oln/core/concept/window.hh (working copy)
@@ -48,6 +48,7 @@
stc_typename(bkd_qiter);
Exact op_unary_minus_() const;
+ unsigned size() const;
protected:
Window();
@@ -70,6 +71,13 @@
return exact(this)->impl_op_unary_minus_();
}
+ template <typename Exact>
+ unsigned
+ Window<Exact>::size() const
+ {
+ return exact(this)->impl_size();
+ }
+
# endif // ! OLN_INCLUDE_ONLY
} // end of namespace oln
Index: oln/core/internal/dpoint_base.hh
--- oln/core/internal/dpoint_base.hh (revision 957)
+++ oln/core/internal/dpoint_base.hh (working copy)
@@ -204,7 +204,8 @@
Exact&
point_base_<Exact>::impl_op_plus_equal_(const typename
point_base_<Exact>::dpoint& rhs)
{
- this->v_ += rhs.vec();
+ typedef typename point_base_<Exact>::dpoint dpoint__;
+ this->v_ += rhs.dpoint_base_<dpoint__>::vec();
return exact(*this);
}
@@ -212,7 +213,8 @@
Exact&
point_base_<Exact>::impl_op_minus_equal_(const typename
point_base_<Exact>::dpoint& rhs)
{
- this->v_ -= rhs.vec();
+ typedef typename point_base_<Exact>::dpoint dpoint__;
+ this->v_ -= rhs.dpoint_base_<dpoint__>::vec();
return exact(*this);
}
@@ -221,7 +223,7 @@
point_base_<Exact>::impl_op_minus_(const Exact& rhs) const
{
typename point_base_<Exact>::dpoint tmp;
- tmp.vec() = this->v_ - rhs.vec();
+ tmp.vec() = this->v_ - rhs.point_base_<Exact>::vec();
return tmp;
}
Index: oln/core/internal/f_weighted_window.hh
--- oln/core/internal/f_weighted_window.hh (revision 957)
+++ oln/core/internal/f_weighted_window.hh (working copy)
@@ -28,12 +28,17 @@
#ifndef OLN_CORE_INTERNAL_F_WEIGHTED_WINDOW_HH
# define OLN_CORE_INTERNAL_F_WEIGHTED_WINDOW_HH
+# include <mlc/basic.hh>
# include <oln/core/concept/dpoint.hh>
# include <oln/core/concept/weighted_window.hh>
# define oln_f_weighted_window(W, Dp) \
-typename oln::internal::f_weighted_window_< W, Dp >::ret
+typename oln::internal::f_weighted_window_< mlc_basic( W ), Dp >::ret
+
+
+# define oln_f_image_to_weighted_window(I) \
+typename oln::internal::f_weighted_window_< oln_value(I), oln_dpoint(I) >::ret
namespace oln
@@ -51,7 +56,9 @@
// Weighted window types.
+ template <typename W> struct weighted_window1d;
template <typename W> struct weighted_window2d;
+ template <typename W> struct weighted_window3d;
template <typename W, typename Dp> class weighted_window;
/// \}
@@ -75,12 +82,24 @@
};
template <typename W>
+ struct weighted_window__< W, dpoint1d >
+ {
+ typedef weighted_window1d<W> ret;
+ };
+
+ template <typename W>
struct weighted_window__< W, dpoint2d >
{
typedef weighted_window2d<W> ret;
};
- // FIXME: 1D, 3D, 2D hex/tri...
+ // FIXME: 2D hex/tri...
+
+ template <typename W>
+ struct weighted_window__< W, dpoint3d >
+ {
+ typedef weighted_window3d<W> ret;
+ };
/// \}
Index: oln/core/internal/dpoints_impl.hh
--- oln/core/internal/dpoints_impl.hh (revision 957)
+++ oln/core/internal/dpoints_impl.hh (working copy)
@@ -49,7 +49,7 @@
{
public:
- unsigned size() const;
+ unsigned impl_size() const;
const Dp& operator[](unsigned i) const;
const std::vector<Dp>& dpoints() const;
bool has(const Dp& dp) const;
@@ -87,7 +87,7 @@
template <typename Dp>
unsigned
- dpoints_impl_<Dp>::size() const
+ dpoints_impl_<Dp>::impl_size() const
{
return v_.size();
}
Index: oln/morpho/cc_tarjan.hh
--- oln/morpho/cc_tarjan.hh (revision 957)
+++ oln/morpho/cc_tarjan.hh (working copy)
@@ -81,7 +81,7 @@
parent(p) = p;
if ( input(p) )
{
- oln_niter(I) n(p, input);
+ oln_niter(I) n(input, p);
for_all(n)
{
if ( input(n) = true and is_processed(n) )
Index: oln/linear/log_5x5.hh
--- oln/linear/log_5x5.hh (revision 0)
+++ oln/linear/log_5x5.hh (revision 0)
@@ -0,0 +1,87 @@
+// 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_LINEAR_LOG_5X5_HH
+# define OLN_LINEAR_LOG_5X5_HH
+
+# include <oln/linear/convolution.hh>
+# include <oln/core/2d/weighted_window2d.hh>
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_5x5(const Image_2D<I>& f);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic versions.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_5x5_(const Image_2D<I>& f)
+ {
+ // Ref: Cf. Sonka et al., pages 85-86.
+ static int values[] = { 0, 0, -1, 0, 0,
+ 0, -1, -2, -1, 0,
+ -1, -2, 16, -2, -1,
+ 0, -1, -2, -1, 0,
+ 0, 0, -1, 0, 0 };
+ return oln::linear::convolution<V>(f, values);
+ }
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_5x5(const Image_2D<I>& f)
+ {
+ return impl::log_5x5_<V>(f);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_LOG_5X5_HH
Index: oln/linear/laplacian_8_cross.hh
--- oln/linear/laplacian_8_cross.hh (revision 0)
+++ oln/linear/laplacian_8_cross.hh (revision 0)
@@ -0,0 +1,85 @@
+// 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_LINEAR_LAPLACIAN_8_cross_HH
+# define OLN_LINEAR_LAPLACIAN_8_cross_HH
+
+# include <oln/linear/convolution.hh>
+# include <oln/core/2d/weighted_window2d.hh>
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian_8_cross(const Image_2D<I>& f);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian_8_cross_(const Image_2D<I>& f)
+ {
+ static int values[] = { 2, -1, 2,
+ -1, -4, -1,
+ 2, -1, 2 };
+ return oln::linear::convolution<V>(f, values);
+ }
+
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian_8_cross(const Image_2D<I>& f)
+ {
+ return impl::laplacian_8_cross_<V>(f);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_LAPLACIAN_8_cross_HH
Index: oln/linear/laplacian.hh
--- oln/linear/laplacian.hh (revision 0)
+++ oln/linear/laplacian.hh (revision 0)
@@ -0,0 +1,95 @@
+// 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_LINEAR_LAPLACIAN_HH
+# define OLN_LINEAR_LAPLACIAN_HH
+
+
+# ifdef OLN_ENV_2D
+# include <oln/linear/laplacian_4.hh>
+# endif // ! OLN_ENV_2D
+
+// FIXME: 1D, 3D, ...
+
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian(const Image<I>& f);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Dispatch w.r.t. image dimension.
+
+
+# ifdef OLN_ENV_2D
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian_(const Image_2D<I>& f)
+ {
+ return oln::linear::laplacian_4<V>(f);
+ }
+
+# endif // ! OLN_ENV_2D
+
+
+ // FIXME: 1D, 3D, ...
+
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian(const Image<I>& f)
+ {
+ return impl::laplacian_<V>(f);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_LAPLACIAN_HH
Index: oln/linear/log_7x7.hh
--- oln/linear/log_7x7.hh (revision 0)
+++ oln/linear/log_7x7.hh (revision 0)
@@ -0,0 +1,89 @@
+// 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_LINEAR_LOG_7X7_HH
+# define OLN_LINEAR_LOG_7X7_HH
+
+# include <oln/linear/convolution.hh>
+# include <oln/core/2d/weighted_window2d.hh>
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_7x7(const Image_2D<I>& f);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic versions.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_7x7_(const Image_2D<I>& f)
+ {
+ // Ref: Cf. Russ, p. 250.
+ static int values[] = { 0, 0, -1, -1, -1, 0, 0,
+ 0, -1, -3, -3, -3, -1, 0,
+ -1, -3, 0, 7, 0, -3, -1,
+ -1, -3, 7, 24, 7, -3, -1,
+ -1, -3, 0, 7, 0, -3, -1,
+ 0, -1, -3, -3, -3, -1, 0,
+ 0, 0, -1, -1, -1, 0, 0 };
+ return oln::linear::convolution<V>(f, values);
+ }
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_7x7(const Image_2D<I>& f)
+ {
+ return impl::log_7x7_<V>(f);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_LOG_7X7_HH
Index: oln/linear/laplacian_4.hh
--- oln/linear/laplacian_4.hh (revision 0)
+++ oln/linear/laplacian_4.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_LINEAR_LAPLACIAN_4_HH
+# define OLN_LINEAR_LAPLACIAN_4_HH
+
+# include <oln/linear/convolution.hh>
+# include <oln/core/2d/weighted_window2d.hh>
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian_4(const Image_2D<I>& f);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic versions.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian_4_(const Image_2D<I>& f)
+ {
+ static int values[] = { 0, 1, 0,
+ 1, -4, 1,
+ 0, 1, 0 };
+ return oln::linear::convolution<V>(f, values);
+ }
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian_4(const Image_2D<I>& f)
+ {
+ return impl::laplacian_4_<V>(f);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_LAPLACIAN_4_HH
Index: oln/linear/log_17x17.hh
--- oln/linear/log_17x17.hh (revision 0)
+++ oln/linear/log_17x17.hh (revision 0)
@@ -0,0 +1,99 @@
+// 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_LINEAR_LOG_17X17_HH
+# define OLN_LINEAR_LOG_17X17_HH
+
+# include <oln/linear/convolution.hh>
+# include <oln/core/2d/weighted_window2d.hh>
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_17x17(const Image_2D<I>& f);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic versions.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_17x17_(const Image_2D<I>& f)
+ {
+ // Ref: Cf. Sonka et al., pages 85-86.
+ static int values[] = { 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0,
0,
+ 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0,
+ 0, 0, -1, -1, -1, -2, -3, -3, -3, -3, -3, -2, -1, -1, -1, 0, 0,
+ 0, 0, -1, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1, -1, 0, 0,
+ 0, -1, -1, -2, -3, -3, -3, -2, -3, -2, -3, -3, -3, -2, -1, -1, 0,
+ 0, -1, -2, -3, -3, -3, 0, 2, 4, 2, 0, -3, -3, -3, -2, -1, 0,
+ -1, -1, -3, -3, -3, 0, 4, 10, 12, 10, 4, 0, -3, -3, -3, -1, -1,
+ -1, -1, -3, -3, -2, 2, 10, 18, 21, 18, 10, 2, -2, -3, -3, -1, -1,
+ -1, -1, -3, -3, -3, 4, 12, 21, 24, 21, 12, 4, -3, -3, -3, -1, -1,
+ -1, -1, -3, -3, -2, 2, 10, 18, 21, 18, 10, 2, -2, -3, -3, -1, -1,
+ -1, -1, -3, -3, -3, 0, 4, 10, 12, 10, 4, 0, -3, -3, -3, -1, -1,
+ 0, -1, -2, -3, -3, -3, 0, 2, 4, 2, 0, -3, -3, -3, -2, -1, 0,
+ 0, -1, -1, -2, -3, -3, -3, -2, -3, -2, -3, -3, -3, -2, -1, -1, 0,
+ 0, 0, -1, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1, -1, 0, 0,
+ 0, 0, -1, -1, -1, -2, -3, -3, -3, -3, -3, -2, -1, -1, -1, 0, 0,
+ 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0 };
+ return oln::linear::convolution<V>(f, values);
+ }
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_17x17(const Image_2D<I>& f)
+ {
+ return impl::log_17x17_<V>(f);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_LOG_17X17_HH
Index: oln/linear/laplacian_8.hh
--- oln/linear/laplacian_8.hh (revision 0)
+++ oln/linear/laplacian_8.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_LINEAR_LAPLACIAN_8_HH
+# define OLN_LINEAR_LAPLACIAN_8_HH
+
+# include <oln/linear/convolution.hh>
+# include <oln/core/2d/weighted_window2d.hh>
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian_8(const Image_2D<I>& f);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic versions.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian_8_(const Image_2D<I>& f)
+ {
+ static int values[] = { -1, 2, -1,
+ 2, -4, 2,
+ -1, 2, -1 };
+ return oln::linear::convolution<V>(f, values);
+ }
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ laplacian_8(const Image_2D<I>& f)
+ {
+ return impl::laplacian_8_<V>(f);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_LAPLACIAN_8_HH
Index: oln/linear/convolution.hh
--- oln/linear/convolution.hh (revision 957)
+++ oln/linear/convolution.hh (working copy)
@@ -47,14 +47,14 @@
oln_plain_value(I, V)
convolution(const Image<I>& f, const Image<J>& g);
- template <typename V, typename I, typename W>
- oln_plain_value(I, V)
- convolution(const Image<I>& f, const Weighted_Window<W>& w_win);
-
template <typename V, typename I, typename W, unsigned n>
oln_plain_value(I, V)
convolution(const Image<I>& f, const W (&values)[n]);
+ template <typename V, typename I, typename W>
+ oln_plain_value(I, V)
+ convolution(const Image<I>& f, const Weighted_Window<W>& w_win);
+
# ifndef OLN_INCLUDE_ONLY
@@ -92,7 +92,7 @@
template <typename V, typename I, typename W>
oln_plain_value(I, V)
- convolution_window_(const Point_Wise_Accessible_Image<I>& input, const
W& win)
+ convolution_window_(const Point_Wise_Accessible_Image<I>& input, const
W& w_win)
{
oln_plain_value(I, V) output;
prepare(output, with, input);
@@ -100,11 +100,11 @@
for_all(p)
{
V val = 0;
- for (unsigned i = 0; i < win.size(); ++i)
+ for (unsigned i = 0; i < w_win.size(); ++i)
{
- oln_point(I) q = p.to_point() + win.dp(i);
+ oln_point(I) q = p.to_point() + w_win.dp(i);
if (input.has(q))
- val += win.w(i) * input(q);
+ val += w_win.w(i) * input(q);
}
output(p) = val;
}
Index: oln/linear/log_13x13.hh
--- oln/linear/log_13x13.hh (revision 0)
+++ oln/linear/log_13x13.hh (revision 0)
@@ -0,0 +1,95 @@
+// 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_LINEAR_LOG_13X13_HH
+# define OLN_LINEAR_LOG_13X13_HH
+
+# include <oln/linear/convolution.hh>
+# include <oln/core/2d/weighted_window2d.hh>
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_13x13(const Image_2D<I>& f);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic versions.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_13x13_(const Image_2D<I>& f)
+ {
+ // Ref: Cf. Russ, p. 250.
+ static int values[] = { 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0,
+ 0, 0, 0, -1, -1, -2, -2, -2, -1, -1, 0, 0, 0,
+ 0, 0, -2, -2, -3, -3, -4, -3, -3, -2, -2, 0, 0,
+ 0, -1, -2, -3, -3, -3, -2, -3, -3, -3, -2, -1, 0,
+ 0, -1, -3, -3, -1, 4, 6, 4, -1, -3, -3, -1, 0,
+ -1, -2, -3, -3, 4, 14, 19, 14, 4, -3, -3, -2, -1,
+ -1, -2, -4, -2, 6, 19, 24, 19, 6, -2, -4, -2, -1,
+ 1, -2, -3, -3, 4, 14, 19, 14, 4, -3, -3, -2, -1,
+ 0, -1, -3, -3, -1, 4, 6, 4, -1, -3, -3, -1, 0,
+ 0, -1, -2, -3, -3, -3, -2, -3, -3, -3, -2, -1, 0,
+ 0, 0, -2, -2, -3, -3, -4, -3, -3, -2, -2, 0, 0,
+ 0, 0, 0, -1, -1, -2, -2, -2, -1, -1, 0, 0, 0,
+ 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0 };
+ return oln::linear::convolution<V>(f, values);
+ }
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ log_13x13(const Image_2D<I>& f)
+ {
+ return impl::log_13x13_<V>(f);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_LOG_13X13_HH
Index: oln/linear/sharpen.hh
--- oln/linear/sharpen.hh (revision 0)
+++ oln/linear/sharpen.hh (revision 0)
@@ -0,0 +1,85 @@
+// 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_LINEAR_SHARPEN_HH
+# define OLN_LINEAR_SHARPEN_HH
+
+# include <oln/arith/minus.hh>
+# include <oln/arith/times.hh>
+# include <oln/linear/laplacian.hh>
+
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ sharpen(const Image<I>& f, float strength);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ sharpen_(const Image<I>& f, float strength)
+ {
+ return arith::minus<V>(input,
+ arith::times<V>(linear::laplacian(input), strength));
+ }
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ sharpen(const Image<I>& f, float strength)
+ {
+ precondition(strength > 0);
+ return impl::sharpen_<V>(f, strength);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_SHARPEN_HH
Index: oln/linear/mean.hh
--- oln/linear/mean.hh (revision 0)
+++ oln/linear/mean.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_LINEAR_MEAN_HH
+# define OLN_LINEAR_MEAN_HH
+
+# include <oln/core/gen/literal.hh>
+# include <oln/convert/to_weighted_window.hh>
+# include <oln/linear/convolution.hh>
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I, typename W>
+ oln_plain_value(I, V)
+ mean(const Image<I>& f, const Window<W>& win);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ template <typename V, typename I, typename W>
+ oln_plain_value(I, V)
+ mean_(const Image<I>& f, const Window<W>& win)
+ {
+ lit_p2v_<oln_point(I), float> g(1.f / win.size());
+ return linear::convolution<V>(f, convert::to_weighted_window(g, win));
+ }
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I, typename W>
+ oln_plain_value(I, V)
+ mean(const Image<I>& f, const Window<W>& win)
+ {
+ return impl::mean_<V>(f, win);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_MEAN_HH
Index: oln/linear/mexican_hat.hh
--- oln/linear/mexican_hat.hh (revision 0)
+++ oln/linear/mexican_hat.hh (revision 0)
@@ -0,0 +1,86 @@
+// 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_LINEAR_MEXICAN_HAT_HH
+# define OLN_LINEAR_MEXICAN_HAT_HH
+
+# include <oln/linear/convolution.hh>
+# include <oln/core/2d/weighted_window2d.hh>
+
+
+namespace oln
+{
+
+ namespace linear
+ {
+
+ // Fwd decl.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ mexican_hat(const Image<I>& f);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ mexican_hat_(const Image_2D<I>& f)
+ {
+ int values[] = { 0, 0, -1, 0, 0,
+ 0, -1, -2, -1, 0,
+ -1, -2, 16, -2, -1,
+ 0, -1, -2, -1, 0,
+ 0, 0, -1, 0, 0 };
+ return oln::linear::convolution<V>(f, values);
+ }
+
+ } // end of namespace oln::linear::impl
+
+
+ // Facade.
+
+ template <typename V, typename I>
+ oln_plain_value(I, V)
+ mexican_hat(const Image_2D<I>& f)
+ {
+ return impl::mexican_hat_<V>(f);
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::linear
+
+} // end of namespace oln
+
+
+#endif // ! OLN_LINEAR_MEXICAN_HAT_HH