#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxCannyThresholdAlt (HxImageRep img, double sigma, double level) |
Computes the Canny edge map of a scalar image, performs non-maxima suppression, and tresholds the norm of the resulting vector field at the given level (alternative implementation). More... |
|
Computes the Canny edge map of a scalar image, performs non-maxima suppression, and tresholds the norm of the resulting vector field at the given level (alternative implementation).
00014 { 00015 HxString fname("HxCannyThresholdAlt"); 00016 00017 if (img.isNull()) 00018 { 00019 HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID); 00020 return HxImageRep(); 00021 } 00022 00023 if (sigma <= 0.0) 00024 { 00025 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of sigma", HxGlobalError::HX_GE_INVALID); 00026 return HxImageRep(); 00027 } 00028 00029 if (img.signature().imageDimensionality() != 2) 00030 { 00031 HxGlobalError::instance()->reportError(fname, "only defined for 2D images", HxGlobalError::HX_GE_INVALID); 00032 return HxImageRep(); 00033 } 00034 if (img.signature().pixelDimensionality() != 1) 00035 { 00036 HxGlobalError::instance()->reportError(fname, "only defined for scalar pixel types", HxGlobalError::HX_GE_INVALID); 00037 return HxImageRep(); 00038 } 00039 00040 HxImageRep edges = HxCannyEdgeMap(img, sigma); 00041 HxTagList tags; 00042 HxAddTag(tags, "level", HxValue(level)); 00043 return edges.neighbourhoodOp("isMaxGradDir", tags); 00044 } |