Index: ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* configure.ac: Add convert utilities.
Index: tools/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* tools/utilities/convert/color_space.cc: New file. Convert
from a color space to another.
* tools/utilities/convert/Makefile.am: New file.
Index: configure.ac
--- configure.ac Wed, 14 Apr 2004 16:47:52 +0200 thivol_d
(oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.5 600)
+++ configure.ac Wed, 23 Jun 2004 09:22:34 +0200 van-vl_n
(oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.5 600)
@@ -353,6 +353,15 @@
[tools/utilities/morpho/Makefile],
[], [morpho])
+### The convert utilities are a component.
+ OLN_COMPONENT([tools/utilities/convert],
+ [convert-utilities],
+ [oln_cv_build_convert_utils],
+ [the convert utilities],
+ [OLN_UTILITIES],
+ [tools/utilities/convert/Makefile],
+ [], [convert])
+
])dnl End of OLN_COLLECTION([OLN_UTILITIES])
], [utilities])dnl End of OLN_COMPONENT([tools/utilities])
Index: tools/utilities/convert/color_space.cc
--- tools/utilities/convert/color_space.cc Wed, 23 Jun 2004 12:37:49
+0200 van-vl_n ()
+++ tools/utilities/convert/color_space.cc Wed, 23 Jun 2004 12:36:22
+0200 van-vl_n (oln/u/17_color_spac 644)
@@ -0,0 +1,268 @@
+// -*-
c++ -*-
+// 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.
+
+//
+// How to add a new color space (ex:hsi)?
+//
+// 1) Add header "#include <oln/convert/rgbhsi.hh>"
+// 2) Add "FROM_X_TO_RGB(hsi);"
+// "FROM_RGB_TO_X(hsi);"
+// 3) Add "else if (cs_in == "hsi")
+// r = from_x_to_rgb(copy_to_x<hsi_8>(i));"
+// 4) Add "else if (cs_out == "hsi")
+// save(from_rgb_to_x<hsi_8>(r), f_out);"
+// 3) update help usage()
+//
+
+#include <oln/basics2d.hh>
+#include <ntg/color.hh>
+#include <oln/convert/rgbhsi.hh>
+#include <oln/convert/rgbhsl.hh>
+#include <oln/convert/rgbhsv.hh>
+#include <oln/convert/rgbnrgb.hh>
+#include <oln/convert/rgbxyz.hh>
+#include <oln/convert/rgbyiq.hh>
+#include <oln/convert/rgbyuv.hh>
+#include <getopt.hh>
+
+using namespace oln;
+using namespace ntg;
+
+static struct option long_options[] =
+ {
+ { "help", no_argument, 0, 'h' },
+ { "version", no_argument, 0, 'V' },
+ { 0, 0, 0, 0 }
+ };
+
+
+
+//! Help and exit
+void
+usage(const char *pg)
+{
+ std::cout << "Usage : " << pg
+ << " FileIn.ppm FileOut.ppm Color_space_in Color_space_out"
+ << std::endl
+ << "Example : `" << pg
+ << " ../../../olena/img/lena.ppm lena_hsl.ppm rgb hsl"
+ << std::endl
+ << "Color space: hsi hsl hsv nrgb xyz yiq yuv rgb"
+ << std::endl
+ << "Note : every conversion goes through the rgb"
+ << "color space."
+ << std::endl
+ << "Report bugs to <" OLN_PACKAGE_BUGREPORT ">." << std::endl;
+ exit(1);
+}
+
+void
+version(const char *pg)
+{
+ std::cout << pg << " for Olena " << OLN_PACKAGE_VERSION << std::endl
+ << std::endl
+ << "Copyright (C) 2004 EPITA Research and Development Laboratory."
+ << std::endl
+ << "This is free software; see the source for copying conditions."
+ << " There is NO"
+ << std::endl
+ << "warranty; not even for MERCHANTABILITY or FITNESS FOR A"
+ <<" PARTICULAR PURPOSE."
+ << std::endl << std::endl
+ << "Written by Niels Van Vliet <niels(a)lrde.epita.fr>" << std::endl;
+ exit(0);
+}
+
+
+//! cast an rgb_8 image to a x image
+template<class D, class I>
+typename oln::mute<I, D>::ret
+copy_to_x(const oln::abstract::vectorial_image<I> &i)
+{
+ //Not very clean.
+ assert(ntg_nb_comp(oln_value_type(I)) == 3);
+ typename oln::mute<I, D>::ret out(i.size());
+
+ oln_iter_type(I) it(i);
+ for_all(it)
+ for (unsigned c = 0; c < 3; ++c)
+ out[it][c] = i[it][c];
+ return out;
+}
+
+
+
+template<class T>
+oln::image2d<ntg::rgb_8>
+from_x_to_rgb(const oln::image2d<T> &in)
+{
+ assert(0);
+}
+
+#define FROM_X_TO_RGB(T) \
+ template<> \
+ oln::image2d<ntg::rgb_8> \
+ from_x_to_rgb<ntg::T##_8>(const oln::image2d<ntg::T##_8>&in) \
+ { \
+ return apply(oln::convert::f_##T##_to_rgb<8, 8>(), in); \
+ }
+
+
+template<class T>
+oln::image2d<T>
+from_rgb_to_x(const oln::image2d<ntg::rgb_8> &in)
+{
+ assert(0);
+}
+
+#define FROM_RGB_TO_X(T) \
+ template<> \
+ oln::image2d<ntg::T##_8> \
+ from_rgb_to_x<ntg::T##_8>(const oln::image2d<ntg::rgb_8>&in) \
+ { \
+ return apply(oln::convert::f_rgb_to_##T<8, 8>(), in); \
+ }
+
+
+FROM_X_TO_RGB(hsi);
+FROM_RGB_TO_X(hsi);
+FROM_X_TO_RGB(hsl);
+FROM_RGB_TO_X(hsl);
+FROM_X_TO_RGB(hsv);
+FROM_RGB_TO_X(hsv);
+FROM_X_TO_RGB(nrgb);
+FROM_RGB_TO_X(nrgb);
+FROM_X_TO_RGB(xyz);
+FROM_RGB_TO_X(xyz);
+FROM_X_TO_RGB(yiq);
+FROM_RGB_TO_X(yiq);
+FROM_X_TO_RGB(yuv);
+FROM_RGB_TO_X(yuv);
+
+
+
+
+using namespace oln;
+using namespace ntg;
+int
+main(int argc,
+ char **argv)
+{
+
+ int c;
+ int opt_index = 0;
+ while ((c = getopt_long (argc, argv, "hV:", long_options,
&opt_index)) != -1)
+ switch (c)
+ {
+ case ':':
+ case '?':
+ std::cerr << "Try `" << argv[0]
+ << " --help' for more information." << std::endl;
+ exit (1);
+
+ case 'h':
+ usage(argv[0]);
+
+ case 'V':
+ version(argv[0]);
+
+ default:
+ opt_index = 0;
+ break;
+ }
+
+
+ if ((optind + 4) != argc)
+ usage(argv[0]);
+
+ const std::string f_in (argv[optind]);
+ const std::string f_out (argv[optind + 1]);
+ const std::string cs_in (argv[optind + 2]);
+ const std::string cs_out (argv[optind + 3]);
+
+ image2d<rgb_8> i (f_in);
+ if (!i.has_impl())
+ {
+ std::cout << "File not found: "<< f_in << std::endl;
+ usage(argv[0]);
+ }
+
+ if (cs_in == cs_out)
+ {
+ save(i, f_out);
+ exit(0);
+ }
+
+ // First the image is cast into the input type given by the user, and
+ // converted to rgb.
+ image2d<rgb_8> r;
+ if (cs_in == "hsi")
+ r = from_x_to_rgb(copy_to_x<hsi_8>(i));
+ else if (cs_in == "hsl")
+ r = from_x_to_rgb(copy_to_x<hsl_8>(i));
+ else if (cs_in == "hsv")
+ r = from_x_to_rgb(copy_to_x<hsv_8>(i));
+ else if (cs_in == "nrgb")
+ r = from_x_to_rgb(copy_to_x<nrgb_8>(i));
+ else if (cs_in == "xyz")
+ r = from_x_to_rgb(copy_to_x<xyz_8>(i));
+ else if (cs_in == "yiq")
+ r = from_x_to_rgb(copy_to_x<yiq_8>(i));
+ else if (cs_in == "yuv")
+ r = from_x_to_rgb(copy_to_x<yuv_8>(i));
+ else if (cs_in == "rgb")
+ r = i;
+ else
+ {
+ std::cout << "Format not supported: " << cs_in << std::endl;
+ usage(argv[0]);
+ }
+
+ // Then the rgb image is converted to the output type given by the user.
+ if (cs_out == "hsi")
+ save(from_rgb_to_x<hsi_8>(r), f_out);
+ else if (cs_out == "hsl")
+ save(from_rgb_to_x<hsl_8>(r), f_out);
+ else if (cs_out == "hsv")
+ save(from_rgb_to_x<hsv_8>(r), f_out);
+ else if (cs_out == "nrgb")
+ save(from_rgb_to_x<nrgb_8>(r), f_out);
+ else if (cs_out == "xyz")
+ save(from_rgb_to_x<xyz_8>(r), f_out);
+ else if (cs_out == "yiq")
+ save(from_rgb_to_x<yiq_8>(r), f_out);
+ else if (cs_out == "yuv")
+ save(from_rgb_to_x<yuv_8>(r), f_out);
+ else if (cs_out == "rgb")
+ save(r, f_out);
+ else
+ {
+ std::cout << "Format not supported: " << cs_out << std::endl;
+ usage(argv[0]);
+ }
+}
Index: tools/utilities/convert/Makefile.am
--- tools/utilities/convert/Makefile.am Wed, 23 Jun 2004 12:37:49 +0200
van-vl_n ()
+++ tools/utilities/convert/Makefile.am Wed, 23 Jun 2004 12:29:03 +0200
van-vl_n (oln/u/18_Makefile.a 644)
@@ -0,0 +1,5 @@
+AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_OPTIMIZE)
+INCLUDES = -I$(srcdir)/../../lib
+LDADD = ../../lib/libolntools.a
+bin_PROGRAMS = color_space
+color_space_SOURCES = color_space.cc
Index: ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* config/oln.m4: set TOOLS_LDFLAGS inside of LDFLAGS.
* configure.ac: Export TOOLS_LDFLAGS.
Index: doc/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* ref/out/exdoc.config.in: Use TOOLS_LDFLAGS instead of LDLAGS.
Index: configure.ac
--- configure.ac Wed, 23 Jun 2004 12:41:33 +0200 van-vl_n (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.6 600)
+++ configure.ac Thu, 24 Jun 2004 17:47:30 +0200 simon (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.6 600)
@@ -457,6 +457,7 @@
])dnl End of OLN_COLLECTION([OLN_TOP])
AC_SUBST([DOC_CPPFLAGS])
+AC_SUBST([TOOLS_LDFLAGS])
AC_OUTPUT
Index: config/oln.m4
--- config/oln.m4 Mon, 14 Jun 2004 17:26:55 +0200 odou_s (oln/j/15_oln.m4 1.38.1.7 600)
+++ config/oln.m4 Thu, 24 Jun 2004 17:41:32 +0200 simon (oln/j/15_oln.m4 1.38.1.7 600)
@@ -573,7 +573,9 @@
FFTW_LDFLAGS="-L${with_fftw}/lib"
fi
oln_save_CXXFLAGS=$CXXFLAGS
+ oln_save_LDFLAGS=$LDFLAGS
CXXFLAGS="$CXXFLAGS $FFTW_CXXFLAGS"
+ LDFLAGS="$LDFLAGS $FFTW_LDFLAGS"
oln_have_fftw=no
AC_CHECK_HEADER([fftw.h],
[AC_CHECK_LIB([fftw],
@@ -583,7 +585,8 @@
AC_DEFINE([HAVE_FFTW], 1,
[Define to 1 if we can use fftw])])])
CXXFLAGS=$oln_save_CXXFLAGS
- LDFLAGS="$LDFLAGS $FFTW_LDFLAGS"
+ LDFLAGS=$oln_save_LDFLAGS
+ TOOLS_LDFLAGS="$TOOLS_LDFLAGS $FFTW_LDFLAGS"
fi
AC_SUBST([FFTW_CXXFLAGS])
AC_SUBST([FFTW_LDFLAGS])
@@ -614,7 +617,9 @@
ZLIB_LDFLAGS="-L${with_zlib}/lib"
fi
oln_save_CXXFLAGS=$CXXFLAGS
+ oln_save_LDFLAGS=$LDFLAGS
CXXFLAGS="$CXXFLAGS $ZLIB_CXXFLAGS"
+ LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS"
oln_have_zlib=no
AC_CHECK_HEADER([zlib.h],
[AC_CHECK_LIB([z],
@@ -624,7 +629,8 @@
AC_DEFINE([HAVE_ZLIB], 1,
[Define to 1 if we can use zlib])])])
CXXFLAGS=$oln_save_CXXFLAGS
- LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS"
+ LDFLAGS=$oln_save_LDFLAGS
+ TOOLS_LDFLAGS="$TOOLS_LDFLAGS $ZLIB_LDFLAGS"
fi
AC_SUBST([ZLIB_CXXFLAGS])
AC_SUBST([ZLIB_LDFLAGS])
Index: doc/ref/out/exdoc.config.in
--- doc/ref/out/exdoc.config.in Mon, 14 Jun 2004 17:26:55 +0200 odou_s (oln/k/7_exdoc.conf 1.9 600)
+++ doc/ref/out/exdoc.config.in Thu, 24 Jun 2004 17:52:19 +0200 simon (oln/k/7_exdoc.conf 1.9 600)
@@ -5,7 +5,7 @@
CAPTIONS = cxx # We want to run cxx on the extracted files (see line below)
ALIAS cxx = @CXX@ # Here, cxx means g++ but you can choose other compilers
# FIXME: we should write the compilation line in the source file (for libs).
- OPTIONS = @DOC_CPPFLAGS@ @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_builddir@/olena -I@top_srcdir@/olena -I@top_srcdir@/metalic -I@top_builddir@ $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" -DHAVE_CONFIG_H @LDFLAGS@ # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
+ OPTIONS = @DOC_CPPFLAGS@ @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_builddir@/olena -I@top_srcdir@/olena -I@top_srcdir@/metalic -I@top_builddir@ $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" -DHAVE_CONFIG_H @TOOLS_LDFLAGS@ # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
OUT = out # FIXME: should be obsolete
EXT = cc # Extension of generated file
STD_OUT_EXT = std # Extension of generated file standard output
--
Simon Odou
simon(a)lrde.epita.fr
Je sais que y'a plein de trucs crades dans ce checkin, alors si vous avez des
suggestions, n'hesitez pas a m'en faire part, j'en tiendrai compte lorsque
je retoucherai tout ca (apres mon seminaire).
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* oln/makefile.src: Add new files to the distribution.
* oln/transforms/shapelets.hh: Small Changes.
* oln/morpher/func_morpher.hh: Add file, image can now be seen through
a functor.
* oln/core/fpoint2d.hh: Add file. Contain floating point
implementation.
* oln/core/fdpoint2d.hh: Add file. Contain floating dpoint
implementation.
* oln/geom/translate.hh: Add file. Implementation of image translation
using floating dpoint.
* oln/geom/rotate.hh: Add file. Implementation of image rotation using
floating point.
-2004-07-06 Damien Thivolle <damien(a)lrde.epita.fr>
+2004-06-07 Damien Thivolle <damien(a)lrde.epita.fr>
* oln/transforms/shapelets.hh: Change functions to functors,
bug fixes.
Index: olena/oln/makefile.src
--- olena/oln/makefile.src Mon, 14 Jun 2004 09:07:03 +0200 odou_s (oln/r/4_makefile.s 1.3 600)
+++ olena/oln/makefile.src Tue, 15 Jun 2004 19:41:15 +0200 thivol_d (oln/r/4_makefile.s 1.3 600)
@@ -76,7 +76,9 @@
core/dpoint2d.hxx \
core/dpoint3d.hh \
core/dpoint3d.hxx \
+ core/fdpoint2d.hh \
core/fold.hh \
+ core/fpoint2d.hh \
core/fwd_iter1d.hh \
core/fwd_iter2d.hh \
core/fwd_iter3d.hh \
@@ -113,6 +115,8 @@
core/window3d.hh \
core/winiter.hh \
core/winneighb.hh \
+ geom/rotate.hh \
+ geom/translate.hh \
io/base.hh \
io/basics.hh \
io/file.hh \
@@ -147,6 +151,7 @@
level/threshold.hh \
math/macros.hh \
morpher/color_morpher.hh \
+ morpher/func_morpher.hh \
morpher/generic_morpher.hh \
morpher/iter_morpher.hh \
morpher/piece_morpher.hh \
Index: olena/oln/transforms/shapelets.hh
--- olena/oln/transforms/shapelets.hh Mon, 07 Jun 2004 19:41:27 +0200 thivol_d (oln/r/10_shapelets. 1.2 600)
+++ olena/oln/transforms/shapelets.hh Tue, 15 Jun 2004 19:39:53 +0200 thivol_d (oln/r/10_shapelets. 1.2 600)
@@ -18,17 +18,21 @@
{
T operator()(unsigned n, T x)
{
+
if (n == 0)
return 1;
if (n == 1)
return 2. * x;
- return 2. * x * (*this)(n - 1, x) - 2. * double(n - 1) * (*this)(n - 2, x);
+ return 2. * x * (*this)(n - 1, x) - 2. * T(n - 1) * (*this)(n - 2, x);
}
};
template <class T>
struct fact : public std::unary_function<T, T>
{
+
+
+
T operator() (T n)
{
precondition(n >= 0);
@@ -49,7 +53,7 @@
T operator()(int n, T x)
{
assert(n >= 0);
- const double c = sqrt(pow(2.0, n) * sqrt(M_PI) * T(fact<int>()(n)));
+ const double c = sqrt(pow(2.0, n) * sqrt(M_PI) * fact<T>()(n));
return hermite<T>()(n, x) * exp(x * x / -2.0) / c;
}
@@ -111,6 +115,8 @@
func(k, l, double(it.row() - row), double(it.col() - col), b);
}
res[k * n + l] = s;
+ // std::cout << k << " - " << l << " = " << s << std::endl;
+
}
return res;
}
@@ -136,9 +142,15 @@
for (int k = 0; k < m; k++)
for (int l = 0; l < n; l++)
// Add the value at the point
+ {
+ if (vec[k * n + l] * vec[k * n + l] > 40000)
+ {
for_all(it)
resf[it] += vec[k * n + l] *
shapelets_basis<2, double>()(k, l, double(it.row() - nrows / 2), double(it.col() - ncols / 2), b);
+ //std::cout << k << " - " << l << std::endl;
+ }
+ }
image2d<D> res(oln::image2d_size(nrows, ncols, 0));
Index: olena/oln/morpher/func_morpher.hh
--- olena/oln/morpher/func_morpher.hh Tue, 15 Jun 2004 19:49:30 +0200 thivol_d ()
+++ olena/oln/morpher/func_morpher.hh Tue, 15 Jun 2004 16:01:36 +0200 thivol_d (oln/r/14_func_morph 644)
@@ -0,0 +1,142 @@
+// 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 OLENA_MORPHER_FUNC_MORPHER_HH
+# define OLENA_MORPHER_FUNC_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class SrcType, class Ftor, class Exact = mlc::final>
+ struct func_morpher;
+
+
+ } // end of namespace morpher
+
+ template <class SrcType, class Ftor, class Exact>
+ struct image_id<oln::morpher::func_morpher<SrcType, Ftor, Exact> >
+ {
+ enum {dim = SrcType::dim};
+ /*! <The image dimension. */
+ typedef oln_impl_type(SrcType) impl_type;
+ /*! <The underlying implementation.*/
+ typedef oln_value_type(SrcType) value_type;
+ /*! <The modified value type.*/
+ typedef typename mlc::exact_vt<oln::morpher::func_morpher<SrcType, Ftor, Exact>,
+ Exact>::ret exact_type;
+
+ typedef oln_point_type(SrcType) point_type;
+ };
+
+ /*! Specialized version for subq_morpher.
+ **
+ ** \param SrcType Input type decorated.
+ **
+ ** \param N The new number of bits by components.
+ **
+ ** \param Exact The exact type of the morpher.
+ */
+ template <class SrcType, class Ftor, class Exact>
+ struct image_traits <oln::morpher::func_morpher<SrcType, Ftor, Exact> > :
+ public image_traits<oln::morpher::abstract::generic_morpher<SrcType,
+ typename image_id<oln::morpher::func_morpher<SrcType, Ftor, Exact> >::exact_type> >
+ {
+ };
+
+ namespace morpher {
+
+
+
+ template <class SrcType, class Ftor, class Exact>
+ struct func_morpher:
+ public abstract::generic_morpher<SrcType,
+ typename oln::image_id<func_morpher<SrcType, Ftor, Exact> >::exact_type>
+ {
+
+ Ftor f;
+
+ /// The exact type of \a this. This class can be derived.
+ typedef typename oln::image_id<func_morpher<SrcType, Ftor, Exact> >::exact_type exact_type;
+
+ /// The upper class.
+ typedef abstract::generic_morpher<SrcType,
+ exact_type> super_type;
+
+ /// The value point of the resulting image.
+ typedef typename image_id<exact_type>::value_type value_type;
+ typedef typename image_id<exact_type>::point_type point_type;
+ typedef typename image_id<exact_type>::impl_type impl_type;
+
+ /// Construct the morpher with an image.
+ func_morpher(const SrcType &ima, const Ftor f_)
+ : super_type(ima)
+ { f = f_;}
+
+ /// Construct the morpher with another morpher.
+ func_morpher(const func_morpher<SrcType, Ftor>& r)
+ : super_type(r.get_ima())
+ { f = r.f; }
+
+ /*! Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ func_morpher() {}
+
+ /// Return the value stored at \a p in the resulting image.
+ const value_type
+ at(const point_type& p) const
+ {
+ return f(ima_, p);
+ }
+
+ /// Return the implementation.
+ const impl_type*
+ impl() const
+ {
+ return ima_.impl();
+ }
+
+ static std::string
+ name()
+ {
+ return "subq_morpher<" + SrcType::name() + ">";
+ }
+
+ };
+ }
+}
+
+
+
+#endif // !OLENA_MORPHER_FUNC_MORPHER_HH
Index: olena/oln/core/fpoint2d.hh
--- olena/oln/core/fpoint2d.hh Tue, 15 Jun 2004 19:49:30 +0200 thivol_d ()
+++ olena/oln/core/fpoint2d.hh Tue, 15 Jun 2004 14:23:37 +0200 thivol_d (oln/r/15_fpoint2d.h 644)
@@ -0,0 +1,321 @@
+// Copyright (C) 2001, 2002, 2003, 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 OLENA_CORE_FPOINT2D_HH
+# define OLENA_CORE_FPOINT2D_HH
+
+# include <iostream>
+
+# include <oln/core/abstract/image.hh>
+# include <oln/core/point2d.hh>
+
+namespace oln {
+
+
+ // fwd decl
+ template <class F>
+ class fpoint2d;
+
+ template <class F>
+ class fdpoint2d;
+
+ /*! \class point_traits<fpoint2d>
+ **
+ ** The specialized version for fpoint2d.
+ */
+
+ template<class F>
+ struct point_traits<fpoint2d<F> >
+ {
+ enum { dim = 2 };
+ typedef fdpoint2d<F> dpoint_type;
+ };
+
+ /*! \class fpoint2d
+ **
+ ** Olena Floating class point2d.
+ */
+
+ template <class F>
+ class fpoint2d
+ {
+ private:
+
+ F coord_[2];
+
+ public:
+
+ typedef fpoint2d<F> exact_type;
+ typedef fpoint2d<F> self_type;
+ typedef fdpoint2d<F> dpoint_type;
+
+ fpoint2d(F x, F y)
+ {
+ coord_[0] = x;
+ coord_[1] = y;
+ }
+
+ fpoint2d()
+ {}
+
+ /// Give the value of the nth coordinate of the point.
+
+ F
+ row() const
+ {
+ return coord_[0];
+ }
+
+ F&
+ row()
+ {
+ return coord_[0];
+ }
+
+ F
+ col() const
+ {
+ return coord_[1];
+ }
+
+ F&
+ col()
+ {
+ return coord_[1];
+ }
+
+ F
+ nth(const unsigned dim) const
+ {
+ assert(dim < 2);
+ return coord_[dim];
+ }
+
+ /// Return a reference to the nth coordinate of the point.
+
+ F&
+ nth(const unsigned dim)
+ {
+ assert(dim < 2);
+ return coord_[dim];
+ }
+
+ exact_type
+ operator-() const
+ {
+ return exact_type(-coord_[0], -coord_[1]);
+ }
+
+ exact_type&
+ operator+=(const dpoint_type& dp)
+ {
+ row() += dp.row();
+ col() += dp.col();
+ return *this;
+ }
+
+ exact_type&
+ operator-=(const dpoint_type& dp)
+ {
+ row() += dp.row();
+ col() += dp.col();
+ return *this;
+ }
+
+ dpoint_type
+ operator-(const self_type& p) const
+ {
+ dpoint_type dp(row() - p.row(), col() - p.col());
+ return dp;
+ }
+
+
+ exact_type
+ operator-(const dpoint_type& dp) const
+ {
+ exact_type p = *this;
+ p += dp;
+ return p;
+ }
+
+ dpoint_type
+ operator+(const self_type& p) const
+ {
+ dpoint_type dp(row() + p.row(), col() + p.col());
+ return dp;
+ }
+
+ exact_type
+ operator+(const dpoint_type& dp) const
+ {
+ exact_type p = *this;
+ p -= dp;
+ return p;
+ }
+
+
+ /*! \brief Test if \a p and the current point have the same coordinates
+ **
+ ** \return True if \a p and the current point have the same coordinates,
+ ** false otherwise.
+ */
+
+ bool
+ operator==(const self_type& p) const
+ {
+ return p.nth(0) == coord_[0] && p.nth(1) == coord_[1];
+ }
+
+
+ /*! \brief Test if \a p and the current point do
+ ** not have the same coordinates.
+ **
+ ** \return False if \a p and the current point have
+ ** the same coordinates, true otherwise.
+ */
+
+ bool
+ operator!=(const self_type& p) const
+ {
+ return !(p.nth(0) == coord_[0] && p.nth(1) == coord_[1]);
+ }
+
+
+
+ };
+
+ template <class T>
+ struct func_traits
+ {
+ };
+
+ template <class T, class F>
+ struct nearest;
+
+ template <class T, class F>
+ struct bilinear;
+
+ template <class T, class F>
+ struct func_traits<nearest<T, F> >
+ {
+ typedef F f_type;
+ };
+
+ template <class T, class F>
+ struct func_traits<bilinear<T, F> >
+ {
+ typedef F f_type;
+ };
+
+ template <class T, class Exact>
+ struct fpoint2d_access
+ {
+
+ typedef typename func_traits<Exact>::f_type f_type;
+
+ const T operator()(const image2d<T> &ima, const fpoint2d<f_type> p) const
+ {
+ return (static_cast<const Exact *>(this))->access_impl(ima, p);
+ }
+
+ };
+
+
+ template <class T, class F>
+ struct nearest : public fpoint2d_access<T, nearest<T, F> >
+ {
+
+ const T access_impl(const image2d<T> &ima, const fpoint2d<F> p) const
+ {
+
+ point2d p2d(int(p.nth(0)), int(p.nth(1)));
+
+ if (ima.hold(p2d))
+ return ima[p2d];
+ else // FIXME : should be ntg_max_val(T)
+ return ntg::rgb_8(255, 255, 255);
+ }
+
+ };
+
+ template <class T, class F>
+ struct bilinear : public fpoint2d_access<T, bilinear<T, F> >
+ {
+
+ const T access_impl(const image2d<T> &ima, const fpoint2d<F> p) const
+ {
+ double x = floorf(p.nth(0));
+ double y = floorf(p.nth(1));
+
+ int a = int(x);
+ int b = int(y);
+
+
+ if (ima.hold(point2d(a, b)) && ima.hold(point2d(a + 1, b + 1)))
+ {
+ int res[3];
+
+ res[0] = int((double(ima(a, b)[0]) * (x + 1 - p.nth(0)) +
+ double(ima(a + 1, b)[0]) * (p.nth(0) - x)) * (y + 1 - p.nth(1)) +
+ (double(ima(a, b + 1)[0]) * (p.nth(0) - x) +
+ double(ima(a + 1, b + 1)[0]) * (x + 1 - p.nth(0))) * (p.nth(1) - y));
+ res[1] = int((double(ima(a, b)[1]) * (x + 1 - p.nth(0)) +
+ double(ima(a + 1, b)[1]) * (p.nth(0) - x)) * (y + 1 - p.nth(1)) +
+ (double(ima(a, b + 1)[1]) * (p.nth(0) - x) +
+ double(ima(a + 1, b + 1)[1]) * (x + 1 - p.nth(0))) * (p.nth(1) - y));
+ res[2] = int((double(ima(a, b)[2]) * (x + 1 - p.nth(0)) +
+ double(ima(a + 1, b)[2]) * (p.nth(0) - x)) * (y + 1 - p.nth(1)) +
+ (double(ima(a, b + 1)[2]) * (p.nth(0) - x) +
+ double(ima(a + 1, b + 1)[2]) * (x + 1 - p.nth(0))) * (p.nth(1) - y));
+ return ntg::rgb_8(res[0], res[1], res[2]);
+ }
+ else if (ima.hold(point2d(a, b)))
+ return ima(a, b);
+ else // FIXME : should be ntg_max_val(T)
+ return ntg::rgb_8(255, 255, 255);
+ }
+
+ };
+
+
+} // end of oln
+
+
+/// Write on an output stream \a o the coordinate of the fpoint2d \a p.
+
+template <class F>
+inline std::ostream&
+operator<<(std::ostream& o, const oln::fpoint2d<F>& p)
+{
+ return o << '(' << p.nth(0) << ',' << p.nth(1) << ')';
+}
+
+
+
+
+
+#endif // ! OLENA_CORE_FPOINT2D_HH
Index: olena/oln/core/fdpoint2d.hh
--- olena/oln/core/fdpoint2d.hh Tue, 15 Jun 2004 19:49:30 +0200 thivol_d ()
+++ olena/oln/core/fdpoint2d.hh Tue, 15 Jun 2004 11:02:18 +0200 thivol_d (oln/r/16_fdpoint2d. 644)
@@ -0,0 +1,201 @@
+// Copyright (C) 2001, 2002, 2003, 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 OLENA_CORE_FDPOINT2D_HH
+# define OLENA_CORE_FDPOINT2D_HH
+
+# include <iostream>
+
+# include <oln/core/abstract/image.hh>
+# include <oln/core/fpoint2d.hh>
+
+namespace oln {
+
+ // fwd decl
+ template <class F>
+ class dfpoint2d;
+
+
+
+ /*! \class dpoint_traits<fdpoint2d>
+ **
+ ** The specialized version for fdpoint2d.
+ */
+
+ template<class F>
+ struct dpoint_traits<fdpoint2d<F> >
+ {
+ enum { dim = 2 };
+ typedef fpoint2d<F> point_type;
+ };
+
+ /*! \class fdpoint2d
+ **
+ */
+
+ template <class F>
+ class fdpoint2d
+ {
+ private:
+
+ F coord_[2];
+
+
+ public:
+
+
+ typedef fdpoint2d<F> exact_type;
+
+ fdpoint2d()
+ {}
+
+ /// The coordinates of the dpoint2d are set to \a row and \a col.
+
+ fdpoint2d(F row, F col)
+ {
+ coord_[0] = row;
+ coord_[1] = col;
+ }
+
+ /// The coordinates of the dpoint2d are set to the \a p coordinates.
+ fdpoint2d(const exact_type& p)
+ {
+ coord_[0] = p.row();
+ coord_[1] = p.col();
+ }
+
+ /// Return the value of the dpoint2d row coordinate.
+
+ F
+ row() const
+ {
+ return coord_[0];
+ }
+
+ /// Return a reference to the dpoint2d row coordinate.
+
+ F&
+ row()
+ {
+ return coord_[0];
+ }
+
+ /// Return the value of the dpoint2d column coordinate.
+
+ F
+ col() const
+ {
+ return coord_[1];
+ }
+
+ /// Return a reference to the dpoint2d column coordinate.
+
+ F&
+ col()
+ {
+ return coord_[1];
+ }
+
+ static std::string
+ name()
+ {
+ return "fdpoint2d";
+ }
+
+ exact_type
+ operator+(const exact_type& dp) const
+ {
+ exact_type tmp(*this);
+ tmp += dp;
+ return tmp;
+ }
+
+ /*! \brief Return a dpoint2d whose coordinates are equal to
+ ** the opposite of the current dpoint2d coordinates.
+ */
+
+ exact_type
+ operator-() const
+ {
+ exact_type dp(-row(), -col());
+ return dp;
+ }
+
+
+ /*! \brief Return a dpoint2d whose coordinates are equal to
+ ** the current dpoint2d coordinates minus \a dp coordinates.
+ */
+
+ exact_type
+ operator-(const exact_type& dp) const
+ {
+ exact_type tmp = *this;
+ tmp -= dp;
+ return tmp;
+ }
+
+
+ /*! \brief Return a reference to the current dpoint2d
+ ** plus \a dp.
+ */
+
+ exact_type&
+ operator+=(const exact_type& dp)
+ {
+ row() += dp.row();
+ col() += dp.col();
+ return *this;
+ }
+
+ /*! \brief Return a reference to the current dpoint2d
+ ** minus \a dp.
+ */
+
+ exact_type&
+ operator-=(const exact_type& dp)
+ {
+ row() -= dp.row();
+ col() -= dp.col();
+ return *this;
+ }
+ };
+
+
+} // end of oln
+
+/// Write on an output stream \a o the coordinates of the dpoint2d \a dp.
+
+template <class F>
+inline std::ostream&
+operator<<(std::ostream& o, const oln::fdpoint2d<F> dp)
+{
+ o << "(" << dp.row() << "," << dp.col() << ")" << std::endl;
+ return o;
+}
+
+
+#endif // !OLENA_CORE_FDPOINT2D_HH
Index: olena/oln/geom/translate.hh
--- olena/oln/geom/translate.hh Tue, 15 Jun 2004 19:49:30 +0200 thivol_d ()
+++ olena/oln/geom/translate.hh Tue, 15 Jun 2004 11:53:36 +0200 thivol_d (oln/s/6_translate. 644)
@@ -0,0 +1,72 @@
+// Copyright (C) 2001, 2002, 2003, 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 OLENA_GEOM_TRANSLATE_HH
+# define OLENA_GEOM_TRANSLATE_HH
+
+# include <cmath>
+# include <iostream>
+
+# include <oln/core/image2d.hh>
+# include <oln/core/fpoint2d.hh>
+# include <oln/core/fdpoint2d.hh>
+
+namespace oln {
+
+ namespace geom {
+
+ template <class T, class F, class Exact>
+ struct translate
+ {
+ typedef oln::image2d<T> im_type;
+
+
+ image2d<T>
+ operator()(const oln::image2d<T>& ima,
+ const fdpoint2d<F> dp,
+ fpoint2d_access<T, Exact> interp)
+ {
+ im_type res(ima.size());
+ oln_iter_type(im_type) it(ima);
+
+ for_all(it)
+ {
+ res[it] = interp(ima, fpoint2d<F>(it.row(), it.col()) - dp);
+ }
+ return res;
+ }
+ };
+ }
+}
+
+
+
+
+
+#endif // !OLENA_GEOM_TRANSLATE_HH
+
Index: olena/oln/geom/rotate.hh
--- olena/oln/geom/rotate.hh Tue, 15 Jun 2004 19:49:30 +0200 thivol_d ()
+++ olena/oln/geom/rotate.hh Tue, 15 Jun 2004 16:07:48 +0200 thivol_d (oln/u/14_rotate.hh 644)
@@ -0,0 +1,219 @@
+// Copyright (C) 2001, 2002, 2003, 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 OLENA_GEOM_ROTATE_HH
+# define OLENA_GEOM_ROTATE_HH
+
+# include <cmath>
+# include <iostream>
+
+# include <oln/core/image2d.hh>
+# include <oln/core/fpoint2d.hh>
+
+namespace oln {
+
+ namespace geom {
+
+ template <class T, class Access>
+ struct ftor_rotate
+ {
+ private:
+ fpoint2d_access<T, Access> interp;
+ point2d center;
+ double cos_angle, sin_angle, a, b;
+
+ public:
+ ftor_rotate(const point2d& center_,
+ const fpoint2d_access<T, Access>& interp_,
+ const double rad_angle_) :
+ interp(interp_),
+ center(center_)
+ {
+ cos_angle = cos(-rad_angle_);
+ sin_angle = sin(-rad_angle_);
+
+ std::cout << sin_angle << " " << cos_angle << std::endl;
+
+ a = double(center.row());
+ b = double(center.col());
+
+ }
+
+ ftor_rotate() {}
+
+ ftor_rotate(const ftor_rotate<T, Access>& rhs)
+ {
+ interp = rhs.interp;
+ center = rhs.center;
+ cos_angle = rhs.cos_angle;
+ sin_angle = rhs.sin_angle;
+ a = rhs.a;
+ b = rhs.b;
+ }
+
+ const T
+ operator()(const image2d<T>& ima,
+ const point2d p) const
+ {
+ double x, y;
+ double c, d;
+
+ c = a + ima.size().nrows() / 2;
+ d = b + ima.size().ncols() / 2;
+
+ x = cos_angle * double(p.row()) - sin_angle * double(p.col()) -
+ c * cos_angle + d * sin_angle + c;
+ y = sin_angle * double(p.row()) + cos_angle * double(p.col()) -
+ c * sin_angle - d * cos_angle + d;
+
+ return interp(ima, fpoint2d<double>(x, y));
+ }
+ };
+
+ template <class T, class Access>
+ struct rotate
+ {
+ typedef image2d<T> im_type;
+
+ im_type
+ operator()(const im_type& ima,
+ const point2d center,
+ double rad_angle,
+ fpoint2d_access<T, Access> interp)
+ {
+ im_type res(ima.size());
+ ftor_rotate<T, Access> f(center, interp, rad_angle);
+ oln_iter_type(im_type) it(res);
+
+ for_all(it)
+ {
+ res[it] = f(ima, point2d(it.row(), it.col()));
+ }
+ return res;
+ }
+ };
+
+
+ template <class T, class Access>
+ struct ftor_rotate_enlarge
+ {
+ private:
+ fpoint2d_access<T, Access> interp;
+ point2d center;
+ double cos_angle;
+ double sin_angle;
+ double a;
+ double b;
+
+ public:
+ ftor_rotate_enlarge(const point2d& center_,
+ const fpoint2d_access<T, Access>& interp_,
+ const double rad_angle_) :
+ interp(interp_),
+ center(center_)
+ {
+ cos_angle = cos(-rad_angle_);
+ sin_angle = sin(-rad_angle_);
+ a = double(center.row());
+ b = double(center.col());
+ }
+
+ ftor_rotate_enlarge()
+ {}
+
+ ftor_rotate_enlarge(const ftor_rotate_enlarge& rhs) :
+ interp(rhs.interp),
+ center(rhs.center)
+ {
+ cos_angle = rhs.cos_angle;
+ sin_angle = rhs.sin_angle;
+ a = rhs.a;
+ b = rhs.b;
+ }
+
+ T
+ operator()(const image2d<T>& ima,
+ const point2d p)
+ {
+ double x, y;
+ double c, d;
+ double rrows = ima.size().nrows() * cos_angle +
+ ima.size().ncols() * -sin_angle;
+ double rcols = ima.size().nrows() * -sin_angle +
+ ima.size().ncols() * cos_angle;
+ double vt = (rrows - ima.size().nrows()) / 2;
+ double ht = (rcols - ima.size().ncols()) / 2;
+
+ c = a + ima.size().nrows() / 2;
+ d = b + ima.size().ncols() / 2;
+
+ x = cos_angle * double(p.row() - vt) - sin_angle * double(p.col() - ht) -
+ c * cos_angle + d * sin_angle + c;
+ y = sin_angle * double(p.row() - vt) + cos_angle * double(p.col() - ht) -
+ c * sin_angle - d * cos_angle + d;
+
+ return interp(ima, fpoint2d<double>(x, y));
+ }
+ };
+
+
+
+
+ template <class T, class Access>
+ struct rotate_enlarge
+ {
+
+ typedef image2d<T> im_type;
+
+ im_type
+ operator()(const im_type& ima,
+ const point2d center,
+ double rad_angle,
+ fpoint2d_access<T, Access> interp)
+ {
+ im_type res(image2d_size(int(ima.size().nrows() * cos(rad_angle) +
+ ima.size().ncols() * sin(rad_angle)),
+ int(ima.size().nrows() * sin(rad_angle) +
+ ima.size().ncols() * cos(rad_angle)),
+ 0));
+
+ oln_iter_type(im_type) it(res);
+ ftor_rotate_enlarge<T, Access> f(center, interp, rad_angle);
+
+ for_all(it)
+ {
+ res[it] = f(ima, point2d(it.row(), it.col()));
+ }
+ return res;
+ }
+ };
+
+ }
+}
+
+
+#endif // !OLENA_CORE_FPOINT2D_HH
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/tests/convol/tests/slow_gaussian: New file.
Index: olena/tests/convol/tests/slow_gaussian
--- olena/tests/convol/tests/slow_gaussian Sun, 13 Jun 2004 13:20:26
+0200 van-vl_n ()
+++ olena/tests/convol/tests/slow_gaussian Wed, 09 Jun 2004 20:04:10
+0200 van-vl_n (oln/r/11_slow_gauss 644)
@@ -0,0 +1,81 @@
+// -*-
c++ -*-
+// 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.
+
+#include "data.hh"
+#include "check.hh"
+
+#include <oln/basics2d.hh>
+#include <oln/convol/slow_gaussian.hh>
+#include <ntg/int.hh>
+#include <oln/utils/md5.hh>
+using namespace oln;
+using namespace ntg;
+
+int main()
+{
+ // Image1d
+ {
+ image1d<int_u8> l(4);
+ l(0) = 1;
+ l(1) = 6;
+ l(2) = 64;
+ l(3) = 0;
+
+ l = convol::slow::gaussian(l, 0.5, 3);
+ if (l(0) != 2 || l(1) != 12 || l(2) != 51 || l(3) != 7)
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+ }
+
+ // Image2d
+ {
+ oln::utils::key::value_type data_key[] =
+ {0x95, 0xe3, 0x63, 0xe0, 0xef, 0x21, 0xcd, 0x34, 0xa2,
+ 0x15, 0xa3, 0x4e, 0x82, 0x37, 0x40, 0x70};
+ oln::utils::key key(data_key);
+
+ image2d<int_u8> lena(rdata("lena.pgm"));
+
+ float_d sigma = 2.5;
+ if (oln::utils::md5(convol::slow::gaussian(lena, sigma, 3)) != key)
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+ }
+
+ // Image3d. Result not tested.
+ {
+ image3d<int_u8> i(10, 10, 10);
+ convol::slow::gaussian(i, 0.2, 3);
+ }
+
+ std::cout << "OK" << std::endl;
+}