The
iaConfigureContourDetection type is used to define the parameters of the contour detection function. The characteristics of these parameters can be defined and changed using different WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see
Declaring a variable.
monContour is aiConfigureContourDetection
monContour.DetectionAlgorithm = aiDetectContourCannyEdge
monContour.Dilate = True
monContour.GaussianFilterKernelSize = 3
monContour.ValueThreshold = 150
monContour.ValueThresholdMax = 255
monPolygone is Polygon
monPolygone = AIDetectContour("Image_test_contour_3.png", monContour)
Properties
Properties specific to aiConfigureContourDetection variables
The following properties can be used to handle aiConfigureContourDetection variables:
| | |
Property name | Type used | Effect |
---|
DetectionAlgorithm | Integer constant | Contour detection algorithm: - aiDetectContourCannyEdge (Default): edge detection algorithm developed by J.F.Canny in 1986.
- aiDetectContourBinaryThresholding: Binary thresholding algorithm.
|
Dilate | Boolean | Applies dilation to the image, which in some cases may allow for better detection: - True to apply dilation to the image,
- False (default value) otherwise.
|
GaussianFilterKernelSize | Integer | Noise reduction using Gaussian blur. By default, this property is set to 3. Remark: This value must be an odd number. |
ValueThreshold | Real | This property is used when the thresholding algorithm is applied. Any pixel with a value greater than ValueThreshold will be set to the value of ValueThresholdMax. By default, this property is set to 150.0. |
ValueThresholdMax | Real | This property is used when the thresholding algorithm is applied. Any pixel with a value greater than ValueThreshold will be set to the value of ValueThresholdMax. By default, this property is set to 255.0. |
WLanguage functions that use aiConfigureContourDetection variables
aiConfigureContourDetection variables can be handled using the following WLanguage functions:
| |
| Detects the contours of the shapes in an image. |