CannyEdgeDetection¶
- class CannyEdgeDetection(*args, **kwargs)¶
Bases:
pybind11_object
Overloaded function.
__init__(self: visp._visp.core.CannyEdgeDetection) -> None
Default constructor of the vpCannyEdgeDetection class. The thresholds used during the hysteresis thresholding step are set to be automatically computed.
__init__(self: visp._visp.core.CannyEdgeDetection, gaussianKernelSize: int, gaussianStdev: float, sobelAperture: int, lowerThreshold: float = -1.f, upperThreshold: float = -1.f, lowerThresholdRatio: float = 0.6f, upperThresholdRatio: float = 0.8f, filteringType: visp._visp.core.ImageFilter.CannyFilteringAndGradientType = vpImageFilter::CANNY_GBLUR_SOBEL_FILTERING) -> None
Construct a new vpCannyEdgeDetection object that uses Gaussian blur + Sobel operators to compute the edge map.
- Parameters:
- gaussianKernelSize
The size of the Gaussian filter kernel. Must be odd.
- gaussianStdev
The standard deviation of the Gaussian filter.
- sobelAperture
The size of the Sobel filters kernel. Must be odd.
- lowerThreshold
The lower threshold of the hysteresis thresholding step. If negative, will be computed from the upper threshold.
- upperThreshold
The upper threshold of the hysteresis thresholding step. If negative, will be computed from the histogram of the absolute gradient.
- lowerThresholdRatio
If the thresholds must be computed,the lower threshold will be equal to the upper threshold times lowerThresholdRatio .
- upperThresholdRatio
If the thresholds must be computed,the upper threshold will be equal to the value such as the number of pixels of the image times upperThresholdRatio have an absolute gradient lower than the upper threshold.
- filteringType
The filtering and gradient operators to apply to the image before the edge detection operation.
Methods
Overloaded function.
Overloaded function.
Set the lower and upper Canny Thresholds used to qualify the edge point candidates.
Set the lower and upper Canny Thresholds ratio that are used to compute them automatically.
Set the Filtering And Gradient operators to apply to the image before the edge detection operation.
Set the Gaussian Filters kernel size and standard deviation and initialize the aforementioned filters.
Set the parameters of the gradient filter (Sobel or Scharr) kernel size filters.
Set the Gradients of the image that will be processed.
Inherited Methods
Operators
__doc__
Overloaded function.
__module__
Attributes
__annotations__
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: visp._visp.core.CannyEdgeDetection) -> None
Default constructor of the vpCannyEdgeDetection class. The thresholds used during the hysteresis thresholding step are set to be automatically computed.
__init__(self: visp._visp.core.CannyEdgeDetection, gaussianKernelSize: int, gaussianStdev: float, sobelAperture: int, lowerThreshold: float = -1.f, upperThreshold: float = -1.f, lowerThresholdRatio: float = 0.6f, upperThresholdRatio: float = 0.8f, filteringType: visp._visp.core.ImageFilter.CannyFilteringAndGradientType = vpImageFilter::CANNY_GBLUR_SOBEL_FILTERING) -> None
Construct a new vpCannyEdgeDetection object that uses Gaussian blur + Sobel operators to compute the edge map.
- Parameters:
- gaussianKernelSize
The size of the Gaussian filter kernel. Must be odd.
- gaussianStdev
The standard deviation of the Gaussian filter.
- sobelAperture
The size of the Sobel filters kernel. Must be odd.
- lowerThreshold
The lower threshold of the hysteresis thresholding step. If negative, will be computed from the upper threshold.
- upperThreshold
The upper threshold of the hysteresis thresholding step. If negative, will be computed from the histogram of the absolute gradient.
- lowerThresholdRatio
If the thresholds must be computed,the lower threshold will be equal to the upper threshold times lowerThresholdRatio .
- upperThresholdRatio
If the thresholds must be computed,the upper threshold will be equal to the value such as the number of pixels of the image times upperThresholdRatio have an absolute gradient lower than the upper threshold.
- filteringType
The filtering and gradient operators to apply to the image before the edge detection operation.
- detect(*args, **kwargs)¶
Overloaded function.
detect(self: visp._visp.core.CannyEdgeDetection, cv_I: cv::Mat) -> visp._visp.core.ImageGray
detect(self: visp._visp.core.CannyEdgeDetection, I_color: visp._visp.core.ImageRGBa) -> visp._visp.core.ImageGray
Detect the edges in an image. Convert the color image into a gray-scale image.
- Parameters:
- I_color
An RGB image, in ViSP format.
- Returns:
vpImage<unsigned char> 255 means an edge, 0 means not an edge.
detect(self: visp._visp.core.CannyEdgeDetection, I: visp._visp.core.ImageGray) -> visp._visp.core.ImageGray
Detect the edges in a gray-scale image.
- Parameters:
- I
A gray-scale image, in ViSP format.
- Returns:
vpImage<unsigned char> 255 means an edge, 0 means not an edge.
- setCannyThresholds(self, lowerThresh: float, upperThresh: float) None ¶
Set the lower and upper Canny Thresholds used to qualify the edge point candidates. Edge point candidates whose gradient is between these two values is kept only if it linked somehow to a strong edge point.
- Parameters:
- lowerThresh: float¶
The lower threshold: each point whose gradient is below this threshold is discarded. When lower threshold value is negative, Canny recommendation is applied to have the lower threshold 3 times lower than the upper threshold.
- upperThresh: float¶
The upper threshold: each point whose gradient is greater than this threshold is said to be a strong edge point and is kept.
- setCannyThresholdsRatio(self, lowerThreshRatio: float, upperThreshRatio: float) None ¶
Set the lower and upper Canny Thresholds ratio that are used to compute them automatically. To ask to compute automatically the thresholds, you must set the lower and upper thresholds with negative values using the appropriate setter.
Note
See vpCannyEdgeDetection::setCannyThresholds(const float&, const float&)
- Parameters:
- lowerThreshRatio: float¶
The lower threshold ratio: if the thresholds are computed automatically, the lower threshold will be equal to the upper threshold multiplied by lowerThreshRatio .
- upperThreshRatio: float¶
The upper threshold ratio: if the thresholds are computed automatically, the upper threshold will be set such as upperThreshRatio times the number of pixels of the image have their absolute gradient lower then the upper threshold.
- setFilteringAndGradientType(self, type: visp._visp.core.ImageFilter.CannyFilteringAndGradientType) None ¶
Set the Filtering And Gradient operators to apply to the image before the edge detection operation.
- Parameters:
- type: visp._visp.core.ImageFilter.CannyFilteringAndGradientType¶
The operators to apply.
- setGaussianFilterParameters(self, kernelSize: int, stdev: float) None ¶
Set the Gaussian Filters kernel size and standard deviation and initialize the aforementioned filters.
- setGradientFilterAperture(self, apertureSize: int) None ¶
Set the parameters of the gradient filter (Sobel or Scharr) kernel size filters.
- setGradients(self, dIx: visp._visp.core.ImageFloat, dIy: visp._visp.core.ImageFloat) None ¶
Set the Gradients of the image that will be processed.
- Parameters:
- dIx: visp._visp.core.ImageFloat¶
Gradient along the horizontal axis of the image.
- dIy: visp._visp.core.ImageFloat¶
Gradient along the vertical axis of the image.