#include <iostream>
#include <vigra/multi_array.hxx>
#include <vigra/tensorutilities.hxx>
#include <vigra/boundarytensor.hxx>
int main(int argc, char ** argv)
{
if(argc != 2)
{
std::cout << "Usage: " << argv[0] << " infile" << std::endl;
std::cout << "creates: boundarystrength.tif, cornerstrength.tif" << std::endl;
return 1;
}
try
{
ImageImportInfo info(argv[1]);
int w = info.width(), h = info.height();
MultiArray<2, TinyVector<float, 3> > boundarytensor(w, h);
double scale;
std::cout << "Operator scale ? ";
std::cin >> scale;
if(info.isGrayscale())
{
MultiArray<2, float> in(w, h);
}
else if(info.isColor())
{
MultiArray<2, RGBValue<float> > in(w, h);
MultiArray<2, TinyVector<float, 3> > bandtensor(w, h);
for(int b=0; b<3; ++b)
{
boundarytensor += bandtensor;
}
}
else
{
std::cerr << "Sorry, can only operate on gray and color images.\n";
return 1;
}
MultiArray<2, float> boundarystrength(w, h), cornerness(w, h);
MultiArray<2, TinyVector<float, 2> > edgeness(w,h);
exportImage(boundarystrength, ImageExportInfo(
"boundarystrength.tif").setPixelType(
"UINT8"));
exportImage(cornerness, ImageExportInfo(
"cornerstrength.tif").setPixelType(
"UINT8"));
}
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 boundaryTensor(...)
Calculate the boundary tensor for a scalar valued image.
void tensorTrace(...)
Calculate the trace of a 2x2 tensor.
void tensorToEdgeCorner(...)
Decompose a symmetric 2x2 tensor into its edge and corner parts.