Oleneux, Oleneux
Il faudrait que chacun mette à jour sa section de la page assignement
du twiki, de manière à la rendre beaucoup plus précise qu'elle ne l'est
actuellement. L'idéal serait qu'y figure notre travail hebdomadaire.
http://www.lrde.epita.fr/cgi-bin/twiki/view/Projects/OlenaAssignments
--
Simon Odou
simon(a)lrde.epita.fr
Index: ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* NEWS: Describe behavior hierarchy.
Index: olena/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* oln/core/abstract/behavior.hh: Add behavior hierarchy (abstract
part).
* oln/core/behavior.hh: Add behavior hierarchy content.
* oln/morpho/attributes.hh: Correct 'ifndef' macros.
* tests/convol/tests/uniform_gauss: Improve tests.
* oln/convol/fast_gaussian.hh: Make the gaussian take care of the
behavior hierarchy.
* oln/convol/fast_gaussian.hxx: Likewise.
Index: NEWS
--- NEWS Mon, 09 Feb 2004 18:57:03 +0100 palma_g (oln/0_NEWS 1.17 640)
+++ NEWS Tue, 10 Feb 2004 15:25:07 +0100 palma_g (oln/0_NEWS 1.17 640)
@@ -1,11 +1,18 @@
Olena 0.10 Not yet
+ * Border behavior can be controlled with the behavior hierarchy.
+ If an algorithm support it, you can choose the way the image
+ border will be seen. Three behaviors are available: mirror,
+ replicate or user defined value.
+
* Attribute opening/closing enhancement
- - Make the algothim more generic.
- - Add a lot of attributes.
+ - Make the algorithm more generic.
+ - Add a lot of attributes (area, disk, square, dist,
+ rectangle, volume, height, maxvalue, minvalue).
* Change the color conversion system
- - CIE RGB is the main color system.
+ - CIE RGB is the main color system e.g. it can be converted
+ directly into any other color system.
- Conversion between 2 color systems should pass by the RGB one.
Olena 0.9 August 8, 2003
Index: olena/oln/convol/fast_gaussian.hh
--- olena/oln/convol/fast_gaussian.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/26_fast_gauss 1.6.1.6.1.3 640)
+++ olena/oln/convol/fast_gaussian.hh Tue, 10 Feb 2004 14:56:04 +0100 palma_g (oln/26_fast_gauss 1.6.1.6.1.3 640)
@@ -31,7 +31,7 @@
# include <oln/basics.hh>
# include <oln/convert/basics.hh>
# include <ntg/float.hh>
-
+# include <oln/core/behavior.hh>
//
// Gaussian filter implementation from
// "Recursively implementing the gaussian and its derivatives"
@@ -44,39 +44,66 @@
// FIXME: add tests!
- template <class C, class B, class I>
+ template <class C, class B, class I, class BE>
typename mute<I, typename convoutput<C, B, oln_value_type(I)>::ret>::ret
gaussian(const convert::abstract::conversion<C, B>& input_conv,
- const abstract::image<I>& in, ntg::float_s sigma);
+ const abstract::image<I>& in, ntg::float_s sigma,
+ const abstract::behavior<BE> &behavior);
- template <class C, class B, class I>
+ template <class C, class B, class I, class BE>
typename mute<I, typename convoutput<C, B, oln_value_type(I)>::ret>::ret
gaussian_derivative(const convert::abstract::conversion<C, B>& input_conv,
- const abstract::image<I>& in, ntg::float_s sigma);
- template <class C, class B, class I>
+ const abstract::image<I>& in, ntg::float_s sigma,
+ const abstract::behavior<BE> &behavior);
+ template <class C, class B, class I, class BE>
typename mute<I, typename convoutput<C, B, oln_value_type(I)>::ret>::ret
gaussian_second_derivative(const convert::abstract::conversion<C, B>& input_conv,
const abstract::image<I>& in,
- ntg::float_s sigma);
+ ntg::float_s sigma,
+ const abstract::behavior<BE> &behavior);
/* Same functions, with a default conversion. */
+ template <class I, class BE> inline
+ oln_concrete_type(I)
+ gaussian(const abstract::image<I>& in, ntg::float_s sigma,
+ const abstract::behavior<BE> &behavior)
+ { return gaussian(convert::force<oln_value_type(I)>(), in, sigma,
+ behavior); }
+
+ template <class I, class BE> inline
+ oln_concrete_type(I)
+ gaussian_derivative(const abstract::image<I>& in, ntg::float_s sigma,
+ const abstract::behavior<BE> &behavior)
+ { return gaussian_derivative(convert::force<oln_value_type(I)>(), in, sigma,
+ behavior); }
+
+ template <class I, class BE> inline
+ oln_concrete_type(I)
+ gaussian_second_derivative(const abstract::image<I>& in,
+ ntg::float_s sigma,
+ const abstract::behavior<BE> &behavior = mirror_behavior<>())
+ { return gaussian_second_derivative(convert::force<oln_value_type(I)>(),
+ in, sigma, behavior); }
+
+ /* Same functions, with a default behavior (mirror_behavior). */
template <class I> inline
oln_concrete_type(I)
gaussian(const abstract::image<I>& in, ntg::float_s sigma)
- { return gaussian(convert::force<oln_value_type(I)>(), in, sigma); }
+ { return gaussian(convert::force<oln_value_type(I)>(), in, sigma,
+ mirror_bhv()); }
template <class I> inline
oln_concrete_type(I)
gaussian_derivative(const abstract::image<I>& in, ntg::float_s sigma)
- { return gaussian_derivative(convert::force<oln_value_type(I)>(), in, sigma); }
+ { return gaussian_derivative(convert::force<oln_value_type(I)>(), in, sigma,
+ mirror_bhv()); }
template <class I> inline
oln_concrete_type(I)
- gaussian_second_derivative(const abstract::image<I>& in,
- ntg::float_s sigma)
- { return gaussian_second_derivative(convert::force<oln_value_type(I)>(),
- in, sigma); }
+ gaussian_second_derivative(const abstract::image<I>& in, ntg::float_s sigma)
+ { return gaussian_second_derivative(convert::force<oln_value_type(I)>(), in, sigma,
+ mirror_bhv()); }
}
}
}
Index: olena/oln/convol/fast_gaussian.hxx
--- olena/oln/convol/fast_gaussian.hxx Wed, 28 Jan 2004 16:28:44 +0100 palma_g (oln/25_fast_gauss 1.7.1.8.1.5 640)
+++ olena/oln/convol/fast_gaussian.hxx Tue, 10 Feb 2004 13:09:29 +0100 palma_g (oln/25_fast_gauss 1.7.1.8.1.5 640)
@@ -230,12 +230,13 @@
}
};
- template <class C, class B, class I, class F>
+ template <class C, class B, class I, class F, class BE>
typename mute<I, typename convoutput<C,B,oln_value_type(I)>::ret>::ret
gaussian_common_(const convert::abstract::conversion<C,B>& c,
const abstract::image<I>& in,
const F& coef,
- ntg::float_s sigma)
+ ntg::float_s sigma,
+ const abstract::behavior<BE> &behavior)
{
typename mute<I, ntg::float_s>::ret work_img(in.size());
@@ -247,7 +248,7 @@
be linear, so when sigma is big enougth, the signal may
be parasitized by the non signal values.
*/
- work_img.border_adapt_mirror(ntg::cast::round<coord>(5 * sigma));
+ behavior.adapt_border(work_img, ntg::cast::round<coord>(5 * sigma));
gaussian_<I::dim>::doit(work_img, coef);
@@ -265,10 +266,11 @@
} // internal
- template <class C, class B, class I>
+ template <class C, class B, class I, class BE>
typename mute<I, typename convoutput<C,B,oln_value_type(I)>::ret>::ret
gaussian(const convert::abstract::conversion<C,B>& c,
- const abstract::image<I>& in, ntg::float_s sigma)
+ const abstract::image<I>& in, ntg::float_s sigma,
+ const abstract::behavior<BE> &behavior)
{
internal::recursivefilter_coef_<float>
coef(1.68f, 3.735f,
@@ -278,13 +280,14 @@
sigma,
internal::recursivefilter_coef_<float>::DericheGaussian);
- return internal::gaussian_common_(c, in, coef, sigma);
+ return internal::gaussian_common_(c, in, coef, sigma, behavior);
}
- template <class C, class B, class I>
+ template <class C, class B, class I, class BE>
typename mute<I, typename convoutput<C,B,oln_value_type(I)>::ret>::ret
gaussian_derivative(const convert::abstract::conversion<C,B>& c,
- const abstract::image<I>& in, ntg::float_s sigma)
+ const abstract::image<I>& in, ntg::float_s sigma,
+ const abstract::behavior<BE> &behavior)
{
internal::recursivefilter_coef_<float>
coef(-0.6472f, -4.531f,
@@ -295,13 +298,14 @@
internal::recursivefilter_coef_<float>
::DericheGaussianFirstDerivative);
- return internal::gaussian_common_(c, in, coef, sigma);
+ return internal::gaussian_common_(c, in, coef, sigma, behavior);
}
- template <class C, class B, class I>
+ template <class C, class B, class I, class BE>
typename mute<I, typename convoutput<C,B,oln_value_type(I)>::ret>::ret
gaussian_second_derivative(const convert::abstract::conversion<C,B>& c,
- const abstract::image<I>& in, ntg::float_s sigma)
+ const abstract::image<I>& in, ntg::float_s sigma,
+ const abstract::behavior<BE> &behavior)
{
internal::recursivefilter_coef_<float>
coef(-1.331f, 3.661f,
@@ -312,7 +316,7 @@
internal::recursivefilter_coef_<float>
::DericheGaussianSecondDerivative);
- return internal::gaussian_common_(c, in, coef, sigma);
+ return internal::gaussian_common_(c, in, coef, sigma, behavior);
}
} // fast
Index: olena/tests/convol/tests/uniform_gauss
--- olena/tests/convol/tests/uniform_gauss Fri, 30 Jan 2004 10:25:13 +0100 palma_g (oln/j/41_uniform_ga 1.1 644)
+++ olena/tests/convol/tests/uniform_gauss Tue, 10 Feb 2004 15:17:49 +0100 palma_g (oln/j/41_uniform_ga 1.1 644)
@@ -23,9 +23,10 @@
for_all(it)
img[it] = 42;
image2d<int_u8> img2 = convol::fast::gaussian(img, 5);
+ image2d<int_u8> img3 = convol::fast::gaussian(img, 5, replicate_bhv());
for_all(it)
- if (img[it] != img2[it])
+ if ((img[it] != img2[it]) || (img[it] != img3[it]))
return true;
return false;
}
Index: olena/oln/morpho/attributes.hh
--- olena/oln/morpho/attributes.hh Mon, 09 Feb 2004 18:57:03 +0100 palma_g (oln/j/45_attributes 1.2 644)
+++ olena/oln/morpho/attributes.hh Tue, 10 Feb 2004 14:59:24 +0100 palma_g (oln/j/45_attributes 1.2 644)
@@ -25,18 +25,11 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef ATTRIBUTES_HH
-# define ATTRIBUTES_HH
+#ifndef OLN_MORPHO_ATTRIBUTES_HH
+# define OLN_MORPHO_ATTRIBUTES_HH
# include <mlc/type.hh>
# include <vector>
-// some usefull macros
-
-// those macros should be moved into mlc
-// # define mlc_exact_vt_type(T, Exact) typename mlc::exact_vt<T, Exact>::ret
-// # define oln_2_exact_vt_type(self, T, Exact) typename mlc::exact_vt<self<T, Exact>, Exact>::ret
-// # define dispatch(Fun) return exact().Fun##_impl
-
// attribute dedicated macros
# define attr_lambda_type(T) typename attr_traits<T>::lambda_type
# define attr_env_type(T) typename attr_traits<T>::env_type
@@ -859,5 +852,5 @@
// FIXME: to be written...
-#endif // ndef ATTRIBUTES_HH
+#endif // !OLN_MORPHO_ATTRIBUTES
Index: olena/oln/core/abstract/behavior.hh
--- olena/oln/core/abstract/behavior.hh Tue, 10 Feb 2004 15:33:34 +0100 palma_g ()
+++ olena/oln/core/abstract/behavior.hh Tue, 10 Feb 2004 14:54:58 +0100 palma_g (oln/j/46_behavior.h 644)
@@ -0,0 +1,57 @@
+// 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_CORE_ABSTRACT_BEHAVIOR_HH
+# define OLENA_CORE_ABSTRACT_BEHAVIOR_HH
+# include <mlc/type.hh>
+# include <oln/core/abstract/image.hh>
+# include <oln/core/coord.hh>
+
+namespace oln {
+ namespace abstract {
+ // behavior hierarchy
+ //the aim of this one is to describe how an algorithm should work
+ //on borders
+ template <class Exact>
+ class behavior: public mlc_hierarchy::any<Exact>
+ {
+ public:
+ typedef behavior<Exact> self_type;
+ typedef mlc_exact_vt_type(self_type, Exact) exact_type;
+
+ template <class I>
+ void adapt_border(oln::abstract::image<I> &im, coord border_size) const
+ {
+ mlc_dispatch(adapt_border)(im, border_size);
+ };
+ protected:
+ behavior() {};
+ };
+ } // !abstract
+}
+
+#endif // !OLENA_CORE_ABSTRACT_BEHAVIOR_HH
Index: olena/oln/core/behavior.hh
--- olena/oln/core/behavior.hh Tue, 10 Feb 2004 15:33:34 +0100 palma_g ()
+++ olena/oln/core/behavior.hh Tue, 10 Feb 2004 15:12:48 +0100 palma_g (oln/j/47_behavior.h 644)
@@ -0,0 +1,108 @@
+// 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_CORE_BEHAVIOR_HH
+# define OLENA_CORE_BEHAVIOR_HH
+# include <oln/core/abstract/behavior.hh>
+# include <mlc/type.hh>
+
+namespace oln {
+ // mirror the image content into the border
+ template <class Exact = mlc::final>
+ class mirror_behavior:
+ public abstract::behavior<mlc_exact_vt_type(mirror_behavior<Exact>, Exact)>
+ {
+ public:
+ typedef mirror_behavior<Exact> self_type;
+ typedef mlc_exact_vt_type(self_type, Exact) exact_type;
+
+ template <class I>
+ void adapt_border_impl(oln::abstract::image<I> &im, coord border_size) const
+ {
+ im.border_adapt_mirror(border_size);
+ };
+ };
+
+ // set the border to a specific value
+ template <class T, class Exact = mlc::final>
+ class value_behavior:
+ public abstract::behavior<mlc_2_exact_vt_type(value_behavior, T, Exact)>
+ {
+ public:
+ typedef value_behavior<T, Exact> self_type;
+ typedef mlc_exact_vt_type(self_type, Exact) exact_type;
+ typedef T value_type;
+
+ explicit value_behavior(value_type value): value_(value)
+ {
+ };
+
+ template <class I>
+ void adapt_border_impl(abstract::image<I> &im, coord border_size) const
+ {
+ im.border_adapt_assign(border_size, ntg::cast::force<oln_value_type(I)>(value_));
+ };
+
+ protected:
+ value_type value_;
+ };
+
+ // replicate the border
+ template <class Exact = mlc::final>
+ class replicate_behavior:
+ public abstract::behavior<mlc_exact_vt_type(replicate_behavior<Exact>, Exact)>
+ {
+ public:
+ typedef replicate_behavior<Exact> self_type;
+ typedef mlc_exact_vt_type(self_type, Exact) exact_type;
+
+ template <class I>
+ void adapt_border_impl(abstract::image<I> &im, coord border_size) const
+ {
+ im.border_adapt_copy(border_size);
+ };
+ };
+
+ // tools to call ctors with type inference
+ inline mirror_behavior<> mirror_bhv()
+ {
+ return mirror_behavior<>();
+ }
+
+ template <class T>
+ inline value_behavior<T> value_bhv(const T &value)
+ {
+ return value_behavior<T>(value);
+ }
+
+ inline replicate_behavior<> replicate_bhv()
+ {
+ return replicate_behavior<>();
+ }
+} // !oln
+
+#endif // !OLN_CORE_BEHAVIOR_HH
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
Spam detection software, running on the system "kualalumpur.lrde.epita.fr", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or block
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: Save 70 percent on Viagra Save 70 percent on Viagra and
Increase Sex Drive. Most places charge $19.95, we charge only
URI:http://www.medz4cheap.com//via/?mrbig $2.95.
URI:http://www.medz4cheap.com//via/?mrbig What is ZENEGRA (Generic
Viagra)? ZENEGRA is a male impotence drug. It helps men obtain and
maintain an erection. Men that do not have impotence problems report
that ZENEGRA increases sexual pleasure and staying power, as well as
increasing the size and hardness of erections. ********* 384131654
URI:http://www.medz4cheap.com//via/?mrbig Why should I buy ZENEGRA
(Generic Viagra)? We the cheapest source of generic Viagra on the
Internet. Viagra has helped over 25,000,000 American men regain their
sexual power. 242683 URI:http://www.medz4cheap.com//via/?mrbig Will you
ship ZENEGRA (Generic Viagra) to my country? Generic Viagra Online
ships worldwide including Canada, Japan, UK and Australia. We ship our
product in a discrete brown package that does not mention the contents
of the shipment. All orders are shipped from India and usually take
15-30 days to arive. 242683 **
URI:http://www.medz4cheap.com//via/?mrbig How do i pay for ZENEGRA
(Generic Viagra)? We accept major creditcards, and checking accounts
(US only). All data is transmitted directly to the bank using 134bit
encription, and processed instantly. We never keep your information
stored on our server. You are totally safe to order online from us.
Infact ordering online from us is safer than using your card at a
restaurant or store. 1659901274
URI:http://www.medz4cheap.com//via/?mrbig Buy ZENEGRA Generic Viagra
and save over 70 percent! We have the worlds lowest prices GUARANTEED.
[...]
Content analysis details: (31.1 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
2.1 FROM_WEBMAIL_END_NUMS6 From webmail service and address ends in numbers
0.3 NO_REAL_NAME From: does not include a real name
0.9 FROM_ENDS_IN_NUMS From: ends in numbers
1.7 INVALID_DATE_TZ_ABSURD Invalid Date: header (timezone does not exist)
1.1 FROM_NUM_AT_WEBMAIL From address is webmail, but starts with a number
2.8 SUBJ_VIAGRA Subject includes "viagra"
0.7 ADDR_NUMS_AT_BIGSITE Uses an address with lots of numbers, at a big ISP
1.6 FROM_STARTS_WITH_NUMS From: starts with nums
4.2 IMPOTENCE BODY: Impotence cure
4.3 GENERIC_VIAGRA BODY: Mentions Generic Viagra
1.9 INCREASE_SEX BODY: Talks about a bigger drive for sex
1.1 VIAGRA_ONLINE BODY: Fast Viagra Delivery
0.5 HTML_40_50 BODY: Message is 40% to 50% HTML
0.0 HTML_MESSAGE BODY: HTML included in message
0.1 HTML_FONT_BIG BODY: HTML has a big font
0.1 HTML_FONTCOLOR_UNSAFE BODY: HTML font color not in safe 6x6x6 palette
0.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
0.4 HTML_FONT_INVISIBLE BODY: HTML font color is same as background
0.1 HTML_FONTCOLOR_RED BODY: HTML font color is red
0.6 DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date
0.5 FORGED_YAHOO_RCVD 'From' yahoo.com does not match 'Received' headers
0.5 RCVD_IN_NJABL_DIALUP RBL: NJABL: dialup sender did non-local SMTP
[217.226.112.251 listed in dnsbl.njabl.org]
2.5 RCVD_IN_DYNABLOCK RBL: Sent directly from dynamic IP address
[217.226.112.251 listed in dnsbl.sorbs.net]
0.1 RCVD_IN_SORBS RBL: SORBS: sender is listed in SORBS
[217.226.112.251 listed in dnsbl.sorbs.net]
0.1 RCVD_IN_NJABL RBL: Received via a relay in dnsbl.njabl.org
[217.226.112.251 listed in dnsbl.njabl.org]
1.2 FROM_ALL_NUMS From an address that is all numbers (non-phone)
1.6 FORGED_MUA_OUTLOOK Forged mail pretending to be from MS Outlook
The original message was not completely plain text, and may be unsafe to
open with some email clients; in particular, it may contain a virus,
or confirm that your address can receive spam. If you wish to view
it, it may be safer to save it to a file and open it with an editor.