7 个版本
0.1.6 | 2024年1月14日 |
---|---|
0.1.5 | 2022年5月6日 |
0.1.4 | 2022年4月24日 |
0.1.3 | 2022年1月16日 |
0.1.2 | 2021年9月6日 |
#101 in 视频
每月30次下载
13KB
184 行
simple_image_interface
- 这是一个用于 Rust 的简单图像接口库。
- 如果您使用此库,可以轻松地在图像、视频和摄像头输入之间切换。
- 它可能对机器人视觉等调试领域很有用。
- 支持图像接口
- 摄像头
- 网络摄像头 (v4l2)
- Realsense
- Basler 摄像头
- 视频
- mp4
- 图像
- png
- jpeg
- 摄像头
文档
开始使用
安装
- rscam 的安装
sudo apt install libv4l-dev
- ffmpeg-next 的安装
sudo apt install -y clang libavcodec-dev libavformat-dev libavutil-dev pkg-config libavdevice-dev
- Cargo.toml
"simple_image_interface" = "0.1.6"
示例代码
- 创建接口
- 详细内容,请参阅 示例代码
use simple_image_interface::simple_image_interface::SimpleImageInterface;
fn main() {
if args.len() < 2 || &args[1] == "pic" {
interface = SimpleImageInterface::new_picture("./data/from_raw.png");
} else if &args[1] == "video" {
interface = SimpleImageInterface::new_video("./data/random_ball.mp4");
} else {
interface = SimpleImageInterface::new_camera("/dev/video0", 640, 360, 330);
// width, height, fps
}
let mut frame_index = 0;
loop {
frame_index += 1;
let input_image = interface.get_frame();
if input_image.is_none() {
break;
}
my_image_proc(&input_image.unwrap(), frame_index);
}
}
- 示例代码执行
# Run for picture
cargo run --release --example example pic
# Run for video
cargo run --release --example example video
注意
- 不使用 trait 对象,而是使用 lapper 结构以提高执行速度
历史
- v0.1.6
- 更新依赖项并修复一些警告
- 重构
- v0.1.5
- 重构
- [注意] 修改模块架构
- v0.1.4
- 重命名存储库名称
- v0.1.3
- 重构
- v0.1.2
- v0.1.1
- 修复错误
- v0.1.0
- 发布初始库
参考
- https://github.com/loyd/rscam : 用于摄像头输入
- https://github.com/zmwangx/rust-ffmpeg : 用于视频输入
依赖项
~6–15MB
~175K SLoC