Smooth an image using Recursive convolution functions functions: smooth.cxx
Usage: example_smooth infile outfile
#include <iostream>
#include <vigra/multi_array.hxx>
#include <vigra/convolution.hxx>
#include <vigra/nonlineardiffusion.hxx>
{
{
std::cout <<
"Usage: " <<
argv[0] <<
" infile outfile" << std::endl;
std::cout << "(supported formats: " << impexListFormats() << ")" << std::endl;
return 1;
}
int type;
std::cout << "Type of smoothing (1 = Gauss, 2 = Exponential, 3 = nonlinear) ? ";
std::cin >> type;
double scale;
std::cout << "Amount of smoothing (operator scale) ? ";
std::cin >> scale;
if(type == 3)
{
std::cout << "Edge threshold ? ";
}
try
{
{
importImage(
info, destImage(
in));
switch(type)
{
case 2:
{
recursiveSmoothX(
in,
out, scale);
recursiveSmoothY(
out,
out, scale);
break;
}
case 3:
{
nonlinearDiffusion(
in,
out,
break;
}
default:
{
gaussianSmoothing(
in,
out, scale);
}
}
}
else
{
switch(type)
{
case 2:
{
recursiveSmoothX(
in,
out, scale);
recursiveSmoothY(
out,
out, scale);
break;
}
case 3:
{
{
nonlinearDiffusion(
in.bindElementChannel(
band),
out.bindElementChannel(
band),
}
break;
}
default:
{
gaussianSmoothing(
in,
out, scale);
}
}
}
}
catch (std::exception & e)
{
std::cout << e.what() << std::endl;
return 1;
}
return 0;
}
Argument object for the function exportImage().
Definition imageinfo.hxx:134
Argument object for the function importImage().
Definition imageinfo.hxx:391
Class for a single RGB value.
Definition rgbvalue.hxx:128
image import and export functions