Synopsis
HxImageRep HxCannyEdgeMap(HxImageRep img, double sigma)
Input
HxImageRep img
double sigma
Return value
HxImageRep
Description
The function HxCannyEdgeMap computes the magnitude of the gradient of img in the X- and Y-direction. For every position in img, the magnitude in the X-direction is put in the first element of the output-vector, while the magnitude in the Y-direction is put in the second element of the output-vector.
The magnitudes of the gradient in the X- and Y-direction are calculated by convolving img with the derivative of a 1D-Gaussian in both directions. The used Gaussians have a standard deviation of sigma.
Remarks
Examples
Calculating the norm of the output of HxCannyEdgeMap
#include "HxImageRepGlobalFuncs.h" #include "HxImageRep.h" HxImageRep HxCannyEdgeMapExample1(HxImageRep img) { img = HxImageAsDouble(img); img = HxCannyEdgeMap(img, 1.0); img = HxNorm1(img); img = HxContrastStretch(img, 255); img = HxImageAsByte(img); return img; } int main(int argc, char* argv[]) { HxImageRep im1 = HxMakeFromFile(argv[1]); im1 = HxCannyEdgeMapExample1(im1); HxWriteFile(im1, argv[2]); return 0; }
Input image for the HxCannyEdgeMap example.
Output image of the HxCannyEdgeMap example.
In this example we apply HxCannyEdgeMap on a grey value image. We take the size of the resulting vector pixels (HxNorm1), after which we stretch the image for proper visualisation (HxContrastStretch).
See also
HxCannyThreshold, HxCannyThresholdAlt,
Keywords
Edge detection, Filter, Canny,