Assembly: Cognex.VisionPro.LineMax (in Cognex.VisionPro.LineMax.dll) Version: 65.1.0.0
Property Value
Type: DoubleThe size of the 2D kernel sides in pixels. The default is 2.
| Event Type | Reason |
|---|---|
| ICogChangedEvent Changed | Fires when this property changes. The following state flag may be affected: |
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown if set to a value less than 1 or greater than 64. |
Decrease this value to improve accuracy and detect sharp edges; increase this value to blur out sharp edges and detect gradual edges.
Each gradient is computed from a square region of image pixels. The GradientKernelSizeInPixels value specifies the size in pixels of one side of that square region. The entire image is tiled with squares of this size. For example, a value of one means the gradient field contains one gradient for every image pixel; whereas a value of four means the gradient field contains one gradient for every 16 pixels (i.e. 4x4 kernel size).
Note that the GradientKernelSizeInPixels value can be fractional. For example, a value of 3.25 means the gradient field contains a gradient for every 3.25x3.25 pixels. Applying this value to a 13x13 (pixels) image yields a 4x4 gradient field.
To maintain accuracy, each element of the gradient field must be computed from a precisely square patch of physical space. This means that the GradientKernelSizeInPixels value will be applied non-uniformly if the number of pixels per physical unit differs along the x and y axes of the image.
For example, consider an image that has 4 pixels per millimeter along the image x axis, but only 3 pixels per millimeter along the image y axis. If you set the GradientKernelSizeInPixels to 4, a 4-by-3 rectangle of pixels will be used to compute the gradient vector for each square millimeter of physical space.
In other words, GradientKernelSizeInPixels specifies the _maximum_ kernel side length in pixels. One image axis may require a smaller value to ensure the kernel is square in physical units.
Further processing is done on the gradient field, not the image pixels. Therefore, the pixels to gradient field conversion can significantly reduce the amount of data to process. This results in higher accuracy and longer execution times for smaller GradientKernelSizeInPixels values; and lower accuracy and shorter execution times for larger ones.
The projection step operates on the gradient field: multiple gradients within the field are "projected" into a single gradient to average out noise and to reduce the amount of gradients to consider. The number of gradients combined during projection is controlled by ProjectionLengthInPixels. There is no benefit (in noise reduction, or data reduction) to having a projection length that is smaller than the GradientKernelSizeInPixels value. Therefore, GradientKernelSizeInPixels serves as a lower limit for ProjectionLengthInPixels.
If you set GradientKernelSizeInPixels to a value that is larger than the current projection length value, ProjectionLengthInPixels will automatically be set to that larger value. Likewise, setting ProjectionLengthInPixels to a value that is smaller than the current GradientKernelSizeInPixels value will automatically update the GradientKernelSizeInPixels to this smaller value.