apply_colormap
最后更新
depthai_nodes.node.apply_colormap类
ApplyColormap
frame : dai.ImgFrame | dai.beta.Map2D | dai.ImgDetections | dai.SegmentationMask:包含要着色的二维数组的输入消息。
output : dai.ImgFrame:着色后的输出帧(3 通道 BGR)。
colormapValue:OpenCV 颜色映射枚举(例如 cv2.COLORMAP_JET)或自定义的 OpenCV 兼容颜色映射 LUT。默认为 cv2.COLORMAP_JET。maxValue:用于归一化的最大值。如果设置为 0,则每帧确定最大值。默认为 0。
方法
init
Python
1def __init__(colormapValue: int | np.ndarray = cv2.COLORMAP_JET, maxValue: int = 0):colormapValue(int | np.ndarray):OpenCV 颜色映射枚举(例如 cv2.COLORMAP_JET)或自定义的 OpenCV 兼容颜色映射 LUT。默认为 cv2.COLORMAP_JET。maxValue(int):用于归一化的最大值。如果设置为 0,则每帧确定最大值。默认为 0。
build
Python
1def build(frame: dai.Node.Output) -> ApplyColormap:frame(dai.Node.Output):生成要着色的类地图消息的上游输出。
ApplyColormap:已配置的节点实例。
process
Python
1def process(frame: dai.Buffer):frame(dai.Buffer):RAW ImgFrame、beta Map2D、SegmentationMask 或带有实例掩码的 ImgDetections。掩码标签 255 为背景。
TypeError:如果 ImgFrame 未使用 RAW 像素格式。ValueError:如果消息类型不受支持。
setColormap
Python
1def setColormap(colormapValue: int | np.ndarray):colormapValue(int | np.ndarray):OpenCV 颜色映射枚举值或自定义的 OpenCV 兼容 LUT。
ValueError:如果自定义颜色映射不是形状为(256, 1, 3)的 uint8 数组。
setMaxValue
Python
1def setMaxValue(maxValue: int):maxValue(int):用于归一化的最大输入值。0 表示保持每帧归一化。
ValueError:如果上限不是非负整数。