Horus Doc || Global Function Guide || General documentation   | Function documentation  

HxCannyEdgeMap

Synopsis

HxImageRep HxCannyEdgeMap(HxImageRep img, double sigma)

Input

HxImageRep img
The image you want to determine the edges of.

double sigma
The standard deviation of the Gaussian kernel that is used to calculate the canny edge map.

Return value

HxImageRep
The output image is a 2D image, with HxVec2Double pixels. The first component of the pixel is the magnitude of the gradient in the X-direction, the second component of the pixel is the magnitude of the gradient in the Y-direction.

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

Valid input images
This function is only properly defined for 2D images with scalar pixels.

Valid values for sigma
This function is only properly defined for sigma greater than 0.

Border handling
This function uses MIRRORED border handling, see section Border handling.

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;
}

exampleImage1.gif

Input image for the HxCannyEdgeMap example.

HxCannyEdgeMapResult1.gif

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,


Generated on Mon Jan 27 15:44:58 2003 for GlobalFunctionGuide by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001