
Index: olena/ChangeLog from Niels Van Vliet <niels@lrde.epita.fr> * olena/tests/convol/tests/slow_gaussian: New file. Index: olena/tests/convol/tests/slow_gaussian --- olena/tests/convol/tests/slow_gaussian Sun, 13 Jun 2004 13:20:26 +0200 van-vl_n () +++ olena/tests/convol/tests/slow_gaussian Wed, 09 Jun 2004 20:04:10 +0200 van-vl_n (oln/r/11_slow_gauss 644) @@ -0,0 +1,81 @@ +// -*- c++ -*- +// Copyright (C) 2004 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, 59 Temple Place - Suite 330, 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. + +#include "data.hh" +#include "check.hh" + +#include <oln/basics2d.hh> +#include <oln/convol/slow_gaussian.hh> +#include <ntg/int.hh> +#include <oln/utils/md5.hh> +using namespace oln; +using namespace ntg; + +int main() +{ + // Image1d + { + image1d<int_u8> l(4); + l(0) = 1; + l(1) = 6; + l(2) = 64; + l(3) = 0; + + l = convol::slow::gaussian(l, 0.5, 3); + if (l(0) != 2 || l(1) != 12 || l(2) != 51 || l(3) != 7) + { + std::cout << "FAIL" << std::endl; + return true; + } + } + + // Image2d + { + oln::utils::key::value_type data_key[] = + {0x95, 0xe3, 0x63, 0xe0, 0xef, 0x21, 0xcd, 0x34, 0xa2, + 0x15, 0xa3, 0x4e, 0x82, 0x37, 0x40, 0x70}; + oln::utils::key key(data_key); + + image2d<int_u8> lena(rdata("lena.pgm")); + + float_d sigma = 2.5; + if (oln::utils::md5(convol::slow::gaussian(lena, sigma, 3)) != key) + { + std::cout << "FAIL" << std::endl; + return true; + } + } + + // Image3d. Result not tested. + { + image3d<int_u8> i(10, 10, 10); + convol::slow::gaussian(i, 0.2, 3); + } + + std::cout << "OK" << std::endl; +}