#include <vigra/multi_array.hxx>
#include <vigra/convolution.hxx>
#include <iostream>
int main (int argc, char ** argv)
{
if(argc != 3)
{
std::cout << "Usage: " << argv[0] << " infile outfile" << std::endl;
return 1;
}
try
{
ImageImportInfo info(argv[1]);
std::cout << "Which mode of convolution?\n";
std::cout << "1 - disk average\n";
std::cout << "2 - corners of a 3x3-box\n";
std::cout << "3 - Gaussian filter\n";
std::cout << "4 - separable Gaussian filter (x- and x-dimension separately)\n";
int mode;
std::cin >> mode;
Kernel2D<double> kernel2dim;
Kernel1D<double> kernel1dim;
switch(mode)
{
case 1:
kernel2dim.initDisk(2);
break;
case 2:
kernel2dim.initExplicitly(Diff2D(-1,-1), Diff2D(1,1)) =
0.25, 0.0, 0.25,
0.0, 0.0, 0.0,
0.25, 0.0, 0.25;
break;
case 3:
kernel2dim.initGaussian(1.5);
break;
case 4:
kernel1dim.initGaussian(1.5);
break;
default:
vigra_precondition(false, "mode must be between 1 and 4.");
}
if (info.isGrayscale())
{
MultiArray<2, float> imageArray(info.shape()),
exportArray(info.shape());
if (mode == 4)
{
}
else
{
}
}
else
{
MultiArray<2, RGBValue<float> > imageArray(info.shape());
MultiArray<2, RGBValue<float> > exportArray(info.shape());
if (mode == 4)
{
}
else
{
}
}
}
catch (std::exception & e)
{
std::cout << e.what() << std::endl;
return 1;
}
return 0;
}
void importImage(...)
Read an image from a file.
void exportImage(...)
Write an image to a file.
image import and export functions
std::string impexListFormats()
List the image formats VIGRA can read and write.
void convolveImage(...)
Convolve an image with the given kernel(s).