Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* olena/oln/Makefile.am: Add files from oln/morpher/
* olena/oln/morpher/generic_morpher.hh: Correct comments and code.
* olena/oln/morpher/subq_morpher.hh: Likewise.
* olena/oln/morpher/color_morpher.hh: Likewise.
* olena/tests/morpher/tests/compose_morph: New file, contains
morpher composition tests.
* olena/tests/morpher/tests/sq_morph: New file, contains sub quantifying
morpher tests.
* olena/tests/morpher/tests/color_morph: New file, contains color morpher
tests.
* olena/tests/morpher/tests/sq_morph_8: Remove file.
* olena/tests/morpher/tests/sq_morph_7: Likewise.
* olena/tests/morpher/tests/sq_morph_6: Likewise.
* olena/tests/morpher/tests/sq_morph_5: Likewise.
* olena/tests/morpher/tests/sq_morph_4: Likewise.
* olena/tests/morpher/tests/sq_morph_3: Likewise.
* olena/tests/morpher/tests/sq_morph_2: Likewise.
* olena/tests/morpher/tests/sq_morph_1: Likewise.
* olena/tests/morpher/tests/rmorph: Likewise.
* olena/tests/morpher/tests/gmorph: Likewise.
* olena/tests/morpher/tests/color_sq_morph: Likewise.
* olena/tests/morpher/tests/bmorph: Likewise.
Index: olena/oln/Makefile.am
--- olena/oln/Makefile.am Fri, 19 Mar 2004 17:28:35 +0100 palma_g (oln/q/47_Makefile.a
1.3.1.1.1.6.1.7.1.3 640)
+++ olena/oln/Makefile.am Tue, 30 Mar 2004 19:28:29 +0200 thivol_d (oln/q/47_Makefile.a
1.3.1.1.1.6.1.7.1.3 640)
@@ -146,6 +146,9 @@
level/set_level.hh \
level/threshold.hh \
math/macros.hh \
+ morpher/color_morpher.hh \
+ morpher/generic_morpher.hh \
+ morpher/subq_morpher.hh \
morpho/attribute_closing_opening.hh \
morpho/attribute_closing_opening_map.hxx \
morpho/attribute_closing_opening_map.hh \
Index: olena/oln/morpher/generic_morpher.hh
--- olena/oln/morpher/generic_morpher.hh Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/18_generic_mo 1.3 600)
+++ olena/oln/morpher/generic_morpher.hh Tue, 30 Mar 2004 19:21:21 +0200 thivol_d
(oln/m/18_generic_mo 1.3 600)
@@ -27,8 +27,8 @@
-#ifndef GENERIC_MORPHER_HH
-# define GENERIC_MORPHER_HH
+#ifndef OLENA_MORPHER_GENERIC_MORPHER_HH
+# define OLENA_MORPHER_GENERIC_MORPHER_HH
# include <string>
@@ -38,17 +38,11 @@
namespace oln {
- /*! \namespace oln::morpher
- **
- ** Contain all the morpher relative declarations and functions.
- */
+ /// Contain all the morpher relative declarations and functions.
namespace morpher {
- /*! \namespace oln::morpher::abstract
- **
- ** Implementation of oln::abstract::generic_morpher.
- */
+ /// Implementation of oln::abstract::generic_morpher.
namespace abstract {
@@ -115,33 +109,52 @@
public:
+ /// The self type.
typedef generic_morpher<DestType, SrcType, Exact> self_type;
+
+ /// The exact type of the morpher.
typedef Exact exact_type;
+ /// The morpher point type.
typedef oln_point_type(DestType) point_type;
+ /// The morpher dpoint type.
typedef oln_dpoint_type(DestType) dpoint_type;
+ /// The morpher iterator type.
typedef oln_iter_type(DestType) iter_type;
+ /// The morpher forward iterator type.
typedef oln_fwd_iter_type(DestType) fwd_iter_type;
+ /// The morpher backward iterator type.
typedef oln_bkd_iter_type(DestType) bkd_iter_type;
+ /// The morpher value type.
typedef oln_value_type(DestType) value_type;
+ /// The morpher size type.
typedef oln_size_type(DestType) size_type;
+ /// The morpher underlying implementation.
typedef oln_impl_type(DestType) impl_type;
/// Type of the decorated image.
typedef SrcType src_self_type;
+ /// The decorated image point type.
typedef oln_point_type(SrcType) src_point_type;
+ /// The decorated image dpoint type.
typedef oln_dpoint_type(SrcType) src_dpoint_type;
+ /// The decorated image iterator type.
typedef oln_iter_type(SrcType) src_iter_type;
+ /// The decorated image forward iterator type.
typedef oln_fwd_iter_type(SrcType) src_fwd_iter_type;
+ /// The decorated image backward iterator type.
typedef oln_bkd_iter_type(SrcType) src_bkd_iter_type;
+ /// The decorated image value type.
typedef oln_value_type(SrcType) src_value_type;
+ /// The decorated image size type.
typedef oln_size_type(SrcType) src_size_type;
- /// Underlying implementation of the decorated image.
+ /// The decorated image underlying implementation.
typedef oln_impl_type(SrcType) src_impl_type;
/// Exact type of the decorated image.
typedef oln_exact_type(SrcType) src_exact_type;
+ /// The upper class.
typedef typename gm_inherit<DestType, Exact>::ret super_type;
/// Return the decorated image.
@@ -151,9 +164,24 @@
return ima_;
}
+ /// Instantiate and return the image that the morpher simulates.
+ DestType*
+ unmorph() const
+ {
+ DestType* im = new DestType(to_exact(*this).size());
+ oln_iter_type(DestType) it(*im);
+
+ for_all(it)
+ (*im)[it] = to_exact(*this).operator[](it);
+ return im;
+ }
+
/*! Default implementation of at.
**
** Return the value stored at \a p in the decorated image.
+ **
+ ** \warning This method should not be called directly.
+ ** Prefer operator[].
*/
const src_value_type
at(const src_point_type& p) const
@@ -164,6 +192,9 @@
/*! Default implementation of at.
**
** Return a reference to the value stored at \a p in the decorated image.
+ **
+ ** \warning This method should not be called directly.
+ ** Prefer operator[].
*/
src_value_type&
at(const src_point_type& p)
@@ -209,8 +240,8 @@
**
** Assign \a rhs to the decorated image.
*/
- src_self_type&
- assign(src_self_type& rhs)
+ src_exact_type&
+ assign(src_exact_type& rhs)
{
return to_exact(ima_).assign(rhs);
}
@@ -227,7 +258,12 @@
return to_exact(ima_).border_set_width(min_border, copy_border);
}
- self_type& operator=(self_type& rhs)
+ /*! Default implementation of the = operator.
+ **
+ ** Assign the decorated image to 'a r.
+ */
+ self_type&
+ operator=(self_type& rhs)
{
return to_exact(*this).assign(rhs.exact());
}
@@ -247,4 +283,4 @@
} // end of namespace oln
-#endif // !GENERIC_MORPHER_HH
+#endif // !OLENA_MORPHER_GENERIC_MORPHER_HH
Index: olena/oln/morpher/subq_morpher.hh
--- olena/oln/morpher/subq_morpher.hh Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/25_subq_morph 1.1 600)
+++ olena/oln/morpher/subq_morpher.hh Tue, 30 Mar 2004 17:36:55 +0200 thivol_d
(oln/m/25_subq_morph 1.1 600)
@@ -27,8 +27,8 @@
-#ifndef SUBQ_MORPHER_HH
-# define SUBQ_MORPHER_HH
+#ifndef OLENA_MORPHER_SUBQ_MORPHER_HH
+# define OLENA_MORPHER_SUBQ_MORPHER_HH
# include "generic_morpher.hh"
@@ -40,18 +40,35 @@
struct subq_morpher;
} // end of namespace morpher
- /// Retrieve types and dimension of the subq_morpher.
+ /*! Retrieve types and dimension of the subq_morpher.
+ **
+ ** \param SrcType Input type decorated.
+ **
+ ** \param N The new number of bits by component.
+ **
+ ** \param Exact The exact type of the morpher.
+ */
template <class SrcType, unsigned N, class Exact>
struct image_id<oln::morpher::subq_morpher<SrcType, N, Exact> >
{
enum {dim = SrcType::dim};
+ /*! <The image dimension. */
typedef oln_impl_type(SrcType) impl_type;
+ /*! <The underlying implementation.*/
typedef typename ntg::color<3, N, ntg::rgb_traits> value_type;
+ /*! <The modified value type.*/
typedef typename mlc::exact_vt<oln::morpher::subq_morpher<SrcType, N,
Exact>,
Exact>::ret exact_type;
};
- /// Specialized version for subq_morpher.
+ /*! 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, unsigned N, class Exact>
struct image_traits <oln::morpher::subq_morpher<SrcType, N, Exact> > :
public image_traits<abstract::image_with_impl<oln_impl_type(SrcType),
@@ -67,6 +84,11 @@
** For Example, calling color_mute with
** color<3, 8, rgb_traits>, 5 will give
** the type : color<3, 5, rgb_traits>.
+ **
+ ** \param T The data type of the image.
+ **
+ ** \param N The new number of bits by component.
+ **
*/
template <class T, unsigned N>
@@ -82,8 +104,9 @@
struct color_mute<ntg::color<nbcomps_, nbits_, color_system>, N>
{
typedef ntg::color<nbcomps_, N, color_system> ret;
+ /*! <The new value type.*/
enum { nbcomps = nbcomps_ };
- enum { nbits = nbits_ };
+ /*! <The number of components */
};
@@ -94,6 +117,12 @@
** as an image with a lower color depth.
** subq_morpher<image2d<rgb_8>, 5> is
** the same as image2d<rgb_5>.
+ **
+ ** \param SrcType The input type decorated.
+ **
+ ** \param N The new numbers of bits by component.
+ **
+ ** \param Exact The exact type of the morpher.
*/
template <class SrcType, unsigned N, class Exact>
struct subq_morpher:
@@ -102,16 +131,16 @@
typename color_mute<oln_value_type(SrcType),
N>::ret>::ret ,
SrcType,
- subq_morpher<SrcType, N, Exact> >
+ typename oln::image_id<subq_morpher<SrcType, N, Exact>
>::exact_type>
{
- // super_type
+ /// The upper class.
typedef abstract::generic_morpher<
typename oln::mute<SrcType,
typename color_mute<oln_value_type(SrcType),
N>::ret>::ret,
SrcType,
- subq_morpher<SrcType, N, Exact> > super_type;
+ typename oln::image_id<subq_morpher<SrcType, N, Exact> >::exact_type>
super_type;
/// The exact type of \a this. This class can be derived.
typedef typename oln::image_id<subq_morpher<SrcType, N, Exact>
>::exact_type exact_type;
@@ -126,20 +155,18 @@
/// The value point of the resulting image.
typedef typename color_mute<oln_value_type(SrcType), N>::ret value_type;
typedef oln_point_type(SrcType) point_type;
- typedef oln_fwd_iter_type(SrcType) fwd_iter_type;
- typedef oln_bkd_iter_type(SrcType) bkd_iter_type;
- typedef oln_iter_type(SrcType) iter_type;
- typedef oln_size_type(SrcType) size_type;
typedef oln_impl_type(SrcType) impl_type;
enum { nbcomps = color_mute<oln_value_type(SrcType), N>::nbcomps };
/// Construct the morpher with an image.
subq_morpher(const SrcType &ima)
- : super_type(ima) {}
+ : super_type(ima)
+ {}
/// Construct the morpher with another morpher.
subq_morpher(const subq_morpher<SrcType, N>& r)
- : super_type(r.get_ima()) {}
+ : super_type(r.get_ima())
+ {}
/*! Empty constructor.
**
@@ -148,7 +175,8 @@
subq_morpher() {}
/// Return the value stored at \a p in the resulting image.
- const value_type at(const point_type& p) const
+ const value_type
+ at(const point_type& p) const
{
value_type tmp;
unsigned int i;
@@ -168,7 +196,8 @@
return ima_.impl();
}
- static std::string name()
+ static std::string
+ name()
{
return "subq_morpher<" + SrcType::name() + ">";
}
@@ -197,6 +226,7 @@
** \image html oln_morpher_subq_morpher.png
** \image latex oln_morpher_subq_morpher.png
*/
+
template <unsigned S, class I>
const subq_morpher<I, S> sqmorph(I &ima)
{
@@ -210,5 +240,5 @@
-#endif // !SUBQ_MORPHER_HH
+#endif // !OLENA_MORPHER_SUBQ_MORPHER_HH
Index: olena/oln/morpher/color_morpher.hh
--- olena/oln/morpher/color_morpher.hh Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/26_color_morp 1.1 600)
+++ olena/oln/morpher/color_morpher.hh Tue, 30 Mar 2004 19:08:32 +0200 thivol_d
(oln/m/26_color_morp 1.1 600)
@@ -26,8 +26,8 @@
// Public License.
-#ifndef COLOR_MORPHER_HH
-# define COLOR_MORPHER_HH
+#ifndef OLENA_MORPHER_COLOR_MORPHER_HH
+# define OLENA_MORPHER_COLOR_MORPHER_HH
# include <oln/morpher/generic_morpher.hh>
@@ -41,28 +41,55 @@
} // end of namespace morpher
- /// Retrieve types and dimension of the color_morpher.
+ /*! \brief Retrieve types and dimension of the color_morpher.
+ **
+ ** \param I The type of the decorated image.
+ **
+ ** \param Exact The exact type of the object.
+ */
template <class I, class Exact>
struct image_id<morpher::color_morpher<I, Exact> >
{
enum {dim = I::dim};
+ /*! <The Image dimension.*/
typedef oln_impl_type(I) impl_type;
+ /*! <Underlying implementation.*/
typedef ntg_comp_type(oln_value_type(I)) value_type;
+ /*! <The value type of the decorated image. Here the
+ ** component type of the source image value_type is
+ ** retrieved.
+ */
typedef typename mlc::exact_vt<morpher::color_morpher<I, Exact>,
Exact>::ret exact_type;
+ /*! <Retrieve the exact type of the image. It depends on
+ ** the value of Exact.
+ */
};
- /// Specialized version for color_morpher.
- template <class I>
- struct image_traits <morpher::color_morpher<I> > :
+ /*! \brief Specialized version for color_morpher.
+ **
+ ** \param I The type of the decorated image.
+ **
+ ** \param Exact The exact type of the object.
+ */
+ template <class I, class Exact>
+ struct image_traits <morpher::color_morpher<I, Exact> > :
public image_traits<abstract::image_with_impl<oln_impl_type(I),
- morpher::color_morpher<I> > >
+ morpher::color_morpher<I, Exact> > >
{
};
namespace morpher {
- /// Abstract color_morpher class used for code factorization.
+ /*! \brief Abstract color_morpher class used for
+ ** code factorization.
+ **
+ ** \param DestType Output type of the morpher.
+ **
+ ** \param SrcType Input type decorated.
+ **
+ ** \param Exact Exact type
+ */
template <class DestType, class SrcType, class Exact>
class super_color_morpher : public abstract::generic_morpher<DestType, SrcType,
Exact>
{
@@ -134,6 +161,10 @@
** Using this class, an rgb image can be viewed
** according to one of its component.
**
+ ** \param SrcType Input Type decorated.
+ **
+ ** \param Exact Exact type.
+ **
** \see oln::morpher::abstract::generic_morpher
*/
template <class SrcType, class Exact>
@@ -141,7 +172,7 @@
public super_color_morpher<typename oln::mute<oln_exact_type(SrcType),
ntg_comp_type(oln_value_type(SrcType))>::ret,
SrcType,
- color_morpher<SrcType, Exact> >
+ typename image_id<color_morpher<SrcType, Exact> >::exact_type >
{
/// The type of the object instantiated. color_morpher can be derived.
typedef typename image_id<color_morpher<SrcType, Exact> >::exact_type
exact_type;
@@ -152,15 +183,16 @@
typedef color_morpher<SrcType, Exact> self_type;
typedef oln_iter_type(SrcType) iter_type;
+ /*! <Type of the class iterator.*/
typedef oln_point_type(SrcType) point_type;
- typedef oln_fwd_iter_type(SrcType) fwd_iter_type;
- typedef oln_size_type(SrcType) size_type;
+ /*! <Type of the class point.*/
typedef ntg_comp_type(oln_value_type(SrcType)) value_type;
- typedef oln_impl_type(SrcType) impl_type;
+ /*! <The value type of the decorated image.*/
typedef super_color_morpher<typename oln::mute<oln_exact_type(SrcType),
ntg_comp_type(oln_value_type(SrcType))>::ret,
SrcType,
- color_morpher<SrcType, Exact> > super_type;
+ typename image_id<color_morpher<SrcType, Exact> >::exact_type >
super_type;
+ /*! <The upper class. */
/// Construct the color_morpher with an image \a ima and a component \a n.
color_morpher(const SrcType &ima, unsigned n) : super_type(ima, n)
@@ -179,6 +211,9 @@
/*! Return a reference to the \a n_th component of the
** rgb value stored at \a p.
+ **
+ ** \warning This method should not be used directly.
+ ** Prefer operator[].
*/
value_type&
at(const point_type& p)
@@ -186,7 +221,11 @@
return const_cast<SrcType &>(this->ima_)[p][this->n_];
}
- /// Return the \a n_th component of the rgb value stored at \a p.
+ /*! Return the \a n_th component of the rgb value stored at \a p.
+ **
+ ** \warning This method should not be used directly.
+ ** Prefer operator[].
+ */
const value_type
at(const point_type& p) const
{
@@ -207,59 +246,44 @@
return this->exact();
}
- /*! Perform a shallow from \a rhs to the current decorated
- ** image. The points will be shared by the two images.
- */
- self_type&
- assign(DestType& rhs)
- {
- oln_iter_type(SrcType) it(rhs);
-
- for_all(it)
- this->at(it) = rhs[it];
- return this->exact();
- }
-
- /*! This operator= assigns rhs to the current image.
- **
- ** \todo FIXME: This operator= doesn't work if declared in
- ** the generic_morpher.
- */
- self_type&
- operator=(DestType& rhs)
- {
- return this->exact().assign(rhs);
- }
-
static std::string
name()
{
- return "color_morpher<" + SrcType::name() + ">";
+ return "color_morpher<" + SrcType::name() + "," + Exact::name() +
">";
}
};
- /// The specialized version for `const' declared images.
+ /*! \brief The specialized version for `const' declared images.
+ **
+ ** \param SrcType Input type decorated.
+ **
+ ** \param Exact Exact Type.
+ **
+ ** \see oln::morpher::abstract::generic_morpher
+ */
template <class SrcType, class Exact>
struct color_morpher<const SrcType, Exact> :
public super_color_morpher<typename oln::mute<oln_exact_type(SrcType),
ntg_comp_type(oln_value_type(SrcType))>::ret,
SrcType,
- color_morpher<const SrcType, Exact> >
+ typename image_id<color_morpher<const SrcType, Exact> >::exact_type>
{
/// The type of the object instantiated. color_morpher can be derived.
typedef typename image_id<color_morpher<SrcType, Exact> >::exact_type
exact_type;
typedef oln_point_type(SrcType) point_type;
- typedef oln_fwd_iter_type(SrcType) fwd_iter_type;
- typedef oln_size_type(SrcType) size_type;
+ /*! <The type of the class point.*/
+ typedef oln_iter_type(SrcType) iter_type;
+ /*! <The type of the class iterator.*/
typedef ntg_comp_type(oln_value_type(SrcType)) value_type;
- typedef oln_impl_type(SrcType) impl_type;
+ /*! <The value of the decorated image.*/
typedef super_color_morpher<typename oln::mute<oln_exact_type(SrcType),
ntg_comp_type(oln_value_type(SrcType))>::ret,
SrcType,
- color_morpher<const SrcType, Exact> > super_type;
+ typename image_id<color_morpher<const SrcType, Exact> >::exact_type>
super_type;
+ /*! <The upper class.*/
/// Construct the color_morpher with an image \a ima and a component \a n.
color_morpher(const SrcType &ima, unsigned n) : super_type(ima, n)
@@ -277,7 +301,11 @@
color_morpher()
{}
- /// Return the \a n_th component of the rgb value stored at \a p.
+ /*! Return the \a n_th component of the rgb value stored at \a p.
+ **
+ ** \warning This method should not be used directly.
+ ** Prefer operator[].
+ */
const value_type
at(const point_type& p) const
{
@@ -381,4 +409,4 @@
} // end of namespace oln
-#endif // !COLOR_MORPHER_HH
+#endif // !OLENA_MORPHER_COLOR_MORPHER_HH
Index: olena/tests/morpher/tests/compose_morph
--- olena/tests/morpher/tests/compose_morph Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
+++ olena/tests/morpher/tests/compose_morph Sun, 28 Mar 2004 20:57:30 +0200 thivol_d
(oln/m/43_compose_mo 644)
@@ -0,0 +1,30 @@
+// -*- c++ -*-
+#include <oln/morpher/color_morpher.hh>
+#include <oln/morpher/subq_morpher.hh>
+#include <oln/basics2d.hh>
+#include <ntg/all.hh>
+
+#include <oln/utils/md5.hh>
+#include "data.hh"
+#include "check.hh"
+
+int main()
+{
+ bool fail (false);
+ oln::utils::key::value_type data_key_c[16]
+ = {0x18, 0x25, 0x3a, 0xc8, 0x64, 0xbd, 0x38, 0xa8,
+ 0x57, 0x24, 0x7d, 0x0, 0x62, 0xa9, 0xd1, 0x8d};
+
+ oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
+
+ fail = fail |
(oln::utils::md5(oln::morpher::rmorph(oln::morpher::sqmorph<7>(imc))) !=
oln::utils::key(data_key_c));
+
+ if (!fail)
+ std::cout << "OK" << std::endl;
+ else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+}
+
Index: olena/tests/morpher/tests/sq_morph
--- olena/tests/morpher/tests/sq_morph Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
+++ olena/tests/morpher/tests/sq_morph Tue, 30 Mar 2004 19:14:40 +0200 thivol_d
(oln/m/44_sq_morph 644)
@@ -0,0 +1,67 @@
+// -*- c++ -*-
+#include <oln/morpher/subq_morpher.hh>
+#include <oln/basics2d.hh>
+#include <ntg/all.hh>
+
+#include <oln/utils/md5.hh>
+#include "data.hh"
+#include "check.hh"
+
+int main()
+{
+ bool fail (false);
+ oln::utils::key::value_type data_key_c_1[16]
+ = {0xae, 0xb0, 0x65, 0x65, 0xdd, 0x28, 0x5a, 0xc6,
+ 0x8a, 0x17, 0x7e, 0xd, 0xe5, 0xe6, 0x4f, 0x1d};
+
+ oln::utils::key::value_type data_key_c_2[16]
+ = {0x4, 0x58, 0x8b, 0x60, 0x31, 0x5b, 0x33, 0x4e,
+ 0xac, 0xad, 0x85, 0x18, 0x6, 0x25, 0xb6, 0x36};
+
+ oln::utils::key::value_type data_key_c_3[16]
+ = {0xd1, 0xcc, 0xe6, 0x1f, 0xec, 0x26, 0x2b, 0xfd,
+ 0x2b, 0x9c, 0xea, 0x59, 0x35, 0x76, 0x64, 0x8};
+
+ oln::utils::key::value_type data_key_c_4[16]
+ = {0xcf, 0x42, 0xc, 0x2f, 0xcb, 0x8e, 0x2a, 0x36,
+ 0xb9, 0x53, 0xcc, 0x42, 0xfc, 0x54, 0x27, 0x82};
+
+ oln::utils::key::value_type data_key_c_5[16]
+ = {0x90, 0xe5, 0x71, 0x6b, 0x7e, 0x15, 0x51, 0x16,
+ 0x43, 0x43, 0xa6, 0x81, 0x9e, 0x48, 0x88, 0xea};
+
+ oln::utils::key::value_type data_key_c_6[16]
+ = {0xc3, 0x7e, 0x14, 0xc7, 0x5d, 0xfc, 0xa7, 0xd9,
+ 0xc, 0xd7, 0x29, 0xa5, 0x84, 0x41, 0xfd, 0x12};
+
+ oln::utils::key::value_type data_key_c_7[16]
+ = {0x62, 0xa7, 0x2a, 0x3e, 0xe, 0x39, 0xda, 0x93,
+ 0x62, 0x59, 0x15, 0xe6, 0x60, 0x12, 0x8a, 0xc2};
+
+ oln::utils::key::value_type data_key_c_8[16]
+ = {0x47, 0xa5, 0xb6, 0xa2, 0xc8, 0xf1, 0x4d, 0xb8,
+ 0x90, 0x67, 0xaa, 0x19, 0x3d, 0x43, 0xb6, 0xe0};
+
+ oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
+ const oln::image2d<ntg::rgb_8> imc_const =
oln::load(rdata("lena.ppm"));
+
+ fail = fail | (oln::utils::md5(oln::morpher::sqmorph<1>(imc)) !=
oln::utils::key(data_key_c_1));
+ fail = fail | (oln::utils::md5(oln::morpher::sqmorph<2>(imc)) !=
oln::utils::key(data_key_c_2));
+ fail = fail | (oln::utils::md5(oln::morpher::sqmorph<3>(imc)) !=
oln::utils::key(data_key_c_3));
+ fail = fail | (oln::utils::md5(oln::morpher::sqmorph<4>(imc)) !=
oln::utils::key(data_key_c_4));
+ fail = fail | (oln::utils::md5(oln::morpher::sqmorph<5>(imc)) !=
oln::utils::key(data_key_c_5));
+ fail = fail | (oln::utils::md5(oln::morpher::sqmorph<6>(imc)) !=
oln::utils::key(data_key_c_6));
+ fail = fail | (oln::utils::md5(oln::morpher::sqmorph<7>(imc)) !=
oln::utils::key(data_key_c_7));
+ fail = fail | (oln::utils::md5(oln::morpher::sqmorph<8>(imc)) !=
oln::utils::key(data_key_c_8));
+ fail = fail | (oln::utils::md5(oln::morpher::sqmorph<1>(imc_const)) !=
oln::utils::key(data_key_c_1));
+ fail = fail |
(oln::utils::md5(oln::morpher::sqmorph<3>(oln::morpher::sqmorph<5>(imc))) !=
+ oln::utils::md5(oln::morpher::sqmorph<3>(imc)));
+
+ if (!fail)
+ std::cout << "OK" << std::endl;
+ else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+}
Index: olena/tests/morpher/tests/color_morph
--- olena/tests/morpher/tests/color_morph Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
+++ olena/tests/morpher/tests/color_morph Tue, 30 Mar 2004 19:54:21 +0200 thivol_d
(oln/m/45_color_morp 644)
@@ -0,0 +1,50 @@
+// -*- c++ -*-
+#include <oln/morpher/color_morpher.hh>
+#include <oln/basics2d.hh>
+#include <ntg/all.hh>
+
+#include <oln/utils/md5.hh>
+#include "data.hh"
+#include "check.hh"
+
+int main()
+{
+ bool fail (false);
+ oln::utils::key::value_type data_key_c_r[16]
+ = {0xe1, 0x5, 0x51, 0x40, 0xea, 0xa, 0x13, 0x96,
+ 0xc7, 0xa6, 0x62, 0x2c, 0xfa, 0xe4, 0x53, 0x8e};
+
+ oln::utils::key::value_type data_key_c_b[16]
+ = {0x7, 0x8e, 0x3, 0xaa, 0x45, 0xce, 0x38, 0x62,
+ 0xf9, 0x1d, 0xb7, 0x9f, 0x56, 0x1c, 0x52, 0x2d};
+
+ oln::utils::key::value_type data_key_c_g[16]
+ = {0x50, 0x36, 0xf3, 0xb3, 0x56, 0x66, 0x18, 0xbc,
+ 0x7a, 0x12, 0x36, 0x75, 0xc, 0x7f, 0xc6, 0xf4};
+
+
+ oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
+ const oln::image2d<ntg::rgb_8> imc_const =
oln::load(rdata("lena.ppm"));
+ oln::image2d<ntg::rgb_8> imd(imc.size());
+ oln::morpher::color_morpher<oln::image2d<ntg::rgb_8> > mimc(imc, 0);
+ oln::morpher::color_morpher<oln::image2d<ntg::rgb_8> > mimd(imd, 0);
+
+ mimd = mimc;
+
+ fail = fail | (oln::utils::md5(oln::morpher::rmorph(imc)) != oln::utils::md5(mimd));
+ fail = fail | (oln::utils::md5(oln::morpher::rmorph(imc)) !=
oln::utils::key(data_key_c_r));
+ fail = fail | (oln::utils::md5(oln::morpher::gmorph(imc)) !=
oln::utils::key(data_key_c_g));
+ fail = fail | (oln::utils::md5(oln::morpher::bmorph(imc)) !=
oln::utils::key(data_key_c_b));
+ fail = fail | (oln::utils::md5(oln::morpher::rmorph(imc_const)) !=
oln::utils::key(data_key_c_r));
+ fail = fail | (oln::utils::md5(*(oln::morpher::rmorph(imc).unmorph())) !=
oln::utils::key(data_key_c_r));
+
+
+ if (!fail)
+ std::cout << "OK" << std::endl;
+ else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+}
+
Index: olena/tests/morpher/tests/sq_morph_8
--- olena/tests/morpher/tests/sq_morph_8 Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/28_sq_morph_8 1.1 600)
+++ olena/tests/morpher/tests/sq_morph_8 Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,29 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/subq_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0x47, 0xa5, 0xb6, 0xa2, 0xc8, 0xf1, 0x4d, 0xb8,
- 0x90, 0x67, 0xaa, 0x19, 0x3d, 0x43, 0xb6, 0xe0};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::sqmorph<8>(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/sq_morph_7
--- olena/tests/morpher/tests/sq_morph_7 Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/29_sq_morph_7 1.1 600)
+++ olena/tests/morpher/tests/sq_morph_7 Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,29 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/subq_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0x62, 0xa7, 0x2a, 0x3e, 0xe, 0x39, 0xda, 0x93,
- 0x62, 0x59, 0x15, 0xe6, 0x60, 0x12, 0x8a, 0xc2};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::sqmorph<7>(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/sq_morph_6
--- olena/tests/morpher/tests/sq_morph_6 Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/30_sq_morph_6 1.1 600)
+++ olena/tests/morpher/tests/sq_morph_6 Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,29 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/subq_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0xc3, 0x7e, 0x14, 0xc7, 0x5d, 0xfc, 0xa7, 0xd9,
- 0xc, 0xd7, 0x29, 0xa5, 0x84, 0x41, 0xfd, 0x12};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::sqmorph<6>(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/sq_morph_5
--- olena/tests/morpher/tests/sq_morph_5 Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/31_sq_morph_5 1.1 600)
+++ olena/tests/morpher/tests/sq_morph_5 Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,29 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/subq_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0x90, 0xe5, 0x71, 0x6b, 0x7e, 0x15, 0x51, 0x16,
- 0x43, 0x43, 0xa6, 0x81, 0x9e, 0x48, 0x88, 0xea};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::sqmorph<5>(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/sq_morph_4
--- olena/tests/morpher/tests/sq_morph_4 Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/32_sq_morph_4 1.1 600)
+++ olena/tests/morpher/tests/sq_morph_4 Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,29 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/subq_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0xcf, 0x42, 0xc, 0x2f, 0xcb, 0x8e, 0x2a, 0x36,
- 0xb9, 0x53, 0xcc, 0x42, 0xfc, 0x54, 0x27, 0x82};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::sqmorph<4>(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/sq_morph_3
--- olena/tests/morpher/tests/sq_morph_3 Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/33_sq_morph_3 1.1 600)
+++ olena/tests/morpher/tests/sq_morph_3 Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,29 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/subq_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0xd1, 0xcc, 0xe6, 0x1f, 0xec, 0x26, 0x2b, 0xfd,
- 0x2b, 0x9c, 0xea, 0x59, 0x35, 0x76, 0x64, 0x8};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::sqmorph<3>(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/sq_morph_2
--- olena/tests/morpher/tests/sq_morph_2 Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/34_sq_morph_2 1.1 600)
+++ olena/tests/morpher/tests/sq_morph_2 Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,29 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/subq_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0x4, 0x58, 0x8b, 0x60, 0x31, 0x5b, 0x33, 0x4e,
- 0xac, 0xad, 0x85, 0x18, 0x6, 0x25, 0xb6, 0x36};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::sqmorph<2>(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/sq_morph_1
--- olena/tests/morpher/tests/sq_morph_1 Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/35_sq_morph_1 1.1 600)
+++ olena/tests/morpher/tests/sq_morph_1 Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,29 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/subq_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0xae, 0xb0, 0x65, 0x65, 0xdd, 0x28, 0x5a, 0xc6,
- 0x8a, 0x17, 0x7e, 0xd, 0xe5, 0xe6, 0x4f, 0x1d};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::sqmorph<1>(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/rmorph
--- olena/tests/morpher/tests/rmorph Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/36_rmorph 1.1 600)
+++ olena/tests/morpher/tests/rmorph Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,28 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/color_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0xe1, 0x5, 0x51, 0x40, 0xea, 0xa, 0x13, 0x96,
- 0xc7, 0xa6, 0x62, 0x2c, 0xfa, 0xe4, 0x53, 0x8e};
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::rmorph(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/gmorph
--- olena/tests/morpher/tests/gmorph Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/37_gmorph 1.1 600)
+++ olena/tests/morpher/tests/gmorph Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,29 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/color_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0x50, 0x36, 0xf3, 0xb3, 0x56, 0x66, 0x18, 0xbc,
- 0x7a, 0x12, 0x36, 0x75, 0xc, 0x7f, 0xc6, 0xf4};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::gmorph(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/color_sq_morph
--- olena/tests/morpher/tests/color_sq_morph Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/38_color_sq_m 1.1 600)
+++ olena/tests/morpher/tests/color_sq_morph Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,30 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/color_morpher.hh>
-#include <oln/morpher/subq_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0x18, 0x25, 0x3a, 0xc8, 0x64, 0xbd, 0x38, 0xa8,
- 0x57, 0x24, 0x7d, 0x0, 0x62, 0xa9, 0xd1, 0x8d};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail |
(oln::utils::md5(oln::morpher::rmorph(oln::morpher::sqmorph<7>(imc))) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
Index: olena/tests/morpher/tests/bmorph
--- olena/tests/morpher/tests/bmorph Mon, 29 Mar 2004 00:39:14 +0200 thivol_d
(oln/m/39_bmorph 1.1 600)
+++ olena/tests/morpher/tests/bmorph Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
@@ -1,29 +0,0 @@
-// -*- c++ -*-
-#include <oln/morpher/color_morpher.hh>
-#include <oln/basics2d.hh>
-#include <ntg/all.hh>
-
-#include <oln/utils/md5.hh>
-#include "data.hh"
-#include "check.hh"
-
-int main()
-{
- bool fail (false);
- oln::utils::key::value_type data_key_c[16]
- = {0x7, 0x8e, 0x3, 0xaa, 0x45, 0xce, 0x38, 0x62,
- 0xf9, 0x1d, 0xb7, 0x9f, 0x56, 0x1c, 0x52, 0x2d};
-
- oln::image2d<ntg::rgb_8> imc = oln::load(rdata("lena.ppm"));
-
- fail = fail | (oln::utils::md5(oln::morpher::bmorph(imc)) !=
oln::utils::key(data_key_c));
-
- if (!fail)
- std::cout << "OK" << std::endl;
- else
- {
- std::cout << "FAIL" << std::endl;
- return true;
- }
-}
-
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr