Measure gap widths

Measure gap widths

Measures gap widths using a gray-level profile.

Inputs

profile
1-by-N gray-scale profile vector originating typically from gray level profiling.
startPoint
The location of the first profile point in world coordinates.
endPoint
The location of the last profile point in world coordinates.
algorithm
Gap edge detection algorithm. Gap edges are detected from filtered profile using the selected algorithm.
smoothness
Smoothness of the profile filter. Small smoothness value works best with sharp edges. Large smoothness value gives better results if the edges are dull or the image is noisy.
threshold
The following condition must be met at be met before a filtered profile entry is considered to be a start / end of a gap: Absolute mode: Filtered gray level must be larger than this. Differential mode: Rate of change must be larger than this. Gaussian zero crossing mode: Two consecutive 2nd order differences must be of opposite signs and their difference must be larger than threshold.
hysteresis
Hysteresis to the threshold Absolute mode: The threshold must be exceeded by this number before the pixel is considered an edge. Differential mode: Pixel at which the rate of change is local maximum minus hysteresis is set as an edge. Gaussian zero crossing mode: N/A
maxGapCount
maximum number of gaps to be detected

Outputs

filteredProfile
Filtered vector which is matched against the threshold. In absolute mode contains smoothed input profile. In differential mode contains filtered differences. In zero crossing mode contains filtered 2nd order differences.
gapStartLength
distance of the left edge of the gap from the beginning of the profile line in world coodinates.
gapEndLength
distance of the right edge of the gap from the beginning of the profile line in world coodinates.
gapWidth
Width of the gap in world coordinates
gapType
Type of the gap. 0 = dark gap, 1 = light gap.
gapMagnitude
Magnitude of the filtered profile which exceeded the threshold for the left edge of this gap. The bigger the value, the sharper the edge is. Absolute mode: Maximum gray level in light gap and minimum gray level in dark gap. Differential mode: Maximum change in light gap (>0) and minimum change in dark gap (<0) at the left edge of the gap. Gaussian zero crossing mode: Difference between the two consecutive 2nd order differences with opposite signs.
gapStartPoint
World coordinates of the left end of the gap on XY-plane
gapCenterPoint
World coordinates of the center of the gap on XY-plane
gapEndPoint
World coordinates of the right end of the gap on XY-plane

Supported algorithms

Enumerator
AbsoluteThreshold 

Detect gap boundaries at positions where the given threshold gray level is crossed in either direction.

DifferentialThreshold 

Detect gap boundaries at steepest gray level changes. Positive changes mean a dark-to-light boundary and negative changes a light-to-dark boundary.

GaussianZeroCross 

Marr-Hildreth edge detector. First filters the input profile with a Gaussian filter whose width is changed according to the smoothness parameter. A second order differential function is then computed. Zero crossings of this differential function indicate the points at which the change of magnitude is the largest. These points are selected as boundaries.

Gap filter types

Enumerator
DarkGap 

Report only dark gaps.

LightGap 

Report only light gaps.

DarkOrLightGap 

Report both gap types.