Skip to main content

Export MCAP camera frames to PNG with robot coordinate axis overlays

Project description

mcap2img

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


安装

pip install mcap2img

环境要求:Python 3.10 ~ 3.12,macOS / Linux / Windows。


快速开始

单个 MCAP 文件:

mcap2img --input /path/to/bag.mcap --output ./output

批量处理(目录下多个 .mcap):

mcap2img --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 关闭 输出详细日志

示例:

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

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

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

输出说明

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

常见问题

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

图像上没有坐标轴?
可能该帧缺少 camera_inforobot_info 数据,程序仍会保存原图。

重新导出前清理旧文件:

rm -rf output/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcap2img-0.1.1.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcap2img-0.1.1-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file mcap2img-0.1.1.tar.gz.

File metadata

  • Download URL: mcap2img-0.1.1.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mcap2img-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b51a63e9a0ed5c0c87b7e62821838b687e6853ba3b1c7edcdfc663ceaff18592
MD5 44ed568e0fb8398b13eb0bd3e3f88768
BLAKE2b-256 af1492e259c42609059db8e0102458cb5b4dfa5b2296ca7c805df01b01067b28

See more details on using hashes here.

File details

Details for the file mcap2img-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mcap2img-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mcap2img-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fc0eb260b8ad99a9295580ec4609be99e4984a4dcaa1ffe708109045b51c6b52
MD5 57cd32a409cd207ea8ef522523170d79
BLAKE2b-256 7f8da5323f42a3836b399e0d3c55e14f27a9c9a08038bd0d2228992e70ffa846

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page