|
MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
|
| MAYAFLUX_API void MayaFlux::Kinesis::Vision::apply_contour_mask | ( | std::span< float > | pixels, |
| uint32_t | w, | ||
| uint32_t | h, | ||
| uint32_t | channels, | ||
| const Contour & | contour, | ||
| float | origin_x, | ||
| float | origin_y, | ||
| float | scale_x, | ||
| float | scale_y | ||
| ) |
Zero all pixels in pixels that fall outside contour.
For each pixel in the buffer, reconstructs its normalised image-space position from its row/column index, the crop origin (origin_x, origin_y), and the pixel dimensions. Tests containment using the winding number algorithm against the contour's point polygon. Pixels outside the polygon have all channel values set to 0.
The buffer is modified in place. Pixels inside the polygon are untouched.
| pixels | Interleaved float buffer, size must be w * h * channels. |
| w | Buffer width in pixels. |
| h | Buffer height in pixels. |
| channels | Channels per pixel. |
| contour | Contour whose polygon defines the keep region. |
| origin_x | Normalised x coordinate of the buffer's left edge. |
| origin_y | Normalised y coordinate of the buffer's top edge. |
| scale_x | Normalised width covered by one pixel column. |
| scale_y | Normalised height covered by one pixel row. |
Definition at line 211 of file Contours.cpp.
References h, pixels, and MayaFlux::Kinesis::Vision::Contour::points.
Referenced by MayaFlux::Yantra::VisionExtractor< InputType, OutputType >::extract_implementation().
Here is the caller graph for this function: