|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
| MAYAFLUX_API std::vector< Contour > MayaFlux::Kinesis::Vision::find_contours | ( | std::span< const float > | mask, |
| uint32_t | w, | ||
| uint32_t | h, | ||
| float | min_area = 0.0F, |
||
| uint32_t | max_contours = 0, |
||
| uint32_t | max_points_per_contour = 0 |
||
| ) |
Extract outer and hole contours from a binary mask.
Labels 8-connected foreground components and traces their outer boundaries with Moore neighborhood following. Enclosed 4-connected background regions are traced as holes, with parent_label naming their enclosing foreground component. Background connected to an image edge is excluded. Outer contours use Contour::no_parent (0xFFFFFFFF) as their parent_label. Each contour closes from its last point to its first. Closure follows the starting directed edge so touching branches may revisit the start pixel.
Area is (absolute pixel polygon area + half the pixel perimeter + 1) divided by w * h. Perimeter is the closed polygon length in pixels.
Contours with fewer than 3 points are discarded. Contours whose normalised area is below min_area are discarded after tracing. A nonzero max_contours sorts by descending area and retains at most that many contours. Outer boundaries and holes share this limit. A nonzero max_points_per_contour stops each trace at that many points; measurements use the retained polygon, including its closing edge.
| mask | Single-channel float span, size must be w * h. |
| w | Image width in pixels. |
| h | Image height in pixels. |
| min_area | Minimum normalised area [0,1] to retain. Default 0 (no filter). |
| max_contours | Maximum number of contours to return. 0 means no limit. |
| max_points_per_contour | Maximum trace length. 0 means no caller limit. |
Definition at line 111 of file Contours.cpp.
References connected_components(), find_contours(), and h.
Referenced by find_contours(), and MayaFlux::Kinesis::Vision::VisionExecutor::run().
Here is the call graph for this function:
Here is the caller graph for this function: