Detecting Areas
<module>/detect-area searches one image, once, and reports the regions it finds.
Running it
Set the image address and execute:
module-1/detect-area/input/input-image-address = hdvisionsystems/lumiscan-cam-driver/camera1/output/image write module-1/detect-area/execute
Then read output/status-code and output/result.
Everything else has a working default, so this first run tells you whether anything is being found at all. Tuning follows: see Tuning the Detection, and Analysing a Scene for commissioning the threshold level.
The result
output/result is an area_detect_result flatbuffer.
| Field | Meaning |
|---|---|
|
Centre of the region. |
|
[pixel^2] Pixels the region covers, counted - never derived from a fitted shape. |
|
Which region this is in |
|
Tight box around the region. |
|
How many regions, for a control program that only needs a count. |
|
[pixel^2] Sum over all regions - the headline number for a coverage check. |
|
The biggest region. |
|
The searched region - the whole image unless a crop was set. |
|
|
|
Microseconds since epoch, when the run finished. |
Regions are sorted by area, so blobs[0] is the largest.
total_area is usually the number to act on: coverage, contamination and fill checks are all "how
much", not "how many".
Colour images
Either a grey or a colour image goes in. Thresholding and connected components are single-channel operations, so a colour image is converted and measured like any other. On ctrlX OS, a ctrlX image node delivers three colour channels whatever the camera is, so a grayscale camera produces three identical copies. There is no flag, and a region is reported once however many channels arrived.
Restricting the search
input/crop/{startX, startY, width, height} limits the search to part of the image. A zero width or
height reaches the corresponding edge, so the default all-zero region searches everything and
startX=100 with zero sizes searches from there to the bottom-right corner.
Two reasons to use it: speed, and excluding areas where a region cannot be, which avoids counting background clutter.
A region reaching past an edge is refused rather than trimmed, naming the input and the limit it broke.
Preprocessing
input/preprocess/method applies one filter before detection:
| Method | What it does |
|---|---|
|
The default. |
|
Laplacian of Gaussian - blur then a second derivative; emphasises regions of a size set by the sigma. |
|
Difference of Gaussians - two blurs subtracted, a band pass. |
|
Determinant of Hessian - second derivatives combined. |
Only the chosen method’s parameters are read, and only they are validated.
The regions themselves
The result carries numbers, not pixels. The pixels are in output/blob-labels, published by every
run: one region number per pixel, and blobs[].label says which number is which region. See
The Label Image.
An empty result
An empty blobs list with status-code 1 means no regions matched - nothing else. Every other
reason a run could produce nothing is caught before detection and reported as a negative status code.
See Execution Status.