bounding-boxes
它能做什么
该技能从模拟场景中生成带标注的边界框。适合为计算机视觉构建图像数据集的人。
适用场景
- ✓当你需要模拟器中车辆或其他角色的边界框的时候。
- ✓当你希望在模拟世界中绘制边界框以便检查的时候。
- ✓当你需要一张带标注的摄像头图像,以及与之对应的 2D 框 JSON 文件的时候。
技能链接
https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/python-api/bounding-boxes/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把车辆边界框投影到我的前置摄像头上,并保存一张带标注的 PNG 和一个 JSON 文件。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会读取每个角色的 3D 边界框,可以在世界中绘制它以便检查,并通过摄像头将其投影为 2D 框。它会保存带标注的图像和包含这些框的 JSON 文件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Bounding boxes
Paths.
scripts/…andreferences/…below are relative to the directory holding this SKILL.md. Your working directory is the user's project, not that directory, so prefix them with its absolute path or the command is not found.
Three things: read actors' 3D boxes, draw them in the world, or project them
into a camera image as 2D boxes with a JSON sidecar — the standard CARLA
dataset-annotation pipeline (client_bounding_boxes.py).
Instructions
Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh), clear FAILs
- [ ] Step 2: For `project`, have a camera on the ego (create-sensor) + actors around
- [ ] Step 3: list / draw / project
Commands need CARLA_HOST/CARLA_PORT from scripts/env.sh.
Step 1: Check prerequisites
bash scripts/check_env.sh
Step 3: Boxes
source scripts/env.sh
# 3D box geometry of every vehicle
python3 scripts/bounding_boxes.py list --filter vehicle.*
# draw 3D boxes around vehicles — they track moving cars, stay 30 s (default)
python3 scripts/bounding_boxes.py draw --filter vehicle.*
python3 scripts/bounding_boxes.py draw --filter vehicle.* --seconds 60
# project vehicle boxes into a camera frame -> annotated PNG + JSON
python3 scripts/bounding_boxes.py project --camera <camera_id> --filter vehicle.* --out boxes.png
How the projection works (brief)
Capture one frame → build the camera intrinsics K from its fov + resolution →
for each actor, take its 3D box's 8 world vertices (get_world_vertices),
transform to camera space with the camera's inverse matrix, keep those in front,
apply K → 2D points → the min/max is the 2D box. Off-frame and too-far
(--max-dist) actors are skipped. Full math in the reference.
Examples
Example 1: annotate the ego camera
User says: "put boxes on the cars in the camera view"
Spawn a camera on the ego (create-sensor), then project --camera <id> --filter vehicle.* → boxes.png with green 2D boxes + boxes.json.
Example 2: how big is that actor
User says: "what are the dimensions of vehicle 137?"
list --filter vehicle.* (find 137) → its LxWxH from the extent.
Example 3: visualise in 3D
User says: "outline all the vehicles in the world"
draw --filter vehicle.* — green 3D boxes on a rendered server.
Troubleshooting
Problem: project finds no boxes
Cause: no actors in front of / within --max-dist of the camera, or wrong filter.
Solution: raise --max-dist, widen --filter, ensure vehicles are in view.
Problem: boxes misaligned Cause: the frame and the actor poses drifted (fast motion, async). Solution: capture in synchronous mode (set-world-settings) so the frame and poses are from the same tick.
Problem: draw shows nothing
Cause: headless -nullrhi server.
Solution: use a rendered server (see debug-draw).
Note: boxes always track moving actors
draw re-stamps each frame for --seconds (default 30), so boxes ride moving
cars automatically — the command blocks for that duration.
Outputs
list: box dimensions per actor.draw: 3D box overlay (rendered view).project:<out>.png(annotated) +<out>.json(2D boxes: id, type, xyxy).
Detail (intrinsics, world→camera transform, level boxes, lidar-to-camera) in references/bounding-boxes.md.
常见问题
没有摄像头能绘制边界框吗?
能。它可以列出框的几何数据,或在世界中绘制 3D 框。投影步骤则需要摄像头。
绘制的框会在屏幕上停留多久?
默认停留 30 秒,你也可以设置更长的时间。
投影需要什么?
一个附着在自车上的摄像头(由传感器技能放置),以及其周围的角色。
详情
作者的原始描述
Gets actor and level 3D bounding boxes and projects them into a camera image as 2D boxes — the dataset-annotation workflow. Lists box geometry, draws 3D boxes in the world via debug, or captures one camera frame and writes an annotated PNG plus a JSON of 2D boxes for matching actors. Use when the user asks to "get bounding boxes", "draw boxes around the cars", "project boxes onto the camera", or "generate a detection dataset / annotations".
repo: carla-simulator/carla
热度
- GitHub 星标
- 15k
- 排名
- #11084
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
create-leaderboard-route
15k帮你的智能体通过在模拟器视角中放置路径点和场景触发器,构建 CARLA Leaderboard 路线文件,并对其进行检查和排序。
package-leaderboard-agent
15k帮你的智能体把驾驶智能体打包成 Docker 镜像,用于提交 CARLA Leaderboard,并检查文件夹结构,测试镜像能否加载它。
read-leaderboard-results
15k帮你的智能体阅读 CARLA Leaderboard 结果文件,解释每条路线的得分和违规情况,并按另一规则版本重新计分。
run-leaderboard-evaluation
15k帮你的智能体用你的驾驶智能体在一组路线上运行 CARLA Leaderboard 评估器,先检查设置,并保存可以恢复的检查点。