URL:
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
ChangeLog:
2008-09-30 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Fixes on median.
* mln/level/median.hh: Add initialisation of p :
p = input.domain().pmin() + up;
* tests/level/median_.cc: Some tests.
---
mln/level/median.hh | 1
tests/level/median_.cc | 54 +++++++++++++++++++------------------------------
2 files changed, 22 insertions(+), 33 deletions(-)
Index: branches/cleanup-2008/milena/tests/level/median_.cc
===================================================================
--- branches/cleanup-2008/milena/tests/level/median_.cc (revision 2444)
+++ branches/cleanup-2008/milena/tests/level/median_.cc (revision 2445)
@@ -1,37 +1,6 @@
-// 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/level/median.cc
- *
- * \brief Test on mln::level::median.
- */
-
#include <mln/core/image/image2d.hh>
#include <mln/win/rectangle2d.hh>
+#include <mln/make/box2d.hh>
#include <mln/io/pgm/load.hh>
#include <mln/io/pgm/save.hh>
@@ -41,13 +10,31 @@
#include "tests/data.hh"
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+
int main()
{
using namespace mln;
using value::int_u8;
- win::rectangle2d rect(5, 5);
+ {
+ border::thickness = 5;
+ box2d bb = make::box2d(0, 0, 3, 3);
+ image2d<int_u8> ima(bb);
+ debug::iota(ima);
+ debug::println(ima);
+
+ win::rectangle2d rect(3, 3);
+ image2d<int_u8> out(ima.domain());
+
+ level::impl::median_(ima, rect, out);
+ }
+
+
+ {
+ win::rectangle2d rect(20, 20);
border::thickness = 6;
image2d<int_u8> lena;
@@ -57,3 +44,4 @@
level::impl::median_(lena, rect, out);
io::pgm::save(out, "out.pgm");
}
+}
Index: branches/cleanup-2008/milena/mln/level/median.hh
===================================================================
--- branches/cleanup-2008/milena/mln/level/median.hh (revision 2444)
+++ branches/cleanup-2008/milena/mln/level/median.hh (revision 2445)
@@ -143,6 +143,7 @@
void init()
{
med.init();
+ p = input.domain().pmin() + up;
mln_qiter(W) q(win, p);
for_all(q) if (input.has(q))
med.take(input(q));