A multi-threaded port of the python code found here: github.com/maitek/image_stacking
This crate contains multi-threaded functions that aligns and stacks images using OpenCV and Rayon.
Read more about image alignment with OpenCV here.
git clone https://github.com/maitek/image_stacking image_stacking_py
Opencv-rust can be little tricky to install. Follow the instructions from rust opencv
cargo build --release
cargo run --example main --release
and then wait a few seconds. The program should sort the images by quality, drop the least sharp image, and align and stack the rest. The result should be two windows showing the stacked images using two different alignment methods.
rust
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,
},
)?;
Depending on the parameters the ecc_match()
is much slower, but also more accurate.
rust
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,
},
)?;
.reshape()
in keypoint_match()
sharpness_tenengrad()
function. Mat not square?Licensed under either of
at your option.