Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleGenerateGauss.cpp

Example for convolution of two matrices

Author
woelk 01/2008 (c) www. vision-n.de
/* This file is part of the BIAS library (Basic ImageAlgorithmS).
Copyright (C) 2003-2009 (see file CONTACT for details)
Multimediale Systeme der Informationsverarbeitung
Institut fuer Informatik
Christian-Albrechts-Universitaet Kiel
BIAS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
BIAS 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with BIAS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/**
@example ExampleGenerateGauss.cpp
@relates GenerateGauss
@brief Example for convolution of two matrices
@ingroup g_examples
@author woelk 01/2008 (c) www. vision-n.de
*/
#include <Base/Math/GenerateGauss.hh>
#include <Base/Math/Vector.hh>
#include <Base/Math/Matrix.hh>
#include <iostream>
using namespace BIAS;
using namespace std;
int main(int argc, char *argv[])
{
int size = 5;
double sigma = 2.0;
bool normalize = true;
/// generation using sigma and size
GenerateGauss::Gauss1D(size, sigma, vg, normalize);
if (normalize) cout << "normalized ";
cout << "gauss vector of size "<<size<<" with sigma "<<sigma<<" : "<<vg<<endl;
GenerateGauss::Gauss2D(size, sigma, mg, normalize);
if (normalize) cout << "normalized ";
cout << "gauss matrix of size "<<size<<"x"<<size<<" with sigma "<<sigma
<<" : "<<mg<<endl;
/// generation using size and ratio
double ratio = 1e-2;
GenerateGauss::Gauss1DSize(size, ratio, vg, sigma, normalize);
if (normalize) cout << "normalized ";
cout << "gauss vector of size "<<size<<" with ratio "<<ratio
<<" results in sigma "<<sigma<<" : "<<vg<<endl;
GenerateGauss::Gauss2DSize(size, ratio, mg, sigma, normalize);
if (normalize) cout << "normalized ";
cout << "gauss matrix of size "<<size<<"x"<<size<<" with ratio "<<ratio
<<" results in sigma "<<sigma<<" : "<<mg<<endl;
/// generation using sigma and ratio
sigma = 1.0;
GenerateGauss::Gauss1DSigma(sigma, ratio, vg, normalize);
if (normalize) cout << "normalized ";
cout << "gauss vector with sigma "<<sigma<<" and ratio "<<ratio
<<" results in size "<<vg.size()<<" : "<<vg<<endl;
GenerateGauss::Gauss2DSigma(sigma, ratio, mg, normalize);
if (normalize) cout << "normalized ";
cout << "gauss matrix with sigma "<<sigma<<" and ratio "<<ratio
<<" results in size "<<mg.num_rows()<<"x"<<mg.num_cols()<<" : "
<<mg<<endl;
return 0;
}