annotate3d op• 数据种类:image2d → image2d
• 调用: import fullseye as fs; fs.ledger.annotate3d_scale_bar(img, origin, direction, length, pose, K, unit='', depth=None, color='neutral', width=2.0, tick=8.0, font_size=12, label_fmt='{:g}', box_alpha=0.55, text_color=None, occlusion_tol=0.01, scheme='okabe_ito', font_path=None)(要直接调用实现,import annotate3d; annotate3d.annotate3d_scale_bar(img, origin, direction, length, pose, K, unit='', depth=None, color='neutral', width=2.0, tick=8.0, font_size=12, label_fmt='{:g}', box_alpha=0.55, text_color=None, occlusion_tol=0.01, scheme='okabe_ito', font_path=None);从台账取用则 ops3d.get("annotate3d_scale_bar"))
返回图像(image2d):把网格单位下长度为 length 的比例尺贴在面上并投影。
比例尺是从 origin 沿 direction(归一化)前进 length 的 3-D 线段,投影后的像素长度会随其相对视线的倾斜而缩短(如实显示透视与缩短)。若与像平面平行,像素长度为 f * length / z —— tests 会验证这一点。
ValueError
direction 为零、length 非正、端点在相机后方 / 图像外。
步骤: 构造 p1 = origin + direction / |direction| * length,投影 origin 与 p1(与 annotate3d_project 相同的约定)。绘制连接两端像素的线,以及两端长度为 tick [px] 的垂直刻度(_bar_with_ticks),在从线的中点朝画面上方(row 较小的一侧)离开 tick/2 + 4 px 的位置放置 label_fmt.format(length) + " " + unit 的文字框。
参数:
• origin (3,)、direction (3,)(只使用方向。忽略长度,零则拒绝),length: 网格单位的长度(> 0,1e-300 以上)。
• unit: 字符串(为空则只显示数值)。label_fmt: str.format 的格式(默认 "{:g}")。
• width [px] >= 0.5、tick [px] >= 0(0 则无刻度)、font_size / box_alpha / text_color / font_path: 文字框的外观。
• depth: 前方距离图像。若两端都被遮挡,线画为虚线。
• color: 默认 "neutral"(角色名)。occlusion_tol: [0, 1)。
返回值: 绘制后的新图像(float64 [0, 1])。
报错条件: direction 的范数小于 1e-12 / length <= 0 / 任一端点 z <= 1e-9 / 任一端点在图像外(本 op 要求两端都 in_image — 与箭头不同,框外会被拒绝) / 位姿、K、depth 不正确 / 文字框放不下。
注意: 像素上的长度会随相对视线的倾斜而缩短(与像平面平行时为 f * length / z px)。沿深度方向放置会显得短,但那才是如实的投影。若要显示 2 点间的实测值,用 annotate3d_measure。
• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。
• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。
• annotate3d_figure — py -3.11 examples_3d/annotate3d_figure.py
image2d 作为输入)fuse_to_voxel · fit_poly_surface · eval_poly_surface · surface_form_error · background_flatten · polar_unwrap · fit_zernike · matcap_shade
annotate3d)annotate3d_project · annotate3d_arrow · annotate3d_label · annotate3d_axes · annotate3d_bbox · annotate3d_measure
*Provenance: annotate3d.py — 3D 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*
© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.