改为按帧自适应显示 Autocal 深度色阶
从有效 UV 区域计算当前帧范围,排除无效值和区域外像素。57 项定向测试及代码、文档检查通过。
This commit is contained in:
@@ -307,16 +307,19 @@ class FingerSourcePanel(QWidget):
|
||||
fresh = (getattr(packet, "depth_valid", None) is True
|
||||
and getattr(packet, "depth_frame_id", None) == packet.frame_id)
|
||||
if fresh and depth is not None and np.shape(depth) == frame.shape[:2]:
|
||||
# Fixed scale in SDK divergence units, never millimetres.
|
||||
colored = depth_map_to_bgr(depth, flow_colormap("light"),
|
||||
value_range=(0, 1), invalid_mask=mask)
|
||||
if colored is not None:
|
||||
valid = np.isfinite(depth)
|
||||
if mask is not None:
|
||||
valid &= np.asarray(mask, dtype=bool)
|
||||
valid = np.isfinite(depth)
|
||||
if mask is not None:
|
||||
valid &= np.asarray(mask, dtype=bool)
|
||||
if np.any(valid):
|
||||
# Adapt to this frame's valid UV region, excluding the exterior.
|
||||
low, high = float(np.min(depth[valid])), float(np.max(depth[valid]))
|
||||
colored = depth_map_to_bgr(
|
||||
np.where(valid, depth, low), flow_colormap("light"),
|
||||
value_range=(low, high), invalid_mask=valid,
|
||||
)
|
||||
blended = cv2.addWeighted(frame, .4, colored, .6, 0)
|
||||
frame[valid] = blended[valid]
|
||||
notes.append(t("feedback.depth_scale"))
|
||||
notes.append(t("feedback.depth_scale").format(low=low, high=high))
|
||||
else:
|
||||
notes.append(t("feedback.depth_missing"))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user