Metadata-Version: 2.4
Name: mcap2shadowimg
Version: 0.2.0
Summary: Export MCAP camera frames to PNG with robot coordinate axis overlays
Author: mcap2shadowimg
License-Expression: MIT
Keywords: mcap,robotics,camera,opencv,export
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: <3.14,>=3.10
Description-Content-Type: text/markdown
Requires-Dist: mcap>=1.1.1
Requires-Dist: av>=12.0.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: opencv-python>=4.8.0
Requires-Dist: protobuf==4.25.1
Requires-Dist: scipy>=1.10.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"

# mcap2shadowimg

将 MCAP 文件中的相机视频帧导出为 PNG，并可在图像上叠加机器人坐标轴。

---

## 安装

```bash
pip install mcap2shadowimg
```

环境要求：Python 3.10 ~ 3.12，macOS / Linux / Windows。

---

## 快速开始

**单个 MCAP 文件：**

```bash
mcap2shadowimg --input /path/to/bag.mcap --output ./output
```

**批量处理（目录下多个 `.mcap`）：**

```bash
mcap2shadowimg --input /path/to/mcap_dir --output ./output
```

每个 MCAP 会在输出目录下按文件名创建子目录，例如：

```
output/
  my_bag/
    camera2/
      1778813410223851000.png
      ...
```

---

## 常用参数

| 参数 | 默认值 | 说明 |
|------|--------|------|
| `--input` | 必填 | `.mcap` 文件路径，或包含多个 `.mcap` 的目录 |
| `--output` | `./output` | PNG 输出目录 |
| `--cameras` | `2` | 要导出的相机编号，逗号分隔 |
| `--overlay-robots` | `robot1,robot2` | 绘制坐标轴的机器人 id |
| `-v`, `--verbose` | 关闭 | 输出详细日志 |

**示例：**

```bash
# 导出 camera0 和 camera2
mcap2shadowimg --input bag.mcap --output ./output --cameras 0,2

# 指定叠加的机器人
mcap2shadowimg --input bag.mcap --output ./output --overlay-robots robot1,robot2

# 开启详细日志
mcap2shadowimg --input bag.mcap --output ./output -v
```

---

## 输出说明

- 默认只导出 **camera2**
- PNG 文件名为 MCAP 的 `log_time`（纳秒时间戳）
- 若某帧缺少标定或机器人位姿，仍会保存原图，只是不绘制坐标轴

---

## 常见问题

**导出较慢？**  
默认仅导出 camera2，通常比导出全部相机快很多。可用 `--cameras` 指定需要的相机。

**图像上没有坐标轴？**  
可能该帧缺少 `camera_info` 或 `robot_info` 数据，程序仍会保存原图。

**重新导出前清理旧文件：**

```bash
rm -rf output/*
```
