#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
| HxImageRep L_HXIMAGEREP | HxCannyEdgeMap (HxImageRep img, double sigma) |
| Computes the Canny edge map of a scalar image. More... | |
|
||||||||||||
|
Computes the Canny edge map of a scalar image. The result is a vector image.
00016 {
00017 HxString fname("HxCannyEdgeMap");
00018
00019 if (img.isNull())
00020 {
00021 HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID);
00022 return HxImageRep();
00023 }
00024
00025 if (sigma <= 0.0)
00026 {
00027 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of sigma", HxGlobalError::HX_GE_INVALID);
00028 return HxImageRep();
00029 }
00030
00031 if (img.signature().imageDimensionality() != 2)
00032 {
00033 HxGlobalError::instance()->reportError(fname, "only defined for 2D images", HxGlobalError::HX_GE_INVALID);
00034 return HxImageRep();
00035 }
00036 if (img.signature().pixelDimensionality() != 1)
00037 {
00038 HxGlobalError::instance()->reportError(fname, "only defined for scalar pixel types", HxGlobalError::HX_GE_INVALID);
00039 return HxImageRep();
00040 }
00041
00042 int minSize = HxImageMinSize(img);
00043
00044 HxImageRep gauss0 = HxMakeGaussian1d(sigma, 0, 4.0, minSize);
00045 HxImageRep gauss1 = HxMakeGaussian1d(sigma, 1, 4.0, minSize);
00046
00047 HxImageRep Ix = img.genConv2dSep(gauss1, gauss0, "mul", "addAssign",
00048 HxImageRep::ARITH_PREC);
00049 HxImageRep Iy = img.genConv2dSep(gauss0, gauss1, "mul", "addAssign",
00050 HxImageRep::ARITH_PREC);
00051
00052 return HxMakeFrom2Images(Ix, Iy);
00053 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001