Olena-patches
Threads by month
- ----- 2025 -----
- 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
June 2004
- 6 participants
- 14 discussions
"Shouldn't such a massive change be reflected in NEWS? Are you working
on the documentation and test suite too?"
(Copyright Akim)
This is true for shaplets AND for deconvolution.
Reply "ok" once it is done.
Thanks.
--
Niels
2
1
Index: tools/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* utilities/convert/Makefile.am: Correct flags.
Index: tools/utilities/convert/Makefile.am
--- tools/utilities/convert/Makefile.am Mon, 28 Jun 2004 15:53:02 +0200 thivol_d (oln/v/10_Makefile.a 1.2 600)
+++ tools/utilities/convert/Makefile.am Tue, 29 Jun 2004 10:46:02 +0200 palma_g (oln/v/10_Makefile.a 1.2 600)
@@ -1,4 +1,4 @@
-AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_OPTIMIZE) -lz
+AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_OPTIMIZE) $(ZLIB_LDFLAGS)
INCLUDES = -I$(srcdir)/../../lib
LDADD = ../../lib/libolntools.a
bin_PROGRAMS = color_space
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
2
2
Au passage, y'a 6 tests qui marchent pas dans morpho, et ce sont pas mes
changements qui les font foirer :))
Index: integre/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* ntg/core/internal/global_ops.hh: Make compliant to g++-3.4.
* ntg/real/int_s.hh: Likewise.
* ntg/real/int_u.hh: Likewise.
* ntg/real/optraits_real_defs.hh: Likewise.
* ntg/core/pred_succ.hh: Likewise.
Index: metalic/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* mlc/type.hh: Make compliant to g++-3.4.
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* oln/convert/rgbnrgb.hh: Make compliant to g++-3.4.
* oln/convert/rgbxyz.hh: Likewise.
* oln/topo/dmap.hxx: Likewise.
* oln/utils/histogram.hh: Likewise.
* oln/morpho/attribute_closing_opening.hh: Likewise.
* oln/topo/tarjan/flat-zone.hh: Likewise.
* oln/core/abstract/image_with_impl.hh: Likewise.
* tests/utils/tests/histogram: Likewise.
* oln/io/pnm_write_2d.hh: Likewise.
* oln/topo/combinatorial-map/internal/anyfunc.hh: Likewise.
* oln/topo/combinatorial-map/internal/beta.hh: Likewise.
* oln/topo/combinatorial-map/internal/lambda.hh: Likewise.
* oln/topo/combinatorial-map/internal/level.hh: Likewise.
* oln/topo/combinatorial-map/internal/sigma.hh: Likewise.
* oln/core/abstract/image_with_type_with_dim.hh: Likewise.
* oln/convert/rgbhsv.hh: Likewise.
* oln/convert/rgbhsl.hh: Likewise.
* oln/convert/rgbhsi.hh: Likewise.
* oln/convert/rgbyuv.hh: Likewise.
* oln/convert/rgbyiq.hh: Likewise.
* oln/morpho/attributes.hh: Likewise.
* oln/core/abstract/behavior.hh: Likewise.
* oln/core/behavior.hh: Likewise.
* oln/morpho/attribute_closing_opening_map.hh: Likewise.
* oln/utils/buffer.hxx: Likewise.
* oln/utils/key.hxx: Likewise.
* oln/utils/md5.hxx: Likewise.
* oln/utils/md5.hh: Likewise.
* oln/morpher/subq_morpher.hh: Likewise.
* oln/morpher/color_morpher.hh: Likewise.
* oln/morpher/piece_morpher.hh: Likewise.
* oln/morpher/slicing_morpher.hh: Likewise.
* oln/topo/tarjan/tarjan_with_attr.hh: Likewise.
* oln/utils/qsort.hh: Likewise.
* oln/transforms/shapelets.hh: Likewise.
* oln/morpher/func_morpher.hh: Likewise.
* oln/core/fpoint2d.hh: Likewise.
Index: olena/oln/convert/rgbnrgb.hh
--- olena/oln/convert/rgbnrgb.hh Mon, 15 Mar 2004 15:32:27 +0100 van-vl_n (oln/17_rgbnrgb.hh 1.13 600)
+++ olena/oln/convert/rgbnrgb.hh Sat, 26 Jun 2004 00:54:31 +0200 thivol_d (oln/17_rgbnrgb.hh 1.13 600)
@@ -77,7 +77,7 @@
{
std::ostringstream s;
s << "f_rgb_to_nrgb<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
@@ -122,7 +122,7 @@
{
std::ostringstream s;
s << "f_nrgb_to_rgb<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
Index: olena/oln/convert/rgbxyz.hh
--- olena/oln/convert/rgbxyz.hh Mon, 15 Mar 2004 15:32:27 +0100 van-vl_n (oln/19_rgbxyz.hh 1.14 600)
+++ olena/oln/convert/rgbxyz.hh Sat, 26 Jun 2004 00:51:19 +0200 thivol_d (oln/19_rgbxyz.hh 1.14 600)
@@ -74,7 +74,7 @@
{
std::ostringstream s;
s << "f_rgb_to_xyz<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
@@ -120,7 +120,7 @@
{
std::ostringstream s;
s << "f_xyz_to_rgb<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
Index: metalic/mlc/type.hh
--- metalic/mlc/type.hh Tue, 13 Apr 2004 17:31:32 +0200 van-vl_n (oln/c/21_type.hh 1.29 600)
+++ metalic/mlc/type.hh Fri, 25 Jun 2004 18:29:09 +0200 thivol_d (oln/c/21_type.hh 1.29 600)
@@ -310,6 +310,6 @@
| dispatch |
`---------*/
-# define mlc_dispatch(Fun) return exact().Fun##_impl
+# define mlc_dispatch(Fun) return this->exact().Fun##_impl
#endif // ! METALIC_TYPE_HH
Index: olena/oln/topo/dmap.hxx
--- olena/oln/topo/dmap.hxx Tue, 13 Apr 2004 17:31:32 +0200 van-vl_n (oln/p/3_dmap.hxx 1.7.1.10 600)
+++ olena/oln/topo/dmap.hxx Sat, 26 Jun 2004 21:41:41 +0200 thivol_d (oln/p/3_dmap.hxx 1.7.1.10 600)
@@ -144,11 +144,11 @@
return tmp; \
}
- oln_topo_chamfer2_(chamfer, 1, 1, 3, 0.9003);
- oln_topo_chamfer2_(chamfer, 1, 2, 3, 1.2732);
- oln_topo_chamfer2_(chamfer, 2, 3, 3, 2.1736);
- oln_topo_chamfer2_(chamfer, 5, 7, 3, 5.2474);
- oln_topo_chamfer2_(chamfer, 12, 17, 3, 12.6684);
+ oln_topo_chamfer2_(chamfer, 1, 1, 3, 0.9003)
+ oln_topo_chamfer2_(chamfer, 1, 2, 3, 1.2732)
+ oln_topo_chamfer2_(chamfer, 2, 3, 3, 2.1736)
+ oln_topo_chamfer2_(chamfer, 5, 7, 3, 5.2474)
+ oln_topo_chamfer2_(chamfer, 12, 17, 3, 12.6684)
inline const chamfer<int>&
chessboard()
@@ -162,10 +162,10 @@
return chamfer_1_2();
}
- oln_topo_chamfer3_(chamfer, 4, 6, 9, 5, 4.1203);
- oln_topo_chamfer3_(chamfer, 5, 7, 11, 5, 5.0206);
- oln_topo_chamfer3_(chamfer, 9, 13, 20, 5, 9.1409);
- oln_topo_chamfer3_(chamfer, 16, 23, 36, 5, 16.3351);
+ oln_topo_chamfer3_(chamfer, 4, 6, 9, 5, 4.1203)
+ oln_topo_chamfer3_(chamfer, 5, 7, 11, 5, 5.0206)
+ oln_topo_chamfer3_(chamfer, 9, 13, 20, 5, 9.1409)
+ oln_topo_chamfer3_(chamfer, 16, 23, 36, 5, 16.3351)
inline const chamfer<float>& best_set_3x3()
{ return mk_chamfer_3x3(0.9481, 1.3408); }
@@ -173,19 +173,19 @@
{ return mk_chamfer_5x5(0.9801, 1.4060, 2.2044); }
// maximum absolute error for integer local distances (Table 2)
- oln_topo_chamfer2_(mchamfer, 1, 1, 3, 0.8536);
- oln_topo_chamfer2_(mchamfer, 1, 2, 3, 1.2071);
- oln_topo_chamfer2_(mchamfer, 2, 3, 3, 2.1180);
- oln_topo_chamfer2_(mchamfer, 5, 7, 3, 5.1675);
- oln_topo_chamfer2_(mchamfer, 12, 17, 3, 12.5000);
+ oln_topo_chamfer2_(mchamfer, 1, 1, 3, 0.8536)
+ oln_topo_chamfer2_(mchamfer, 1, 2, 3, 1.2071)
+ oln_topo_chamfer2_(mchamfer, 2, 3, 3, 2.1180)
+ oln_topo_chamfer2_(mchamfer, 5, 7, 3, 5.1675)
+ oln_topo_chamfer2_(mchamfer, 12, 17, 3, 12.5000)
inline const chamfer<int>& mchessboard() { return mchamfer_1_1(); }
inline const chamfer<int>& mcityblock() { return mchamfer_1_2(); }
- oln_topo_chamfer3_(mchamfer, 4, 6, 9, 5, 4.1213);
- oln_topo_chamfer3_(mchamfer, 5, 7, 11, 5, 5.0092);
- oln_topo_chamfer3_(mchamfer, 9, 13, 20, 5, 9.0819);
- oln_topo_chamfer3_(mchamfer, 17, 24, 38, 5, 17.2174);
+ oln_topo_chamfer3_(mchamfer, 4, 6, 9, 5, 4.1213)
+ oln_topo_chamfer3_(mchamfer, 5, 7, 11, 5, 5.0092)
+ oln_topo_chamfer3_(mchamfer, 9, 13, 20, 5, 9.0819)
+ oln_topo_chamfer3_(mchamfer, 17, 24, 38, 5, 17.2174)
inline const chamfer<float>& mbest_set_3x3() {
const float coef = 1.0412;
Index: integre/ntg/core/internal/global_ops.hh
--- integre/ntg/core/internal/global_ops.hh Wed, 08 Oct 2003 23:36:51 +0200 burrus_n (oln/g/27_global_ops 1.11.1.14 600)
+++ integre/ntg/core/internal/global_ops.hh Sat, 26 Jun 2004 00:25:06 +0200 thivol_d (oln/g/27_global_ops 1.11.1.14 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -38,6 +38,8 @@
# include <mlc/contract.hh>
# include <mlc/is_a.hh>
+# include <ntg/real/builtin_float.hh>
+# include <ntg/real/optraits_builtin_int.hh>
# include <ntg/core/internal/global_ops_traits.hh>
# include <ntg/core/macros.hh>
# include <ntg/core/value.hh>
Index: integre/ntg/real/int_s.hh
--- integre/ntg/real/int_s.hh Thu, 27 Nov 2003 11:26:27 +0100 burrus_n (oln/g/24_int_s.hh 1.16.1.16.1.1 600)
+++ integre/ntg/real/int_s.hh Sat, 26 Jun 2004 00:04:21 +0200 thivol_d (oln/g/24_int_s.hh 1.16.1.16.1.1 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -32,6 +32,7 @@
# include <ntg/real/optraits_real.hh>
# include <ntg/real/real_value.hh>
# include <ntg/bin.hh>
+# include <ntg/real/int_u.hh>
# include <mlc/bool.hh>
# include <mlc/cmp.hh>
@@ -89,7 +90,7 @@
| typetraits<int_s> |
`------------------*/
- template <unsigned nbits, class behavior>
+ template <unsigned nbits, typename behavior>
struct typetraits<int_s<nbits, behavior> >
: public typetraits<sint_value<int_s<nbits, behavior> > >
{
Index: integre/ntg/real/int_u.hh
--- integre/ntg/real/int_u.hh Thu, 27 Nov 2003 11:26:27 +0100 burrus_n (oln/g/23_int_u.hh 1.19.1.16.1.1 600)
+++ integre/ntg/real/int_u.hh Fri, 25 Jun 2004 23:57:00 +0200 thivol_d (oln/g/23_int_u.hh 1.19.1.16.1.1 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -33,7 +33,9 @@
# include <ntg/real/real_value.hh>
# include <ntg/bin.hh>
+# include <mlc/bool.hh>
# include <mlc/cmp.hh>
+# include <mlc/is_a.hh>
# include <string>
# include <sstream>
@@ -79,7 +81,7 @@
| typetraits<int_u> |
`------------------*/
- template <unsigned nbits, class behavior>
+ template <unsigned nbits, typename behavior>
struct typetraits<int_u<nbits, behavior> >
: public typetraits<uint_value<int_u<nbits, behavior> > >
{
Index: integre/ntg/real/optraits_real_defs.hh
--- integre/ntg/real/optraits_real_defs.hh Thu, 27 Nov 2003 11:26:27 +0100 burrus_n (oln/g/11_optraits_s 1.14.1.1 600)
+++ integre/ntg/real/optraits_real_defs.hh Fri, 25 Jun 2004 17:26:09 +0200 thivol_d (oln/g/11_optraits_s 1.14.1.1 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -94,7 +94,7 @@
{ \
typedef ntg_return_type(Name, T1, T2) return_type; \
typedef typename \
- typetraits<E>::abstract_behavior_type::get<return_type> \
+ typetraits<E>::abstract_behavior_type::template get<return_type> \
behavior_type; \
return_type tmp; \
tmp = behavior_type::check_##Name(lhs.exact().val(), \
@@ -109,7 +109,7 @@
{ \
typedef ntg_return_type(Name, T1, T2) return_type; \
typedef typename \
- typetraits<E>::abstract_behavior_type::get<return_type> \
+ typetraits<E>::abstract_behavior_type::template get<return_type> \
behavior_type; \
return_type tmp; \
tmp = behavior_type::check_##Name(lhs.exact().val(), \
@@ -124,7 +124,7 @@
{ \
typedef ntg_return_type(Name, T1, T2) return_type; \
typedef typename \
- typetraits<E>::abstract_behavior_type::get<return_type> \
+ typetraits<E>::abstract_behavior_type::template get<return_type> \
behavior_type; \
return_type tmp; \
tmp = behavior_type::check_##Name(lhs.exact(), \
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Sun, 23 May 2004 13:55:35 +0200 palma_g (oln/10_histogram. 1.6.1.14.1.14 600)
+++ olena/oln/utils/histogram.hh Fri, 25 Jun 2004 18:02:30 +0200 thivol_d (oln/10_histogram. 1.6.1.14.1.14 600)
@@ -233,7 +233,7 @@
histogram(const value_to_point_type & c2p = value_to_point_type()):
v2p_(c2p), img_(internal::img_max_size<value_type>()())
{
- clear();
+ this->clear();
}
/// This compute the histogram of an image.
@@ -242,8 +242,8 @@
const value_to_point_type & v2p = value_to_point_type()):
v2p_(v2p), img_(internal::img_max_size<value_type>()())
{
- clear();
- init(input);
+ this->clear();
+ this->init(input);
}
/// clear() should be called.
@@ -408,7 +408,7 @@
at(const value_type& i) const
{
adjust(i);
- return img_[v2p_(i)];
+ return this->img_[v2p_(i)];
}
/// operator[] should be called.
@@ -416,7 +416,7 @@
at(const value_type& i)
{
adjust(i);
- return img_[v2p_(i)];
+ return this->img_[v2p_(i)];
}
/// Quick function min.
@@ -424,7 +424,7 @@
min()
{
for (; min_ != ntg_max_val(value_type); min_ = ntg::succ(min_))
- if (img_[v2p_(min_)] > ntg_zero_val(cpt_type))
+ if (this->img_[v2p_(min_)] > ntg_zero_val(cpt_type))
break;
return min_;
}
@@ -433,7 +433,7 @@
max()
{
for (; max_ != ntg_min_val(value_type); max_ = ntg::pred(max_))
- if (img_[v2p_(max_)] > ntg_zero_val(cpt_type))
+ if (this->img_[v2p_(max_)] > ntg_zero_val(cpt_type))
break;
return max_;
}
@@ -506,7 +506,7 @@
const cpt_type
at(const value_type& i) const
{
- return img_[v2p_(i)];
+ return this->img_[v2p_(i)];
}
/// operator[] should be called.
@@ -514,14 +514,14 @@
at(const value_type& i)
{
adjust(i);
- return img_[v2p_(i)];
+ return this->img_[v2p_(i)];
}
/// Quick function min.
value_type
min()
{
for (; min_ != ntg_max_val(value_type); min_ = succ(min_))
- if (img_[v2p_(min_)] > ntg_zero_val(cpt_type))
+ if (this->img_[v2p_(min_)] > ntg_zero_val(cpt_type))
break;
return min_;
}
@@ -597,7 +597,7 @@
const cpt_type
at(const value_type& i) const
{
- return img_[v2p_(i)];
+ return this->img_[v2p_(i)];
}
/// operator[] should be called.
@@ -605,14 +605,14 @@
at(const value_type& i)
{
adjust(i);
- return img_[v2p_(i)];
+ return this->img_[v2p_(i)];
}
/// Quick function max.
value_type
max()
{
for (; max_ != ntg_min_val(value_type); max_ = ntg::pred(max_))
- if (img_[v2p_(max_)] > ntg_zero_val(cpt_type))
+ if (this->img_[v2p_(max_)] > ntg_zero_val(cpt_type))
break;
return max_;
}
Index: olena/oln/morpho/attribute_closing_opening.hh
--- olena/oln/morpho/attribute_closing_opening.hh Thu, 25 Mar 2004 15:00:37 +0100 palma_g (oln/q/49_attribute_ 1.23 600)
+++ olena/oln/morpho/attribute_closing_opening.hh Sat, 26 Jun 2004 02:32:43 +0200 thivol_d (oln/q/49_attribute_ 1.23 600)
@@ -163,7 +163,7 @@
** \image latex oln_morpho_fast_card_closing.png
**
*/
- xxx_closing_decl(card);
+ xxx_closing_decl(card)
/*!
** \brief Perform a cardinal opening.
@@ -190,7 +190,7 @@
** \image latex oln_morpho_fast_card_opening.png
**
*/
- xxx_opening_decl(card);
+ xxx_opening_decl(card)
/*!
** \brief Perform an integral closing.
@@ -217,7 +217,7 @@
** \image latex oln_morpho_fast_integral_closing.png
**
*/
- xxx_closing_decl(integral);
+ xxx_closing_decl(integral)
/*!
** \brief Perform an integral opening.
@@ -244,7 +244,7 @@
** \image latex oln_morpho_fast_integral_opening.png
**
*/
- xxx_opening_decl(integral);
+ xxx_opening_decl(integral)
/*!
** \brief Perform a height closing.
@@ -271,7 +271,7 @@
** \image latex oln_morpho_fast_height_opening.png
**
*/
- xxx_opening_decl(height);
+ xxx_opening_decl(height)
/*!
** \brief Perform a height closing.
@@ -299,7 +299,7 @@
** \image latex oln_morpho_fast_height_closing.png
**
*/
- xxx_closing_decl(height);
+ xxx_closing_decl(height)
/*!
@@ -328,7 +328,7 @@
** \image latex oln_morpho_fast_maxvalue_closing.png
**
*/
- xxx_closing_decl(maxvalue);
+ xxx_closing_decl(maxvalue)
/*!
** \brief Perform a maxvalue opening.
@@ -356,7 +356,7 @@
** \image latex oln_morpho_fast_maxvalue_opening.png
**
*/
- xxx_opening_decl(maxvalue);
+ xxx_opening_decl(maxvalue)
/*!
** \brief Perform a minvalue opening.
@@ -384,7 +384,7 @@
** \image latex oln_morpho_fast_minvalue_opening.png
**
*/
- xxx_opening_decl(minvalue);
+ xxx_opening_decl(minvalue)
/*!
** \brief Perform a minvalue closing.
@@ -412,7 +412,7 @@
** \image latex oln_morpho_fast_minvalue_closing.png
**
*/
- xxx_closing_decl(minvalue);
+ xxx_closing_decl(minvalue)
/*!
** \brief Perform a ball opening.
@@ -440,7 +440,7 @@
** \image latex oln_morpho_fast_ball_opening.png
**
*/
- xxx_opening_im_decl(ball);
+ xxx_opening_im_decl(ball)
/*!
** \brief Perform a ball closing.
@@ -468,7 +468,7 @@
** \image latex oln_morpho_fast_ball_closing.png
**
*/
- xxx_closing_im_decl(ball);
+ xxx_closing_im_decl(ball)
/*!
** \brief Perform a dist opening.
@@ -496,7 +496,7 @@
** \image latex oln_morpho_fast_dist_opening.png
**
*/
- xxx_opening_im_decl(dist);
+ xxx_opening_im_decl(dist)
/*!
** \brief Perform a dist closing.
@@ -524,7 +524,7 @@
** \image latex oln_morpho_fast_dist_closing.png
**
*/
- xxx_closing_im_decl(dist);
+ xxx_closing_im_decl(dist)
/*!
** \brief Perform a cube closing.
@@ -552,7 +552,7 @@
** \image latex oln_morpho_fast_cube_closing.png
**
*/
- xxx_closing_im_decl(cube);
+ xxx_closing_im_decl(cube)
/*!
** \brief Perform a cube opening.
@@ -580,7 +580,7 @@
** \image latex oln_morpho_fast_cube_opening.png
**
*/
- xxx_opening_im_decl(cube);
+ xxx_opening_im_decl(cube)
/*!
** \brief Perform a box closing.
@@ -609,7 +609,7 @@
** \image latex oln_morpho_fast_box_closing.png
**
*/
- xxx_closing_im_decl(box);
+ xxx_closing_im_decl(box)
/*!
** \brief Perform a box opening.
@@ -638,7 +638,7 @@
** \image latex oln_morpho_fast_box_opening.png
**
*/
- xxx_opening_im_decl(box);
+ xxx_opening_im_decl(box)
} // !fast
} // !morpho
Index: olena/oln/topo/tarjan/flat-zone.hh
--- olena/oln/topo/tarjan/flat-zone.hh Wed, 14 Apr 2004 00:08:50 +0200 thivol_d (oln/r/35_flat-zone. 1.14 600)
+++ olena/oln/topo/tarjan/flat-zone.hh Sat, 26 Jun 2004 21:09:02 +0200 thivol_d (oln/r/35_flat-zone. 1.14 600)
@@ -87,7 +87,7 @@
typedef mlc_exact_vt_type(self_type, Exact) exact_type; ///< Exact type of the class.
typedef abstract::tarjan_with_attr<exact_type> super_type; ///< Type of parent class.
- friend class super_type;
+ //friend class super_type;
friend class abstract::tarjan<exact_type>;
/*!
** \brief Constructor.
@@ -104,9 +104,9 @@
get_processing_order_impl()
{
std::vector<point_type> res;
- oln_iter_type(image_type) it(input_);
+ oln_iter_type(image_type) it(this->input_);
- res.reserve(input_.npoints());
+ res.reserve(this->input_.npoints());
for_all(it)
res.push_back(it);
return res;
@@ -124,16 +124,16 @@
void
mark_set_impl(const point_type &x)
{
- if (parent_.size() == parent_.capacity())
+ if (this->parent_.size() == this->parent_.capacity())
{
- capacity = parent_.capacity() + capacity_chunk;
- parent_.reserve(capacity);
- comp_value_.reserve(capacity);
- }
- to_comp_[x] = ncomps_ + 1;
- data_.push_back(A(input_, x, env_));
- parent_.push_back(ncomps_ + 1);
- comp_value_.push_back(ncomps_ + 1);
+ this->capacity = this->parent_.capacity() + this->capacity_chunk;
+ this->parent_.reserve(this->capacity);
+ this->comp_value_.reserve(this->capacity);
+ }
+ this->to_comp_[x] = this->ncomps_ + 1;
+ this->data_.push_back(A(this->input_, x, this->env_));
+ this->parent_.push_back(this->ncomps_ + 1);
+ this->comp_value_.push_back(this->ncomps_ + 1);
}
/*!
@@ -147,24 +147,24 @@
void
uni_impl(const point_type& n, const point_type& p)
{
- comp_type r = find_root(to_comp_[n]);
- precondition(to_comp_[n] <= ncomps_);
- precondition(to_comp_[p] <= (ncomps_ + 1));
- if (r != to_comp_[p])
- if (input_[n] == input_[p])
- {
- if (to_comp_[p] == (ncomps_ + 1)) // first merge of p component
- {
- precondition(r < comp_value_.capacity());
- data_[r] += data_[to_comp_[p]];
- precondition(r <= ncomps_);
- to_comp_[p] = r;
+ comp_type r = find_root(this->to_comp_[n]);
+ precondition(this->to_comp_[n] <= this->ncomps_);
+ precondition(this->to_comp_[p] <= (this->ncomps_ + 1));
+ if (r != this->to_comp_[p])
+ if (this->input_[n] == this->input_[p])
+ {
+ if (this->to_comp_[p] == (this->ncomps_ + 1)) // first merge of p component
+ {
+ precondition(r < this->comp_value_.capacity());
+ this->data_[r] += this->data_[this->to_comp_[p]];
+ precondition(r <= this->ncomps_);
+ this->to_comp_[p] = r;
}
else
{
- precondition(r < parent_.capacity());
- data_[parent_[to_comp_[p]]] += data_[parent_[r]];
- parent_[r] = parent_[to_comp_[p]];
+ precondition(r < this->parent_.capacity());
+ this->data_[this->parent_[this->to_comp_[p]]] += this->data_[this->parent_[r]];
+ this->parent_[r] = this->parent_[this->to_comp_[p]];
}
}
Index: olena/oln/core/abstract/image_with_impl.hh
--- olena/oln/core/abstract/image_with_impl.hh Mon, 29 Mar 2004 09:26:50 +0200 odou_s (oln/t/27_image_with 1.14.1.11 600)
+++ olena/oln/core/abstract/image_with_impl.hh Fri, 25 Jun 2004 17:28:07 +0200 thivol_d (oln/t/27_image_with 1.14.1.11 600)
@@ -152,7 +152,7 @@
const size_type&
size() const
{
- assertion(has_impl());
+ assertion(this->has_impl());
return this->exact().impl()->size();
}
Index: olena/tests/utils/tests/histogram
--- olena/tests/utils/tests/histogram Tue, 20 Apr 2004 15:16:21 +0200 van-vl_n (oln/u/27_histogram. 1.2.1.4 600)
+++ olena/tests/utils/tests/histogram Sat, 26 Jun 2004 21:49:34 +0200 thivol_d (oln/u/27_histogram. 1.2.1.4 600)
@@ -67,7 +67,7 @@
hu8[ntg_max_val(int_u8)] == 0 &&
hu8[ntg_min_val(int_u8)] == 0;
return res;
-};
+}
bool
check_int_s4_and_distr()
@@ -141,7 +141,7 @@
utils::max(his4) == utils::max(his4_max) &&
utils::max(his4) == utils::max(his4_minmax);
return res;
-};
+}
bool
@@ -162,7 +162,7 @@
hr8[rgb_8(0, 0, 0)] == 0 &&
hr8[rgb_8(44, 44, 44)] == 0;
return res;
-};
+}
bool
check()
Index: olena/oln/io/pnm_write_2d.hh
--- olena/oln/io/pnm_write_2d.hh Mon, 15 Mar 2004 19:59:55 +0100 thivol_d (oln/u/44_pnm_write_ 1.6 600)
+++ olena/oln/io/pnm_write_2d.hh Sat, 26 Jun 2004 20:57:20 +0200 thivol_d (oln/u/44_pnm_write_ 1.6 600)
@@ -29,6 +29,8 @@
# define OLENA_IO_PNM_WRITE_2D_HH
# include <ntg/basics.hh>
+# include <ntg/real/typetraits_builtin_int.hh>
+# include <ntg/real/int_u.hh>
# include <oln/core/traverse.hh>
# include <oln/utils/stat.hh>
# include <oln/io/pnm_common.hh>
@@ -154,7 +156,7 @@
info.rows = im.nrows();
info.max_val = ntg_max_val(oln_value_type(I));
- if (info.max_val > ntg::to_ntg(65535U))
+ if (ntg::to_ntg(65535U) < info.max_val)
return false;
if (!pnm_write_header2d(out, pnm_id, info))
Index: olena/oln/topo/combinatorial-map/internal/anyfunc.hh
--- olena/oln/topo/combinatorial-map/internal/anyfunc.hh Mon, 15 Mar 2004 15:32:27 +0100 van-vl_n (oln/v/3_anyfunc.hh 1.4 600)
+++ olena/oln/topo/combinatorial-map/internal/anyfunc.hh Sat, 26 Jun 2004 20:47:03 +0200 thivol_d (oln/v/3_anyfunc.hh 1.4 600)
@@ -76,26 +76,26 @@
/// Resize the domain of f.
void resize(unsigned n)
{
- self().resize_(n);
+ this->self().resize_(n);
}
/// Assign a value \e to f(i).
void assign(const U & i, const V & e)
{
assertion(i < f_.size());
- self().assign_(i, e);
+ this->self().assign_(i, e);
}
/// f(i) = 0.
void erase(const U & i)
{
assertion(i < f_.size());
- self().erase_(i);
+ this->self().erase_(i);
}
/// Print the function.
std::ostream & print(std::ostream & ostr) const
{
for (unsigned i = 1; i < f_.size(); ++i)
- ostr << self().name() << "(" << i << ") = " << f_[i] << std::endl;
+ ostr << this->self().name() << "(" << i << ") = " << f_[i] << std::endl;
return ostr;
}
Index: olena/oln/topo/combinatorial-map/internal/beta.hh
--- olena/oln/topo/combinatorial-map/internal/beta.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n (oln/v/5_beta.hh 1.3 600)
+++ olena/oln/topo/combinatorial-map/internal/beta.hh Sat, 26 Jun 2004 20:46:47 +0200 thivol_d (oln/v/5_beta.hh 1.3 600)
@@ -54,13 +54,13 @@
void
assign_(const U & i, const V & e)
{
- f_[i] = e;
+ this->f_[i] = e;
}
void
erase_(const U & i)
{
- f_[i] = 0;
+ this->f_[i] = 0;
}
};
Index: olena/oln/topo/combinatorial-map/internal/lambda.hh
--- olena/oln/topo/combinatorial-map/internal/lambda.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n (oln/v/6_lambda.hh 1.3 600)
+++ olena/oln/topo/combinatorial-map/internal/lambda.hh Sat, 26 Jun 2004 20:46:35 +0200 thivol_d (oln/v/6_lambda.hh 1.3 600)
@@ -59,20 +59,20 @@
void
resize_(unsigned n)
{
- f_.resize(n+1);
+ this->f_.resize(n+1);
}
void
assign_(const U & i, const V & e)
{
- f_[i] = e;
+ this->f_[i] = e;
}
void
erase(const U & i)
{
- f_[i] = 0;
- f_[alpha<U>::result(i)] = 0;
+ this->f_[i] = 0;
+ this->f_[alpha<U>::result(i)] = 0;
}
};
Index: olena/oln/topo/combinatorial-map/internal/level.hh
--- olena/oln/topo/combinatorial-map/internal/level.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n (oln/v/7_level.hh 1.3 600)
+++ olena/oln/topo/combinatorial-map/internal/level.hh Sat, 26 Jun 2004 21:20:19 +0200 thivol_d (oln/v/7_level.hh 1.3 600)
@@ -28,6 +28,8 @@
#ifndef OLENA_TOPO_COMBINATORIAL_MAP_INTERNAL_LEVEL_HH
# define OLENA_TOPO_COMBINATORIAL_MAP_INTERNAL_LEVEL_HH
+# include <mlc/contract.hh>
+
# include <iostream>
# include <vector>
@@ -63,7 +65,7 @@
public:
level(unsigned n) : tree_(n+1)
{
- assertion(n);
+ assertion(n != 0);
}
U father(const U & child) const
Index: olena/oln/topo/combinatorial-map/internal/sigma.hh
--- olena/oln/topo/combinatorial-map/internal/sigma.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n (oln/v/9_sigma.hh 1.3 600)
+++ olena/oln/topo/combinatorial-map/internal/sigma.hh Sat, 26 Jun 2004 20:59:32 +0200 thivol_d (oln/v/9_sigma.hh 1.3 600)
@@ -60,30 +60,30 @@
void
resize_(unsigned n)
{
- f_.resize(n+1);
- f_1_.resize(n+1);
+ this->f_.resize(n+1);
+ this->f_1_.resize(n+1);
}
void
assign_(const U & i, const U & e)
{
- assertion(e < f_1_.size());
+ assertion(e < this->f_1_.size());
- f_[i] = e;
- f_1_[e] = i;
+ this->f_[i] = e;
+ this->f_1_[e] = i;
}
void
erase_(const U & d)
{
- f_[f_1_[d]] = f_[d];
- f_1_[f_[d]] = f_1_[d];
- f_[d] = f_1_[d] = 0;
+ this->f_[this->f_1_[d]] = this->f_[d];
+ this->f_1_[this->f_[d]] = this->f_1_[d];
+ this->f_[d] = this->f_1_[d] = 0;
unsigned d_ = alpha<U>::result(d);
- f_[f_1_[d_]] = f_[d_];
- f_1_[f_[d_]] = f_1_[d_];
- f_[d_] = f_1_[d_] = 0;
+ this->f_[this->f_1_[d_]] = this->f_[d_];
+ this->f_1_[this->f_[d_]] = this->f_1_[d_];
+ this->f_[d_] = this->f_1_[d_] = 0;
}
private:
Index: olena/oln/core/abstract/image_with_type_with_dim.hh
--- olena/oln/core/abstract/image_with_type_with_dim.hh Thu, 11 Mar 2004 17:12:19 +0100 thivol_d (oln/v/11_image_with 1.5 600)
+++ olena/oln/core/abstract/image_with_type_with_dim.hh Fri, 25 Jun 2004 18:14:44 +0200 thivol_d (oln/v/11_image_with 1.5 600)
@@ -188,7 +188,7 @@
** forces the function to only accept vectorial images.
*/
- oln_label_image_(vectorial_image, data_type_image);
+ oln_label_image_(vectorial_image, data_type_image)
/*! This class, when used in a function declaration,
** forces the function to only accept vectorial images
@@ -202,7 +202,7 @@
** forces the function to only accept non vectorial images.
*/
- oln_label_image_(non_vectorial_image, data_type_image);
+ oln_label_image_(non_vectorial_image, data_type_image)
/*! \class non_vectorial_image_with_dim
**
@@ -218,7 +218,7 @@
** forces the function to only accept binary images.
*/
- oln_label_image_(binary_image, non_vectorial_image);
+ oln_label_image_(binary_image, non_vectorial_image)
/*! \class binary_image_with_dim
**
@@ -234,7 +234,7 @@
** forces the function to only accept integer images.
*/
- oln_label_image_(integer_image, non_vectorial_image);
+ oln_label_image_(integer_image, non_vectorial_image)
/*! \class integer_image_with_dim
**
@@ -250,7 +250,7 @@
** forces the function to only accept decimal images.
*/
- oln_label_image_(decimal_image, non_vectorial_image);
+ oln_label_image_(decimal_image, non_vectorial_image)
/*! \class decimal_image_with_dim
**
Index: olena/oln/convert/rgbhsv.hh
--- olena/oln/convert/rgbhsv.hh Mon, 15 Mar 2004 15:32:27 +0100 van-vl_n (oln/j/35_rgbhsv.hh 1.3 600)
+++ olena/oln/convert/rgbhsv.hh Sat, 26 Jun 2004 00:50:29 +0200 thivol_d (oln/j/35_rgbhsv.hh 1.3 600)
@@ -98,7 +98,7 @@
{
std::ostringstream s;
s << "f_rgb_to_hsv<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
@@ -182,7 +182,7 @@
{
std::ostringstream s;
s << "f_hsv_to_rgb<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
Index: olena/oln/convert/rgbhsl.hh
--- olena/oln/convert/rgbhsl.hh Tue, 20 Apr 2004 16:03:16 +0200 van-vl_n (oln/j/36_rgbhsl.hh 1.5 600)
+++ olena/oln/convert/rgbhsl.hh Sat, 26 Jun 2004 00:49:36 +0200 thivol_d (oln/j/36_rgbhsl.hh 1.5 600)
@@ -129,7 +129,7 @@
{
std::ostringstream s;
s << "f_rgb_to_hsl<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
@@ -204,7 +204,7 @@
{
std::ostringstream s;
s << "f_hsl_to_rgb<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
Index: olena/oln/convert/rgbhsi.hh
--- olena/oln/convert/rgbhsi.hh Mon, 15 Mar 2004 15:32:27 +0100 van-vl_n (oln/j/37_rgbhsi.hh 1.3 600)
+++ olena/oln/convert/rgbhsi.hh Sat, 26 Jun 2004 00:44:38 +0200 thivol_d (oln/j/37_rgbhsi.hh 1.3 600)
@@ -85,7 +85,7 @@
{
std::ostringstream s;
s << "f_rgb_to_hsi<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
@@ -130,7 +130,7 @@
{
std::ostringstream s;
s << "f_hsi_to_rgb<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
Index: olena/oln/convert/rgbyuv.hh
--- olena/oln/convert/rgbyuv.hh Mon, 15 Mar 2004 15:32:27 +0100 van-vl_n (oln/j/38_rgbyuv.hh 1.3 600)
+++ olena/oln/convert/rgbyuv.hh Sat, 26 Jun 2004 00:53:46 +0200 thivol_d (oln/j/38_rgbyuv.hh 1.3 600)
@@ -75,7 +75,7 @@
{
std::ostringstream s;
s << "f_rgb_to_yuv<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
/* Conversion from RGB to YUV.
@@ -116,7 +116,7 @@
{
std::ostringstream s;
s << "f_yuv_to_rgb<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
Index: olena/oln/convert/rgbyiq.hh
--- olena/oln/convert/rgbyiq.hh Mon, 15 Mar 2004 15:32:27 +0100 van-vl_n (oln/j/39_rgbyiq.hh 1.3 600)
+++ olena/oln/convert/rgbyiq.hh Sat, 26 Jun 2004 00:51:58 +0200 thivol_d (oln/j/39_rgbyiq.hh 1.3 600)
@@ -76,7 +76,7 @@
{
std::ostringstream s;
s << "f_rgb_to_yiq<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
@@ -118,7 +118,7 @@
{
std::ostringstream s;
s << "f_yiq_to_rgb<" << inbits << ", " << outbits << '>';
- s.str();
+ return s.str();
}
};
Index: olena/oln/morpho/attributes.hh
--- olena/oln/morpho/attributes.hh Sun, 23 May 2004 12:21:34 +0200 palma_g (oln/j/45_attributes 1.13.1.3 600)
+++ olena/oln/morpho/attributes.hh Sat, 26 Jun 2004 02:31:22 +0200 thivol_d (oln/j/45_attributes 1.13.1.3 600)
@@ -245,7 +245,7 @@
const env_type&):
value_(ntg_unit_val(value_type))
{
- };
+ }
/*!
@@ -342,7 +342,7 @@
const oln_point_type(I2) &p,
const env_type &env): super_type(im, p, env)
{
- };
+ }
};
/*-----------*
@@ -390,7 +390,7 @@
area_(1),
value_(1)
{
- };
+ }
// interface part
/*!
@@ -552,7 +552,7 @@
const env_type &) :
value_(input[p])
{
- };
+ }
// interface part
/*!
@@ -673,7 +673,7 @@
const oln_point_type(I) &p,
const env_type & e): super_type(e.getImage(), p, e)
{
- };
+ }
};
/*----------------------*
@@ -732,7 +732,7 @@
std::copy(e.getParent()[p].begin(),
e.getParent()[p].end(),
std::back_inserter(points_));
- };
+ }
/*!
** \brief Accessor to value_.
@@ -893,7 +893,7 @@
min_(input[p]),
max_(input[p])
{
- };
+ }
/*!
** \brief Accessor to min value.
@@ -1038,7 +1038,7 @@
const env_type &):
value_(input[p])
{
- };
+ }
/*!
** \brief Accessor to value_.
@@ -1154,7 +1154,7 @@
const env_type &) :
value_(input[p])
{
- };
+ }
/*!
** \brief Accessor to value_.
Index: olena/oln/core/abstract/behavior.hh
--- olena/oln/core/abstract/behavior.hh Wed, 09 Jun 2004 20:13:57 +0200 van-vl_n (oln/j/46_behavior.h 1.4 600)
+++ olena/oln/core/abstract/behavior.hh Fri, 25 Jun 2004 18:38:26 +0200 thivol_d (oln/j/46_behavior.h 1.4 600)
@@ -61,7 +61,7 @@
void adapt_border(const oln::abstract::image<I> &im, coord border_size) const
{
mlc_dispatch(adapt_border)(im, border_size);
- };
+ }
protected:
/*!
** \brief CTor
Index: olena/oln/core/behavior.hh
--- olena/oln/core/behavior.hh Tue, 15 Jun 2004 20:36:26 +0200 odou_s (oln/j/47_behavior.h 1.5 600)
+++ olena/oln/core/behavior.hh Sat, 26 Jun 2004 23:01:16 +0200 thivol_d (oln/j/47_behavior.h 1.5 600)
@@ -51,7 +51,7 @@
coord border_size) const
{
im.border_adapt_mirror(border_size);
- };
+ }
};
// set the border to a specific value
@@ -81,7 +81,7 @@
{
im.border_adapt_assign(border_size,
ntg::cast::force<oln_value_type(I)>(value_));
- };
+ }
/// Empty constructor for any_with_diamond hierarchy.
value_behavior() {}
@@ -111,7 +111,8 @@
coord border_size) const
{
im.border_adapt_copy(border_size);
- };
+ }
+
};
// tools to call ctors with type inference
Index: olena/oln/morpho/attribute_closing_opening_map.hh
--- olena/oln/morpho/attribute_closing_opening_map.hh Thu, 25 Mar 2004 15:00:37 +0100 palma_g (oln/j/49_attribute_ 1.11 600)
+++ olena/oln/morpho/attribute_closing_opening_map.hh Sat, 26 Jun 2004 02:36:12 +0200 thivol_d (oln/j/49_attribute_ 1.11 600)
@@ -281,7 +281,7 @@
** \image latex oln_morpho_slow_card_closing.png
**
*/
- xxx_closing_map_decl(card);
+ xxx_closing_map_decl(card)
/*!
** \brief Perform a cardinal opening.
@@ -307,7 +307,7 @@
** \image latex oln_morpho_slow_card_opening.png
**
*/
- xxx_opening_map_decl(card);
+ xxx_opening_map_decl(card)
/*!
** \brief Perform an integral closing.
@@ -334,7 +334,7 @@
** \image latex oln_morpho_slow_integral_closing.png
**
*/
- xxx_closing_map_decl(integral);
+ xxx_closing_map_decl(integral)
/*!
** \brief Perform an integral opening.
@@ -361,7 +361,7 @@
** \image latex oln_morpho_slow_integral_opening.png
**
*/
- xxx_opening_map_decl(integral);
+ xxx_opening_map_decl(integral)
/*!
** \brief Perform a height closing.
@@ -387,7 +387,7 @@
** \image latex oln_morpho_slow_height_opening.png
**
*/
- xxx_opening_map_decl(height);
+ xxx_opening_map_decl(height)
/*!
** \brief Perform a height closing.
@@ -414,7 +414,7 @@
** \image latex oln_morpho_slow_height_closing.png
**
*/
- xxx_closing_map_decl(height);
+ xxx_closing_map_decl(height)
/*!
@@ -442,7 +442,7 @@
** \image latex oln_morpho_slow_maxvalue_closing.png
**
*/
- xxx_closing_map_decl(maxvalue);
+ xxx_closing_map_decl(maxvalue)
/*!
** \brief Perform a maxvalue opening.
@@ -469,7 +469,7 @@
** \image latex oln_morpho_slow_maxvalue_opening.png
**
*/
- xxx_opening_map_decl(maxvalue);
+ xxx_opening_map_decl(maxvalue)
/*!
** \brief Perform a minvalue opening.
@@ -496,7 +496,7 @@
** \image latex oln_morpho_slow_minvalue_opening.png
**
*/
- xxx_opening_map_decl(minvalue);
+ xxx_opening_map_decl(minvalue)
/*!
** \brief Perform a minvalue closing.
@@ -523,7 +523,7 @@
** \image latex oln_morpho_slow_minvalue_closing.png
**
*/
- xxx_closing_map_decl(minvalue);
+ xxx_closing_map_decl(minvalue)
/*!
** \brief Perform a ball opening.
@@ -550,7 +550,7 @@
** \image latex oln_morpho_slow_ball_opening.png
**
*/
- xxx_opening_im_map_decl(ball);
+ xxx_opening_im_map_decl(ball)
/*!
** \brief Perform a ball closing.
@@ -577,7 +577,7 @@
** \image latex oln_morpho_slow_ball_closing.png
**
*/
- xxx_closing_im_map_decl(ball);
+ xxx_closing_im_map_decl(ball)
/*!
** \brief Perform a dist opening.
@@ -604,7 +604,7 @@
** \image latex oln_morpho_slow_dist_opening.png
**
*/
- xxx_opening_im_map_decl(dist);
+ xxx_opening_im_map_decl(dist)
/*!
** \brief Perform a dist closing.
@@ -631,7 +631,7 @@
** \image latex oln_morpho_slow_dist_closing.png
**
*/
- xxx_closing_im_map_decl(dist);
+ xxx_closing_im_map_decl(dist)
/*!
** \brief Perform a cube closing.
@@ -658,7 +658,7 @@
** \image latex oln_morpho_slow_cube_closing.png
**
*/
- xxx_closing_im_map_decl(cube);
+ xxx_closing_im_map_decl(cube)
/*!
** \brief Perform a cube opening.
@@ -685,7 +685,7 @@
** \image latex oln_morpho_slow_cube_opening.png
**
*/
- xxx_opening_im_map_decl(cube);
+ xxx_opening_im_map_decl(cube)
/*!
** \brief Perform a box closing.
@@ -713,7 +713,7 @@
** \image latex oln_morpho_slow_box_closing.png
**
*/
- xxx_closing_im_map_decl(box);
+ xxx_closing_im_map_decl(box)
/*!
** \brief Perform a box opening.
@@ -741,7 +741,7 @@
** \image latex oln_morpho_slow_box_opening.png
**
*/
- xxx_opening_im_map_decl(box);
+ xxx_opening_im_map_decl(box)
} // end of namespace slow
Index: integre/ntg/core/pred_succ.hh
--- integre/ntg/core/pred_succ.hh Tue, 30 Mar 2004 12:40:46 +0200 van-vl_n (oln/k/8_pred_succ. 1.2 600)
+++ integre/ntg/core/pred_succ.hh Fri, 25 Jun 2004 18:18:37 +0200 thivol_d (oln/k/8_pred_succ. 1.2 600)
@@ -59,7 +59,7 @@
T
succ(const T &t)
{
- return T(internal::with_arith<T>::ret(t) + 1);
+ return T(typename internal::with_arith<T>::ret(t) + 1);
}
/*! Return the predecessor of \a t.
@@ -70,7 +70,7 @@
T
pred(const T&t)
{
- return T(internal::with_arith<T>::ret(t) - 1);
+ return T(typename internal::with_arith<T>::ret(t) - 1);
}
namespace internal {
Index: olena/oln/utils/buffer.hxx
--- olena/oln/utils/buffer.hxx Fri, 19 Mar 2004 17:28:35 +0100 palma_g (oln/k/9_buffer.hxx 1.2 600)
+++ olena/oln/utils/buffer.hxx Sat, 26 Jun 2004 01:10:37 +0200 thivol_d (oln/k/9_buffer.hxx 1.2 600)
@@ -39,7 +39,7 @@
{
data_.reserve(length_);
data_.push_back(ntg_zero_val(value_type));
-};
+}
// add implementation
template <class E>
@@ -54,7 +54,7 @@
push_back(e_cast & mask, !count);
mask >>= 1;
}
-};
+}
// push_back implementation
inline
@@ -109,7 +109,7 @@
precondition(n < data_.size());
return reorder(data_[n]);
-};
+}
// append padding implementation
inline
@@ -119,7 +119,7 @@
while (((data_.size() * 32) % 512) != 448)
push_back(false, true);
padding_appended_ = true;
-};
+}
// append_length implementation
inline
@@ -130,14 +130,14 @@
add(reorder(len2_), false);
add(reorder(len1_), false);
length_appended_ = true;
-};
+}
// size implementation.
inline
unsigned buffer::size() const
{
return data_.size();
-};
+}
// bit len implementation.
inline
Index: olena/oln/utils/key.hxx
--- olena/oln/utils/key.hxx Fri, 19 Mar 2004 17:28:35 +0100 palma_g (oln/k/11_key.hxx 1.2 600)
+++ olena/oln/utils/key.hxx Sat, 26 Jun 2004 01:10:10 +0200 thivol_d (oln/k/11_key.hxx 1.2 600)
@@ -50,7 +50,7 @@
{
precondition(i < 16);
return data_[i];
-};
+}
// [] operator
inline
@@ -58,7 +58,7 @@
{
precondition(i < 16);
return data_[i];
-};
+}
// == operator
inline
Index: olena/oln/utils/md5.hxx
--- olena/oln/utils/md5.hxx Tue, 13 Apr 2004 21:22:13 +0200 van-vl_n (oln/k/13_md5.hxx 1.3 600)
+++ olena/oln/utils/md5.hxx Sat, 26 Jun 2004 01:29:42 +0200 thivol_d (oln/k/13_md5.hxx 1.3 600)
@@ -110,7 +110,7 @@
T.push_back(0xbd3af235); /* 62 */
T.push_back(0x2ad7d2bb); /* 63 */
T.push_back(0xeb86d391); /* 64 */
-};
+}
// sav() implementation.
inline
@@ -226,7 +226,7 @@
b += bb;
c += cc;
d += dd;
-};
+}
// sub step implementation.
template <class Fun>
Index: olena/oln/utils/md5.hh
--- olena/oln/utils/md5.hh Tue, 13 Apr 2004 21:22:13 +0200 van-vl_n (oln/k/14_md5.hh 1.3 600)
+++ olena/oln/utils/md5.hh Sat, 26 Jun 2004 01:32:12 +0200 thivol_d (oln/k/14_md5.hh 1.3 600)
@@ -142,7 +142,7 @@
**
** F(X,Y,Z) = XY v not(X) Z
*/
- struct
+ struct F_
{
storage_type operator()(const storage_type &x,
const storage_type &y,
@@ -151,14 +151,16 @@
// return z ^ (x & (y ^ z));
return x & y | ~x & z;
}
- } F;
+ };
+
+ F_ F;
/*!
** \brief Functor for bit operations.
**
** G(X,Y,Z) = XZ v Y not(Z)
*/
- struct
+ struct G_
{
storage_type operator()(const storage_type &x,
const storage_type &y,
@@ -166,14 +168,16 @@
{
return x & z | y & ~z;
}
- } G;
+ };
+
+ G_ G;
/*!
** \brief Functor for bit operations.
**
** H(X,Y,Z) = X xor Y xor Z
*/
- struct
+ struct H_
{
storage_type operator()(const storage_type &x,
const storage_type &y,
@@ -181,14 +185,16 @@
{
return x ^ y ^ z;
}
- } H;
+ };
+
+ H_ H;
/*!
** \brief Functor for bit operations.
**
** I(X,Y,Z) = Y xor (X v not(Z))
*/
- struct
+ struct I_
{
storage_type operator()(const storage_type &x,
const storage_type &y,
@@ -196,7 +202,10 @@
{
return y ^ (x | ~z);
}
- } I;
+ };
+
+ I_ I;
+
};
#include <oln/utils/md5.hxx>
Index: olena/oln/morpher/subq_morpher.hh
--- olena/oln/morpher/subq_morpher.hh Sat, 03 Apr 2004 14:42:26 +0200 thivol_d (oln/m/25_subq_morph 1.3 600)
+++ olena/oln/morpher/subq_morpher.hh Sat, 26 Jun 2004 02:21:14 +0200 thivol_d (oln/m/25_subq_morph 1.3 600)
@@ -184,7 +184,7 @@
const impl_type*
impl() const
{
- return ima_.impl();
+ return this->ima_.impl();
}
static std::string
Index: olena/oln/morpher/color_morpher.hh
--- olena/oln/morpher/color_morpher.hh Sat, 03 Apr 2004 23:02:21 +0200 thivol_d (oln/m/26_color_morp 1.4 600)
+++ olena/oln/morpher/color_morpher.hh Fri, 25 Jun 2004 18:35:21 +0200 thivol_d (oln/m/26_color_morp 1.4 600)
@@ -141,14 +141,14 @@
impl_type*
impl()
{
- return ima_.impl();
+ return this->ima_.impl();
}
/// Return the image implementation.
const impl_type*
impl() const
{
- return ima_.impl();
+ return this->ima_.impl();
}
Index: olena/oln/morpher/piece_morpher.hh
--- olena/oln/morpher/piece_morpher.hh Sun, 04 Apr 2004 16:48:06 +0200 odou_s (oln/m/40_piece_morp 1.2 600)
+++ olena/oln/morpher/piece_morpher.hh Sat, 26 Jun 2004 01:02:26 +0200 thivol_d (oln/m/40_piece_morp 1.2 600)
@@ -206,7 +206,7 @@
at(const point_type& p)
{
return const_cast<value_type &>
- ( const_cast<SrcType &>(this->ima_)[p + p_] );
+ ( const_cast<SrcType &>(this->ima_)[p + this->p_] );
}
/*!
@@ -217,7 +217,7 @@
const value_type
at(const point_type& p) const
{
- return this->ima_[p + p_];
+ return this->ima_[p + this->p_];
}
/*! Perform a shallow copy from the decorated image of \a rhs
@@ -301,7 +301,7 @@
const value_type
at(const point_type &p) const
{
- return this->ima_[p + p_];
+ return this->ima_[p + this->p_];
}
/// Useful to debug.
Index: olena/oln/morpher/slicing_morpher.hh
--- olena/oln/morpher/slicing_morpher.hh Sun, 04 Apr 2004 16:48:06 +0200 odou_s (oln/m/42_slicing_mo 1.3 600)
+++ olena/oln/morpher/slicing_morpher.hh Sat, 26 Jun 2004 02:22:34 +0200 thivol_d (oln/m/42_slicing_mo 1.3 600)
@@ -205,7 +205,7 @@
** since it is protected.
*/
super_slicing_morpher(const SrcType &ima, const coord slice)
- : super_type(ima), slice_(slice), size_(image_size_dec(ima_.size())), impl_(size_)
+ : super_type(ima), slice_(slice), size_(image_size_dec(this->ima_.size())), impl_(size_)
{}
/*!
@@ -273,13 +273,13 @@
value_type&
at(const point_type &p)
{
- typename SrcType::point_type tmp_p(p, slice_);
+ typename SrcType::point_type tmp_p(p, this->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_);
+ typename SrcType::point_type tmp_p(p, this->slice_);
return this->ima_[tmp_p];
}
@@ -363,7 +363,7 @@
const value_type
at(const point_type &p) const
{
- typename SrcType::point_type tmp_p(p, slice_);
+ typename SrcType::point_type tmp_p(p, this->slice_);
return this->ima_[tmp_p];
}
Index: olena/oln/topo/tarjan/tarjan_with_attr.hh
--- olena/oln/topo/tarjan/tarjan_with_attr.hh Fri, 02 Apr 2004 18:35:46 +0200 palma_g (oln/m/46_tarjan_wit 1.3 600)
+++ olena/oln/topo/tarjan/tarjan_with_attr.hh Sat, 26 Jun 2004 20:58:29 +0200 thivol_d (oln/m/46_tarjan_wit 1.3 600)
@@ -70,7 +70,8 @@
typedef tarjan<exact_type> super_type; ///< Type of parent class.
// Make parent class able to call implementations.
- friend class super_type;
+ friend class tarjan<exact_type>;
+ //friend class super_type;
/*!
** \brief Return the attribute value associated to a
@@ -148,7 +149,7 @@
image_out_type
get_compute_impl(const oln::abstract::neighborhood<N> &Ng)
{
- std::vector<point_type> I(get_processing_order());
+ std::vector<point_type> I(this->get_processing_order());
level::fill(to_comp_, ntg_sup_val(comp_type));
to_comp_.border_adapt_assign(Ng.delta(), ntg_sup_val(comp_type));
Index: olena/oln/utils/qsort.hh
--- olena/oln/utils/qsort.hh Sun, 23 May 2004 13:55:35 +0200 palma_g (oln/r/9_qsort.hh 1.1 600)
+++ olena/oln/utils/qsort.hh Sat, 26 Jun 2004 20:48:03 +0200 thivol_d (oln/r/9_qsort.hh 1.1 600)
@@ -28,6 +28,7 @@
# define OLN_UTILS_QSORT_HH
# include <vector>
# include <oln/core/abstract/image.hh>
+# include <oln/core/abstract/image_with_type_with_dim.hh>
# include <algorithm>
# include <iostream>
Index: olena/oln/transforms/shapelets.hh
--- olena/oln/transforms/shapelets.hh Tue, 15 Jun 2004 19:50:21 +0200 thivol_d (oln/r/10_shapelets. 1.3 600)
+++ olena/oln/transforms/shapelets.hh Fri, 25 Jun 2004 14:12:22 +0200 thivol_d (oln/r/10_shapelets. 1.3 600)
@@ -111,7 +111,7 @@
oln_iter_type(I) it(ima);
for_all(it)
{
- s += (ima[it] - ntg_max_val(oln_value_type(I)) / 2) *
+ s += (ima[it]) * //ntg_max_val(oln_value_type(I)) - ima[it]) *
func(k, l, double(it.row() - row), double(it.col() - col), b);
}
res[k * n + l] = s;
@@ -137,18 +137,18 @@
oln_iter_type(tmp_type) it(resf);
- oln::level::fill(resf, ntg_max_val(D) / 2);
+ oln::level::fill(resf, ntg_min_val(D));
// For each vector
for (int k = 0; k < m; k++)
for (int l = 0; l < n; l++)
// Add the value at the point
{
- if (vec[k * n + l] * vec[k * n + l] > 40000)
+ if (vec[k * n + l] * vec[k * n + l] > 20000)
{
for_all(it)
resf[it] += vec[k * n + l] *
shapelets_basis<2, double>()(k, l, double(it.row() - nrows / 2), double(it.col() - ncols / 2), b);
- //std::cout << k << " - " << l << std::endl;
+ std::cout << k << " - " << l << " = " << vec[k * n + l] << std::endl;
}
}
Index: olena/oln/morpher/func_morpher.hh
--- olena/oln/morpher/func_morpher.hh Tue, 15 Jun 2004 19:50:21 +0200 thivol_d (oln/r/14_func_morph 1.1 600)
+++ olena/oln/morpher/func_morpher.hh Fri, 25 Jun 2004 17:29:08 +0200 thivol_d (oln/r/14_func_morph 1.1 600)
@@ -117,14 +117,14 @@
const value_type
at(const point_type& p) const
{
- return f(ima_, p);
+ return f(this->ima_, p);
}
/// Return the implementation.
const impl_type*
impl() const
{
- return ima_.impl();
+ return this->ima_.impl();
}
static std::string
Index: olena/oln/core/fpoint2d.hh
--- olena/oln/core/fpoint2d.hh Tue, 15 Jun 2004 19:50:21 +0200 thivol_d (oln/r/15_fpoint2d.h 1.1 600)
+++ olena/oln/core/fpoint2d.hh Sat, 26 Jun 2004 20:11:44 +0200 thivol_d (oln/r/15_fpoint2d.h 1.1 600)
@@ -30,6 +30,7 @@
# include <iostream>
+# include <oln/core/image2d.hh>
# include <oln/core/abstract/image.hh>
# include <oln/core/point2d.hh>
Merci d'etre arrive jusque la, au passage, je sais pas trop si c'est correct:
Make ... compliant to g++-3.4 :)
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
3
14
Index: ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* NEWS: Add g++ 3.4 compliance.
Index: tools/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* tools/utilities/convert/color_space.cc: Make the file compliant with
g++-3.4.
* tools/utilities/convert/Makefile.am: Add missing library include to
the compilation flags.
Index: NEWS
--- NEWS Thu, 15 Apr 2004 19:46:21 +0200 van-vl_n (oln/0_NEWS 1.23 600)
+++ NEWS Mon, 28 Jun 2004 15:49:27 +0200 thivol_d (oln/0_NEWS 1.23 600)
@@ -1,3 +1,7 @@
+Olena 0.11 unknown date
+
+ * Olena now compiles with g++ 3.4.
+
Olena 0.10 April 15, 2004
* New documentation system.
Index: tools/utilities/convert/color_space.cc
--- tools/utilities/convert/color_space.cc Wed, 23 Jun 2004 12:41:33 +0200 van-vl_n (oln/u/19_color_spac 1.1 600)
+++ tools/utilities/convert/color_space.cc Mon, 28 Jun 2004 15:47:47 +0200 thivol_d (oln/u/19_color_spac 1.1 600)
@@ -149,20 +149,20 @@
}
-FROM_X_TO_RGB(hsi);
-FROM_RGB_TO_X(hsi);
-FROM_X_TO_RGB(hsl);
-FROM_RGB_TO_X(hsl);
-FROM_X_TO_RGB(hsv);
-FROM_RGB_TO_X(hsv);
-FROM_X_TO_RGB(nrgb);
-FROM_RGB_TO_X(nrgb);
-FROM_X_TO_RGB(xyz);
-FROM_RGB_TO_X(xyz);
-FROM_X_TO_RGB(yiq);
-FROM_RGB_TO_X(yiq);
-FROM_X_TO_RGB(yuv);
-FROM_RGB_TO_X(yuv);
+FROM_X_TO_RGB(hsi)
+FROM_RGB_TO_X(hsi)
+FROM_X_TO_RGB(hsl)
+FROM_RGB_TO_X(hsl)
+FROM_X_TO_RGB(hsv)
+FROM_RGB_TO_X(hsv)
+FROM_X_TO_RGB(nrgb)
+FROM_RGB_TO_X(nrgb)
+FROM_X_TO_RGB(xyz)
+FROM_RGB_TO_X(xyz)
+FROM_X_TO_RGB(yiq)
+FROM_RGB_TO_X(yiq)
+FROM_X_TO_RGB(yuv)
+FROM_RGB_TO_X(yuv)
Index: tools/utilities/convert/Makefile.am
--- tools/utilities/convert/Makefile.am Wed, 23 Jun 2004 12:41:33 +0200 van-vl_n (oln/v/10_Makefile.a 1.1 600)
+++ tools/utilities/convert/Makefile.am Mon, 28 Jun 2004 15:47:41 +0200 thivol_d (oln/v/10_Makefile.a 1.1 600)
@@ -1,4 +1,4 @@
-AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_OPTIMIZE)
+AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_OPTIMIZE) -lz
INCLUDES = -I$(srcdir)/../../lib
LDADD = ../../lib/libolntools.a
bin_PROGRAMS = color_space
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
3
2
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* oln/morpher/border_morpher.hh: Make compliant to g++-3.4.
+2004-06-26 Damien Thivolle <damien(a)lrde.epita.fr>
+
* oln/convert/rgbnrgb.hh: Make compliant to g++-3.4.
* oln/convert/rgbxyz.hh: Likewise.
* oln/topo/dmap.hxx: Likewise.
Index: olena/oln/morpher/border_morpher.hh
--- olena/oln/morpher/border_morpher.hh Tue, 15 Jun 2004 20:36:26 +0200 odou_s (oln/u/15_border_mor 1.1 600)
+++ olena/oln/morpher/border_morpher.hh Sun, 27 Jun 2004 23:19:20 +0200 thivol_d (oln/u/15_border_mor 1.1 600)
@@ -117,13 +117,13 @@
const BehaviorType& be)
: super_type(ima), width(width), be(be)
{
- be.adapt_border(ima, width + get_ima().border());
+ be.adapt_border(ima, width + this->get_ima().border());
for (unsigned i = 0; i < image_id<exact_type>::dim; ++i)
{
- size_.nth(i) = get_ima().size().nth(i) + 2 * width;
+ size_.nth(i) = this->get_ima().size().nth(i) + 2 * width;
dp_.nth(i) = -width;
}
- size_.border() = get_ima().size().border();
+ size_.border() = this->get_ima().size().border();
}
const coord width; ///< The width of the border.
@@ -232,7 +232,7 @@
at(const point_type& p)
{
return const_cast<value_type &>
- ( const_cast<SrcType &>(this->ima_)[p + get_dp()] );
+ ( const_cast<SrcType &>(this->ima_)[p + this->get_dp()] );
}
/*!
@@ -243,7 +243,7 @@
const value_type
at(const point_type& p) const
{
- return this->ima_[p + get_dp()];
+ return this->ima_[p + this->get_dp()];
}
/*! Perform a shallow copy from the decorated image of \a rhs
@@ -329,7 +329,7 @@
const value_type
at(const point_type &p) const
{
- return this->ima_[p + get_dp()];
+ return this->ima_[p + this->get_dp()];
}
/// Useful to debug.
A vos checkin pour la 10.200 :)
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
3
3
Index: ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* configure.ac: Add convert utilities.
Index: tools/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* tools/utilities/convert/color_space.cc: New file. Convert
from a color space to another.
* tools/utilities/convert/Makefile.am: New file.
Index: configure.ac
--- configure.ac Wed, 14 Apr 2004 16:47:52 +0200 thivol_d
(oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.5 600)
+++ configure.ac Wed, 23 Jun 2004 09:22:34 +0200 van-vl_n
(oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.5 600)
@@ -353,6 +353,15 @@
[tools/utilities/morpho/Makefile],
[], [morpho])
+### The convert utilities are a component.
+ OLN_COMPONENT([tools/utilities/convert],
+ [convert-utilities],
+ [oln_cv_build_convert_utils],
+ [the convert utilities],
+ [OLN_UTILITIES],
+ [tools/utilities/convert/Makefile],
+ [], [convert])
+
])dnl End of OLN_COLLECTION([OLN_UTILITIES])
], [utilities])dnl End of OLN_COMPONENT([tools/utilities])
Index: tools/utilities/convert/color_space.cc
--- tools/utilities/convert/color_space.cc Wed, 23 Jun 2004 12:37:49
+0200 van-vl_n ()
+++ tools/utilities/convert/color_space.cc Wed, 23 Jun 2004 12:36:22
+0200 van-vl_n (oln/u/17_color_spac 644)
@@ -0,0 +1,268 @@
+// -*-
c++ -*-
+// Copyright (C) 2004 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+//
+// How to add a new color space (ex:hsi)?
+//
+// 1) Add header "#include <oln/convert/rgbhsi.hh>"
+// 2) Add "FROM_X_TO_RGB(hsi);"
+// "FROM_RGB_TO_X(hsi);"
+// 3) Add "else if (cs_in == "hsi")
+// r = from_x_to_rgb(copy_to_x<hsi_8>(i));"
+// 4) Add "else if (cs_out == "hsi")
+// save(from_rgb_to_x<hsi_8>(r), f_out);"
+// 3) update help usage()
+//
+
+#include <oln/basics2d.hh>
+#include <ntg/color.hh>
+#include <oln/convert/rgbhsi.hh>
+#include <oln/convert/rgbhsl.hh>
+#include <oln/convert/rgbhsv.hh>
+#include <oln/convert/rgbnrgb.hh>
+#include <oln/convert/rgbxyz.hh>
+#include <oln/convert/rgbyiq.hh>
+#include <oln/convert/rgbyuv.hh>
+#include <getopt.hh>
+
+using namespace oln;
+using namespace ntg;
+
+static struct option long_options[] =
+ {
+ { "help", no_argument, 0, 'h' },
+ { "version", no_argument, 0, 'V' },
+ { 0, 0, 0, 0 }
+ };
+
+
+
+//! Help and exit
+void
+usage(const char *pg)
+{
+ std::cout << "Usage : " << pg
+ << " FileIn.ppm FileOut.ppm Color_space_in Color_space_out"
+ << std::endl
+ << "Example : `" << pg
+ << " ../../../olena/img/lena.ppm lena_hsl.ppm rgb hsl"
+ << std::endl
+ << "Color space: hsi hsl hsv nrgb xyz yiq yuv rgb"
+ << std::endl
+ << "Note : every conversion goes through the rgb"
+ << "color space."
+ << std::endl
+ << "Report bugs to <" OLN_PACKAGE_BUGREPORT ">." << std::endl;
+ exit(1);
+}
+
+void
+version(const char *pg)
+{
+ std::cout << pg << " for Olena " << OLN_PACKAGE_VERSION << std::endl
+ << std::endl
+ << "Copyright (C) 2004 EPITA Research and Development Laboratory."
+ << std::endl
+ << "This is free software; see the source for copying conditions."
+ << " There is NO"
+ << std::endl
+ << "warranty; not even for MERCHANTABILITY or FITNESS FOR A"
+ <<" PARTICULAR PURPOSE."
+ << std::endl << std::endl
+ << "Written by Niels Van Vliet <niels(a)lrde.epita.fr>" << std::endl;
+ exit(0);
+}
+
+
+//! cast an rgb_8 image to a x image
+template<class D, class I>
+typename oln::mute<I, D>::ret
+copy_to_x(const oln::abstract::vectorial_image<I> &i)
+{
+ //Not very clean.
+ assert(ntg_nb_comp(oln_value_type(I)) == 3);
+ typename oln::mute<I, D>::ret out(i.size());
+
+ oln_iter_type(I) it(i);
+ for_all(it)
+ for (unsigned c = 0; c < 3; ++c)
+ out[it][c] = i[it][c];
+ return out;
+}
+
+
+
+template<class T>
+oln::image2d<ntg::rgb_8>
+from_x_to_rgb(const oln::image2d<T> &in)
+{
+ assert(0);
+}
+
+#define FROM_X_TO_RGB(T) \
+ template<> \
+ oln::image2d<ntg::rgb_8> \
+ from_x_to_rgb<ntg::T##_8>(const oln::image2d<ntg::T##_8>&in) \
+ { \
+ return apply(oln::convert::f_##T##_to_rgb<8, 8>(), in); \
+ }
+
+
+template<class T>
+oln::image2d<T>
+from_rgb_to_x(const oln::image2d<ntg::rgb_8> &in)
+{
+ assert(0);
+}
+
+#define FROM_RGB_TO_X(T) \
+ template<> \
+ oln::image2d<ntg::T##_8> \
+ from_rgb_to_x<ntg::T##_8>(const oln::image2d<ntg::rgb_8>&in) \
+ { \
+ return apply(oln::convert::f_rgb_to_##T<8, 8>(), in); \
+ }
+
+
+FROM_X_TO_RGB(hsi);
+FROM_RGB_TO_X(hsi);
+FROM_X_TO_RGB(hsl);
+FROM_RGB_TO_X(hsl);
+FROM_X_TO_RGB(hsv);
+FROM_RGB_TO_X(hsv);
+FROM_X_TO_RGB(nrgb);
+FROM_RGB_TO_X(nrgb);
+FROM_X_TO_RGB(xyz);
+FROM_RGB_TO_X(xyz);
+FROM_X_TO_RGB(yiq);
+FROM_RGB_TO_X(yiq);
+FROM_X_TO_RGB(yuv);
+FROM_RGB_TO_X(yuv);
+
+
+
+
+using namespace oln;
+using namespace ntg;
+int
+main(int argc,
+ char **argv)
+{
+
+ int c;
+ int opt_index = 0;
+ while ((c = getopt_long (argc, argv, "hV:", long_options,
&opt_index)) != -1)
+ switch (c)
+ {
+ case ':':
+ case '?':
+ std::cerr << "Try `" << argv[0]
+ << " --help' for more information." << std::endl;
+ exit (1);
+
+ case 'h':
+ usage(argv[0]);
+
+ case 'V':
+ version(argv[0]);
+
+ default:
+ opt_index = 0;
+ break;
+ }
+
+
+ if ((optind + 4) != argc)
+ usage(argv[0]);
+
+ const std::string f_in (argv[optind]);
+ const std::string f_out (argv[optind + 1]);
+ const std::string cs_in (argv[optind + 2]);
+ const std::string cs_out (argv[optind + 3]);
+
+ image2d<rgb_8> i (f_in);
+ if (!i.has_impl())
+ {
+ std::cout << "File not found: "<< f_in << std::endl;
+ usage(argv[0]);
+ }
+
+ if (cs_in == cs_out)
+ {
+ save(i, f_out);
+ exit(0);
+ }
+
+ // First the image is cast into the input type given by the user, and
+ // converted to rgb.
+ image2d<rgb_8> r;
+ if (cs_in == "hsi")
+ r = from_x_to_rgb(copy_to_x<hsi_8>(i));
+ else if (cs_in == "hsl")
+ r = from_x_to_rgb(copy_to_x<hsl_8>(i));
+ else if (cs_in == "hsv")
+ r = from_x_to_rgb(copy_to_x<hsv_8>(i));
+ else if (cs_in == "nrgb")
+ r = from_x_to_rgb(copy_to_x<nrgb_8>(i));
+ else if (cs_in == "xyz")
+ r = from_x_to_rgb(copy_to_x<xyz_8>(i));
+ else if (cs_in == "yiq")
+ r = from_x_to_rgb(copy_to_x<yiq_8>(i));
+ else if (cs_in == "yuv")
+ r = from_x_to_rgb(copy_to_x<yuv_8>(i));
+ else if (cs_in == "rgb")
+ r = i;
+ else
+ {
+ std::cout << "Format not supported: " << cs_in << std::endl;
+ usage(argv[0]);
+ }
+
+ // Then the rgb image is converted to the output type given by the user.
+ if (cs_out == "hsi")
+ save(from_rgb_to_x<hsi_8>(r), f_out);
+ else if (cs_out == "hsl")
+ save(from_rgb_to_x<hsl_8>(r), f_out);
+ else if (cs_out == "hsv")
+ save(from_rgb_to_x<hsv_8>(r), f_out);
+ else if (cs_out == "nrgb")
+ save(from_rgb_to_x<nrgb_8>(r), f_out);
+ else if (cs_out == "xyz")
+ save(from_rgb_to_x<xyz_8>(r), f_out);
+ else if (cs_out == "yiq")
+ save(from_rgb_to_x<yiq_8>(r), f_out);
+ else if (cs_out == "yuv")
+ save(from_rgb_to_x<yuv_8>(r), f_out);
+ else if (cs_out == "rgb")
+ save(r, f_out);
+ else
+ {
+ std::cout << "Format not supported: " << cs_out << std::endl;
+ usage(argv[0]);
+ }
+}
Index: tools/utilities/convert/Makefile.am
--- tools/utilities/convert/Makefile.am Wed, 23 Jun 2004 12:37:49 +0200
van-vl_n ()
+++ tools/utilities/convert/Makefile.am Wed, 23 Jun 2004 12:29:03 +0200
van-vl_n (oln/u/18_Makefile.a 644)
@@ -0,0 +1,5 @@
+AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_OPTIMIZE)
+INCLUDES = -I$(srcdir)/../../lib
+LDADD = ../../lib/libolntools.a
+bin_PROGRAMS = color_space
+color_space_SOURCES = color_space.cc
3
5
Index: ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* config/oln.m4: set TOOLS_LDFLAGS inside of LDFLAGS.
* configure.ac: Export TOOLS_LDFLAGS.
Index: doc/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* ref/out/exdoc.config.in: Use TOOLS_LDFLAGS instead of LDLAGS.
Index: configure.ac
--- configure.ac Wed, 23 Jun 2004 12:41:33 +0200 van-vl_n (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.6 600)
+++ configure.ac Thu, 24 Jun 2004 17:47:30 +0200 simon (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.6 600)
@@ -457,6 +457,7 @@
])dnl End of OLN_COLLECTION([OLN_TOP])
AC_SUBST([DOC_CPPFLAGS])
+AC_SUBST([TOOLS_LDFLAGS])
AC_OUTPUT
Index: config/oln.m4
--- config/oln.m4 Mon, 14 Jun 2004 17:26:55 +0200 odou_s (oln/j/15_oln.m4 1.38.1.7 600)
+++ config/oln.m4 Thu, 24 Jun 2004 17:41:32 +0200 simon (oln/j/15_oln.m4 1.38.1.7 600)
@@ -573,7 +573,9 @@
FFTW_LDFLAGS="-L${with_fftw}/lib"
fi
oln_save_CXXFLAGS=$CXXFLAGS
+ oln_save_LDFLAGS=$LDFLAGS
CXXFLAGS="$CXXFLAGS $FFTW_CXXFLAGS"
+ LDFLAGS="$LDFLAGS $FFTW_LDFLAGS"
oln_have_fftw=no
AC_CHECK_HEADER([fftw.h],
[AC_CHECK_LIB([fftw],
@@ -583,7 +585,8 @@
AC_DEFINE([HAVE_FFTW], 1,
[Define to 1 if we can use fftw])])])
CXXFLAGS=$oln_save_CXXFLAGS
- LDFLAGS="$LDFLAGS $FFTW_LDFLAGS"
+ LDFLAGS=$oln_save_LDFLAGS
+ TOOLS_LDFLAGS="$TOOLS_LDFLAGS $FFTW_LDFLAGS"
fi
AC_SUBST([FFTW_CXXFLAGS])
AC_SUBST([FFTW_LDFLAGS])
@@ -614,7 +617,9 @@
ZLIB_LDFLAGS="-L${with_zlib}/lib"
fi
oln_save_CXXFLAGS=$CXXFLAGS
+ oln_save_LDFLAGS=$LDFLAGS
CXXFLAGS="$CXXFLAGS $ZLIB_CXXFLAGS"
+ LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS"
oln_have_zlib=no
AC_CHECK_HEADER([zlib.h],
[AC_CHECK_LIB([z],
@@ -624,7 +629,8 @@
AC_DEFINE([HAVE_ZLIB], 1,
[Define to 1 if we can use zlib])])])
CXXFLAGS=$oln_save_CXXFLAGS
- LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS"
+ LDFLAGS=$oln_save_LDFLAGS
+ TOOLS_LDFLAGS="$TOOLS_LDFLAGS $ZLIB_LDFLAGS"
fi
AC_SUBST([ZLIB_CXXFLAGS])
AC_SUBST([ZLIB_LDFLAGS])
Index: doc/ref/out/exdoc.config.in
--- doc/ref/out/exdoc.config.in Mon, 14 Jun 2004 17:26:55 +0200 odou_s (oln/k/7_exdoc.conf 1.9 600)
+++ doc/ref/out/exdoc.config.in Thu, 24 Jun 2004 17:52:19 +0200 simon (oln/k/7_exdoc.conf 1.9 600)
@@ -5,7 +5,7 @@
CAPTIONS = cxx # We want to run cxx on the extracted files (see line below)
ALIAS cxx = @CXX@ # Here, cxx means g++ but you can choose other compilers
# FIXME: we should write the compilation line in the source file (for libs).
- OPTIONS = @DOC_CPPFLAGS@ @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_builddir@/olena -I@top_srcdir@/olena -I@top_srcdir@/metalic -I@top_builddir@ $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" -DHAVE_CONFIG_H @LDFLAGS@ # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
+ OPTIONS = @DOC_CPPFLAGS@ @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_builddir@/olena -I@top_srcdir@/olena -I@top_srcdir@/metalic -I@top_builddir@ $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" -DHAVE_CONFIG_H @TOOLS_LDFLAGS@ # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
OUT = out # FIXME: should be obsolete
EXT = cc # Extension of generated file
STD_OUT_EXT = std # Extension of generated file standard output
--
Simon Odou
simon(a)lrde.epita.fr
1
0

oln 10.194: Add func_morpher, rotation, translation, fpoint2d, and fdpoint2d
by Damien Thivolle 17 Jun '04
by Damien Thivolle 17 Jun '04
17 Jun '04
Je sais que y'a plein de trucs crades dans ce checkin, alors si vous avez des
suggestions, n'hesitez pas a m'en faire part, j'en tiendrai compte lorsque
je retoucherai tout ca (apres mon seminaire).
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* oln/makefile.src: Add new files to the distribution.
* oln/transforms/shapelets.hh: Small Changes.
* oln/morpher/func_morpher.hh: Add file, image can now be seen through
a functor.
* oln/core/fpoint2d.hh: Add file. Contain floating point
implementation.
* oln/core/fdpoint2d.hh: Add file. Contain floating dpoint
implementation.
* oln/geom/translate.hh: Add file. Implementation of image translation
using floating dpoint.
* oln/geom/rotate.hh: Add file. Implementation of image rotation using
floating point.
-2004-07-06 Damien Thivolle <damien(a)lrde.epita.fr>
+2004-06-07 Damien Thivolle <damien(a)lrde.epita.fr>
* oln/transforms/shapelets.hh: Change functions to functors,
bug fixes.
Index: olena/oln/makefile.src
--- olena/oln/makefile.src Mon, 14 Jun 2004 09:07:03 +0200 odou_s (oln/r/4_makefile.s 1.3 600)
+++ olena/oln/makefile.src Tue, 15 Jun 2004 19:41:15 +0200 thivol_d (oln/r/4_makefile.s 1.3 600)
@@ -76,7 +76,9 @@
core/dpoint2d.hxx \
core/dpoint3d.hh \
core/dpoint3d.hxx \
+ core/fdpoint2d.hh \
core/fold.hh \
+ core/fpoint2d.hh \
core/fwd_iter1d.hh \
core/fwd_iter2d.hh \
core/fwd_iter3d.hh \
@@ -113,6 +115,8 @@
core/window3d.hh \
core/winiter.hh \
core/winneighb.hh \
+ geom/rotate.hh \
+ geom/translate.hh \
io/base.hh \
io/basics.hh \
io/file.hh \
@@ -147,6 +151,7 @@
level/threshold.hh \
math/macros.hh \
morpher/color_morpher.hh \
+ morpher/func_morpher.hh \
morpher/generic_morpher.hh \
morpher/iter_morpher.hh \
morpher/piece_morpher.hh \
Index: olena/oln/transforms/shapelets.hh
--- olena/oln/transforms/shapelets.hh Mon, 07 Jun 2004 19:41:27 +0200 thivol_d (oln/r/10_shapelets. 1.2 600)
+++ olena/oln/transforms/shapelets.hh Tue, 15 Jun 2004 19:39:53 +0200 thivol_d (oln/r/10_shapelets. 1.2 600)
@@ -18,17 +18,21 @@
{
T operator()(unsigned n, T x)
{
+
if (n == 0)
return 1;
if (n == 1)
return 2. * x;
- return 2. * x * (*this)(n - 1, x) - 2. * double(n - 1) * (*this)(n - 2, x);
+ return 2. * x * (*this)(n - 1, x) - 2. * T(n - 1) * (*this)(n - 2, x);
}
};
template <class T>
struct fact : public std::unary_function<T, T>
{
+
+
+
T operator() (T n)
{
precondition(n >= 0);
@@ -49,7 +53,7 @@
T operator()(int n, T x)
{
assert(n >= 0);
- const double c = sqrt(pow(2.0, n) * sqrt(M_PI) * T(fact<int>()(n)));
+ const double c = sqrt(pow(2.0, n) * sqrt(M_PI) * fact<T>()(n));
return hermite<T>()(n, x) * exp(x * x / -2.0) / c;
}
@@ -111,6 +115,8 @@
func(k, l, double(it.row() - row), double(it.col() - col), b);
}
res[k * n + l] = s;
+ // std::cout << k << " - " << l << " = " << s << std::endl;
+
}
return res;
}
@@ -136,9 +142,15 @@
for (int k = 0; k < m; k++)
for (int l = 0; l < n; l++)
// Add the value at the point
+ {
+ if (vec[k * n + l] * vec[k * n + l] > 40000)
+ {
for_all(it)
resf[it] += vec[k * n + l] *
shapelets_basis<2, double>()(k, l, double(it.row() - nrows / 2), double(it.col() - ncols / 2), b);
+ //std::cout << k << " - " << l << std::endl;
+ }
+ }
image2d<D> res(oln::image2d_size(nrows, ncols, 0));
Index: olena/oln/morpher/func_morpher.hh
--- olena/oln/morpher/func_morpher.hh Tue, 15 Jun 2004 19:49:30 +0200 thivol_d ()
+++ olena/oln/morpher/func_morpher.hh Tue, 15 Jun 2004 16:01:36 +0200 thivol_d (oln/r/14_func_morph 644)
@@ -0,0 +1,142 @@
+// Copyright (C) 2004 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+
+
+#ifndef OLENA_MORPHER_FUNC_MORPHER_HH
+# define OLENA_MORPHER_FUNC_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class SrcType, class Ftor, class Exact = mlc::final>
+ struct func_morpher;
+
+
+ } // end of namespace morpher
+
+ template <class SrcType, class Ftor, class Exact>
+ struct image_id<oln::morpher::func_morpher<SrcType, Ftor, Exact> >
+ {
+ enum {dim = SrcType::dim};
+ /*! <The image dimension. */
+ typedef oln_impl_type(SrcType) impl_type;
+ /*! <The underlying implementation.*/
+ typedef oln_value_type(SrcType) value_type;
+ /*! <The modified value type.*/
+ typedef typename mlc::exact_vt<oln::morpher::func_morpher<SrcType, Ftor, Exact>,
+ Exact>::ret exact_type;
+
+ typedef oln_point_type(SrcType) point_type;
+ };
+
+ /*! Specialized version for subq_morpher.
+ **
+ ** \param SrcType Input type decorated.
+ **
+ ** \param N The new number of bits by components.
+ **
+ ** \param Exact The exact type of the morpher.
+ */
+ template <class SrcType, class Ftor, class Exact>
+ struct image_traits <oln::morpher::func_morpher<SrcType, Ftor, Exact> > :
+ public image_traits<oln::morpher::abstract::generic_morpher<SrcType,
+ typename image_id<oln::morpher::func_morpher<SrcType, Ftor, Exact> >::exact_type> >
+ {
+ };
+
+ namespace morpher {
+
+
+
+ template <class SrcType, class Ftor, class Exact>
+ struct func_morpher:
+ public abstract::generic_morpher<SrcType,
+ typename oln::image_id<func_morpher<SrcType, Ftor, Exact> >::exact_type>
+ {
+
+ Ftor f;
+
+ /// The exact type of \a this. This class can be derived.
+ typedef typename oln::image_id<func_morpher<SrcType, Ftor, Exact> >::exact_type exact_type;
+
+ /// The upper class.
+ typedef abstract::generic_morpher<SrcType,
+ exact_type> super_type;
+
+ /// The value point of the resulting image.
+ typedef typename image_id<exact_type>::value_type value_type;
+ typedef typename image_id<exact_type>::point_type point_type;
+ typedef typename image_id<exact_type>::impl_type impl_type;
+
+ /// Construct the morpher with an image.
+ func_morpher(const SrcType &ima, const Ftor f_)
+ : super_type(ima)
+ { f = f_;}
+
+ /// Construct the morpher with another morpher.
+ func_morpher(const func_morpher<SrcType, Ftor>& r)
+ : super_type(r.get_ima())
+ { f = r.f; }
+
+ /*! Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ func_morpher() {}
+
+ /// Return the value stored at \a p in the resulting image.
+ const value_type
+ at(const point_type& p) const
+ {
+ return f(ima_, p);
+ }
+
+ /// Return the implementation.
+ const impl_type*
+ impl() const
+ {
+ return ima_.impl();
+ }
+
+ static std::string
+ name()
+ {
+ return "subq_morpher<" + SrcType::name() + ">";
+ }
+
+ };
+ }
+}
+
+
+
+#endif // !OLENA_MORPHER_FUNC_MORPHER_HH
Index: olena/oln/core/fpoint2d.hh
--- olena/oln/core/fpoint2d.hh Tue, 15 Jun 2004 19:49:30 +0200 thivol_d ()
+++ olena/oln/core/fpoint2d.hh Tue, 15 Jun 2004 14:23:37 +0200 thivol_d (oln/r/15_fpoint2d.h 644)
@@ -0,0 +1,321 @@
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLENA_CORE_FPOINT2D_HH
+# define OLENA_CORE_FPOINT2D_HH
+
+# include <iostream>
+
+# include <oln/core/abstract/image.hh>
+# include <oln/core/point2d.hh>
+
+namespace oln {
+
+
+ // fwd decl
+ template <class F>
+ class fpoint2d;
+
+ template <class F>
+ class fdpoint2d;
+
+ /*! \class point_traits<fpoint2d>
+ **
+ ** The specialized version for fpoint2d.
+ */
+
+ template<class F>
+ struct point_traits<fpoint2d<F> >
+ {
+ enum { dim = 2 };
+ typedef fdpoint2d<F> dpoint_type;
+ };
+
+ /*! \class fpoint2d
+ **
+ ** Olena Floating class point2d.
+ */
+
+ template <class F>
+ class fpoint2d
+ {
+ private:
+
+ F coord_[2];
+
+ public:
+
+ typedef fpoint2d<F> exact_type;
+ typedef fpoint2d<F> self_type;
+ typedef fdpoint2d<F> dpoint_type;
+
+ fpoint2d(F x, F y)
+ {
+ coord_[0] = x;
+ coord_[1] = y;
+ }
+
+ fpoint2d()
+ {}
+
+ /// Give the value of the nth coordinate of the point.
+
+ F
+ row() const
+ {
+ return coord_[0];
+ }
+
+ F&
+ row()
+ {
+ return coord_[0];
+ }
+
+ F
+ col() const
+ {
+ return coord_[1];
+ }
+
+ F&
+ col()
+ {
+ return coord_[1];
+ }
+
+ F
+ nth(const unsigned dim) const
+ {
+ assert(dim < 2);
+ return coord_[dim];
+ }
+
+ /// Return a reference to the nth coordinate of the point.
+
+ F&
+ nth(const unsigned dim)
+ {
+ assert(dim < 2);
+ return coord_[dim];
+ }
+
+ exact_type
+ operator-() const
+ {
+ return exact_type(-coord_[0], -coord_[1]);
+ }
+
+ exact_type&
+ operator+=(const dpoint_type& dp)
+ {
+ row() += dp.row();
+ col() += dp.col();
+ return *this;
+ }
+
+ exact_type&
+ operator-=(const dpoint_type& dp)
+ {
+ row() += dp.row();
+ col() += dp.col();
+ return *this;
+ }
+
+ dpoint_type
+ operator-(const self_type& p) const
+ {
+ dpoint_type dp(row() - p.row(), col() - p.col());
+ return dp;
+ }
+
+
+ exact_type
+ operator-(const dpoint_type& dp) const
+ {
+ exact_type p = *this;
+ p += dp;
+ return p;
+ }
+
+ dpoint_type
+ operator+(const self_type& p) const
+ {
+ dpoint_type dp(row() + p.row(), col() + p.col());
+ return dp;
+ }
+
+ exact_type
+ operator+(const dpoint_type& dp) const
+ {
+ exact_type p = *this;
+ p -= dp;
+ return p;
+ }
+
+
+ /*! \brief Test if \a p and the current point have the same coordinates
+ **
+ ** \return True if \a p and the current point have the same coordinates,
+ ** false otherwise.
+ */
+
+ bool
+ operator==(const self_type& p) const
+ {
+ return p.nth(0) == coord_[0] && p.nth(1) == coord_[1];
+ }
+
+
+ /*! \brief Test if \a p and the current point do
+ ** not have the same coordinates.
+ **
+ ** \return False if \a p and the current point have
+ ** the same coordinates, true otherwise.
+ */
+
+ bool
+ operator!=(const self_type& p) const
+ {
+ return !(p.nth(0) == coord_[0] && p.nth(1) == coord_[1]);
+ }
+
+
+
+ };
+
+ template <class T>
+ struct func_traits
+ {
+ };
+
+ template <class T, class F>
+ struct nearest;
+
+ template <class T, class F>
+ struct bilinear;
+
+ template <class T, class F>
+ struct func_traits<nearest<T, F> >
+ {
+ typedef F f_type;
+ };
+
+ template <class T, class F>
+ struct func_traits<bilinear<T, F> >
+ {
+ typedef F f_type;
+ };
+
+ template <class T, class Exact>
+ struct fpoint2d_access
+ {
+
+ typedef typename func_traits<Exact>::f_type f_type;
+
+ const T operator()(const image2d<T> &ima, const fpoint2d<f_type> p) const
+ {
+ return (static_cast<const Exact *>(this))->access_impl(ima, p);
+ }
+
+ };
+
+
+ template <class T, class F>
+ struct nearest : public fpoint2d_access<T, nearest<T, F> >
+ {
+
+ const T access_impl(const image2d<T> &ima, const fpoint2d<F> p) const
+ {
+
+ point2d p2d(int(p.nth(0)), int(p.nth(1)));
+
+ if (ima.hold(p2d))
+ return ima[p2d];
+ else // FIXME : should be ntg_max_val(T)
+ return ntg::rgb_8(255, 255, 255);
+ }
+
+ };
+
+ template <class T, class F>
+ struct bilinear : public fpoint2d_access<T, bilinear<T, F> >
+ {
+
+ const T access_impl(const image2d<T> &ima, const fpoint2d<F> p) const
+ {
+ double x = floorf(p.nth(0));
+ double y = floorf(p.nth(1));
+
+ int a = int(x);
+ int b = int(y);
+
+
+ if (ima.hold(point2d(a, b)) && ima.hold(point2d(a + 1, b + 1)))
+ {
+ int res[3];
+
+ res[0] = int((double(ima(a, b)[0]) * (x + 1 - p.nth(0)) +
+ double(ima(a + 1, b)[0]) * (p.nth(0) - x)) * (y + 1 - p.nth(1)) +
+ (double(ima(a, b + 1)[0]) * (p.nth(0) - x) +
+ double(ima(a + 1, b + 1)[0]) * (x + 1 - p.nth(0))) * (p.nth(1) - y));
+ res[1] = int((double(ima(a, b)[1]) * (x + 1 - p.nth(0)) +
+ double(ima(a + 1, b)[1]) * (p.nth(0) - x)) * (y + 1 - p.nth(1)) +
+ (double(ima(a, b + 1)[1]) * (p.nth(0) - x) +
+ double(ima(a + 1, b + 1)[1]) * (x + 1 - p.nth(0))) * (p.nth(1) - y));
+ res[2] = int((double(ima(a, b)[2]) * (x + 1 - p.nth(0)) +
+ double(ima(a + 1, b)[2]) * (p.nth(0) - x)) * (y + 1 - p.nth(1)) +
+ (double(ima(a, b + 1)[2]) * (p.nth(0) - x) +
+ double(ima(a + 1, b + 1)[2]) * (x + 1 - p.nth(0))) * (p.nth(1) - y));
+ return ntg::rgb_8(res[0], res[1], res[2]);
+ }
+ else if (ima.hold(point2d(a, b)))
+ return ima(a, b);
+ else // FIXME : should be ntg_max_val(T)
+ return ntg::rgb_8(255, 255, 255);
+ }
+
+ };
+
+
+} // end of oln
+
+
+/// Write on an output stream \a o the coordinate of the fpoint2d \a p.
+
+template <class F>
+inline std::ostream&
+operator<<(std::ostream& o, const oln::fpoint2d<F>& p)
+{
+ return o << '(' << p.nth(0) << ',' << p.nth(1) << ')';
+}
+
+
+
+
+
+#endif // ! OLENA_CORE_FPOINT2D_HH
Index: olena/oln/core/fdpoint2d.hh
--- olena/oln/core/fdpoint2d.hh Tue, 15 Jun 2004 19:49:30 +0200 thivol_d ()
+++ olena/oln/core/fdpoint2d.hh Tue, 15 Jun 2004 11:02:18 +0200 thivol_d (oln/r/16_fdpoint2d. 644)
@@ -0,0 +1,201 @@
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLENA_CORE_FDPOINT2D_HH
+# define OLENA_CORE_FDPOINT2D_HH
+
+# include <iostream>
+
+# include <oln/core/abstract/image.hh>
+# include <oln/core/fpoint2d.hh>
+
+namespace oln {
+
+ // fwd decl
+ template <class F>
+ class dfpoint2d;
+
+
+
+ /*! \class dpoint_traits<fdpoint2d>
+ **
+ ** The specialized version for fdpoint2d.
+ */
+
+ template<class F>
+ struct dpoint_traits<fdpoint2d<F> >
+ {
+ enum { dim = 2 };
+ typedef fpoint2d<F> point_type;
+ };
+
+ /*! \class fdpoint2d
+ **
+ */
+
+ template <class F>
+ class fdpoint2d
+ {
+ private:
+
+ F coord_[2];
+
+
+ public:
+
+
+ typedef fdpoint2d<F> exact_type;
+
+ fdpoint2d()
+ {}
+
+ /// The coordinates of the dpoint2d are set to \a row and \a col.
+
+ fdpoint2d(F row, F col)
+ {
+ coord_[0] = row;
+ coord_[1] = col;
+ }
+
+ /// The coordinates of the dpoint2d are set to the \a p coordinates.
+ fdpoint2d(const exact_type& p)
+ {
+ coord_[0] = p.row();
+ coord_[1] = p.col();
+ }
+
+ /// Return the value of the dpoint2d row coordinate.
+
+ F
+ row() const
+ {
+ return coord_[0];
+ }
+
+ /// Return a reference to the dpoint2d row coordinate.
+
+ F&
+ row()
+ {
+ return coord_[0];
+ }
+
+ /// Return the value of the dpoint2d column coordinate.
+
+ F
+ col() const
+ {
+ return coord_[1];
+ }
+
+ /// Return a reference to the dpoint2d column coordinate.
+
+ F&
+ col()
+ {
+ return coord_[1];
+ }
+
+ static std::string
+ name()
+ {
+ return "fdpoint2d";
+ }
+
+ exact_type
+ operator+(const exact_type& dp) const
+ {
+ exact_type tmp(*this);
+ tmp += dp;
+ return tmp;
+ }
+
+ /*! \brief Return a dpoint2d whose coordinates are equal to
+ ** the opposite of the current dpoint2d coordinates.
+ */
+
+ exact_type
+ operator-() const
+ {
+ exact_type dp(-row(), -col());
+ return dp;
+ }
+
+
+ /*! \brief Return a dpoint2d whose coordinates are equal to
+ ** the current dpoint2d coordinates minus \a dp coordinates.
+ */
+
+ exact_type
+ operator-(const exact_type& dp) const
+ {
+ exact_type tmp = *this;
+ tmp -= dp;
+ return tmp;
+ }
+
+
+ /*! \brief Return a reference to the current dpoint2d
+ ** plus \a dp.
+ */
+
+ exact_type&
+ operator+=(const exact_type& dp)
+ {
+ row() += dp.row();
+ col() += dp.col();
+ return *this;
+ }
+
+ /*! \brief Return a reference to the current dpoint2d
+ ** minus \a dp.
+ */
+
+ exact_type&
+ operator-=(const exact_type& dp)
+ {
+ row() -= dp.row();
+ col() -= dp.col();
+ return *this;
+ }
+ };
+
+
+} // end of oln
+
+/// Write on an output stream \a o the coordinates of the dpoint2d \a dp.
+
+template <class F>
+inline std::ostream&
+operator<<(std::ostream& o, const oln::fdpoint2d<F> dp)
+{
+ o << "(" << dp.row() << "," << dp.col() << ")" << std::endl;
+ return o;
+}
+
+
+#endif // !OLENA_CORE_FDPOINT2D_HH
Index: olena/oln/geom/translate.hh
--- olena/oln/geom/translate.hh Tue, 15 Jun 2004 19:49:30 +0200 thivol_d ()
+++ olena/oln/geom/translate.hh Tue, 15 Jun 2004 11:53:36 +0200 thivol_d (oln/s/6_translate. 644)
@@ -0,0 +1,72 @@
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+
+#ifndef OLENA_GEOM_TRANSLATE_HH
+# define OLENA_GEOM_TRANSLATE_HH
+
+# include <cmath>
+# include <iostream>
+
+# include <oln/core/image2d.hh>
+# include <oln/core/fpoint2d.hh>
+# include <oln/core/fdpoint2d.hh>
+
+namespace oln {
+
+ namespace geom {
+
+ template <class T, class F, class Exact>
+ struct translate
+ {
+ typedef oln::image2d<T> im_type;
+
+
+ image2d<T>
+ operator()(const oln::image2d<T>& ima,
+ const fdpoint2d<F> dp,
+ fpoint2d_access<T, Exact> interp)
+ {
+ im_type res(ima.size());
+ oln_iter_type(im_type) it(ima);
+
+ for_all(it)
+ {
+ res[it] = interp(ima, fpoint2d<F>(it.row(), it.col()) - dp);
+ }
+ return res;
+ }
+ };
+ }
+}
+
+
+
+
+
+#endif // !OLENA_GEOM_TRANSLATE_HH
+
Index: olena/oln/geom/rotate.hh
--- olena/oln/geom/rotate.hh Tue, 15 Jun 2004 19:49:30 +0200 thivol_d ()
+++ olena/oln/geom/rotate.hh Tue, 15 Jun 2004 16:07:48 +0200 thivol_d (oln/u/14_rotate.hh 644)
@@ -0,0 +1,219 @@
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLENA_GEOM_ROTATE_HH
+# define OLENA_GEOM_ROTATE_HH
+
+# include <cmath>
+# include <iostream>
+
+# include <oln/core/image2d.hh>
+# include <oln/core/fpoint2d.hh>
+
+namespace oln {
+
+ namespace geom {
+
+ template <class T, class Access>
+ struct ftor_rotate
+ {
+ private:
+ fpoint2d_access<T, Access> interp;
+ point2d center;
+ double cos_angle, sin_angle, a, b;
+
+ public:
+ ftor_rotate(const point2d& center_,
+ const fpoint2d_access<T, Access>& interp_,
+ const double rad_angle_) :
+ interp(interp_),
+ center(center_)
+ {
+ cos_angle = cos(-rad_angle_);
+ sin_angle = sin(-rad_angle_);
+
+ std::cout << sin_angle << " " << cos_angle << std::endl;
+
+ a = double(center.row());
+ b = double(center.col());
+
+ }
+
+ ftor_rotate() {}
+
+ ftor_rotate(const ftor_rotate<T, Access>& rhs)
+ {
+ interp = rhs.interp;
+ center = rhs.center;
+ cos_angle = rhs.cos_angle;
+ sin_angle = rhs.sin_angle;
+ a = rhs.a;
+ b = rhs.b;
+ }
+
+ const T
+ operator()(const image2d<T>& ima,
+ const point2d p) const
+ {
+ double x, y;
+ double c, d;
+
+ c = a + ima.size().nrows() / 2;
+ d = b + ima.size().ncols() / 2;
+
+ x = cos_angle * double(p.row()) - sin_angle * double(p.col()) -
+ c * cos_angle + d * sin_angle + c;
+ y = sin_angle * double(p.row()) + cos_angle * double(p.col()) -
+ c * sin_angle - d * cos_angle + d;
+
+ return interp(ima, fpoint2d<double>(x, y));
+ }
+ };
+
+ template <class T, class Access>
+ struct rotate
+ {
+ typedef image2d<T> im_type;
+
+ im_type
+ operator()(const im_type& ima,
+ const point2d center,
+ double rad_angle,
+ fpoint2d_access<T, Access> interp)
+ {
+ im_type res(ima.size());
+ ftor_rotate<T, Access> f(center, interp, rad_angle);
+ oln_iter_type(im_type) it(res);
+
+ for_all(it)
+ {
+ res[it] = f(ima, point2d(it.row(), it.col()));
+ }
+ return res;
+ }
+ };
+
+
+ template <class T, class Access>
+ struct ftor_rotate_enlarge
+ {
+ private:
+ fpoint2d_access<T, Access> interp;
+ point2d center;
+ double cos_angle;
+ double sin_angle;
+ double a;
+ double b;
+
+ public:
+ ftor_rotate_enlarge(const point2d& center_,
+ const fpoint2d_access<T, Access>& interp_,
+ const double rad_angle_) :
+ interp(interp_),
+ center(center_)
+ {
+ cos_angle = cos(-rad_angle_);
+ sin_angle = sin(-rad_angle_);
+ a = double(center.row());
+ b = double(center.col());
+ }
+
+ ftor_rotate_enlarge()
+ {}
+
+ ftor_rotate_enlarge(const ftor_rotate_enlarge& rhs) :
+ interp(rhs.interp),
+ center(rhs.center)
+ {
+ cos_angle = rhs.cos_angle;
+ sin_angle = rhs.sin_angle;
+ a = rhs.a;
+ b = rhs.b;
+ }
+
+ T
+ operator()(const image2d<T>& ima,
+ const point2d p)
+ {
+ double x, y;
+ double c, d;
+ double rrows = ima.size().nrows() * cos_angle +
+ ima.size().ncols() * -sin_angle;
+ double rcols = ima.size().nrows() * -sin_angle +
+ ima.size().ncols() * cos_angle;
+ double vt = (rrows - ima.size().nrows()) / 2;
+ double ht = (rcols - ima.size().ncols()) / 2;
+
+ c = a + ima.size().nrows() / 2;
+ d = b + ima.size().ncols() / 2;
+
+ x = cos_angle * double(p.row() - vt) - sin_angle * double(p.col() - ht) -
+ c * cos_angle + d * sin_angle + c;
+ y = sin_angle * double(p.row() - vt) + cos_angle * double(p.col() - ht) -
+ c * sin_angle - d * cos_angle + d;
+
+ return interp(ima, fpoint2d<double>(x, y));
+ }
+ };
+
+
+
+
+ template <class T, class Access>
+ struct rotate_enlarge
+ {
+
+ typedef image2d<T> im_type;
+
+ im_type
+ operator()(const im_type& ima,
+ const point2d center,
+ double rad_angle,
+ fpoint2d_access<T, Access> interp)
+ {
+ im_type res(image2d_size(int(ima.size().nrows() * cos(rad_angle) +
+ ima.size().ncols() * sin(rad_angle)),
+ int(ima.size().nrows() * sin(rad_angle) +
+ ima.size().ncols() * cos(rad_angle)),
+ 0));
+
+ oln_iter_type(im_type) it(res);
+ ftor_rotate_enlarge<T, Access> f(center, interp, rad_angle);
+
+ for_all(it)
+ {
+ res[it] = f(ima, point2d(it.row(), it.col()));
+ }
+ return res;
+ }
+ };
+
+ }
+}
+
+
+#endif // !OLENA_CORE_FPOINT2D_HH
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
3
5
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/basics.hh: Add behavior.hh.
* oln/core/behavior.hh: Add an empty constructor for any_with_diamond.
* oln/makefile.src: Add border morpher file.
* oln/convol/fast_convolution.hh: Use border morpher, fix the size problem.
* tests/convol/tests/fast_convol: Improve test comparing with slow version.
* oln/morpher/border_morpher.hh: Border morpher.
* tests/morpher/tests/border: Test border morpher.
Index: olena/oln/basics.hh
--- olena/oln/basics.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/d/42_basics.hh 1.13 600)
+++ olena/oln/basics.hh Tue, 15 Jun 2004 13:07:11 +0200 odou_s (oln/d/42_basics.hh 1.13 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -54,5 +54,6 @@
# include <oln/core/traverse.hh>
# include <oln/core/compose.hh>
# include <oln/core/generate.hh>
+# include <oln/core/behavior.hh>
#endif // ! OLENA_BASICS_HH
Index: olena/oln/core/behavior.hh
--- olena/oln/core/behavior.hh Wed, 09 Jun 2004 20:13:57 +0200 van-vl_n (oln/j/47_behavior.h 1.4 600)
+++ olena/oln/core/behavior.hh Tue, 15 Jun 2004 15:59:34 +0200 odou_s (oln/j/47_behavior.h 1.4 600)
@@ -83,6 +83,9 @@
ntg::cast::force<oln_value_type(I)>(value_));
};
+ /// Empty constructor for any_with_diamond hierarchy.
+ value_behavior() {}
+
protected:
value_type value_;
};
Index: olena/oln/makefile.src
--- olena/oln/makefile.src Tue, 15 Jun 2004 19:50:21 +0200 thivol_d (oln/r/4_makefile.s 1.4 600)
+++ olena/oln/makefile.src Tue, 15 Jun 2004 20:02:22 +0200 odou_s (oln/r/4_makefile.s 1.4 600)
@@ -150,6 +150,7 @@
level/set_level.hh \
level/threshold.hh \
math/macros.hh \
+ morpher/border_morpher.hh \
morpher/color_morpher.hh \
morpher/func_morpher.hh \
morpher/generic_morpher.hh \
Index: olena/oln/convol/fast_convolution.hh
--- olena/oln/convol/fast_convolution.hh Mon, 14 Jun 2004 17:26:55 +0200 odou_s (oln/r/12_fast_convo 1.2 600)
+++ olena/oln/convol/fast_convolution.hh Tue, 15 Jun 2004 20:27:36 +0200 odou_s (oln/r/12_fast_convo 1.2 600)
@@ -33,6 +33,7 @@
# include <mlc/array/all.hh>
# include <oln/transforms/fft.hh>
# include <oln/morpher/piece_morpher.hh>
+# include <oln/morpher/border_morpher.hh>
namespace oln {
@@ -44,6 +45,34 @@
*/
namespace fast {
+ /// Internal namespace
+ namespace internal {
+
+ inline const coord
+ center_dst(coord n)
+ {
+ return n % 2 ? n / 2 + 1 : n / 2;
+ }
+
+ inline const coord
+ center_src(coord n)
+ {
+ return n % 2 ? n / 2 : (n - 1) / 2;
+ }
+
+ template <class I, class J, class P>
+ const P
+ center(const abstract::image<I>& big_ima, const abstract::image<J>& ima)
+ {
+ P p;
+ for (unsigned i = 0; i < image_id<I>::dim; i++)
+ p.nth(i) = internal::center_dst(big_ima.size().nth(0)) -
+ internal::center_src(ima.size().nth(0)) - 1;
+ return p;
+ }
+
+ } // end of namespace internal
+
/*!
** \brief Perform a convolution of two images.
**
@@ -99,28 +128,43 @@
{
mlc::eq<I::dim, J::dim>::ensure();
mlc::eq<I::dim, 2>::ensure();
- assert(input.npoints() >= k.npoints());
- // We compute k with a size of input (k is centered in big_k).
- image2d<oln_value_type(J)> big_k(input.size());
-#define CENTER_DST(I) \
-((I) % 2 ? (I) / 2 + 1 : (I) / 2)
-#define CENTER_SRC(I) \
-((I) % 2 ? (I) / 2 : ((I) - 1) / 2)
- typedef morpher::piece_morpher< image2d<oln_value_type(J)> > piece_t;
- piece_t piece_k(big_k,
- dpoint2d(CENTER_DST(big_k.size().nrows()) -
- CENTER_SRC(k.size().nrows()) - 1,
- CENTER_DST(big_k.size().ncols()) -
- CENTER_SRC(k.size().ncols()) - 1),
- oln::image2d_size(k.size().nrows(),
- k.size().ncols(),
- big_k.border()));
- oln_iter_type(piece_t) i_k(piece_k);
- for_all(i_k)
- piece_k[i_k] = k[i_k];
+ oln_size_type(I) big_size;
+ coord width_input = 0;
+ coord width_k = 0;
+ for (unsigned i = 0; i < I::dim; i++)
+ {
+ big_size.nth(i) = input.size().nth(i) + k.size().nth(i) - 1;
+ if (width_input < k.size().nth(i) - 1)
+ {
+ width_input = k.size().nth(i) - 1;
+ width_k = input.size().nth(i) - 1;
+ }
+ }
+ big_size.border() = input.border();
+
+ const morpher::border_morpher< const image2d<oln_value_type(I)>, replicate_behavior<> >
+ big_input(input.exact(), (width_input + 1) / 2, replicate_bhv());
- transforms::fft<oln_value_type(I), ntg::rect> tr_input(input.exact());
+ J big_k(big_size);
+ oln_iter_type(J) big_iter(big_k);
+ for_all(big_iter)
+ big_k[big_iter] = 0;
+ oln_iter_type(J) k_iter(k);
+ oln_iter_type(J) input_iter(input);
+
+ morpher::piece_morpher<J>
+ piece_k(big_k, internal::center<J, J, oln_dpoint_type(J)>(big_k, k), k.size());
+
+ for_all(k_iter)
+ piece_k[k_iter] = k[k_iter];
+
+ /// \todo FIXME: unfortunately, fft does not support morphers for now.
+ I big_input_(big_input.size());
+ for_all(big_iter)
+ big_input_[big_iter] = big_input[big_iter];
+
+ transforms::fft<oln_value_type(I), ntg::rect> tr_input(big_input_.exact());
transforms::fft<oln_value_type(J), ntg::rect> tr_k(big_k.exact());
tr_input.transform();
@@ -129,14 +173,19 @@
const typename mute<J, ntg::cplx<ntg::rect, ntg::float_d> >::ret
K = tr_k.transform();
- oln_iter_type(I) i_input(Input);
- for_all(i_input) {
- Input[i_input] *= K[i_input];
+ for_all(big_iter) {
+ Input[big_iter] *= K[big_iter];
// Scale.
- Input[i_input] *= Input.size().nrows() * Input.size().ncols();
+ Input[big_iter] *= Input.nrows() * Input.ncols();
}
- typename mute<I, DestValue>::ret output = tr_input.shift_transform_inv();
+ typename mute<I, DestValue>::ret big_output = tr_input.shift_transform_inv();
+ typename mute<I, DestValue>::ret output(input.size());
+
+ morpher::piece_morpher<J>
+ piece_output(big_output, internal::center<J, J, oln_dpoint_type(J)>(big_input_, input), input.size());
+ for_all(input_iter)
+ output[input_iter] = piece_output[input_iter];
return output;
}
Index: olena/tests/convol/tests/fast_convol
--- olena/tests/convol/tests/fast_convol Mon, 14 Jun 2004 09:07:03 +0200 odou_s (oln/r/13_fast_convo 1.1 600)
+++ olena/tests/convol/tests/fast_convol Tue, 15 Jun 2004 18:31:11 +0200 odou_s (oln/r/13_fast_convo 1.1 600)
@@ -10,11 +10,6 @@
using namespace ntg;
int main() {
- oln::utils::key::value_type data_key[] =
- {0x7a, 0x42, 0xc0, 0xa5, 0xec, 0xc7, 0x14, 0xa, 0xc7,
- 0x21, 0xd9, 0x1f, 0xdb, 0xfa, 0x54, 0xb9};
- oln::utils::key key(data_key);
-
image2d<int_u8> src(rdata("lena.pgm"));
float_d sigma = 2.5;
float_d radius = 3;
@@ -22,12 +17,12 @@
image2d<float_d> f_src(src.size());
oln_iter_type_(image2d<float_d>) i(src);
for_all(i)
- f_src[i] = float_d(src[i]);
+ f_src[i] = cast::bound<float_d>(src[i]);
image2d<float_d> tmp = convol::fast::convolve<float_d>(f_src, k);
+ image2d<float_d> tmp2 = convol::slow::convolve<float_d>(f_src, k);
for_all(i)
- src[i] = tmp[i];
- if (oln::utils::md5(src) != key)
+ if (tmp[i] != tmp2[i])
return false;
}
Index: olena/oln/morpher/border_morpher.hh
--- olena/oln/morpher/border_morpher.hh Tue, 15 Jun 2004 20:35:49 +0200 odou_s ()
+++ olena/oln/morpher/border_morpher.hh Tue, 15 Jun 2004 19:44:35 +0200 odou_s (oln/u/15_border_mor 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 BORDER_MORPHER_HH
+# define BORDER_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+# include <oln/core/abstract/behavior.hh>
+# include <oln/core/behavior.hh>
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class I, class BehaviorType, class Exact = mlc::final>
+ struct border_morpher;
+ template <class I, class BehaviorType, class Exact = mlc::final>
+ struct super_border_morpher;
+
+ } // end of namespace morpher
+
+ /// Informations about the super border morpher.
+ template <class SrcType, class BehaviorType, class Exact>
+ struct image_id< morpher::super_border_morpher<SrcType, BehaviorType, Exact> >
+ {
+ typedef typename mlc::exact_vt<
+ morpher::super_border_morpher<SrcType, BehaviorType, Exact>,
+ Exact>::ret
+ exact_type;
+ ///< Retrieve the exact type of the image.
+ };
+
+ /// Informations about the border morpher.
+ template <class SrcType, class BehaviorType, class Exact>
+ struct image_id< morpher::border_morpher<SrcType, BehaviorType, Exact> >
+ {
+ enum {dim = SrcType::dim}; ///< The Image dimension.
+ typedef oln_impl_type(SrcType) impl_type;
+ ///< Underlying implementation.
+ typedef oln_value_type(SrcType) value_type;
+ ///< The value type of the decorated image.
+ typedef typename mlc::exact_vt<morpher::border_morpher<SrcType, BehaviorType, Exact>,
+ Exact>::ret exact_type;
+ ///< Retrieve the exact type of the image.
+ typedef oln_point_type(SrcType) point_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+ typedef oln_iter_type(SrcType) iter_type;
+ };
+
+ /// Traits for border morpher.
+ template <class SrcType, class BehaviorType, class Exact>
+ struct image_traits < morpher::border_morpher<SrcType, BehaviorType, Exact> >
+ : public
+ image_traits<
+ morpher::abstract::generic_morpher<
+ SrcType,
+ typename image_id<morpher::border_morpher<SrcType,
+ BehaviorType,
+ Exact> >::exact_type
+ >
+ >
+ {};
+
+
+ namespace morpher {
+
+ /// Abstract border morpher class used for code factorization.
+ template <class SrcType, class BehaviorType, class Exact>
+ class super_border_morpher
+ : public abstract::generic_morpher<SrcType, Exact>
+ {
+
+ public:
+
+ typedef super_border_morpher<SrcType, BehaviorType, Exact> self_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef abstract::generic_morpher<SrcType, Exact> super_type;
+
+ typedef typename image_id<exact_type>::dpoint_type dpoint_type;
+ typedef typename image_id<exact_type>::size_type size_type;
+
+ protected:
+
+ /*!
+ ** \brief Default constructor.
+ ** \arg ima will be the image.
+ ** \arg width The width of the border you want to see.
+ ** \arg be The behavior of the border.
+ */
+ super_border_morpher(const SrcType &ima,
+ const coord width,
+ const BehaviorType& be)
+ : super_type(ima), width(width), be(be)
+ {
+ be.adapt_border(ima, width + get_ima().border());
+ for (unsigned i = 0; i < image_id<exact_type>::dim; ++i)
+ {
+ size_.nth(i) = get_ima().size().nth(i) + 2 * width;
+ dp_.nth(i) = -width;
+ }
+ size_.border() = get_ima().size().border();
+ }
+
+ const coord width; ///< The width of the border.
+ const BehaviorType be; ///< The behavior of the border.
+ size_type size_;
+ dpoint_type dp_;
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ super_border_morpher() : width(0)
+ {}
+
+ public:
+
+ /// Return the size (different from the original picture).
+ const size_type
+ size() const
+ {
+ return size_;
+ }
+
+ /// Return the point (-width, -width, ...)
+ const dpoint_type
+ get_dp() const
+ {
+ return dp_;
+ }
+
+ /// Return the behavior of the border.
+ const BehaviorType
+ get_behavior() const
+ {
+ return be;
+ }
+
+ /// Return width, the width of the border.
+ const coord
+ get_width() const
+ {
+ return width;
+ }
+
+ /// Useful to debug.
+ static std::string
+ name()
+ {
+ return "super_border_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /*!
+ ** \brief The default border morpher class.
+ **
+ ** Using this class, a border of picture is a picture.
+ **
+ ** \see oln::morpher::abstract::generic_morpher
+ ** \see oln::morpher::border_morph
+ */
+ template <class SrcType, class BehaviorType, class Exact>
+ struct border_morpher
+ : public super_border_morpher<
+ SrcType,
+ BehaviorType,
+ typename image_id<border_morpher<SrcType, BehaviorType, Exact> >::exact_type
+ >
+ {
+ typedef border_morpher<SrcType, BehaviorType, Exact> self_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef super_border_morpher<SrcType, BehaviorType, exact_type> super_type;
+
+ typedef typename image_id<exact_type>::point_type point_type;
+ typedef typename image_id<exact_type>::dpoint_type dpoint_type;
+ typedef typename image_id<exact_type>::size_type size_type;
+ typedef typename image_id<exact_type>::value_type value_type;
+
+ /// Construct the border morpher with an image \a ima.
+ border_morpher(const SrcType &ima,
+ const coord width,
+ const BehaviorType& be)
+ : super_type(ima, width, be)
+ {}
+
+ /// Construct the border morpher with another border morpher.
+ border_morpher(const self_type& r)
+ : super_type(r.get_ima(), r.get_width(), r.get_behavior())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ border_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 &>
+ ( const_cast<SrcType &>(this->ima_)[p + get_dp()] );
+ }
+
+ /*!
+ ** \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 + get_dp()];
+ }
+
+ /*! 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 "border_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /// The specialized version for `const' images.
+ template <class SrcType, class BehaviorType, class Exact>
+ struct border_morpher<const SrcType, BehaviorType, Exact>
+ : public super_border_morpher<
+ const SrcType,
+ BehaviorType,
+ typename image_id<border_morpher<const SrcType,
+ BehaviorType,
+ Exact> >::exact_type
+ >
+ {
+ typedef border_morpher<const SrcType, BehaviorType, Exact> self_type;
+ typedef typename image_id<self_type>::exact_type exact_type;
+ typedef super_border_morpher<const SrcType, BehaviorType, exact_type> super_type;
+
+ typedef typename image_id<exact_type>::point_type point_type;
+ typedef typename image_id<exact_type>::dpoint_type dpoint_type;
+ typedef typename image_id<exact_type>::size_type size_type;
+ typedef typename image_id<exact_type>::value_type value_type;
+
+ /*!
+ ** \brief Construct a border morpher.
+ ** \arg ima The image.
+ ** \arg width Width
+ */
+ border_morpher(const SrcType &ima,
+ const coord width,
+ const BehaviorType& be)
+ : super_type(ima, width, be)
+ {}
+
+ /// Construct a border morpher from another one.
+ border_morpher(const self_type& r)
+ : super_type(r.get_ima(), r.get_width(), r.get_behavior())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ border_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 + get_dp()];
+ }
+
+ /// Useful to debug.
+ static std::string
+ name()
+ {
+ return "border_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+
+ /*!
+ ** \brief Instantiate a temporary read-only border morpher.
+ ** \arg ima The image.
+ ** \arg width The width of the border.
+ ** \arg be The behavior of the border.
+ **
+ ** A border of the image will be viewed.
+ **
+ ** \code
+ ** #include <oln/morpher/border_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** assert(imc.has_impl());
+ ** oln::save(oln::morpher::border_morph(imc, 100, oln::mirror_bhv()),
+ ** IMG_OUT "oln_morpher_border_morpher.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena_ppm.png
+ ** \image latex lena_ppm.png
+ ** =>
+ ** \image html oln_morpher_border_morpher.png
+ ** \image latex oln_morpher_border_morpher.png
+ */
+ template <class I, class BehaviorType>
+ const border_morpher<I, BehaviorType>
+ border_morph(I &ima,
+ const coord width,
+ const BehaviorType& be)
+ {
+ return border_morpher<I, BehaviorType>(ima, width, be);
+ }
+
+
+ } // end namespace morpher
+
+} // end namespace oln
+
+#endif // !BORDER_MORPHER
Index: olena/tests/morpher/tests/border
--- olena/tests/morpher/tests/border Tue, 15 Jun 2004 20:35:49 +0200 odou_s ()
+++ olena/tests/morpher/tests/border Tue, 15 Jun 2004 15:22:04 +0200 odou_s (oln/u/16_border 644)
@@ -0,0 +1,92 @@
+// -*- c++ -*-
+// Copyright (C) 2004 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#include <oln/morpher/border_morpher.hh>
+#include <oln/basics2d.hh>
+#include <ntg/all.hh>
+
+#include <oln/utils/md5.hh>
+#include "data.hh"
+#include "check.hh"
+
+// Try to read from the morpher.
+template <class E, class F>
+void foo(const oln::abstract::image<E>& src, oln::abstract::image<F>& dst)
+{
+ oln_iter_type(oln::abstract::image<E>) it(dst);
+ for_all(it)
+ dst[it] = src[it];
+}
+
+// Try to write inside the morpher.
+template <class E, class F>
+void foo(oln::abstract::image<E>& src, oln::abstract::image<F>& dst)
+{
+ oln_iter_type(oln::abstract::image<E>) it_src(dst);
+
+ for_all(it_src)
+ src[it_src] = dst[it_src];
+}
+
+int main()
+{
+ bool fail (false);
+
+ oln::utils::key::value_type data1_key[16] =
+ {0x5b, 0x8c, 0xd9, 0x41, 0xc6, 0x62, 0x58, 0x34, 0xff,
+ 0x4c, 0x4, 0x8, 0x33, 0xf2, 0x95, 0xd7};
+ oln::utils::key::value_type data2_key[16] =
+ {0x5a, 0xd1, 0xac, 0x80, 0xec, 0xbd, 0x17, 0x96, 0xad,
+ 0x12, 0xec, 0xe7, 0x2b, 0xa5, 0x50, 0xa2};
+
+
+ oln::coord delta = 10;
+ oln::image2d<ntg::rgb_8> im = oln::load(rdata("lena.ppm"));
+ const oln::image2d<ntg::rgb_8> im_const = oln::load(rdata("lena.ppm"));
+ oln::image2d<ntg::rgb_8> im_out(oln::image2d_size(im.size().nrows() + 2*delta,
+ im.size().ncols() + 2*delta, im.border()));
+ oln::image2d<ntg::rgb_8> im_const_out(oln::image2d_size(im.size().nrows() + 2*delta,
+ im.size().ncols() + 2*delta, im.border()));
+
+ oln::morpher::border_morpher< oln::image2d<ntg::rgb_8>, oln::mirror_behavior<> > im_nonconst_out(im, delta, oln::mirror_bhv());
+
+ foo(im_nonconst_out, im);
+ foo(oln::morpher::border_morph(im, delta, oln::mirror_bhv()), im_out);
+ foo(oln::morpher::border_morph(im_const, delta, oln::mirror_bhv()), im_const_out);
+
+ fail = fail | (oln::utils::md5(im_const_out) != oln::utils::key(data2_key));
+ fail = fail | (oln::utils::md5(im_out) != oln::utils::key(data1_key));
+
+ if (!fail)
+ std::cout << "OK" << std::endl;
+ else
+ {
+ std::cout << "FAIL" << std::endl;
+ return true;
+ }
+}
--
Simon Odou
simon(a)lrde.epita.fr
3
3
Index: ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* config/oln.m4: Set LDFLAGS to compile code examples.
Index: doc/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* ref/out/exdoc.config.in: Use LDFLAGS instead of libs.
2004-05-12 Reda Dehak <reda(a)lrde.epita.fr>
Index: integre/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* ntg/core/macros.hh: Add value accessors (sup() and inf()).
* ntg/utils/cast.hh: Fix a bug in cast::bound().
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/convol/fast_convolution.hh: Clean code.
* oln/convol/slow_gaussian.hxx: Fix too generic parameter.
* oln/convol/slow_gaussian.hh: Fix delta computation.
* oln/convol/fast_gaussian.hxx: Use cast::bound instead of cast::force.
* oln/convol/slow_convolution.hh: Clean code.
Index: olena/oln/convol/slow_convolution.hh
--- olena/oln/convol/slow_convolution.hh Mon, 14 Jun 2004 09:07:03 +0200 odou_s (oln/f/39_convolutio 1.4.1.4.1.6.1.4 600)
+++ olena/oln/convol/slow_convolution.hh Mon, 14 Jun 2004 16:26:53 +0200 odou_s (oln/f/39_convolutio 1.4.1.4.1.6.1.4 600)
@@ -26,8 +26,8 @@
// Public License.
-#ifndef OLENA_CONVOL_SLOW_CONVOLUTION_HH__
-# define OLENA_CONVOL_SLOW_CONVOLUTION_HH__
+#ifndef OLENA_CONVOL_SLOW_CONVOLUTION_HH
+# define OLENA_CONVOL_SLOW_CONVOLUTION_HH
# include <oln/basics.hh>
# include <oln/basics2d.hh>
@@ -71,10 +71,10 @@
oln_iter_type(I) p_im(input);
for_all(p_im)
{
- DestValue sum = ntg_zero_val(DestValue);
+ ntg::float_d sum = ntg_zero_val(ntg::float_d);
for (unsigned i = 0; i < win.card(); ++i)
- sum += static_cast<DestValue> (win.w(i)) *
- static_cast<DestValue> (input[p_im - win.dp(i)]);
+ sum += ntg::cast::bound<ntg::float_d>(win.w(i)) *
+ ntg::cast::bound<ntg::float_d>(input[p_im - win.dp(i)]);
output[p_im] = sum;
}
@@ -96,7 +96,7 @@
template<class DestValue, class I, class J>
typename mute<I, DestValue>::ret
convolve(const abstract::non_vectorial_image< I >& input,
- const abstract::image< J >& k)
+ const abstract::non_vectorial_image< J >& k)
{
mlc::eq<I::dim, J::dim>::ensure();
@@ -108,26 +108,23 @@
for (unsigned i = 0; i < J::dim; i++)
if (k.size().nth(i) > delta)
delta = k.size().nth(i);
+ delta = (delta + 1) / 2;
input.border_adapt_copy(delta);
// Computer center of the kernel.
// \todo FIXME: should be in the image hierarchy.
- oln_iter_type(I) p_im(input);
- oln_iter_type(I) p_k(k);
oln_point_type(I) center;
- unsigned i_center = 0;
- unsigned real_center = k.npoints() % 2 ? k.npoints() / 2 + 1 :
- k.npoints() / 2;
- for_all(p_k)
- if (++i_center == real_center)
- center = p_k;
+ for (unsigned i = 0; i < J::dim; i++)
+ center.nth(i) = (k.size().nth(i) - 1) / 2;
+ oln_iter_type(I) p_im(input);
+ oln_iter_type(J) p_k(k);
for_all(p_im)
{
- DestValue sum = ntg_zero_val(DestValue);
+ ntg::float_d sum = ntg_zero_val(ntg::float_d);
for_all(p_k)
- sum += static_cast<DestValue> (k[p_k]) *
- static_cast<DestValue> (input[p_im - (center - p_k)]);
+ sum += ntg::cast::bound<ntg::float_d>(k[p_k]) *
+ ntg::cast::bound<ntg::float_d>(input[p_im - (center - p_k)]);
output[p_im] = sum;
}
return output;
@@ -161,4 +158,4 @@
} // end namespace oln
-#endif // OLENA_CONVOL_SLOW_CONVOLUTION_HH__
+#endif // OLENA_CONVOL_SLOW_CONVOLUTION_HH
Index: olena/oln/convol/fast_gaussian.hxx
--- olena/oln/convol/fast_gaussian.hxx Mon, 29 Mar 2004 16:40:01 +0200 palma_g (oln/25_fast_gauss 1.7.1.8.1.11 600)
+++ olena/oln/convol/fast_gaussian.hxx Mon, 14 Jun 2004 14:33:46 +0200 odou_s (oln/25_fast_gauss 1.7.1.8.1.11 600)
@@ -155,7 +155,7 @@
current = start;
for (coord i = 0; i < len; ++i)
{
- image[current] = ntg::cast::force<oln_value_type(I)>(tmp1[i] + tmp2[i]);
+ image[current] = ntg::cast::bound<oln_value_type(I)>(tmp1[i] + tmp2[i]);
current += d;
}
}
@@ -304,7 +304,7 @@
oln_iter_type(I) it(in);
for_all(it)
- work_img[it] = ntg::cast::force<ntg::float_s>(in[it]);
+ work_img[it] = ntg::cast::bound<ntg::float_s>(in[it]);
// On tiny sigma, Derich algorithm doesn't work.
// It is the same thing that to convolve with a Dirac.
Index: config/oln.m4
--- config/oln.m4 Sun, 06 Jun 2004 23:17:15 +0200 thivol_d (oln/j/15_oln.m4 1.38.1.6 600)
+++ config/oln.m4 Mon, 14 Jun 2004 16:10:57 +0200 odou_s (oln/j/15_oln.m4 1.38.1.6 600)
@@ -573,9 +573,7 @@
FFTW_LDFLAGS="-L${with_fftw}/lib"
fi
oln_save_CXXFLAGS=$CXXFLAGS
- oln_save_LDFLAGS=$LDFLAGS
CXXFLAGS="$CXXFLAGS $FFTW_CXXFLAGS"
- LDFLAGS="$LDFLAGS $FFTW_LDFLAGS"
oln_have_fftw=no
AC_CHECK_HEADER([fftw.h],
[AC_CHECK_LIB([fftw],
@@ -585,7 +583,7 @@
AC_DEFINE([HAVE_FFTW], 1,
[Define to 1 if we can use fftw])])])
CXXFLAGS=$oln_save_CXXFLAGS
- LDFLAGS=$oln_save_LDFLAGS
+ LDFLAGS="$LDFLAGS $FFTW_LDFLAGS"
fi
AC_SUBST([FFTW_CXXFLAGS])
AC_SUBST([FFTW_LDFLAGS])
@@ -616,9 +614,7 @@
ZLIB_LDFLAGS="-L${with_zlib}/lib"
fi
oln_save_CXXFLAGS=$CXXFLAGS
- oln_save_LDFLAGS=$LDFLAGS
CXXFLAGS="$CXXFLAGS $ZLIB_CXXFLAGS"
- LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS"
oln_have_zlib=no
AC_CHECK_HEADER([zlib.h],
[AC_CHECK_LIB([z],
@@ -628,7 +624,7 @@
AC_DEFINE([HAVE_ZLIB], 1,
[Define to 1 if we can use zlib])])])
CXXFLAGS=$oln_save_CXXFLAGS
- LDFLAGS=$oln_save_LDFLAGS
+ LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS"
fi
AC_SUBST([ZLIB_CXXFLAGS])
AC_SUBST([ZLIB_LDFLAGS])
Index: integre/ntg/utils/cast.hh
--- integre/ntg/utils/cast.hh Thu, 18 Mar 2004 18:24:14 +0100 van-vl_n (oln/i/26_cast.hh 1.3.1.13 600)
+++ integre/ntg/utils/cast.hh Mon, 14 Jun 2004 13:54:30 +0200 odou_s (oln/i/26_cast.hh 1.3.1.13 600)
@@ -89,12 +89,12 @@
const Tdest
bound(const Tsrc& val)
{
- if (ntg_max_val(Tsrc) > ntg_max_val(Tdest))
- if (val > Tsrc(Tdest(ntg_max_val(Tdest))))
- return ntg_max_val(Tdest);
- if (ntg_min_val(Tsrc) < ntg_min_val(Tdest))
- if (val < Tsrc(Tdest(ntg_min_val(Tdest))))
- return ntg_min_val(Tdest);
+ if (ntg_sup_val(Tsrc) > ntg_sup_val(Tdest))
+ if (val > Tsrc(Tdest(ntg_sup_val(Tdest))))
+ return ntg_sup_val(Tdest);
+ if (ntg_inf_val(Tsrc) < ntg_inf_val(Tdest))
+ if (val < Tsrc(Tdest(ntg_inf_val(Tdest))))
+ return ntg_inf_val(Tdest);
return val;
}
Index: integre/ntg/core/macros.hh
--- integre/ntg/core/macros.hh Tue, 13 Apr 2004 17:31:32 +0200 van-vl_n (oln/s/19_macros.hh 1.12 600)
+++ integre/ntg/core/macros.hh Mon, 14 Jun 2004 13:54:03 +0200 odou_s (oln/s/19_macros.hh 1.12 600)
@@ -110,6 +110,10 @@
# define ntg_min_val(T) ntg::type_traits< T >::min()
+# define ntg_sup_val(T) ntg::type_traits< T >::sup()
+
+# define ntg_inf_val(T) ntg::type_traits< T >::inf()
+
# define ntg_inf_val(T) ntg::type_traits< T >::inf()
# define ntg_sup_val(T) ntg::type_traits< T >::sup()
Index: doc/ref/out/exdoc.config.in
--- doc/ref/out/exdoc.config.in Mon, 14 Jun 2004 09:07:03 +0200 odou_s (oln/k/7_exdoc.conf 1.8 600)
+++ doc/ref/out/exdoc.config.in Mon, 14 Jun 2004 15:33:16 +0200 odou_s (oln/k/7_exdoc.conf 1.8 600)
@@ -5,7 +5,7 @@
CAPTIONS = cxx # We want to run cxx on the extracted files (see line below)
ALIAS cxx = @CXX@ # Here, cxx means g++ but you can choose other compilers
# FIXME: we should write the compilation line in the source file (for libs).
- OPTIONS = -lz -lfftw -lrfftw @DOC_CPPFLAGS@ @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_builddir@/olena -I@top_srcdir@/olena -I@top_srcdir@/metalic -I@top_builddir@ $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" -DHAVE_CONFIG_H # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
+ OPTIONS = @DOC_CPPFLAGS@ @CXXFLAGS_OPTIMIZE@ @CXXFLAGS_STRICT_ERRORS@ -I@top_srcdir@/integre -I@top_builddir@/olena -I@top_srcdir@/olena -I@top_srcdir@/metalic -I@top_builddir@ $1 -o $2 -DIMG_OUT=\"../img/\" -DIMG_IN=\"@top_srcdir@/olena/img/\" -DHAVE_CONFIG_H @LDFLAGS@ # tell how to use the soft, i.e. where to put input and output arguments (default if not overriden) ($1: input, $2: output) FIXME: $* should have explicit name, chek flags
OUT = out # FIXME: should be obsolete
EXT = cc # Extension of generated file
STD_OUT_EXT = std # Extension of generated file standard output
Index: olena/oln/convol/slow_gaussian.hh
--- olena/oln/convol/slow_gaussian.hh Mon, 14 Jun 2004 09:07:03 +0200 odou_s (oln/r/7_slow_gauss 1.3 600)
+++ olena/oln/convol/slow_gaussian.hh Mon, 14 Jun 2004 14:31:05 +0200 odou_s (oln/r/7_slow_gauss 1.3 600)
@@ -94,6 +94,7 @@
for (unsigned i = 0; i < I::dim; i++)
if (in.size().nth(i) > delta)
delta = in.size().nth(i);
+ delta = (delta + 1) / 2;
behavior.adapt_border(in, delta);
typename mute<I, ntg::float_d>::ret im =
Index: olena/oln/convol/slow_gaussian.hxx
--- olena/oln/convol/slow_gaussian.hxx Mon, 14 Jun 2004 09:07:03 +0200 odou_s (oln/r/8_slow_gauss 1.3 600)
+++ olena/oln/convol/slow_gaussian.hxx Mon, 14 Jun 2004 14:38:20 +0200 odou_s (oln/r/8_slow_gauss 1.3 600)
@@ -42,7 +42,7 @@
*/
template<class T>
inline T
- normalise(const T &in)
+ normalise(const oln::abstract::non_vectorial_image<T> &in)
{
T w(in.size());
ntg::float_d sum = 0.;
Index: olena/oln/convol/fast_convolution.hh
--- olena/oln/convol/fast_convolution.hh Mon, 14 Jun 2004 09:07:03 +0200 odou_s (oln/r/12_fast_convo 1.1 600)
+++ olena/oln/convol/fast_convolution.hh Mon, 14 Jun 2004 14:56:06 +0200 odou_s (oln/r/12_fast_convo 1.1 600)
@@ -26,12 +26,9 @@
// Public License.
-#ifndef OLENA_CONVOL_FAST_CONVOLUTION_HH__
-# define OLENA_CONVOL_FAST_CONVOLUTION_HH__
+#ifndef OLENA_CONVOL_FAST_CONVOLUTION_HH
+# define OLENA_CONVOL_FAST_CONVOLUTION_HH
-# include <oln/basics.hh>
-# include <oln/basics2d.hh>
-# include <ntg/all.hh>
# include <mlc/cmp.hh>
# include <mlc/array/all.hh>
# include <oln/transforms/fft.hh>
@@ -72,6 +69,7 @@
** using namespace ntg;
**
** int main() {
+ ** #ifdef HAVE_LIBfft
** image2d<int_u8> src(IMG_IN "lena.pgm");
** float_d sigma = 2.5;
** float_d radius = 3;
@@ -84,6 +82,7 @@
** for_all(i)
** src[i] = int_u8(tmp[i]);
** save(src, IMG_OUT "oln_convol_fast_convolve.pgm");
+ ** #endif
** }
** \endcode
** \image html lena_pgm.png
@@ -100,7 +99,7 @@
{
mlc::eq<I::dim, J::dim>::ensure();
mlc::eq<I::dim, 2>::ensure();
- assert(input.npoints() > k.npoints());
+ assert(input.npoints() >= k.npoints());
// We compute k with a size of input (k is centered in big_k).
image2d<oln_value_type(J)> big_k(input.size());
@@ -170,4 +169,4 @@
} // end namespace oln
-#endif // OLENA_CONVOL_FAST_CONVOLUTION_HH__
+#endif // OLENA_CONVOL_FAST_CONVOLUTION_HH
--
Simon Odou
simon(a)lrde.epita.fr
3
2