https://svn.lrde.epita.fr/svn/oln/prototypes/proto-1.0
ChangeLog | 15 +++++++++++++++
oln/morpho/geodesic_dilation.hh | 13 ++++++++-----
oln/morpho/geodesic_erosion.hh | 13 ++++++++-----
tests/morpho/tests/closing | 15 +++++++++------
tests/morpho/tests/erosion | 35 ++++++++++++++++++-----------------
tests/morpho/tests/geodesic_dilation | 4 +---
tests/morpho/tests/geodesic_erosion | 4 +---
tests/morpho/tests/opening | 15 +++++++++------
8 files changed, 69 insertions(+), 45 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Repair geodesic erosion and dilation (cont.).
* oln/morpho/geodesic_dilation.hh
(morpho::proc::geodesic_dilation)
* oln/morpho/geodesic_erosion.hh
(morpho::proc::geodesic_erosion): Fix iterator definition, as well
as min/max operation.
* olena/tests/morpho/tests/closing
* olena/tests/morpho/tests/erosion
* olena/tests/morpho/tests/geodesic_dilation,
* olena/tests/morpho/tests/geodesic_erosion,
* olena/tests/morpho/tests/opening: Aesthetic changes.
2005-04-15 Roland Levillain <roland(a)lrde.epita.fr>
Index: olena/tests/morpho/tests/opening
--- olena/tests/morpho/tests/opening (revision 158)
+++ olena/tests/morpho/tests/opening (working copy)
@@ -8,19 +8,22 @@
#include <oln/level/compare.hh>
#include <ntg/all.hh>
+using namespace oln;
+
bool check()
{
- // MD5 sum of object.pbm's geodesic dilation result.
- oln::utils::key::value_type data_key[16] =
+ // MD5 sum of object.pbm's opening result.
+ // FIXME: Replace this fake with the actual result.
+ utils::key::value_type data_key[16] =
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- oln::utils::key key(data_key);
+ utils::key key(data_key);
- typedef oln::image2d<ntg::bin> im_type;
+ typedef image2d<ntg::bin> im_type;
im_type ima;
- ima = oln::io::read(rdata("16x16.pbm"));
+ ima = io::read(rdata("16x16.pbm"));
- if (oln::utils::md5(oln::morpho::opening(ima, oln::win_c8p())) != key)
+ if (utils::md5(morpho::opening(ima, win_c8p())) != key)
return true;
return false;
Index: olena/tests/morpho/tests/geodesic_erosion
--- olena/tests/morpho/tests/geodesic_erosion (revision 158)
+++ olena/tests/morpho/tests/geodesic_erosion (working copy)
@@ -14,6 +14,7 @@
bool check()
{
// MD5 sum of object.pbm's geodesic erosion result.
+ // FIXME: Replace this fake with the actual result.
utils::key::value_type data_key[16] =
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
@@ -30,12 +31,9 @@
marker = morpho::closing(mask, win_c4p()).exact();
// Classical procedure.
- // FIXME: Re-enable when proc::geodesic_erosion is fixed.
-#if 0
if (utils::md5(morpho::proc::geodesic_erosion(join(marker, nbh),
mask).exact()) != key)
return true;
-#endif
// Facade to object-algorithm.
if (utils::md5(morpho::geodesic_erosion(join(marker, nbh),
Index: olena/tests/morpho/tests/geodesic_dilation
--- olena/tests/morpho/tests/geodesic_dilation (revision 158)
+++ olena/tests/morpho/tests/geodesic_dilation (working copy)
@@ -14,6 +14,7 @@
bool check()
{
// MD5 sum of object.pbm's geodesic dilation result.
+ // FIXME: Replace this fake with the actual result.
utils::key::value_type data_key[16] =
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
@@ -30,12 +31,9 @@
marker = morpho::opening(mask, win_c4p()).exact();
// Classical procedure.
- // FIXME: Re-enable when proc::geodesic_dilation is fixed.
-#if 0
if (utils::md5(morpho::proc::geodesic_dilation(join(marker, nbh),
mask).exact()) != key)
return true;
-#endif
// Facade to object-algorithm.
if (utils::md5(morpho::geodesic_dilation(join(marker, nbh),
Index: olena/tests/morpho/tests/erosion
--- olena/tests/morpho/tests/erosion (revision 158)
+++ olena/tests/morpho/tests/erosion (working copy)
@@ -8,27 +8,28 @@
#include <oln/level/compare.hh>
#include <ntg/all.hh>
+using namespace oln;
+
bool check()
{
- oln::utils::key::value_type data_key[16] =
- {0x7c, 0x4f, 0xf, 0xc7, 0x27, 0x1, 0x98, 0x81,
- 0xfd, 0xb, 0x2e, 0xf6, 0x1c, 0x84, 0xc9, 0x1e};
-
- oln::utils::key key(data_key);
+ // MD5 sum of object.pbm's erosion result.
+ // FIXME: Replace this fake with the actual result.
+ utils::key::value_type data_key[16] =
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ utils::key key(data_key);
- typedef oln::image2d<ntg::bin> im_type;
+ typedef image2d<ntg::bin> im_type;
im_type ima;
- ima = oln::io::read(rdata("16x16.pbm"));
+ ima = io::read(rdata("16x16.pbm"));
- std::cout << oln::utils::md5(oln::morpho::erosion(ima, oln::win_c8p())) <<
std::endl;
- if (oln::utils::md5(oln::morpho::erosion(ima, oln::win_c8p())) == key)
- {
- std::cout << "OK" << std::endl;
- return false;
- }
- else
- {
- std::cout << "FAIL" << std::endl;
+ // Classical procedure.
+ if (utils::md5(morpho::proc::erosion(ima, win_c8p())) != key)
return true;
- }
+
+ // Facade to object-algorithm.
+ if (utils::md5(morpho::erosion(ima, win_c8p())) != key)
+ return true;
+
+ return false;
}
Index: olena/tests/morpho/tests/closing
--- olena/tests/morpho/tests/closing (revision 158)
+++ olena/tests/morpho/tests/closing (working copy)
@@ -8,19 +8,22 @@
#include <oln/level/compare.hh>
#include <ntg/all.hh>
+using namespace oln;
+
bool check()
{
- // MD5 sum of object.pbm's geodesic dilation result.
- oln::utils::key::value_type data_key[16] =
+ // MD5 sum of object.pbm's closing result.
+ // FIXME: Replace this fake with the actual result.
+ utils::key::value_type data_key[16] =
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- oln::utils::key key(data_key);
+ utils::key key(data_key);
- typedef oln::image2d<ntg::bin> im_type;
+ typedef image2d<ntg::bin> im_type;
im_type ima;
- ima = oln::io::read(rdata("16x16.pbm"));
+ ima = io::read(rdata("16x16.pbm"));
- if (oln::utils::md5(oln::morpho::closing(ima, oln::win_c8p())) != key)
+ if (utils::md5(morpho::closing(ima, win_c8p())) != key)
return true;
return false;
Index: olena/oln/morpho/geodesic_dilation.hh
--- olena/oln/morpho/geodesic_dilation.hh (revision 158)
+++ olena/oln/morpho/geodesic_dilation.hh (working copy)
@@ -33,7 +33,6 @@
# include <oln/core/abstract/image_operator.hh>
# include <oln/morpho/stat.hh>
# include <oln/level/compare.hh>
-# include <oln/convert/nbh_to_se.hh>
# include <oln/arith/min.hh>
# include <oln/core/abstract/neighborhood.hh>
@@ -59,11 +58,15 @@
oln_type_of(I1, concrete) output(marker.size());
// FIXME: Useless?
// marker.border_adapt_copy(marker.nbh_get().delta());
- oln_type_of(I1, piter) p(marker);
+ oln_type_of(I1, piter) p(marker.size());
for_all_p (p)
- output[p] =
- arith::min(morpho::max(marker, p, marker.nbh_get().get_win()),
- mask[p]);
+ {
+ oln_type_of(I1, value) a =
+ morpho::max(marker, p, marker.nbh_get().get_win());
+ oln_type_of(I2, value) b = mask[p];
+ // Min.
+ output[p] = a < b ? a : b;
+ }
return output;
}
Index: olena/oln/morpho/geodesic_erosion.hh
--- olena/oln/morpho/geodesic_erosion.hh (revision 158)
+++ olena/oln/morpho/geodesic_erosion.hh (working copy)
@@ -33,7 +33,6 @@
# include <oln/core/abstract/image_operator.hh>
# include <oln/morpho/stat.hh>
# include <oln/level/compare.hh>
-# include <oln/convert/nbh_to_se.hh>
# include <oln/arith/max.hh>
# include <oln/core/abstract/neighborhood.hh>
@@ -59,11 +58,15 @@
oln_type_of(I1, concrete) output(marker.size());
// FIXME: Useless?
// marker.border_adapt_copy(marker.nbh_get().delta());
- oln_type_of(I1, piter) p(marker);
+ oln_type_of(I1, piter) p(marker.size());
for_all_p (p)
- output[p] =
- arith::max(morpho::min(marker, p, marker.nbh_get().get_win()),
- mask[p]);
+ {
+ oln_type_of(I1, value) a =
+ morpho::min(marker, p, marker.nbh_get().get_win());
+ oln_type_of(I2, value) b = mask[p];
+ // Max.
+ output[p] = a > b ? a : b;
+ }
return output;
}