#opencv #image #multi-threading #alignment #stack #rayon #image-stacking

libstacker

基于OpenCV和Rayon的图像对齐和堆叠函数

7个版本

0.0.7 2023年10月24日
0.0.6 2021年11月21日
0.0.3 2021年10月31日

#248 in 图像

MIT/Apache

26KB
369

crates.io Documentation Workflow dependency status license

libstacker

Python代码的多线程端口,可在此处找到:github.com/maitek/image_stacking

此crate包含使用OpenCVRayon对齐和堆叠图像的多线程函数。

关于OpenCV图像对齐的更多信息,请在此处阅读。

使用方法

下载测试图像

gitclone https://github.com/maitek/image_stacking image_stacking_py

构建代码

Opencv-rust的安装可能有点棘手。请遵循rust opencv的说明。

如果您在clang环境中遇到问题,则需要“clang-runtime”功能。此处有关于解决方法。

cargo build --release

或者

cargo build --release --features "clang-runtime"

运行示例

cargo run --example main --release

或者

cargo run --example main --release --features "clang-runtime"

然后等待几秒钟。程序应该按质量排序图像,丢弃最不清晰的图像,并对其余图像进行对齐和堆叠。结果应该有两个窗口显示使用两种不同的对齐方法堆叠的图像。

API

let keypoint_match_img:opencv::core::Mat = keypoint_match(
   // a Vec<PathBuf> containing paths to image files
   collect_image_files(&PathBuf::from("image_stacking_py/images"))?,
   KeyPointMatchParameters {
      method: opencv::calib3d::RANSAC,
      ransac_reproj_threshold: 5.0,
   },
)?;

根据参数,ecc_match()的速度较慢,但更准确。

let ecc_match_img:opencv::core::Mat = ecc_match(
   // a Vec<PathBuf> containing paths to image files
   collect_image_files(&PathBuf::from("image_stacking_py/images"))?,
   EccMatchParameters {
      motion_type: MotionType::Homography,
      max_count: Some(5000),
      epsilon: Some(1e-5),
      gauss_filt_size: 5,
   },
)?;

待办事项

  • 找出docs.rs问题
  • 找出在.reshape()中要做什么 keypoint_match()
  • 找出一些OpenCV参数 责任偷偷转移到最终用户。
  • 完成sharpness_tenengrad()函数。Mat不是正方形?
  • 示例中的命令行选项

许可协议

许可协议为以下之一

由您选择。

依赖项

~3–5.5MB
~73K SLoC