milena r1230: Add color sub_image in sandbox

URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2007-10-03 Guillaume Duhamel <guillaume.duhamel@lrde.epita.fr> Add color sub_image in sandbox. * color_sub.cc: New. Update * labeling_algo.cc, * labeling_level_fast.cc: Update. --- color_sub.cc | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ labeling_algo.cc | 2 - labeling_level_fast.cc | 2 - 3 files changed, 85 insertions(+), 2 deletions(-) Index: trunk/milena/sandbox/duhamel/labeling_algo.cc =================================================================== --- trunk/milena/sandbox/duhamel/labeling_algo.cc (revision 1229) +++ trunk/milena/sandbox/duhamel/labeling_algo.cc (revision 1230) @@ -52,7 +52,7 @@ using value::int_u8; // image2d_b<bool> in = io::pbm::load("../../img/toto.pbm"); - image2d_b<bool> in = io::pbm::load("../../img/toto.pbm"); + image2d_b<bool> in = io::pbm::load("test.pbm"); image2d_b<int_u8> lab(in.domain()); image2d_b<int_u8> inte(in.domain()); Index: trunk/milena/sandbox/duhamel/color_sub.cc =================================================================== --- trunk/milena/sandbox/duhamel/color_sub.cc (revision 0) +++ trunk/milena/sandbox/duhamel/color_sub.cc (revision 1230) @@ -0,0 +1,83 @@ +// 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/sub_image.cc + * + * \brief Tests on mln::sub_image. + */ + +#include <mln/core/image2d_b.hh> +#include <mln/core/sub_image.hh> +#include <mln/core/inplace.hh> +#include <mln/value/int_u8.hh> +#include <mln/value/rgb8.hh> +#include <mln/level/fill.hh> +#include <mln/debug/println.hh> + +#include <mln/core/image2d_b.hh> +#include <mln/core/point2d.hh> +#include <mln/debug/println.hh> +#include <mln/util/graph.hh> +#include <mln/io/ppm/save.hh> +#include <mln/fun/p2b/chess.hh> + +#include <mln/core/image_if_value.hh> +#include <mln/debug/iota.hh> + +namespace mln +{ + template <typename I, typename J> + void + color (Image<I>& ima_, Image<J>& out_) + { + I& ima = exact (ima_); + J& out = exact (out_); + + level::fill (out, value::rgb8(255, 0, 0)); + + { + mln_piter(I) p (ima.domain ()); + for_all (p) + { + out(p) = value::rgb8(ima(p)); + } + } + } +} + +int main() +{ + using namespace mln; + + image2d_b<value::int_u8> ima(3,3); + debug::iota(ima); + image2d_b<value::rgb8> out(ima.domain ().bbox ()); + std::cout << ima.domain() << std::endl; + color(inplace (ima | 6), out); + io::ppm::save(out, "out.ppm"); + debug::println(out); +} Index: trunk/milena/sandbox/duhamel/labeling_level_fast.cc =================================================================== --- trunk/milena/sandbox/duhamel/labeling_level_fast.cc (revision 1229) +++ trunk/milena/sandbox/duhamel/labeling_level_fast.cc (revision 1230) @@ -38,7 +38,7 @@ #include <mln/io/pgm/load.hh> #include <mln/io/pgm/save.hh> -#include "labeling_level.hh" +#include <mln/labeling/level.hh> #include <mln/debug/iota.hh> #include <mln/debug/println_with_border.hh>
participants (1)
-
Guillaume Duhamel