https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Ugo Jardonnet <jardonnet(a)lrde.epita.fr>
Fix threshold testes.
* mln/binarization/threshold.hh: Make args more explicit.
* tests/binarization/thresholding.cc: Rename as ...
* tests/binarization/threshold.cc: ... this.
* tests/binarization/Makefile.am: Update makefile rule.
mln/binarization/threshold.hh | 6 ++-
tests/binarization/Makefile.am | 2 -
tests/binarization/threshold.cc | 62
++++++++++++++++++++++++++++++++++++++++
3 files changed, 67 insertions(+), 3 deletions(-)
Index: mln/binarization/threshold.hh
--- mln/binarization/threshold.hh (revision 1954)
+++ mln/binarization/threshold.hh (working copy)
@@ -63,7 +63,7 @@
template <typename I>
inline
mln_concrete_ch_value(I, bool)
- threshold(const Image<I>& input, const mln_value(I) value)
+ threshold(const Image<I>& input, const mln_value(I) threshold_value)
{
trace::entering("binarization::threshold");
@@ -73,7 +73,9 @@
mln_concrete_ch_value(I, bool) output(exact(input).domain());
- fun::v2b::threshold< mln_value(I) > f(value);
+ // FIXME : threshold value should be a percentage.
+ fun::v2b::threshold< mln_value(I) > f(threshold_value);
+
output = binarization::binarization(exact(input), f);
trace::exiting("binarization::threshold");
Index: tests/binarization/Makefile.am
--- tests/binarization/Makefile.am (revision 1954)
+++ tests/binarization/Makefile.am (working copy)
@@ -5,6 +5,6 @@
check_PROGRAMS = \
thresholding
-thresholding_SOURCES = thresholding.cc
+threshold_SOURCES = threshold.cc
TESTS = $(check_PROGRAMS)
Index: tests/binarization/threshold.cc
--- tests/binarization/threshold.cc (revision 0)
+++ tests/binarization/threshold.cc (revision 0)
@@ -0,0 +1,62 @@
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
(LRDE)
+//
+// 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, 51 Franklin Street, Fifth Floor,
+// 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.
+
+/// \file tests/binarization/thresholding.cc
+/// \brief Test on mln::binarization::threshold.
+
+#include <mln/core/image2d.hh>
+#include <mln/binarization/threshold.hh>
+#include <mln/level/all.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/ppm/load.hh>
+#include <mln/io/pbm/save.hh>
+
+#include "tests/data.hh"
+
+int main(int argc, char **)
+{
+ using namespace mln;
+ using value::int_u8;
+
+ {
+ image2d<int_u8> lena;
+ io::pgm::load(lena, MLN_IMG_DIR "lena.pgm");
+
+ io::pbm::save(binarization::threshold(lena, 50), "out1.pgm");
+ }
+
+ {
+ image2d<int_u8> l;
+ image2d<int> lena;
+ io::pgm::load(l, MLN_IMG_DIR "img/lena.pgm");
+
+ level::paste(l, lena);
+
+ io::pbm::save(binarization::threshold(lena, 50), "out2.pgm");
+ }
+}