Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* oln/convol/fast_gaussian.hh: Add reference.
* oln/convol/fast_gaussian.hxx: Correct algorithm for tiny sigma.
+2004-03-29 Giovanni Palma <giovanni(a)lrde.epita.fr>
+
* tests/convol/tests/md5_convol_fast_gaussian_hh5: Correct test.
* tests/convol/tests/md5_convol_fast_gaussian_hh4: Likewise.
* tests/convol/tests/md5_convol_fast_gaussian_hh3: Likewise.
Index: olena/oln/convol/fast_gaussian.hh
--- olena/oln/convol/fast_gaussian.hh Mon, 29 Mar 2004 15:45:23 +0200 palma_g (oln/26_fast_gauss 1.6.1.6.1.8 640)
+++ olena/oln/convol/fast_gaussian.hh Mon, 29 Mar 2004 16:36:57 +0200 palma_g (oln/26_fast_gauss 1.6.1.6.1.8 640)
@@ -55,7 +55,8 @@
** \brief Gaussian filter.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param C Exact type of the conversion object.
** \param B Base type of the conversion object.
@@ -80,7 +81,8 @@
** \brief Derivative gaussian filter.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param C Exact type of the conversion object.
** \param B Base type of the conversion object.
@@ -106,7 +108,8 @@
** \brief Second derivative gaussian filter.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param C Exact type of the conversion object.
** \param B Base type of the conversion object.
@@ -135,7 +138,8 @@
** \brief Gaussian filter with a default conversion.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param I Exact type of the image.
** \param BE Exact type of the behavior.
@@ -182,7 +186,8 @@
** \brief Derivative gaussian filter with a default conversion.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param I Exact type of the image.
** \param BE Exact type of the behavior.
@@ -228,7 +233,8 @@
** \brief Second derivative gaussian filter with a default conversion.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \param I Exact type of the image.
** \param BE Exact type of the behavior.
@@ -278,7 +284,8 @@
** default behavior.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.\n
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).\n
**
** \warning The content of the border is the mirror of the
** image.
@@ -325,7 +332,8 @@
** and a default behavior.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \warning The content of the border is the mirror of the
** image.
@@ -374,7 +382,8 @@
** conversion and a default behavior.
**
** Gaussian filter implementation from "Recursively implementing
- ** the gaussian and its derivatives" Deriche 93 INRIA REPORT.
+ ** the gaussian and its derivatives" Deriche 93 INRIA REPORT
+ ** (num RR-1893).
**
** \warning The content of the border is the mirror of the
** image.
Index: olena/oln/convol/fast_gaussian.hxx
--- olena/oln/convol/fast_gaussian.hxx Mon, 29 Mar 2004 15:45:23 +0200 palma_g (oln/25_fast_gauss 1.7.1.8.1.10 640)
+++ olena/oln/convol/fast_gaussian.hxx Mon, 29 Mar 2004 16:33:41 +0200 palma_g (oln/25_fast_gauss 1.7.1.8.1.10 640)
@@ -306,6 +306,10 @@
for_all(it)
work_img[it] = ntg::cast::force<ntg::float_s>(in[it]);
+ // On tiny sigma, Derich algorithm doesn't work.
+ // It is the same thing that to convolve with a Dirac.
+ if (sigma > 0.006)
+ {
/* FIXME: relation between sigma and the border shouldn't
be linear, so when sigma is big enougth, the signal may
be parasitized by the non signal values.
@@ -313,7 +317,7 @@
behavior.adapt_border(work_img, ntg::cast::round<coord>(5 * sigma));
gaussian_<I::dim>::doit(work_img, coef);
-
+ }
/* Convert the result image to the user-requested datatype.
FIXME: We are making an unnecessary copy in case the
user expects a ntg::float_s image. */
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
2
2
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* tests/convol/tests/md5_convol_fast_gaussian_hh5: Correct test.
* tests/convol/tests/md5_convol_fast_gaussian_hh4: Likewise.
* tests/convol/tests/md5_convol_fast_gaussian_hh3: Likewise.
* tests/convol/tests/md5_convol_fast_gaussian_hh2: Likewise.
* tests/convol/tests/md5_convol_fast_gaussian_hh1: Likewise.
* tests/convol/tests/md5_convol_fast_gaussian_hh0: Likewise.
* oln/convol/fast_gaussian.hh: Add comments.
* oln/convol/fast_gaussian.hxx: Likewise.
Index: olena/oln/convol/fast_gaussian.hh
--- olena/oln/convol/fast_gaussian.hh Fri, 19 Mar 2004 14:01:37 +0100 palma_g (oln/26_fast_gauss 1.6.1.6.1.7 600)
+++ olena/oln/convol/fast_gaussian.hh Mon, 29 Mar 2004 15:22:05 +0200 palma_g (oln/26_fast_gauss 1.6.1.6.1.7 640)
@@ -67,6 +67,8 @@
** \arg sigma Value of sigma when computing the gaussian.
** \arg behavior Object to know how to work on borders.
**
+ ** \warning If sigma is big enough, the result may differ a
+ ** little bit with the -O3 flag of g++.
*/
template <class C, class B, class I, class BE>
typename mute<I, typename convoutput<C, B, oln_value_type(I)>::ret>::ret
@@ -90,6 +92,9 @@
** \arg sigma Value of sigma when computing the gaussian.
** \arg behavior Object to know how to work on borders.
**
+ ** \warning If sigma is big enough, the result may differ a
+ ** little bit with the -O3 flag of g++.
+ **
*/
template <class C, class B, class I, class BE>
typename mute<I, typename convoutput<C, B, oln_value_type(I)>::ret>::ret
@@ -113,6 +118,9 @@
** \arg sigma Value of sigma when computing the gaussian.
** \arg behavior Object to know how to work on borders.
**
+ ** \warning If sigma is big enough, the result may differ a
+ ** little bit with the -O3 flag of g++.
+ **
*/
template <class C, class B, class I, class BE>
typename mute<I, typename convoutput<C, B, oln_value_type(I)>::ret>::ret
@@ -159,6 +167,9 @@
** =>
** \image html oln_convol_fast_gaussian.png
** \image latex oln_convol_fast_gaussian.png
+ **
+ ** \warning If sigma is big enough, the result may differ a
+ ** little bit with the -O3 flag of g++.
*/
template <class I, class BE> inline
oln_concrete_type(I)
@@ -191,7 +202,7 @@
**
** im_type im1(oln::load(IMG_IN "lena256.pgm"));
**
- ** oln::save(oln::convol::fast::gaussian(im1, 2,
+ ** oln::save(oln::convol::fast::gaussian_derivative(im1, 2,
** oln::value_behavior<oln_value_type_(im_type)>(0)),
** IMG_OUT "oln_convol_fast_gaussian_derivative.pbm");
** return 0;
@@ -204,7 +215,8 @@
** \image html oln_convol_fast_gaussian_derivative.png
** \image latex oln_convol_fast_gaussian_derivative.png
**
- ** \todo FIXME: Make the example use the good function.
+ ** \warning If sigma is big enough, the result may differ a
+ ** little bit with the -O3 flag of g++.
*/
template <class I, class BE> inline
oln_concrete_type(I)
@@ -236,7 +248,7 @@
**
** im_type im1(oln::load(IMG_IN "lena256.pgm"));
**
- ** oln::save(oln::convol::fast::gaussian(im1, 2,
+ ** oln::save(oln::convol::fast::gaussian_second_derivative(im1, 2,
** oln::value_behavior<oln_value_type_(im_type)>(0)),
** IMG_OUT "oln_convol_fast_gaussian_second_derivative.pbm");
** return 0;
@@ -249,7 +261,8 @@
** \image html oln_convol_fast_gaussian_second_derivative.png
** \image latex oln_convol_fast_gaussian_second_derivative.png
**
- ** \todo FIXME: Make the example use the good function.
+ ** \warning If sigma is big enough, the result may differ a
+ ** little bit with the -O3 flag of g++.
*/
template <class I, class BE> inline
oln_concrete_type(I)
@@ -297,6 +310,9 @@
** =>
** \image html oln_convol_fast_gaussian_default.png
** \image latex oln_convol_fast_gaussian_default.png
+ **
+ ** \warning If sigma is big enough, the result may differ a
+ ** little bit with the -O3 flag of g++.
*/
template <class I> inline
oln_concrete_type(I)
@@ -332,7 +348,7 @@
**
** im_type im1(oln::load(IMG_IN "lena256.pgm"));
**
- ** oln::save(oln::convol::fast::gaussian(im1, 2),
+ ** oln::save(oln::convol::fast::gaussian_derivative(im1, 2),
** IMG_OUT "oln_convol_fast_gaussian_derivative_default.pbm");
** return 0;
** }
@@ -344,7 +360,8 @@
** \image html oln_convol_fast_gaussian_derivative_default.png
** \image latex oln_convol_fast_gaussian_derivative_default.png
**
- ** \todo FIXME: Make the example use the good function.
+ ** \warning If sigma is big enough, the result may differ a
+ ** little bit with the -O3 flag of g++.
*/
template <class I> inline
oln_concrete_type(I)
@@ -380,7 +397,7 @@
**
** im_type im1(oln::load(IMG_IN "lena256.pgm"));
**
- ** oln::save(oln::convol::fast::gaussian(im1, 2),
+ ** oln::save(oln::convol::fast::gaussian_second_derivative(im1, 2),
** IMG_OUT "oln_convol_fast_gaussian_second_derivative_default.pbm");
** return 0;
** }
@@ -392,7 +409,8 @@
** \image html oln_convol_fast_gaussian_second_derivative_default.png
** \image latex oln_convol_fast_gaussian_second_derivative_default.png
**
- ** \todo FIXME: Make the example use the good function.
+ ** \warning If sigma is big enough, the result may differ a
+ ** little bit with the -O3 flag of g++.
*/
template <class I> inline
oln_concrete_type(I)
Index: olena/oln/convol/fast_gaussian.hxx
--- olena/oln/convol/fast_gaussian.hxx Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/25_fast_gauss 1.7.1.8.1.9 600)
+++ olena/oln/convol/fast_gaussian.hxx Mon, 29 Mar 2004 15:26:31 +0200 palma_g (oln/25_fast_gauss 1.7.1.8.1.9 640)
@@ -104,7 +104,6 @@
- c.d[1]*tmp1[2] - c.d[2]*tmp1[1]
- c.d[3]*tmp1[0];
-
oln_point_type(I) current(start + d + d + d + d);
for (coord i = 4; i < len; ++i)
{
@@ -170,7 +169,16 @@
struct gaussian_ {};
- // Gaussian filter for 1D images
+ /*! Gaussian filter for 1D images
+ **
+ ** gaussian_ specialization for 1D images.
+ **
+ ** \param I Exact type of the image.
+ ** \param F Type of coefficients.
+ **
+ ** \arg img Image to process.
+ ** \arg coef Coefficients to use.
+ */
template<>
struct gaussian_<1>
{
@@ -189,7 +197,16 @@
};
- // Gaussian filter for 2D images
+ /*! Gaussian filter for 2D images
+ **
+ ** gaussian_ specialization for 2D images.
+ **
+ ** \param I Exact type of the image.
+ ** \param F Type of coefficients.
+ **
+ ** \arg img Image to process.
+ ** \arg coef Coefficients to use.
+ */
template<>
struct gaussian_<2>
{
@@ -215,7 +232,16 @@
}
};
- // Gaussian filter for 3D images
+ /*! Gaussian filter for 3D images
+ **
+ ** gaussian_ specialization for 3D images.
+ **
+ ** \param I Exact type of the image.
+ ** \param F Type of coefficients.
+ **
+ ** \arg img Image to process.
+ ** \arg coef Coefficients to use.
+ */
template<>
struct gaussian_<3>
{
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh5
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh5 Tue, 23 Mar 2004 14:27:20 +0100 palma_g (oln/k/23_md5_convol 1.1 600)
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh5 Mon, 29 Mar 2004 15:33:06 +0200 palma_g (oln/k/23_md5_convol 1.1 644)
@@ -10,17 +10,17 @@
int main()
{
- oln::utils::key::value_type data_key[16] = {0x70, 0x53, 0xa8, 0x84, 0x81,
- 0x4, 0xbc, 0x30, 0x71, 0x23,
- 0x78, 0xba, 0xed, 0x6, 0xc6,
- 0x9e};
+ oln::utils::key::value_type data_key[16] = {0xfc, 0xd6, 0xbc, 0xb5, 0x6c,
+ 0x16, 0x89, 0xfc, 0xef, 0x28,
+ 0xb5, 0x7c, 0x22, 0x47, 0x5b,
+ 0xad};
oln::utils::key key(data_key);
typedef oln::image2d<ntg::int_u8> im_type;
im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2)) == key)
+ if (oln::utils::md5(oln::convol::fast::gaussian_second_derivative(im1, 0.5)) == key)
std::cout << "OK" << std::endl;
else
{
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh4
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh4 Tue, 23 Mar 2004 14:27:20 +0100 palma_g (oln/k/24_md5_convol 1.1 600)
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh4 Mon, 29 Mar 2004 15:32:39 +0200 palma_g (oln/k/24_md5_convol 1.1 644)
@@ -10,14 +10,17 @@
int main()
{
-oln::utils::key::value_type data_key[16] = {0x56, 0x10, 0x9f, 0xa9, 0xec, 0x89, 0x99, 0x14, 0x42, 0x4a, 0xcf, 0x42, 0xa9, 0xa2, 0xe3, 0xf4};
+ oln::utils::key::value_type data_key[16] = {0x4d, 0xbc, 0xd, 0x2, 0x73,
+ 0x93, 0xf4, 0x6, 0xbc, 0x5c,
+ 0x55, 0xac, 0x6, 0xb, 0x67,
+ 0x9};
oln::utils::key key(data_key);
- typedef oln::image2d<ntg::
-int_u8> im_type;
+ typedef oln::image2d<ntg::int_u8> im_type;
im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2)) == key)
+
+ if (oln::utils::md5(oln::convol::fast::gaussian_derivative(im1, 0.5)) == key)
std::cout << "OK" << std::endl;
else
{
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh3
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh3 Tue, 23 Mar 2004 14:27:20 +0100 palma_g (oln/k/25_md5_convol 1.1 600)
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh3 Mon, 29 Mar 2004 15:32:05 +0200 palma_g (oln/k/25_md5_convol 1.1 644)
@@ -10,14 +10,16 @@
int main()
{
-oln::utils::key::value_type data_key[16] = {0x56, 0x10, 0x9f, 0xa9, 0xec, 0x89, 0x99, 0x14, 0x42, 0x4a, 0xcf, 0x42, 0xa9, 0xa2, 0xe3, 0xf4};
-
+ oln::utils::key::value_type data_key[16] = {0xf5, 0x37, 0xe0, 0xad, 0x5f,
+ 0xcc, 0x7f, 0x44, 0x32, 0x53,
+ 0x2a, 0x37, 0x80, 0x38, 0x3f,
+ 0xbb};
oln::utils::key key(data_key);
- typedef oln::image2d<ntg::
-int_u8> im_type;
+ typedef oln::image2d<ntg::int_u8> im_type;
im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2)) == key)
+
+ if (oln::utils::md5(oln::convol::fast::gaussian(im1, 0.5)) == key)
std::cout << "OK" << std::endl;
else
{
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh2
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh2 Tue, 23 Mar 2004 14:27:20 +0100 palma_g (oln/k/26_md5_convol 1.1 600)
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh2 Mon, 29 Mar 2004 15:31:37 +0200 palma_g (oln/k/26_md5_convol 1.1 644)
@@ -10,14 +10,20 @@
int main()
{
-oln::utils::key::value_type data_key[16] = {0xc, 0xec, 0xc0, 0x4c, 0xf4, 0xd1, 0xab, 0xef, 0x1c, 0xd3, 0x9c, 0xa7, 0x4d, 0xd7, 0x28, 0x92};
+ oln::utils::key::value_type data_key[16] = {0xfc, 0xd6, 0xbc, 0xb5, 0x6c,
+ 0x16, 0x89, 0xfc, 0xef, 0x28,
+ 0xb5, 0x7c, 0x22, 0x47, 0x5b,
+ 0xad};
oln::utils::key key(data_key);
- typedef oln::image2d<ntg::
-int_u8> im_type;
+ typedef oln::image2d<ntg::int_u8> im_type;
im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2, oln::value_behavior<oln_value_type_(im_type)>(0))) == key)
+
+ if (oln::utils::md5(oln::convol::fast::gaussian_second_derivative(im1,
+ 0.5,
+ oln::value_behavior<oln_value_type_(im_type)>(0)))
+ == key)
std::cout << "OK" << std::endl;
else
{
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh1
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh1 Tue, 23 Mar 2004 14:27:20 +0100 palma_g (oln/k/27_md5_convol 1.1 600)
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh1 Mon, 29 Mar 2004 15:31:03 +0200 palma_g (oln/k/27_md5_convol 1.1 644)
@@ -10,19 +10,26 @@
int main()
{
-oln::utils::key::value_type data_key[16] = {0xc, 0xec, 0xc0, 0x4c, 0xf4, 0xd1, 0xab, 0xef, 0x1c, 0xd3, 0x9c, 0xa7, 0x4d, 0xd7, 0x28, 0x92};
+ oln::utils::key::value_type data_key[16] = {0x0, 0x8f, 0x63, 0xff, 0xca,
+ 0xae, 0xb5, 0xdb, 0x32, 0xf5,
+ 0x38, 0xfd, 0x13, 0x11, 0x67,
+ 0x9c};
oln::utils::key key(data_key);
- typedef oln::image2d<ntg::
-int_u8> im_type;
+ typedef oln::image2d<ntg::int_u8> im_type;
im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2, oln::value_behavior<oln_value_type_(im_type)>(0))) == key)
+
+ if (oln::utils::md5(oln::convol::fast::gaussian_derivative(im1,
+ 0.5,
+ oln::value_behavior<oln_value_type_(im_type)>(0)))
+ == key)
std::cout << "OK" << std::endl;
else
{
std::cout << "FAIL" << std::endl;
return true;
}
+
return 0;
}
Index: olena/tests/convol/tests/md5_convol_fast_gaussian_hh0
--- olena/tests/convol/tests/md5_convol_fast_gaussian_hh0 Tue, 23 Mar 2004 14:27:20 +0100 palma_g (oln/k/28_md5_convol 1.1 600)
+++ olena/tests/convol/tests/md5_convol_fast_gaussian_hh0 Mon, 29 Mar 2004 15:33:16 +0200 palma_g (oln/k/28_md5_convol 1.1 644)
@@ -10,14 +10,20 @@
int main()
{
-oln::utils::key::value_type data_key[16] = {0xc, 0xec, 0xc0, 0x4c, 0xf4, 0xd1, 0xab, 0xef, 0x1c, 0xd3, 0x9c, 0xa7, 0x4d, 0xd7, 0x28, 0x92};
+ oln::utils::key::value_type data_key[16] = {0xcd, 0x87, 0xa8, 0x95, 0xa3,
+ 0x44, 0x2f, 0x0, 0xc4, 0x39,
+ 0x30, 0x77, 0x67, 0xa8, 0xb7,
+ 0x36};
oln::utils::key key(data_key);
- typedef oln::image2d<ntg::
-int_u8> im_type;
+ typedef oln::image2d<ntg::int_u8> im_type;
im_type im1(oln::load(rdata("lena256.pgm")));
- if (oln::utils::md5(oln::convol::fast::gaussian(im1, 2, oln::value_behavior<oln_value_type_(im_type)>(0))) == key)
+
+ if (oln::utils::md5(oln::convol::fast::gaussian(im1,
+ 0.5,
+ oln::value_behavior<oln_value_type_(im_type)>(0)))
+ == key)
std::cout << "OK" << std::endl;
else
{
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
3
3
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/morpher/slicing_morpher.hh: To have a slice of an image.
Index: olena/oln/morpher/slicing_morpher.hh
--- olena/oln/morpher/slicing_morpher.hh Mon, 29 Mar 2004 09:33:32 +0200 odou_s ()
+++ olena/oln/morpher/slicing_morpher.hh Mon, 29 Mar 2004 09:14:33 +0200 odou_s (oln/m/42_slicing_mo 644)
@@ -0,0 +1,354 @@
+// 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 SLICING_MORPHER_HH
+# define SLICING_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class I, class Exact = mlc::final>
+ struct slicing_morpher;
+
+ } // end of namespace morpher
+
+
+ template <class Image>
+ struct DecDimensionImage
+ {};
+ template <class Type>
+ struct DecDimensionImage< oln::image2d<Type> >
+ {
+ typedef oln::image1d<Type> ret;
+ };
+ template <class Type>
+ struct DecDimensionImage< oln::image3d<Type> >
+ {
+ typedef oln::image2d<Type> ret;
+ };
+
+ /// Inherits identification's informations about the slicing morpher.
+ template <class I, class Exact>
+ struct image_id< morpher::slicing_morpher<I, Exact> >
+ : public image_id<typename DecDimensionImage<I>::ret>
+ {};
+
+ /// Inherits identification's informations about the const slicing morpher.
+ template <class I, class Exact>
+ struct image_id< morpher::slicing_morpher<const I, Exact> >
+ : public image_id<typename DecDimensionImage<I>::ret>
+ {};
+
+ /// Specialized version for slicing morpher.
+ template <class I>
+ struct image_traits< morpher::slicing_morpher<I> > :
+ public image_traits<abstract::image_with_impl<typename DecDimensionImage<I>::ret::impl_type,
+ morpher::slicing_morpher<I> > >
+ {};
+
+ /// Specialized version for slicing morpher.
+ template <class I>
+ struct image_traits< morpher::slicing_morpher<const I> > :
+ public image_traits<abstract::image_with_impl<typename DecDimensionImage<I>::ret::impl_type,
+ morpher::slicing_morpher<const I> > >
+ {};
+
+ namespace morpher {
+
+ /// Return a size of N-1 dimension.
+ oln::image1d_size* image_size_dec(const oln::image2d_size& image_size)
+ {
+ return new oln::image1d_size(image_size.ncols(), image_size.border());
+ }
+
+ /// Return a size of N-1 dimension.
+ oln::image2d_size* image_size_dec(const oln::image3d_size& image_size)
+ {
+ return new oln::image2d_size(image_size.nrows(), image_size.ncols(), image_size.border());
+ }
+
+ /// Abstract piece morpher class used for code factorization.
+ template <class DestType, class SrcType, class Exact>
+ class super_slicing_morpher : public abstract::generic_morpher<DestType, SrcType, Exact>
+ {
+ public:
+
+ typedef oln_size_type(DestType) size_type;
+ typedef oln_impl_type(DestType) impl_type;
+ typedef abstract::generic_morpher<DestType, SrcType, Exact> super_type;
+
+ /// Override the size method.
+ const size_type&
+ size() const
+ {
+ return *size_;
+ }
+
+ /// Override the impl method.
+ const impl_type*
+ impl() const
+ {
+ return impl_;
+ }
+
+ /// Override the impl method.
+ impl_type*
+ impl()
+ {
+ return impl_;
+ }
+
+ ///< Return the last coordinate' value.
+ coord get_slice() const
+ {
+ return slice_;
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "super_slicing_morpher<" + super_type::name() + ">";
+ }
+
+ protected:
+
+ /*!
+ ** \brief Default constructor.
+ ** \arg ima will be the image.
+ ** \arg slice The last coordinate.
+ **
+ ** One can not use this constructor to instantiate this class
+ ** since it is protected.
+ */
+ super_slicing_morpher(const SrcType &ima, const coord slice)
+ : super_type(ima), impl_(0), size_(0), slice_(slice)
+ {
+ size_ = image_size_dec(ima_.size());
+ impl_ = new impl_type(*size_);
+ }
+
+ /// Destructor
+ ~super_slicing_morpher()
+ {
+ delete size_;
+ }
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ super_slicing_morpher() : impl_(0), size_(0), slice_(0)
+ {}
+
+ impl_type *impl_;
+ size_type *size_; ///< The size of the N-1 dimension image.
+ coord slice_; ///< The last coordinate.
+
+ };
+
+ /*!
+ ** \brief The default piece morpher class.
+ **
+ ** Using this class, a piece of picture is a picture.
+ **
+ ** \see oln::morpher::abstract::generic_morpher
+ ** \see oln::morpher::piece_morph
+ */
+ template <class SrcType, class Exact>
+ struct slicing_morpher
+ : public super_slicing_morpher< typename DecDimensionImage<SrcType>::ret, SrcType, slicing_morpher<SrcType, Exact> >
+ {
+ typedef typename image_id< slicing_morpher<SrcType, Exact> >::exact_type exact_type;
+ typedef slicing_morpher<SrcType, Exact> self_type;
+ typedef typename DecDimensionImage<SrcType>::ret DestType;
+ typedef super_slicing_morpher<DestType, SrcType, slicing_morpher<SrcType, Exact> > super_type;
+
+ typedef oln_value_type(DestType) value_type;
+ typedef oln_point_type(DestType) point_type;
+
+ /*!
+ ** \brief Construct a piece morpher.
+ ** \arg ima The image.
+ ** \arg slice The slice value.
+ */
+ slicing_morpher(const SrcType &ima, coord slice)
+ : super_type(ima, slice) {}
+
+ /// Construct a piece morpher from another one.
+ slicing_morpher(const self_type& r)
+ : super_type(r.get_ima(), r.get_slice()) {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ slicing_morpher() {}
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ value_type& at(const point_type &p)
+ {
+ typename SrcType::point_type tmp_p(p, slice_);
+ return const_cast<value_type &>(this->ima_)[tmp_p];
+ }
+
+ const value_type at(const point_type& p) const
+ {
+ typename SrcType::point_type tmp_p(p, slice_);
+ return this->ima_[tmp_p];
+ }
+
+ /*!
+ ** \brief Perform a shallow copy from the decorated image of \a rhs
+ ** to the current decorated image. The points will be shared
+ ** by the two images.
+ */
+ self_type&
+ assign(self_type& rhs)
+ {
+ oln_iter_type(SrcType) it(rhs);
+
+ for_all(it)
+ this->at(it) = rhs[it];
+ return this->exact();
+ }
+
+ /*!
+ ** \brief This operator= assigns rhs to the current image.
+ */
+ self_type&
+ operator=(DestType& rhs)
+ {
+ return this->exact().assign(rhs);
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "slicing_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /// The specialized version for `const' declared images.
+ template <class SrcType, class Exact>
+ struct slicing_morpher<const SrcType, Exact>
+ : public super_slicing_morpher<typename DecDimensionImage<SrcType>::ret, SrcType, slicing_morpher<const SrcType, Exact> >
+ {
+ /// The type of the object instantiated. piece morpher can be derived.
+ typedef typename image_id<slicing_morpher<const SrcType, Exact> >::exact_type exact_type;
+ typedef slicing_morpher<SrcType, Exact> self_type;
+ typedef typename DecDimensionImage<SrcType>::ret DestType;
+ typedef super_slicing_morpher<DestType, SrcType, slicing_morpher<const SrcType, Exact> > super_type;
+
+ typedef oln_value_type(DestType) value_type;
+ typedef oln_point_type(DestType) point_type;
+
+ /*!
+ ** \brief Construct a piece morpher.
+ ** \arg ima The image.
+ ** \arg slice The slice value.
+ */
+ slicing_morpher(const SrcType &ima, coord slice)
+ : super_type(ima, slice)
+ {}
+
+ /// Construct a piece morpher from another one.
+ slicing_morpher(const self_type& r)
+ : super_type(r.get_ima(), r.get_slice())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ slicing_morpher()
+ {}
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ const value_type at(const point_type &p) const
+ {
+ typename SrcType::point_type tmp_p(p, slice_);
+ return this->ima_[tmp_p];
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "slicing_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /*!
+ ** \brief Instantiate a temporary read-only slicing morpher.
+ ** \arg ima The image.
+ ** \arg slice The slice.
+ **
+ ** A slice of the image will be viewed.
+ **
+ ** \code
+ ** #include <oln/morpher/slicing_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** oln::save(oln::morpher::slicing_morph(imc, 5),
+ ** IMG_OUT "oln_morpher_slicing_morpher.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena_ppm.png
+ ** \image latex lena_ppm.png
+ ** =>
+ ** \image html oln_morpher_slicing_morpher.png
+ ** \image latex oln_morpher_slicing_morpher.png
+ */
+ template <class I>
+ const slicing_morpher<I> slicing_morph(I &ima, coord slice)
+ {
+ return slicing_morpher<I>(ima, slice);
+ }
+
+ } // end of morpher namespace
+
+} // end of oln namespace
+
+#endif // !SLICING_MORPHER
--
Simon Odou
simon(a)lrde.epita.fr
3
3
OUPS !!!!
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/morpher/slicing_morpher.hh: Minor fix.
Index: olena/oln/morpher/slicing_morpher.hh
--- olena/oln/morpher/slicing_morpher.hh Mon, 29 Mar 2004 09:33:48 +0200 odou_s (oln/m/42_slicing_mo 1.1 600)
+++ olena/oln/morpher/slicing_morpher.hh Mon, 29 Mar 2004 11:21:41 +0200 odou_s (oln/m/42_slicing_mo 1.1 600)
@@ -85,12 +85,16 @@
/// Return a size of N-1 dimension.
oln::image1d_size* image_size_dec(const oln::image2d_size& image_size)
{
+ // We can't use typedef here because image2d_size and image3d_size don't have
+ // the same number of arguments.
return new oln::image1d_size(image_size.ncols(), image_size.border());
}
/// Return a size of N-1 dimension.
oln::image2d_size* image_size_dec(const oln::image3d_size& image_size)
{
+ // We can't use typedef here because image2d_size and image3d_size don't have
+ // the same number of arguments.
return new oln::image2d_size(image_size.nrows(), image_size.ncols(), image_size.border());
}
@@ -158,6 +162,7 @@
~super_slicing_morpher()
{
delete size_;
+ delete impl_;
}
/*!
--
Simon Odou
simon(a)lrde.epita.fr
3
2
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* olena/oln/core/bkd_iter1d.hh: Fix comments.
* olena/oln/core/bkd_iter2d.hh: Likewise.
* olena/oln/core/bkd_iter3d.hh: Likewise.
* olena/oln/core/fwd_iter1d.hh: Likewise.
* olena/oln/core/fwd_iter2d.hh: Likewise.
* olena/oln/core/fwd_iter3d.hh: Likewise.
* olena/oln/core/abstract/iter1d.hh: Likewise.
* olena/oln/core/abstract/iter2d.hh: Likewise.
* olena/oln/core/abstract/iter3d.hh: Likewise.
* olena/oln/core/abstract/iter.hh: Likewise.
* olena/oln/core/neighborhood1d.hh: Likewise.
* olena/oln/core/neighborhood2d.hh: Likewise.
* olena/oln/core/neighborhood3d.hh: Likewise.
* olena/oln/core/abstract/neighborhood.hh: Likewise.
* olena/oln/core/window1d.hh: Likewise.
* olena/oln/core/window2d.hh: Likewise.
* olena/oln/core/window3d.hh: Likewise.
* olena/oln/core/abstract/window.hh: Likewise.
* olena/oln/core/w_window1d.hh: Likewise.
* olena/oln/core/w_window2d.hh: Likewise.
* olena/oln/core/w_window3d.hh: Likewise.
* olena/oln/core/abstract/w_window.hh: Likewise.
* olena/oln/core/abstract/window_base.hh: Likewise.
* olena/oln/core/abstract/windownd.hh: Likewise.
* olena/oln/core/abstract/w_windownd.hh: Likewise.
* olena/oln/core/abstract/neighborhoodnd.hh: Likewise.
Index: olena/oln/core/bkd_iter1d.hh
--- olena/oln/core/bkd_iter1d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/d/38_bkd_iter1d 1.19 600)
+++ olena/oln/core/bkd_iter1d.hh Mon, 29 Mar 2004 09:42:41 +0200 odou_s (oln/d/38_bkd_iter1d 1.19 600)
@@ -99,7 +99,7 @@
return super_iter_type::operator=(u);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/bkd_iter2d.hh
--- olena/oln/core/bkd_iter2d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/d/37_bkd_iter2d 1.19 600)
+++ olena/oln/core/bkd_iter2d.hh Mon, 29 Mar 2004 09:42:50 +0200 odou_s (oln/d/37_bkd_iter2d 1.19 600)
@@ -98,7 +98,7 @@
return super_iter_type::operator=(u);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/bkd_iter3d.hh
--- olena/oln/core/bkd_iter3d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/d/36_bkd_iter3d 1.19 600)
+++ olena/oln/core/bkd_iter3d.hh Mon, 29 Mar 2004 09:42:54 +0200 odou_s (oln/d/36_bkd_iter3d 1.19 600)
@@ -95,7 +95,7 @@
return super_iter_type::operator=(u);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string name()
{
return std::string("bkd_iter3d<") + Exact::name() + ">";
Index: olena/oln/core/fwd_iter1d.hh
--- olena/oln/core/fwd_iter1d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/d/21_fwd_iter1d 1.16 600)
+++ olena/oln/core/fwd_iter1d.hh Mon, 29 Mar 2004 09:43:10 +0200 odou_s (oln/d/21_fwd_iter1d 1.16 600)
@@ -97,7 +97,7 @@
return super_iter_type::operator=(u);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/fwd_iter2d.hh
--- olena/oln/core/fwd_iter2d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/d/20_fwd_iter2d 1.16 600)
+++ olena/oln/core/fwd_iter2d.hh Mon, 29 Mar 2004 09:43:14 +0200 odou_s (oln/d/20_fwd_iter2d 1.16 600)
@@ -99,7 +99,7 @@
return super_iter_type::operator=(u);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/fwd_iter3d.hh
--- olena/oln/core/fwd_iter3d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/d/19_fwd_iter3d 1.16 600)
+++ olena/oln/core/fwd_iter3d.hh Mon, 29 Mar 2004 09:43:19 +0200 odou_s (oln/d/19_fwd_iter3d 1.16 600)
@@ -96,7 +96,7 @@
return super_iter_type::operator=(u);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/abstract/iter1d.hh
--- olena/oln/core/abstract/iter1d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/d/10_iter1d.hh 1.20 600)
+++ olena/oln/core/abstract/iter1d.hh Mon, 29 Mar 2004 09:38:20 +0200 odou_s (oln/d/10_iter1d.hh 1.20 600)
@@ -88,7 +88,7 @@
return this->p_.col();
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string name()
{
return std::string("_iter1d<") + Exact::name() + ">";
Index: olena/oln/core/abstract/iter2d.hh
--- olena/oln/core/abstract/iter2d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/d/9_iter2d.hh 1.20 600)
+++ olena/oln/core/abstract/iter2d.hh Mon, 29 Mar 2004 09:38:44 +0200 odou_s (oln/d/9_iter2d.hh 1.20 600)
@@ -101,7 +101,7 @@
return this->p_.col();
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string name()
{
return std::string("_iter2d<") + Exact::name() + ">";
Index: olena/oln/core/abstract/iter3d.hh
--- olena/oln/core/abstract/iter3d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/d/8_iter3d.hh 1.20 600)
+++ olena/oln/core/abstract/iter3d.hh Mon, 29 Mar 2004 09:38:42 +0200 odou_s (oln/d/8_iter3d.hh 1.20 600)
@@ -114,7 +114,7 @@
return this->p_.col();
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string name()
{
return std::string("_iter3d<") + Exact::name() + ">";
Index: olena/oln/core/abstract/iter.hh
--- olena/oln/core/abstract/iter.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/40_iter.hh 1.22 600)
+++ olena/oln/core/abstract/iter.hh Mon, 29 Mar 2004 09:41:47 +0200 odou_s (oln/c/40_iter.hh 1.22 600)
@@ -358,7 +358,7 @@
return ! this->operator==(e);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/neighborhood1d.hh
--- olena/oln/core/neighborhood1d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/37_neighborho 1.18 600)
+++ olena/oln/core/neighborhood1d.hh Mon, 29 Mar 2004 09:43:37 +0200 odou_s (oln/c/37_neighborho 1.18 600)
@@ -139,7 +139,7 @@
add(dpoint_type(crd[i]));
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/neighborhood2d.hh
--- olena/oln/core/neighborhood2d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/36_neighborho 1.19 600)
+++ olena/oln/core/neighborhood2d.hh Mon, 29 Mar 2004 09:43:52 +0200 odou_s (oln/c/36_neighborho 1.19 600)
@@ -159,7 +159,7 @@
return r.assign(*this);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/neighborhood3d.hh
--- olena/oln/core/neighborhood3d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/35_neighborho 1.18 600)
+++ olena/oln/core/neighborhood3d.hh Mon, 29 Mar 2004 09:43:57 +0200 odou_s (oln/c/35_neighborho 1.18 600)
@@ -140,7 +140,7 @@
add(dpoint_type(crd[i], crd[i+1], crd[i+2]));
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/abstract/neighborhood.hh
--- olena/oln/core/abstract/neighborhood.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/38_neighborho 1.22 600)
+++ olena/oln/core/abstract/neighborhood.hh Mon, 29 Mar 2004 09:41:46 +0200 odou_s (oln/c/38_neighborho 1.22 600)
@@ -92,7 +92,7 @@
enum { dim = struct_elt_traits<Exact>::dim };
///< Set the dim of the points of the neighborhood.
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/abstract/struct_elt.hh
--- olena/oln/core/abstract/struct_elt.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/25_structelt. 1.23 600)
+++ olena/oln/core/abstract/struct_elt.hh Mon, 29 Mar 2004 09:40:38 +0200 odou_s (oln/c/25_structelt. 1.23 600)
@@ -72,7 +72,7 @@
typedef typename struct_elt_traits<Exact>::abstract_type abstract_type;
///< Set the abstract type of hisself.
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/window1d.hh
--- olena/oln/core/window1d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/15_window1d.h 1.18 600)
+++ olena/oln/core/window1d.hh Mon, 29 Mar 2004 09:44:51 +0200 odou_s (oln/c/15_window1d.h 1.18 600)
@@ -139,7 +139,7 @@
add(dpoint_type(crd[i]));
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/window2d.hh
--- olena/oln/core/window2d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/14_window2d.h 1.20 600)
+++ olena/oln/core/window2d.hh Mon, 29 Mar 2004 09:45:15 +0200 odou_s (oln/c/14_window2d.h 1.20 600)
@@ -160,7 +160,7 @@
return r.assign(*this);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/window3d.hh
--- olena/oln/core/window3d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/13_window3d.h 1.19 600)
+++ olena/oln/core/window3d.hh Mon, 29 Mar 2004 09:45:21 +0200 odou_s (oln/c/13_window3d.h 1.19 600)
@@ -139,7 +139,7 @@
add(dpoint_type(crd[i], crd[i+1], crd[i+2]));
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/abstract/window.hh
--- olena/oln/core/abstract/window.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/16_window.hh 1.20 600)
+++ olena/oln/core/abstract/window.hh Mon, 29 Mar 2004 09:40:55 +0200 odou_s (oln/c/16_window.hh 1.20 600)
@@ -73,7 +73,7 @@
friend class struct_elt<exact_type>;
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/w_window1d.hh
--- olena/oln/core/w_window1d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/19_w_window1d 1.19 600)
+++ olena/oln/core/w_window1d.hh Mon, 29 Mar 2004 09:44:29 +0200 odou_s (oln/c/19_w_window1d 1.19 600)
@@ -163,7 +163,7 @@
return set(dpoint_type(col), weight);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/w_window2d.hh
--- olena/oln/core/w_window2d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/18_w_window2d 1.6.1.14 600)
+++ olena/oln/core/w_window2d.hh Mon, 29 Mar 2004 09:44:36 +0200 odou_s (oln/c/18_w_window2d 1.6.1.14 600)
@@ -182,7 +182,7 @@
return set(dpoint_type(row, col), weight);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/w_window3d.hh
--- olena/oln/core/w_window3d.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/17_w_window3d 1.19 600)
+++ olena/oln/core/w_window3d.hh Mon, 29 Mar 2004 09:44:42 +0200 odou_s (oln/c/17_w_window3d 1.19 600)
@@ -169,7 +169,7 @@
return set(dpoint_type(slice, row, col), weight);
}
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/abstract/w_window.hh
--- olena/oln/core/abstract/w_window.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/c/20_w_window.h 1.17 600)
+++ olena/oln/core/abstract/w_window.hh Mon, 29 Mar 2004 09:41:12 +0200 odou_s (oln/c/20_w_window.h 1.17 600)
@@ -75,7 +75,7 @@
///< Set the type of weight.
friend class struct_elt<exact_type>;
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/abstract/window_base.hh
--- olena/oln/core/abstract/window_base.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/u/3_window_bas 1.12 600)
+++ olena/oln/core/abstract/window_base.hh Mon, 29 Mar 2004 09:41:45 +0200 odou_s (oln/u/3_window_bas 1.12 600)
@@ -134,7 +134,7 @@
friend class neighborhood<Exact>;
// friend class window_base_friend_traits<Sup>::ret;
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/abstract/windownd.hh
--- olena/oln/core/abstract/windownd.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/u/4_windownd.h 1.10 600)
+++ olena/oln/core/abstract/windownd.hh Mon, 29 Mar 2004 09:42:01 +0200 odou_s (oln/u/4_windownd.h 1.10 600)
@@ -72,7 +72,7 @@
friend class window<exact_type>;
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/abstract/w_windownd.hh
--- olena/oln/core/abstract/w_windownd.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/u/5_w_windownd 1.9 600)
+++ olena/oln/core/abstract/w_windownd.hh Mon, 29 Mar 2004 09:42:12 +0200 odou_s (oln/u/5_w_windownd 1.9 600)
@@ -74,7 +74,7 @@
friend class w_window<exact_type>;
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
Index: olena/oln/core/abstract/neighborhoodnd.hh
--- olena/oln/core/abstract/neighborhoodnd.hh Fri, 19 Mar 2004 18:50:43 +0100 odou_s (oln/u/6_neighborho 1.9 600)
+++ olena/oln/core/abstract/neighborhoodnd.hh Mon, 29 Mar 2004 09:42:28 +0200 odou_s (oln/u/6_neighborho 1.9 600)
@@ -76,7 +76,7 @@
friend class neighborhood<exact_type>;
- ///< Return the name of the type.
+ /// Return the name of the type.
static std::string
name()
{
--
Simon Odou
simon(a)lrde.epita.fr
3
2
Le make check se vautre sur 2 tests dans convol/.
Index: ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* configure.ac: Add morphers test suite.
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* olena/oln/morpher/generic_morpher.hh: Correct code and comments.
* olena/oln/morpher/subq_morpher.hh: Add file. Sub quantify morpher implementation.
* olena/oln/morpher/color_morpher.hh: Add file. Color morpher implementation.
* olena/tests/morpher/Makefile.am: Add file. Morphers test suite.
* olena/tests/morpher/tests/sq_morph_8: Add 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: configure.ac
--- configure.ac Mon, 08 Mar 2004 08:12:15 +0100 palma_g (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.15 640)
+++ configure.ac Sun, 28 Mar 2004 21:28:53 +0200 thivol_d (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.15 640)
@@ -141,6 +141,7 @@
OLN_TESTS([topo])
OLN_TESTS([transforms])
OLN_TESTS([utils])
+ OLN_TESTS([morpher])
AC_SUBST([OLN_TESTS_SUBDIRS])
Index: olena/oln/morpher/generic_morpher.hh
--- olena/oln/morpher/generic_morpher.hh Fri, 26 Mar 2004 12:53:24 +0100 thivol_d (oln/m/18_generic_mo 1.2 600)
+++ olena/oln/morpher/generic_morpher.hh Sun, 28 Mar 2004 23:11:19 +0200 thivol_d (oln/m/18_generic_mo 1.2 600)
@@ -38,11 +38,17 @@
namespace oln {
- /// Contain all the morpher relative declarations and functions.
+ /*! \namespace oln::morpher
+ **
+ ** Contain all the morpher relative declarations and functions.
+ */
namespace morpher {
- ///Implementation of oln::abstract::generic_morpher.
+ /*! \namespace oln::morpher::abstract
+ **
+ ** Implementation of oln::abstract::generic_morpher.
+ */
namespace abstract {
@@ -109,21 +115,32 @@
public:
- /// Type of the decorated image.
- typedef SrcType deco_type;
- typedef oln_point_type(SrcType) point_type;
- typedef oln_dpoint_type(SrcType) dpoint_type;
- typedef oln_iter_type(SrcType) iter_type;
- typedef oln_fwd_iter_type(SrcType) fwd_iter_type;
- typedef oln_bkd_iter_type(SrcType) bkd_iter_type;
- typedef oln_value_type(SrcType) value_type;
- typedef oln_size_type(SrcType) size_type;
+ typedef generic_morpher<DestType, SrcType, Exact> self_type;
+ typedef Exact exact_type;
+ typedef oln_point_type(DestType) point_type;
+ typedef oln_dpoint_type(DestType) dpoint_type;
+ typedef oln_iter_type(DestType) iter_type;
+ typedef oln_fwd_iter_type(DestType) fwd_iter_type;
+ typedef oln_bkd_iter_type(DestType) bkd_iter_type;
+ typedef oln_value_type(DestType) value_type;
+ typedef oln_size_type(DestType) size_type;
+ typedef oln_impl_type(DestType) impl_type;
+
+ /// Type of the decorated image.
+ typedef SrcType src_self_type;
+ typedef oln_point_type(SrcType) src_point_type;
+ typedef oln_dpoint_type(SrcType) src_dpoint_type;
+ typedef oln_iter_type(SrcType) src_iter_type;
+ typedef oln_fwd_iter_type(SrcType) src_fwd_iter_type;
+ typedef oln_bkd_iter_type(SrcType) src_bkd_iter_type;
+ typedef oln_value_type(SrcType) src_value_type;
+ typedef oln_size_type(SrcType) src_size_type;
/// Underlying implementation of the decorated image.
- typedef oln_impl_type(SrcType) impl_type;
+ typedef oln_impl_type(SrcType) src_impl_type;
/// Exact type of the decorated image.
- typedef SrcType image_type;
+ typedef oln_exact_type(SrcType) src_exact_type;
typedef typename gm_inherit<DestType, Exact>::ret super_type;
@@ -138,31 +155,31 @@
**
** Return the value stored at \a p in the decorated image.
*/
- const value_type
- at(const point_type& p) const
+ const src_value_type
+ at(const src_point_type& p) const
{
return to_exact(ima_).at(p);
}
- /*! Defaults implementation of at.
+ /*! Default implementation of at.
**
** Return a reference to the value stored at \a p in the decorated image.
*/
- value_type&
- at(const point_type& p)
+ src_value_type&
+ at(const src_point_type& p)
{
return to_exact(ima_).at(p);
}
/// Default implementation of impl.
- const impl_type*
+ const src_impl_type*
impl() const
{
return to_exact(ima_).impl();
}
/// Default implementation of impl.
- impl_type*
+ src_impl_type*
impl()
{
return to_exact(ima_).impl();
@@ -172,7 +189,7 @@
**
** Return a copy of the decorated image.
*/
- image_type
+ src_self_type
clone_() const
{
return to_exact(ima_).clone_();
@@ -192,22 +209,12 @@
**
** Assign \a rhs to the decorated image.
*/
- image_type&
- assign(deco_type& rhs)
+ src_self_type&
+ assign(src_self_type& rhs)
{
return to_exact(ima_).assign(rhs);
}
- /*! Default implementation of operator=.
- **
- ** Assign the decorated image to \a r.
- */
- deco_type&
- operator=(const oln::io::internal::anything& r)
- {
- return r.assign(ima_);
- }
-
/*! Default implementation of border_set_width.
**
** Set the border width of the decorated image to
@@ -220,13 +227,17 @@
return to_exact(ima_).border_set_width(min_border, copy_border);
}
+ self_type& operator=(self_type& rhs)
+ {
+ return to_exact(*this).assign(rhs.exact());
+ }
+
static std::string
name()
{
return "generic_morpher<" + super_type::name() + ">";
}
-
};
} // end of namespace abstract
Index: olena/oln/morpher/subq_morpher.hh
--- olena/oln/morpher/subq_morpher.hh Mon, 29 Mar 2004 00:36:08 +0200 thivol_d ()
+++ olena/oln/morpher/subq_morpher.hh Sun, 28 Mar 2004 23:58:11 +0200 thivol_d (oln/m/25_subq_morph 644)
@@ -0,0 +1,214 @@
+// 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 SUBQ_MORPHER_HH
+# define SUBQ_MORPHER_HH
+
+# include "generic_morpher.hh"
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class SrcType, unsigned N, class Exact = mlc::final>
+ struct subq_morpher;
+ } // end of namespace morpher
+
+ /// Retrieve types and dimension of the subq_morpher.
+ template <class SrcType, unsigned N, class Exact>
+ struct image_id<oln::morpher::subq_morpher<SrcType, N, Exact> >
+ {
+ enum {dim = SrcType::dim};
+ typedef oln_impl_type(SrcType) impl_type;
+ typedef typename ntg::color<3, N, ntg::rgb_traits> value_type;
+ typedef typename mlc::exact_vt<oln::morpher::subq_morpher<SrcType, N, Exact>,
+ Exact>::ret exact_type;
+ };
+
+ /// Specialized version for subq_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),
+ oln::morpher::subq_morpher<SrcType, N, Exact> > >
+ {
+ };
+
+ namespace morpher {
+
+
+ /*! Change the color depth of \a T.
+ **
+ ** For Example, calling color_mute with
+ ** color<3, 8, rgb_traits>, 5 will give
+ ** the type : color<3, 5, rgb_traits>.
+ */
+
+ template <class T, unsigned N>
+ struct color_mute
+ {
+ };
+
+ /// Specialized version for ntg::color.
+ template <unsigned nbcomps_,
+ unsigned nbits_,
+ template <unsigned> class color_system,
+ unsigned N>
+ struct color_mute<ntg::color<nbcomps_, nbits_, color_system>, N>
+ {
+ typedef ntg::color<nbcomps_, N, color_system> ret;
+ enum { nbcomps = nbcomps_ };
+ enum { nbits = nbits_ };
+ };
+
+
+
+ /*! \brief Sub quantify an image.
+ **
+ ** By using this class, an image can be viewed
+ ** as an image with a lower color depth.
+ ** subq_morpher<image2d<rgb_8>, 5> is
+ ** the same as image2d<rgb_5>.
+ */
+ template <class SrcType, unsigned N, class Exact>
+ struct subq_morpher:
+ public 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
+ 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;
+
+ /// 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;
+
+ /// The type of the resulting image.
+ typedef typename oln::mute<SrcType,
+ typename color_mute<oln_value_type(SrcType),
+ N>::ret>::ret DestType;
+
+ typedef subq_morpher<SrcType, N, Exact> self_type;
+
+ /// 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) {}
+
+ /// Construct the morpher with another morpher.
+ subq_morpher(const subq_morpher<SrcType, N>& r)
+ : super_type(r.get_ima()) {}
+
+ /*! Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ subq_morpher() {}
+
+ /// Return the value stored at \a p in the resulting image.
+ const value_type at(const point_type& p) const
+ {
+ value_type tmp;
+ unsigned int i;
+
+ for (i = 0; i < nbcomps; i++)
+ {
+ tmp[i] = this->ima_[p][i] / ((ntg_max_val(ntg_comp_type(oln_value_type(SrcType))) + 1)
+ / (ntg_max_val(ntg_comp_type(value_type)) + 1));
+ }
+ return tmp;
+ }
+
+ /// Return the implementation.
+ const impl_type*
+ impl() const
+ {
+ return ima_.impl();
+ }
+
+ static std::string name()
+ {
+ return "subq_morpher<" + SrcType::name() + ">";
+ }
+
+ };
+
+ /*! \brief Instantiate a temporary read-only subq_morpher.
+ **
+ ** \param S Indicate the color depth of the resulting image.
+ ** It can't be higher than the color depth of \a ima.
+ **
+ ** \code
+ ** #include <oln/morpher/subq_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** oln::save(oln::morpher::sqmorph<3>(imc),
+ ** IMG_OUT "oln_morpher_subq_morpher.ppm");
+ ** }
+ ** \endcode
+ ** \image html lena_ppm.png
+ ** \image latex lena_ppm.png
+ ** =>
+ ** \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)
+ {
+ return subq_morpher<I, S>(ima);
+ }
+
+ } // end of namespace morpher
+
+} // end of namespace morpher
+
+
+
+
+#endif // !SUBQ_MORPHER_HH
+
Index: olena/oln/morpher/color_morpher.hh
--- olena/oln/morpher/color_morpher.hh Mon, 29 Mar 2004 00:36:08 +0200 thivol_d ()
+++ olena/oln/morpher/color_morpher.hh Sun, 28 Mar 2004 23:58:37 +0200 thivol_d (oln/m/26_color_morp 644)
@@ -0,0 +1,384 @@
+// 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 COLOR_MORPHER_HH
+# define COLOR_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class I, class Exact = mlc::final>
+ class color_morpher;
+
+ } // end of namespace morpher
+
+
+ /// Retrieve types and dimension of the color_morpher.
+ template <class I, class Exact>
+ struct image_id<morpher::color_morpher<I, Exact> >
+ {
+ enum {dim = I::dim};
+ typedef oln_impl_type(I) impl_type;
+ typedef ntg_comp_type(oln_value_type(I)) value_type;
+ typedef typename mlc::exact_vt<morpher::color_morpher<I, Exact>,
+ Exact>::ret exact_type;
+ };
+
+ /// Specialized version for color_morpher.
+ template <class I>
+ struct image_traits <morpher::color_morpher<I> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(I),
+ morpher::color_morpher<I> > >
+ {
+ };
+
+ namespace morpher {
+
+ /// Abstract color_morpher class used for code factorization.
+ template <class DestType, class SrcType, class Exact>
+ class super_color_morpher : public abstract::generic_morpher<DestType, SrcType, Exact>
+ {
+ protected:
+
+ /*! The component to return.
+ **
+ ** If \a n is equal to 0, the red component is returned.
+ ** If \a n is equal to 1, the green component is returned.
+ ** If \a n is equal to 2, the blue component is returned.
+ */
+ unsigned n_;
+
+ /*! Default constructor.
+ **
+ ** \a ima will be the decorated image.
+ ** One can not use this constructor to instantiate this class
+ ** since it is protected.
+ */
+ super_color_morpher(const SrcType &ima, unsigned n) : super_type(ima)
+ {
+ assert(n == ntg::rgb_R || n == ntg::rgb_G || n == ntg::rgb_B);
+ n_ = n;
+ }
+
+ /*! Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ super_color_morpher()
+ {}
+
+ public:
+ typedef abstract::generic_morpher<DestType, SrcType, Exact> super_type;
+ typedef oln_impl_type(SrcType) impl_type;
+
+ /// Return the number of the image component to retrieve.
+ unsigned
+ get_comp() const
+ {
+ return n_;
+ }
+
+ /// Return the image implementation.
+ impl_type*
+ impl()
+ {
+ return ima_.impl();
+ }
+
+ /// Return the image implementation.
+ const impl_type*
+ impl() const
+ {
+ return ima_.impl();
+ }
+
+ static std::string
+ name()
+ {
+ return "super_color_morpher<" + super_type::name() + ">";
+ }
+
+
+ };
+
+ /*! The default color_morpher class.
+ **
+ ** Using this class, an rgb image can be viewed
+ ** according to one of its component.
+ **
+ ** \see oln::morpher::abstract::generic_morpher
+ */
+ template <class SrcType, class Exact>
+ struct color_morpher :
+ public super_color_morpher<typename oln::mute<oln_exact_type(SrcType),
+ ntg_comp_type(oln_value_type(SrcType))>::ret,
+ SrcType,
+ color_morpher<SrcType, Exact> >
+ {
+ /// The type of the object instantiated. color_morpher can be derived.
+ typedef typename image_id<color_morpher<SrcType, Exact> >::exact_type exact_type;
+
+ /// The image will be viewed as a Destype image.
+ typedef typename oln::mute<oln_exact_type(SrcType),
+ ntg_comp_type(oln_value_type(SrcType))>::ret DestType;
+
+ typedef color_morpher<SrcType, Exact> self_type;
+ typedef oln_iter_type(SrcType) iter_type;
+ typedef oln_point_type(SrcType) point_type;
+ typedef oln_fwd_iter_type(SrcType) fwd_iter_type;
+ typedef oln_size_type(SrcType) size_type;
+ typedef ntg_comp_type(oln_value_type(SrcType)) value_type;
+ typedef oln_impl_type(SrcType) impl_type;
+ 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;
+
+ /// 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)
+ {}
+
+ /// Construct the color_morpher with another color_morpher.
+ color_morpher(const color_morpher<SrcType, Exact>& r) : super_type(r.get_ima(), r.get_comp())
+ {}
+
+ /*! Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ color_morpher()
+ {}
+
+ /*! Return a reference to the \a n_th component of the
+ ** rgb value stored at \a p.
+ */
+ value_type&
+ at(const point_type& p)
+ {
+ return const_cast<SrcType &>(this->ima_)[p][this->n_];
+ }
+
+ /// Return the \a n_th component of the rgb value stored at \a p.
+ const value_type
+ at(const point_type& p) const
+ {
+ return this->ima_[p][this->n_];
+ }
+
+ /*! Perform a shallow copy from the decorated image of \a rhs
+ ** to the current decorated image. The points will be shared
+ ** by the two images.
+ */
+ self_type&
+ assign(self_type& rhs)
+ {
+ oln_iter_type(SrcType) it(rhs);
+
+ for_all(it)
+ this->at(it) = rhs[it];
+ return this->exact();
+ }
+
+ /*! 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() + ">";
+ }
+
+ };
+
+ /// The specialized version for `const' declared images.
+ 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> >
+ {
+ /// 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;
+ typedef ntg_comp_type(oln_value_type(SrcType)) value_type;
+ typedef oln_impl_type(SrcType) impl_type;
+
+ 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;
+
+ /// 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)
+ {}
+
+ /// Construct the color_morpher with another color_morpher.
+ color_morpher(const color_morpher<const SrcType, Exact>& r) :
+ super_type(r.get_ima(), r.get_comp())
+ {}
+
+ /*! Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ color_morpher()
+ {}
+
+ /// Return the \a n_th component of the rgb value stored at \a p.
+ const value_type
+ at(const point_type& p) const
+ {
+ return this->ima_[p][this->n_];
+ }
+
+ static std::string
+ name()
+ {
+ return "color_morpher<" + SrcType::name() + ">";
+ }
+
+ };
+
+
+ /*! \brief Instantiate a temporary read-only
+ ** color_morpher.
+ **
+ ** The image will be viewed according to its red layer.
+ **
+ ** \code
+ ** #include <oln/morpher/color_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** oln::save(oln::morpher::rmorph(imc),
+ ** IMG_OUT "oln_morpher_red_morpher.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena_ppm.png
+ ** \image latex lena_ppm.png
+ ** =>
+ ** \image html oln_morpher_red_morpher.png
+ ** \image latex oln_morpher_red_morpher.png
+ */
+ template <class I>
+ const color_morpher<I> rmorph(I &ima)
+ {
+ return color_morpher<I>(ima, ntg::rgb_R);
+ }
+
+ /*! \brief Instantiate a temporary read-only
+ ** color_morpher.
+ **
+ ** The image will be viewed according to its green layer.
+ **
+ ** \code
+ ** #include <oln/morpher/color_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** oln::save(oln::morpher::gmorph(imc),
+ ** IMG_OUT "oln_morpher_green_morpher.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena_ppm.png
+ ** \image latex lena_ppm.png
+ ** =>
+ ** \image html oln_morpher_green_morpher.png
+ ** \image latex oln_morpher_green_morpher.png
+ */
+ template <class I>
+ const color_morpher<I> gmorph(I &ima)
+ {
+ return color_morpher<I>(ima, ntg::rgb_G);
+ }
+
+ /*! \brief Instantiate a temporary read-only
+ ** color_morpher.
+ **
+ ** The image will be viewed according to its blue layer.
+ **
+ ** \code
+ ** #include <oln/morpher/color_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** oln::save(oln::morpher::bmorph(imc),
+ ** IMG_OUT "oln_morpher_blue_morpher.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena_ppm.png
+ ** \image latex lena_ppm.png
+ ** =>
+ ** \image html oln_morpher_blue_morpher.png
+ ** \image latex oln_morpher_blue_morpher.png
+ */
+ template <class I>
+ const color_morpher<I> bmorph(I &ima)
+ {
+ return color_morpher<I>(ima, ntg::rgb_B);
+ }
+
+ } // end of namespace morpher
+
+} // end of namespace oln
+
+#endif // !COLOR_MORPHER_HH
Index: olena/tests/morpher/Makefile.am
--- olena/tests/morpher/Makefile.am Mon, 29 Mar 2004 00:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/Makefile.am Sun, 28 Mar 2004 19:31:40 +0200 thivol_d (oln/m/27_Makefile.a 644)
@@ -0,0 +1 @@
+include ../check/Makefile.runtests
Index: olena/tests/morpher/tests/sq_morph_8
--- olena/tests/morpher/tests/sq_morph_8 Mon, 29 Mar 2004 00:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/sq_morph_8 Sun, 28 Mar 2004 20:15:14 +0200 thivol_d (oln/m/28_sq_morph_8 644)
@@ -0,0 +1,29 @@
+// -*- 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:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/sq_morph_7 Sun, 28 Mar 2004 20:20:08 +0200 thivol_d (oln/m/29_sq_morph_7 644)
@@ -0,0 +1,29 @@
+// -*- 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:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/sq_morph_6 Sun, 28 Mar 2004 20:21:51 +0200 thivol_d (oln/m/30_sq_morph_6 644)
@@ -0,0 +1,29 @@
+// -*- 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:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/sq_morph_5 Sun, 28 Mar 2004 20:23:01 +0200 thivol_d (oln/m/31_sq_morph_5 644)
@@ -0,0 +1,29 @@
+// -*- 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:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/sq_morph_4 Sun, 28 Mar 2004 20:24:05 +0200 thivol_d (oln/m/32_sq_morph_4 644)
@@ -0,0 +1,29 @@
+// -*- 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:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/sq_morph_3 Sun, 28 Mar 2004 20:46:05 +0200 thivol_d (oln/m/33_sq_morph_3 644)
@@ -0,0 +1,29 @@
+// -*- 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:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/sq_morph_2 Sun, 28 Mar 2004 20:47:22 +0200 thivol_d (oln/m/34_sq_morph_2 644)
@@ -0,0 +1,29 @@
+// -*- 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:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/sq_morph_1 Sun, 28 Mar 2004 20:49:46 +0200 thivol_d (oln/m/35_sq_morph_1 644)
@@ -0,0 +1,29 @@
+// -*- 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:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/rmorph Sun, 28 Mar 2004 19:57:25 +0200 thivol_d (oln/m/36_rmorph 644)
@@ -0,0 +1,28 @@
+// -*- 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:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/gmorph Sun, 28 Mar 2004 19:59:36 +0200 thivol_d (oln/m/37_gmorph 644)
@@ -0,0 +1,29 @@
+// -*- 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:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/color_sq_morph Sun, 28 Mar 2004 20:57:30 +0200 thivol_d (oln/m/38_color_sq_m 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/bmorph
--- olena/tests/morpher/tests/bmorph Mon, 29 Mar 2004 00:36:08 +0200 thivol_d ()
+++ olena/tests/morpher/tests/bmorph Sun, 28 Mar 2004 20:02:06 +0200 thivol_d (oln/m/39_bmorph 644)
@@ -0,0 +1,29 @@
+// -*- 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
3
2
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/morpher/iter_morpher.hh: To have a specific default iterator.
Index: olena/oln/morpher/iter_morpher.hh
--- olena/oln/morpher/iter_morpher.hh Mon, 29 Mar 2004 09:31:08 +0200 odou_s ()
+++ olena/oln/morpher/iter_morpher.hh Mon, 29 Mar 2004 06:15:32 +0200 odou_s (oln/m/41_iter_morph 644)
@@ -0,0 +1,196 @@
+// Copyright (C) 2004 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef ITER_MORPHER_HH
+# define ITER_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class SrcType, class IterType, class Exact = mlc::final>
+ struct iter_morpher;
+
+ } // end of namespace morpher
+
+ /// Inherits identification's informations about the iter morpher.
+ template <class SrcType, class IterType, class Exact>
+ struct image_id< morpher::iter_morpher<SrcType, IterType, Exact> > : public image_id<SrcType>
+ {};
+
+ /// Inherits identification's informations about the const iter morpher.
+ template <class SrcType, class IterType, class Exact>
+ struct image_id< morpher::iter_morpher<const SrcType, IterType, Exact> > : public image_id<SrcType>
+ {};
+
+ /// Traits for iter morpher.
+ template <class SrcType, class IterType>
+ struct image_traits < morpher::iter_morpher<SrcType, IterType> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(SrcType),
+ morpher::iter_morpher<SrcType, IterType> > >
+ {
+ typedef IterType iter_type;
+ };
+
+ /// Traits for const iter morpher.
+ template <class SrcType, class IterType>
+ struct image_traits < morpher::iter_morpher<const SrcType, IterType> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(SrcType),
+ morpher::iter_morpher<const SrcType, IterType> > >
+ {
+ typedef IterType iter_type;
+ };
+
+ namespace morpher {
+
+ template <class SrcType, class IterType, class Exact>
+ struct iter_morpher
+ : public abstract::generic_morpher< SrcType, SrcType, iter_morpher<SrcType, IterType, Exact> >
+ {
+ /// The type of the object instantiated. iter morpher can be derived.
+ typedef typename image_id< iter_morpher<SrcType, IterType, Exact> >::exact_type exact_type;
+ typedef iter_morpher<SrcType, IterType, Exact> self_type;
+ typedef IterType iter_type;
+ typedef abstract::generic_morpher< SrcType, SrcType, iter_morpher<SrcType, IterType, Exact> > super_type;
+
+ /// Construct the iter morpher with an image \a ima.
+ iter_morpher(const SrcType &ima)
+ : super_type(ima)
+ {}
+
+ /// Construct the iter morpher with another iter morpher.
+ iter_morpher(const self_type& r)
+ : super_type(r.get_ima())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ iter_morpher() {}
+
+ /*! Perform a shallow copy from the decorated image of \a rhs
+ ** to the current decorated image. The points will be shared
+ ** by the two images.
+ */
+ self_type&
+ assign(self_type& rhs)
+ {
+ oln_iter_type(SrcType) it(rhs);
+
+ for_all(it)
+ this->at(it) = rhs[it];
+ return this->exact();
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "iter_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /// The specialized version for `const' declared images.
+ template <class SrcType, class IterType, class Exact>
+ struct iter_morpher<const SrcType, IterType, Exact>
+ : public abstract::generic_morpher< SrcType, SrcType, iter_morpher<const SrcType, IterType, Exact> >
+ {
+ /// The type of the object instantiated. iter morpher can be derived.
+ typedef typename image_id< iter_morpher<SrcType, IterType, Exact> >::exact_type exact_type;
+ typedef iter_morpher<const SrcType, IterType, Exact> self_type;
+ typedef IterType iter_type;
+ typedef abstract::generic_morpher<SrcType, SrcType, iter_morpher<const SrcType, IterType, Exact> > super_type;
+
+ /// Construct the iter morpher with an image \a ima.
+ iter_morpher(const SrcType &ima)
+ : super_type(ima)
+ {}
+
+ /// Construct the iter morpher with another iter morpher.
+ iter_morpher(const iter_morpher<const SrcType, IterType>& r)
+ : super_type(r.get_ima()) {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ iter_morpher()
+ {}
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "iter_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /*!
+ ** \brief Instantiate a temporary read-only iter morpher.
+ **
+ ** The image will be viewed according to its iterator type.
+ ** For example, the foo function will print the size of the picture
+ ** (the bkd_iter_type is used transparently).
+ **
+ ** \code
+ ** #include <oln/morpher/iter_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** template <class E>
+ ** void foo(const oln::abstract::image<E>& img)
+ ** {
+ ** oln_iter_type(oln::abstract::image<E>) it(img);
+ ** for_all(it)
+ ** {
+ ** std::cout << it.row() << " " << it.col() << std::endl;
+ ** break;
+ ** }
+ ** }
+ ** int main()
+ ** {
+ ** const oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** assert(imc.has_impl());
+ ** foo(oln::morpher::iter_morph<oln_bkd_iter_type_(oln::image2d<ntg::rgb_8>)>(imc));
+ ** }
+ ** \endcode
+ */
+ template <class IterType, class I>
+ const iter_morpher<I, IterType> iter_morph(I &ima)
+ {
+ return iter_morpher<I, IterType>(ima);
+ }
+
+ } // End of namespace morpher.
+
+} // End of namespace oln.
+
+#endif // !ITER_MORPHER
--
Simon Odou
simon(a)lrde.epita.fr
2
1
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/morpher/piece_morpher.hh: To use a piece of image like a real one.
* oln/core/abstract/image_with_impl.hh:
* oln/core/point2d.hh: Able to construct a point2d from a point1d.
* oln/core/point2d.hxx: Likewise.
* oln/core/point3d.hh: Able to construct a point3d from a point2d.
* oln/core/point3d.hxx: Likewise.
* oln/core/abstract/image_with_dim.hh: Fix a bug.
* oln/core/abstract/image_with_impl.hh: Fix (same).
Index: olena/oln/core/point2d.hh
--- olena/oln/core/point2d.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/c/30_point2d.hh 1.13 600)
+++ olena/oln/core/point2d.hh Mon, 29 Mar 2004 05:38:52 +0200 odou_s (oln/c/30_point2d.hh 1.13 600)
@@ -75,6 +75,10 @@
point2d(coord row, coord col);
+ /// The coordinates of the point2d are set to \a p and \a col.
+
+ point2d(const point1d& p, coord col);
+
/// Return Give the value of the point2d row coordinate.
coord
Index: olena/oln/core/point2d.hxx
--- olena/oln/core/point2d.hxx Mon, 19 Jan 2004 18:35:23 +0100 astrid (oln/c/29_point2d.hx 1.6 640)
+++ olena/oln/core/point2d.hxx Mon, 29 Mar 2004 05:39:17 +0200 odou_s (oln/c/29_point2d.hx 1.6 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -48,6 +48,13 @@
nth(1) = col;
}
+ inline
+ point2d::point2d(const point1d& p, coord row)
+ {
+ nth(0) = row;
+ nth(1) = p.col();
+ }
+
inline coord
point2d::row() const
{
Index: olena/oln/core/point3d.hh
--- olena/oln/core/point3d.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/c/28_point3d.hh 1.15 600)
+++ olena/oln/core/point3d.hh Mon, 29 Mar 2004 05:40:21 +0200 odou_s (oln/c/28_point3d.hh 1.15 600)
@@ -80,6 +80,10 @@
point3d(coord slice, coord row, coord col);
+ /// The coordinates of the point3d are set to \a p, and \a slice.
+
+ point3d(const point2d& p, coord slice);
+
/// Return the value of the point3d slice coordinate.
coord
Index: olena/oln/core/point3d.hxx
--- olena/oln/core/point3d.hxx Mon, 28 Jul 2003 14:14:03 +0200 david (oln/c/27_point3d.hx 1.5 640)
+++ olena/oln/core/point3d.hxx Mon, 29 Mar 2004 05:39:24 +0200 odou_s (oln/c/27_point3d.hx 1.5 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -51,6 +51,14 @@
nth(2) = col;
}
+ inline
+ point3d::point3d(const point2d& p, coord slice)
+ {
+ nth(0) = slice;
+ nth(1) = p.row();
+ nth(2) = p.col();
+ }
+
inline coord
point3d::slice() const
{
Index: olena/oln/core/abstract/image_with_dim.hh
--- olena/oln/core/abstract/image_with_dim.hh Sun, 14 Mar 2004 19:03:34 +0100 van-vl_n (oln/t/26_image_with 1.21 600)
+++ olena/oln/core/abstract/image_with_dim.hh Mon, 29 Mar 2004 00:47:04 +0200 odou_s (oln/t/26_image_with 1.21 600)
@@ -325,7 +325,7 @@
coord
nrows() const
{
- return this->size().nrows();
+ return this->exact().size().nrows();
}
@@ -334,7 +334,7 @@
coord
ncols() const
{
- return this->size().ncols();
+ return this->exact().size().ncols();
}
/*! \brief Return the value stored at \a row, \a col
Index: olena/oln/core/abstract/image_with_impl.hh
--- olena/oln/core/abstract/image_with_impl.hh Fri, 26 Mar 2004 12:53:24 +0100 thivol_d (oln/t/27_image_with 1.14.1.10 640)
+++ olena/oln/core/abstract/image_with_impl.hh Mon, 29 Mar 2004 00:51:00 +0200 odou_s (oln/t/27_image_with 1.14.1.10 640)
@@ -145,6 +145,17 @@
return impl_;
}
+ /*!
+ ** \brief Get the size of the image.
+ ** \return The size.
+ */
+ const size_type&
+ size() const
+ {
+ assertion(has_impl());
+ return this->exact().impl()->size();
+ }
+
/// Return the core data of the image.
impl_type*
Index: olena/oln/morpher/piece_morpher.hh
--- olena/oln/morpher/piece_morpher.hh Mon, 29 Mar 2004 09:25:14 +0200 odou_s ()
+++ olena/oln/morpher/piece_morpher.hh Mon, 29 Mar 2004 09:15:56 +0200 odou_s (oln/m/40_piece_morp 644)
@@ -0,0 +1,314 @@
+// Copyright (C) 2004 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef PIECE_MORPHER_HH
+# define PIECE_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class I, class Exact = mlc::final>
+ struct piece_morpher;
+
+ } // end of namespace morpher
+
+ /// Inherits identification's informations about the piece morpher.
+ template <class I, class Exact>
+ struct image_id< morpher::piece_morpher<I, Exact> > : public image_id<I>
+ {};
+
+ /// Inherits identification's informations about the const piece morpher.
+ template <class I, class Exact>
+ struct image_id< morpher::piece_morpher<const I, Exact> > : public image_id<I>
+ {};
+
+ /// Traits for piece morpher.
+ template <class I>
+ struct image_traits < morpher::piece_morpher<I> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(I),
+ morpher::piece_morpher<I> > >
+ {};
+
+ /// Traits for const piece morpher.
+ template <class I>
+ struct image_traits < morpher::piece_morpher<const I> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(I),
+ morpher::piece_morpher<const I> > >
+ {};
+
+
+ namespace morpher {
+
+ /// Abstract piece morpher class used for code factorization.
+ template <class SrcType, class Exact>
+ class super_piece_morpher : public abstract::generic_morpher<SrcType, SrcType, Exact>
+ {
+ public:
+
+ typedef abstract::generic_morpher<SrcType, SrcType, Exact> super_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+
+ protected:
+
+ /*!
+ ** \brief Default constructor.
+ ** \arg ima will be the image.
+ ** \arg p The reference point.
+ ** \arg s The size of the piece of image.
+ **
+ ** One can not use this constructor to instantiate this class
+ ** since it is protected.
+ */
+ super_piece_morpher(const SrcType &ima, const dpoint_type& p,
+ const size_type& s)
+ : super_type(ima), size_(s), p_(p)
+ {}
+
+ const size_type size_; ///< The size of the piece of picture.
+ const dpoint_type p_; ///< The reference point of the piece of picture.
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ super_piece_morpher() : size_(size_) {}
+
+ public:
+
+ /// Return the size (different from the original picture).
+ const size_type size() const
+ {
+ return size_;
+ }
+
+ /// Return the reference point.
+ const dpoint_type ref_point() const
+ {
+ return p_;
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "super_piece_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /*!
+ ** \brief The default piece morpher class.
+ **
+ ** Using this class, a piece of picture is a picture.
+ **
+ ** \see oln::morpher::abstract::generic_morpher
+ ** \see oln::morpher::piece_morph
+ */
+ template <class SrcType, class Exact>
+ struct piece_morpher
+ : public super_piece_morpher<SrcType, piece_morpher<SrcType, Exact> >
+ {
+ /// The type of the object instantiated. piece morpher can be derived.
+ typedef typename image_id<piece_morpher<SrcType, Exact> >::exact_type exact_type;
+ typedef piece_morpher<SrcType, Exact> self_type;
+ typedef super_piece_morpher<SrcType, piece_morpher<SrcType, Exact> > super_type;
+
+ typedef oln_point_type(SrcType) point_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+ typedef oln_value_type(SrcType) value_type;
+
+ /// Construct the piece morpher with an image \a ima.
+ piece_morpher(const SrcType &ima, const dpoint_type p,
+ const size_type s)
+ : super_type(ima, p, s)
+ {}
+
+ /// Construct the piece morpher with another piece morpher.
+ piece_morpher(const self_type& r)
+ : super_type(r.get_ima(), r.ref_point(), r.size())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ piece_morpher()
+ {}
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ value_type& at(const point_type& p)
+ {
+ return const_cast<value_type &>(this->ima_)[p + p_];
+ }
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ const value_type at(const point_type& p) const
+ {
+ return this->ima_[p + p_];
+ }
+
+ /*! Perform a shallow copy from the decorated image of \a rhs
+ ** to the current decorated image. The points will be shared
+ ** by the two images.
+ */
+ self_type&
+ assign(self_type& rhs)
+ {
+ oln_iter_type(SrcType) it(rhs);
+
+ for_all(it)
+ this->at(it) = rhs[it];
+ return this->exact();
+ }
+
+ /*!
+ ** \brief This operator= assigns rhs to the current image.
+ */
+ self_type&
+ operator=(SrcType& rhs)
+ {
+ return this->exact().assign(rhs);
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "piece_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /// The specialized version for `const' declared images.
+ template <class SrcType, class Exact>
+ struct piece_morpher<const SrcType, Exact>
+ : public super_piece_morpher< SrcType, piece_morpher<const SrcType, Exact> >
+ {
+ /// The type of the object instantiated. piece morpher can be derived.
+ typedef typename image_id<piece_morpher<SrcType, Exact> >::exact_type exact_type;
+ typedef piece_morpher<const SrcType, Exact> self_type;
+ typedef super_piece_morpher<SrcType, piece_morpher<const SrcType, Exact> > super_type;
+
+ typedef oln_point_type(SrcType) point_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+ typedef oln_value_type(SrcType) value_type;
+
+ /*!
+ ** \brief Construct a piece morpher.
+ ** \arg ima The image.
+ ** \arg p The reference point.
+ ** \arg s The size.
+ */
+ piece_morpher(const SrcType &ima, const dpoint_type p,
+ const size_type s)
+ : super_type(ima, p, s)
+ {}
+
+ /// Construct a piece morpher from another one.
+ piece_morpher(const self_type& r)
+ : super_type(r.get_ima(), r.ref_point(), r.size())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ piece_morpher() {}
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ const value_type at(const point_type &p) const
+ {
+ return this->ima_[p + p_];
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "piece_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+
+ /*!
+ ** \brief Instantiate a temporary read-only piece morpher.
+ ** \arg ima The image.
+ ** \arg p The reference's point.
+ ** \arg s The size of the window.
+ **
+ ** A piece of the image will be viewed.
+ **
+ ** \code
+ ** #include <oln/morpher/piece_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** oln::save(oln::morpher::piece_morph(imc,
+ ** oln::dpoint2d(246, 244),
+ ** oln::image2d_size(30, 60, imc.border())),
+ ** IMG_OUT "oln_morpher_piece_morpher.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena_ppm.png
+ ** \image latex lena_ppm.png
+ ** =>
+ ** \image html oln_morpher_piece_morpher.png
+ ** \image latex oln_morpher_piece_morpher.png
+ */
+ template <class I, class PointType, class SizeType>
+ const piece_morpher<I> piece_morph(I &ima, const PointType p, const SizeType s)
+ {
+ return piece_morpher<I>(ima, p, s);
+ }
+
+
+ } // end namespace morpher
+
+} // end namespace oln
+
+#endif // !PIECE_MORPHER
--
Simon Odou
simon(a)lrde.epita.fr
1
1
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/topo/inter-pixel/inter-pixel.hh: Change the return type
of operator[] from const & to const.
* olena/oln/morpher/subq_morpher.hh: Add file. Sub quantify morpher
implementation.
* olena/oln/morpher/color_morpher.hh: Add file. Color morpher
implementation.
Index: olena/oln/topo/inter-pixel/inter-pixel.hh
--- olena/oln/topo/inter-pixel/inter-pixel.hh Mon, 15 Mar 2004 15:32:27
+0100 van-vl_n (oln/r/34_inter-pixe 1.15 600)
+++ olena/oln/topo/inter-pixel/inter-pixel.hh Sun, 28 Mar 2004 18:07:10
+0200 van-vl_n (oln/r/34_inter-pixe 1.15 600)
@@ -106,7 +106,7 @@
}
/// \todo FIXME: add doc.
- const node_type&
+ const node_type
operator[](const point_type & p) const
{
return data_[p];
1
0
I uncommented some lines in attributes.hh. Why were they
commented?
olena/tests/convol does not pass make check (due to errors
in the gaussian).
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/utils/histogram.hh: Change the return type
of `at' method to const value_type.
* olena/oln/morpho/attributes.hh: Uncomment some lines.
* olena/oln/convol/nagao.hh: Correct comments.
* olena/oln/convol/nagao.hxx: Likewise.
* olena/oln/utils/se_stat.hh: Likewise.
* olena/oln/utils/se_stat.hxx: Likewise.
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Fri, 19 Mar 2004 11:53:50 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.11 640)
+++ olena/oln/utils/histogram.hh Sat, 27 Mar 2004 15:51:26 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.11 640)
@@ -122,7 +122,7 @@
this->exact().clear_impl();
}
/// Read the number of occurrence of \a v.
- const cpt_type&
+ const cpt_type
operator[](const value_type &v)const
{
return this->exact().at(v);
@@ -256,7 +256,7 @@
}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const T &v)const
{
return img_[v2p_(v)];
@@ -404,7 +404,7 @@
min_(ntg_min_val(value_type)), max_(ntg_max_val(value_type)) {}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const value_type& i) const
{
adjust(i);
@@ -503,7 +503,7 @@
upper_type(input, v2p), min_(ntg_min_val(value_type)) {}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const value_type& i) const
{
return img_[v2p_(i)];
@@ -594,7 +594,7 @@
upper_type(input, v2p),max_(ntg_max_val(value_type)) {}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const value_type& i) const
{
return img_[v2p_(i)];
Index: olena/oln/morpho/attributes.hh
--- olena/oln/morpho/attributes.hh Thu, 25 Mar 2004 15:00:37 +0100
palma_g (oln/j/45_attributes 1.10 644)
+++ olena/oln/morpho/attributes.hh Sat, 27 Mar 2004 15:51:59 +0100
van-vl_n (oln/j/45_attributes 1.10 644)
@@ -1213,11 +1213,11 @@
**
** \arg p Point to consider in the image.
*/
- dist_type(//const im_type&,
+ dist_type(const im_type&,
const point_type &p,
- const env_type &) //:
- // value_(ntg_zero_val(value_type)),
- //center_(p)
+ const env_type &):
+ value_(ntg_zero_val(value_type)),
+ center_(p)
{
};
Index: olena/oln/convol/nagao.hh
--- olena/oln/convol/nagao.hh Fri, 26 Mar 2004 20:56:28 +0100 van-vl_n
(oln/m/22_nagao.hh 1.1 600)
+++ olena/oln/convol/nagao.hh Sat, 27 Mar 2004 15:48:41 +0100 van-vl_n
(oln/m/22_nagao.hh 1.1 600)
@@ -127,7 +127,7 @@
/*! A Nagao filter generalized.
**
- ** Each point in the input correspond to the mean of the
+ ** Each point in the input corresponds to the mean of the
** window in which has the smallest variance.
**
** \paran in Input image.
Index: olena/oln/utils/se_stat.hh
--- olena/oln/utils/se_stat.hh Fri, 26 Mar 2004 20:56:28 +0100 van-vl_n
(oln/m/23_se_stat.hh 1.1 644)
+++ olena/oln/utils/se_stat.hh Sat, 27 Mar 2004 15:50:13 +0100 van-vl_n
(oln/m/23_se_stat.hh 1.1 644)
@@ -96,16 +96,16 @@
** \param Sum type used to compute the sum and the average.
** \param Var type used to compute the variance.
**
- ** \note There is two parameters because for vectorial types the sum
+ ** \note There are two parameters because for vectorial types the sum
** is usually a vector, and the variance a non vectorial type.
*/
template <typename Sum = ntg::float_s, typename Var = ntg::float_s>
class se_stat
{
public:
- /// type of used to sum the value (usually floating point values)
+ /// type of used to sum values (usually floating point values)
typedef Sum sum_type;
- /// type of used for the variance (usually floating point values)
+ /// type of the variance (usually floating point values)
typedef Var variance_type;
/*! Build a se stat.
@@ -121,7 +121,7 @@
compute(im, p, s);
}
- /// Computes the mean and the variance.
+ /// Compute the mean and the variance.
template <class I, class S>
se_stat &
compute(const oln::abstract::image<I> &im,
Index: olena/oln/utils/se_stat.hxx
--- olena/oln/utils/se_stat.hxx Fri, 26 Mar 2004 20:56:28 +0100 van-vl_n
(oln/m/24_se_stat.hx 1.1 644)
+++ olena/oln/utils/se_stat.hxx Sat, 27 Mar 2004 15:50:23 +0100 van-vl_n
(oln/m/24_se_stat.hx 1.1 644)
@@ -32,7 +32,7 @@
namespace oln {
namespace utils {
- /// Computes the mean and the variance.
+ /// Compute the mean and the variance.
template <typename Sum, typename Var>
template <class I, class S>
inline se_stat<Sum, Var> &
1
0