Example for using Canny Edge Detector
- Author
- fkellner, 11/2008
#include <Filter/CannyEdge.hh>
#include <Utils/IOUtils.hh>
#include <Utils/Param.hh>
#include <Base/Image/ImageConvert.hh>
using namespace std;
using namespace BIAS;
int main(int argc, char *argv[]) {
string *inName = param.
AddParamString(
"input",
"detect edges in this image",
"input.mip",
'i');
string *outName = param.
AddParamString(
"output",
"output image",
"cannyEdges.mip",
'o');
int *lowThres = param.
AddParamInt(
"low",
"low threshold", 80, 0, 100,
't');
int *highThres = param.
AddParamInt(
"high",
"high threshold", 5, 0, 100,
'T');
if (!IOUtils::ParseCommandLineEvalHelp(param, argc, argv))
return 0;
ImageIO::Load(*inName, srcbase);
ImageIO::Load(*inName, srcf);
ImageConvert::ConvertST(srcf, src, ImageBase::ST_unsignedchar);
} else {
src = srcbase;
}
BIASWARN("Converting input image to Grey Image");
ImageConvert::IP_ToGrey(src);
}
ImageIO::Save(*outName, dst);
return 0;
}