Commit 8fecc482 authored by Roland Levillain's avatar Roland Levillain
Browse files

Milena: Exercise mln::interpolated and mln::tr_image together.

	* tests/core/image/imorph/interpolated-tr_image.cc: New.
	* tests/core/image/imorph/Makefile.am (check_PROGRAMS):
	Add interpolated-tr_image.
parent 3410400c
2013-10-09 Roland Levillain <roland@lrde.epita.fr>
Milena: Exercise mln::interpolated and mln::tr_image together.
* tests/core/image/imorph/interpolated-tr_image.cc: New.
* tests/core/image/imorph/Makefile.am (check_PROGRAMS):
Add interpolated-tr_image.
2013-10-09 Roland Levillain <roland@lrde.epita.fr>
 
Milena: Make rotation axis optional.
# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE)
# Copyright (C) 2009, 2010, 2013 EPITA Research and Development
# Laboratory (LRDE).
#
# This file is part of Olena.
#
......@@ -17,11 +18,11 @@
include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
decorated_image \
interpolated \
labeled_image \
safe_image \
tr_image
decorated_image \
interpolated \
interpolated-tr_image \
labeled_image \
safe_image \
tr_image
TESTS = $(check_PROGRAMS)
// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE).
//
// This file is part of Olena.
//
// Olena is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, version 2 of the License.
//
// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project 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
/// \brief Exercise the mln::interpolated and mln::tr_image morphers
/// together.
#include <iostream>
#include <mln/core/image/image2d.hh>
#include <mln/core/image/imorph/interpolated.hh>
#include <mln/core/image/imorph/safe.hh>
#include <mln/core/image/imorph/tr_image.hh>
#include <mln/fun/x2v/bilinear.hh>
#include <mln/fun/x2x/rotation.hh>
#include <mln/math/pi.hh>
#include <mln/algebra/vec.hh>
#include <mln/debug/iota.hh>
#include <mln/debug/println.hh>
/// Sugar macro for mln::debug::println.
#define PRINTLN(Ima) mln::debug::println(#Ima " = ", Ima)
int main()
{
using namespace mln;
typedef image2d<float> I;
I ima(4, 4);
debug::iota(ima);
PRINTLN(ima);
// Step-by-step approach.
{
/// Wrap `ima' into a safe_image morpher to prevent out-of-domain
/// accesses due to the interpolation or the rotation below.
typedef mln::safe_image<I> S;
S safe(ima, 0.f);
PRINTLN(safe);
/// Add an on-the-fly bilinear interpolation.
typedef interpolated<S, fun::x2v::bilinear> B;
B inter(safe);
PRINTLN(inter);
/// Rotate image on the fly.
float angle = math::pi / 4;
typedef fun::x2x::rotation<2, float> F;
F rotate(angle);
typedef tr_image<mln_domain_(B), B, F> R;
R rotated(inter.domain(), inter, rotate);
PRINTLN(rotated);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment