numberlink.render_utils¶
Rendering utilities for NumberLinkRGB visualizations.
Module Contents¶
Functions¶
Upscale a cell-based frame to pixel dimensions and draw endpoint borders. |
API¶
- numberlink.render_utils.upscale_with_endpoint_borders(frame: ObsType, endpoint_mask: numpy.typing.NDArray[bool], render_config: numberlink.config.RenderConfig, scale: int = 1) ObsType[source]¶
Upscale a cell-based frame to pixel dimensions and draw endpoint borders.
The input
frameis an RGB array with one pixel per cell. The function repeats pixels to reach the requestedscaleand draws borders around cells marked byendpoint_maskusing colors and thickness fromRenderConfig.- Parameters:
frame (ObsType) – RGB image array of shape
(H, W, 3)where each pixel maps to one cell.endpoint_mask (NDArray[bool]) – Boolean mask indicating endpoint positions with shape
(H, W).render_config (RenderConfig) – Rendering configuration specifying border color and thickness.
scale (int, optional) – Number of pixels per cell in the output. Must be at least
1, when smaller than twice the border thickness it is increased to accommodate the border.
- Returns:
Upscaled frame with endpoint borders drawn, shape
(H*scale, W*scale, 3).- Return type:
ObsType