https://svn.lrde.epita.fr/svn/oln/trunk/swilena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Wrap mln::morpho::dilation.
* morpho.ixx: Wrap mln::morpho::dilation.
* image2d_int.i, image2d_int_u8.i: Instantiate it.
* python/lena.py: Exercise it.
image2d_int.i | 1 +
image2d_int_u8.i | 2 ++
morpho.ixx | 11 ++++++++---
python/lena.py | 6 +++++-
4 files changed, 16 insertions(+), 4 deletions(-)
Index: morpho.ixx
--- morpho.ixx (revision 2106)
+++ morpho.ixx (working copy)
@@ -32,6 +32,7 @@
%module morpho
%{
+#include "mln/morpho/dilation.hh"
#include "mln/morpho/erosion.hh"
%}
@@ -42,10 +43,14 @@
namespace morpho
{
- template <typename I, typename W>
/* FIXME: How can we handle concrete in Swilena? Simplify this
- for the moment, and use I directly. */
-// typename mln::trait::concrete< I >::ret
+ for the moment, and use I directly as return type. */
+
+ template <typename I, typename W>
+ I
+ dilation(const Image<I>& input, const Window<W>& win);
+
+ template <typename I, typename W>
I
erosion(const Image<I>& input, const Window<W>& win);
Index: image2d_int.i
--- image2d_int.i (revision 2106)
+++ image2d_int.i (working copy)
@@ -49,4 +49,5 @@
%}
%include "morpho.ixx"
+%template(dilation) mln::morpho::dilation< mln::image2d<int>, mln::window2d
>;
%template(erosion) mln::morpho::erosion< mln::image2d<int>, mln::window2d >;
Index: image2d_int_u8.i
--- image2d_int_u8.i (revision 2106)
+++ image2d_int_u8.i (working copy)
@@ -58,5 +58,7 @@
%}
%include "morpho.ixx"
+%template(dilation) mln::morpho::dilation< mln::image2d< mln::value::int_u<8>
>,
+ mln::window2d >;
%template(erosion) mln::morpho::erosion< mln::image2d< mln::value::int_u<8>
>,
mln::window2d >;
Index: python/lena.py
--- python/lena.py (revision 2106)
+++ python/lena.py (working copy)
@@ -35,5 +35,9 @@
lena = os.path.join (img_dir, "lena.pgm")
ima = image2d_int_u8.load(lena)
+
eroded = image2d_int_u8.erosion (ima, win_c4p())
-image2d_int_u8.save(eroded, "out.pgm")
+image2d_int_u8.save(eroded, "eroded.pgm")
+
+dilated = image2d_int_u8.dilation (ima, win_c4p())
+image2d_int_u8.save(dilated, "dilated.pgm")