URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-20 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add subdirectory draw in tests and fix tests/level.
* mln/display/all.hh: Add save_and_show.hh.
* tests/Makefile.am: Update for display.
* tests/display: New subdirectory tests.
* tests/display/Makefile.am: New Makefile.am for draw.
* tests/show.cc: Remove ...
* tests/display/show.cc: ... and replace here.
* tests/color_pretty.cc: Remove ...
* tests/display/color_pretty.cc: ... and replace here.
* tests/save_and_show.cc: Remove ...
* tests/display/save_and_show.cc: ... and replace here.
* tests/level/apply.cc,
* tests/level/saturate.cc: Fix warning.
---
mln/display/all.hh | 1
tests/Makefile.am | 10 ----
tests/display/Makefile.am | 14 ++++++
tests/display/color_pretty.cc | 86 +++++++++++++++++++++++++++++++++++++++++
tests/display/save_and_show.cc | 74 +++++++++++++++++++++++++++++++++++
tests/display/show.cc | 75 +++++++++++++++++++++++++++++++++++
tests/level/apply.cc | 1
tests/level/saturate.cc | 1
8 files changed, 250 insertions(+), 12 deletions(-)
Index: trunk/milena/tests/save_and_show.cc (deleted)
===================================================================
Index: trunk/milena/tests/show.cc (deleted)
===================================================================
Index: trunk/milena/tests/color_pretty.cc (deleted)
===================================================================
Index: trunk/milena/tests/level/apply.cc
===================================================================
--- trunk/milena/tests/level/apply.cc (revision 1500)
+++ trunk/milena/tests/level/apply.cc (revision 1501)
@@ -40,7 +40,6 @@
{
using namespace mln;
- const unsigned size = 1000;
image2d<int> ima(3, 3);
int vs[3][3] = {
{ 2, 2, 3 },
Index: trunk/milena/tests/level/saturate.cc
===================================================================
--- trunk/milena/tests/level/saturate.cc (revision 1500)
+++ trunk/milena/tests/level/saturate.cc (revision 1501)
@@ -40,7 +40,6 @@
{
using namespace mln;
- const unsigned size = 1000;
image2d<int> ima(3, 3);
int vs[3][3] = {
{ 2, 2, 3 },
Index: trunk/milena/tests/display/save_and_show.cc
===================================================================
--- trunk/milena/tests/display/save_and_show.cc (revision 0)
+++ trunk/milena/tests/display/save_and_show.cc (revision 1501)
@@ -0,0 +1,74 @@
+// Copyright (C) 2007 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, 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/save_and_show.cc
+ *
+ * \brief Tests on mln::display::show.
+ */
+
+# include <mln/core/image2d.hh>
+# include <mln/io/pbm/load.hh>
+# include <mln/make/win_chamfer.hh>
+# include <mln/geom/chamfer.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/core/sub_image.hh>
+# include <mln/core/image_if_value.hh>
+# include <mln/core/inplace.hh>
+# include <mln/core/w_window2d_int.hh>
+# include <mln/display/show.hh>
+# include <mln/io/ppm/save.hh>
+# include <mln/display/save_and_show.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned max = 51;
+
+
+ image2d<bool> input = io::pbm::load("../../img/toto.pbm");
+
+ // Create a weighted windows :
+ // 0 2 0
+ // 2 p 2
+ // 0 2 0
+ const w_window2d_int& w_win = make::mk_chamfer_3x3_int<2, 0> ();
+
+ // Call chamfer for a distance image.
+ image2d<unsigned> tmp = geom::chamfer(input, w_win, max);
+
+ // Call color_pretty for sub_image.
+ for (unsigned i = 2; i < 6; i += 2)
+ {
+ image_if_value<image2d<unsigned> > t = inplace (tmp | i);
+ display::save_and_show (t, "xv");
+ }
+
+// image2d<value::rgb8> ima (100, 100);
+// display::save_and_show (ima, "xv");
+}
Index: trunk/milena/tests/display/show.cc
===================================================================
--- trunk/milena/tests/display/show.cc (revision 0)
+++ trunk/milena/tests/display/show.cc (revision 1501)
@@ -0,0 +1,75 @@
+// Copyright (C) 2007 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, 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/show.cc
+ *
+ * \brief Tests on mln::display::show.
+ */
+
+# include <mln/core/image2d.hh>
+# include <mln/io/pbm/load.hh>
+# include <mln/make/win_chamfer.hh>
+# include <mln/geom/chamfer.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/core/sub_image.hh>
+# include <mln/core/image_if_value.hh>
+# include <mln/core/inplace.hh>
+# include <mln/core/w_window2d_int.hh>
+# include <mln/display/show.hh>
+# include <mln/display/save.hh>
+# include <mln/display/remove.hh>
+# include <mln/display/color_pretty.hh>
+# include <mln/io/ppm/save.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned max = 51;
+
+
+ image2d<bool> input = io::pbm::load("../../img/toto.pbm");
+
+ // Create a weighted windows :
+ // 0 2 0
+ // 2 p 2
+ // 0 2 0
+ const w_window2d_int& w_win = make::mk_chamfer_3x3_int<2, 0> ();
+
+ // Call chamfer for a distance image.
+ image2d<unsigned> tmp = geom::chamfer(input, w_win, max);
+
+ // Call color_pretty for sub_image.
+ for (unsigned i = 2; i < 6; i += 2)
+ {
+ image_if_value<image2d<unsigned> > t = inplace (tmp | i);
+ display::save (t);
+ display::show (t, "xv");
+ }
+ display::remove ();
+}
Index: trunk/milena/tests/display/Makefile.am
===================================================================
--- trunk/milena/tests/display/Makefile.am (revision 0)
+++ trunk/milena/tests/display/Makefile.am (revision 1501)
@@ -0,0 +1,14 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ show \
+ save_and_show \
+ color_pretty
+
+show_SOURCES = show.cc
+save_and_show_SOURCES = save_and_show.cc
+color_pretty_SOURCES = color_pretty.cc
+
+TESTS = $(check_PROGRAMS)
Index: trunk/milena/tests/display/color_pretty.cc
===================================================================
--- trunk/milena/tests/display/color_pretty.cc (revision 0)
+++ trunk/milena/tests/display/color_pretty.cc (revision 1501)
@@ -0,0 +1,86 @@
+// Copyright (C) 2007 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, 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/color_pretty.cc
+ *
+ * \brief Tests on mln::display::color::pretty.
+ */
+
+# include <mln/core/image2d.hh>
+# include <mln/io/pbm/load.hh>
+# include <mln/make/win_chamfer.hh>
+# include <mln/geom/chamfer.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/core/sub_image.hh>
+# include <mln/core/image_if_value.hh>
+# include <mln/core/inplace.hh>
+# include <mln/core/w_window2d_int.hh>
+# include <mln/display/color_pretty.hh>
+# include <mln/io/ppm/save.hh>
+# include <mln/core/p_set.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned max = 51;
+
+
+ image2d<bool> input = io::pbm::load("../../img/toto.pbm");
+
+ // Create a weighted windows :
+ // 0 2 0
+ // 2 p 2
+ // 0 2 0
+ const w_window2d_int& w_win = make::mk_chamfer_3x3_int<2, 0> ();
+
+ // Call chamfer for a distance image.
+ image2d<unsigned> tmp = geom::chamfer(input, w_win, max);
+
+ p_set<point2d > s1;
+ p_set<point2d > s2;
+ p_set<point2d > s3;
+
+ for (int i = 200; i < 300; ++i)
+ for (int j = 0; j < 100; ++j)
+ s2.insert(point2d(i, j));
+
+ for (int i = 0; i < 100; ++i)
+ for (int j = 200; j < 300; ++j)
+ s3.insert(point2d(i, j));
+
+
+
+// // Call color_pretty for sub_image.
+// image2d<value::rgb8> out = display::color_pretty_rgb(tmp, s1, s2, s3);
+
+// // Save output image from color in out.ppm.
+// io::ppm::save(out, "out.ppm");
+
+// std::cout << "out.ppm generate" << std::endl;
+}
Index: trunk/milena/tests/Makefile.am
===================================================================
--- trunk/milena/tests/Makefile.am (revision 1500)
+++ trunk/milena/tests/Makefile.am (revision 1501)
@@ -14,7 +14,6 @@
accu_min \
accu_nil \
\
- border_get \
border_resize_image1d_1 \
border_resize_image1d_2 \
border_resize_image1d_3 \
@@ -33,7 +32,6 @@
canvas_browsing_fwd \
cast_image \
chamfer \
- color_pretty \
convert_to_image \
convert_to_tiles \
convert_to_vec_p \
@@ -100,7 +98,6 @@
level_paste \
level_sort_points \
level_transform \
- line2d \
linear_convolve \
linear_gaussian \
linear_lap \
@@ -113,7 +110,6 @@
\
main \
mat \
- mesh_image \
metal_converts_to \
metal_is \
metal_mat \
@@ -157,7 +153,6 @@
safe_image \
seed2tiling \
set_p \
- show \
sparse_image \
stack \
sub_image \
@@ -204,7 +199,6 @@
accu_min_SOURCES = accu_min.cc
accu_nil_SOURCES = accu_nil.cc
-border_get_SOURCES = border_get.cc
border_resize_image1d_1_SOURCES = border_resize_image1d_1.cc
border_resize_image1d_2_SOURCES = border_resize_image1d_2.cc
border_resize_image1d_3_SOURCES = border_resize_image1d_3.cc
@@ -223,7 +217,6 @@
canvas_browsing_fwd_SOURCES = canvas_browsing_fwd.cc
cast_image_SOURCES = cast_image.cc
chamfer_SOURCES = chamfer.cc
-color_pretty_SOURCES = color_pretty.cc
convert_to_image_SOURCES = convert_to_image.cc
convert_to_tiles_SOURCES = convert_to_tiles.cc
convert_to_vec_p_SOURCES = convert_to_vec_p.cc
@@ -289,7 +282,6 @@
level_paste_SOURCES = level_paste.cc
level_sort_points_SOURCES = level_sort_points.cc
level_transform_SOURCES = level_transform.cc
-line2d_SOURCES = line2d.cc
linear_convolve_SOURCES = linear_convolve.cc
linear_gaussian_SOURCES = linear_gaussian.cc
linear_lap_SOURCES = linear_lap.cc
@@ -302,7 +294,6 @@
main_SOURCES = main.cc
mat_SOURCES = mat.cc
-mesh_image_SOURCES = mesh_image.cc
metal_converts_to_SOURCES = metal_converts_to.cc
metal_is_SOURCES = metal_is.cc
metal_mat_SOURCES = metal_mat.cc
@@ -346,7 +337,6 @@
safe_image_SOURCES = safe_image.cc
seed2tiling_SOURCES = seed2tiling.cc
set_p_SOURCES = set_p.cc
-show_SOURCES = show.cc
sparse_image_SOURCES = sparse_image.cc
stack_SOURCES = stack.cc
sub_image_SOURCES = sub_image.cc
Index: trunk/milena/mln/display/all.hh
===================================================================
--- trunk/milena/mln/display/all.hh (revision 1500)
+++ trunk/milena/mln/display/all.hh (revision 1501)
@@ -48,6 +48,7 @@
# include <mln/display/color_pretty.hh>
# include <mln/display/remove.hh>
+# include <mln/display/save_and_show.hh>
# include <mln/display/save.hh>
# include <mln/display/show.hh>