Coder Social home page Coder Social logo

libstacker.rs's Introduction

crates.io Documentation Workflow dependency status license

libstacker

A multithreaded port of the python code found here: github.com/maitek/image_stacking

This crate contains multithreaded functions that aligns and stacks images using OpenCV and Rayon.

Read more about image alignment with OpenCV here.

Usage:

Download the test images:

git clone https://github.com/maitek/image_stacking image_stacking_py

Build the code:

Opencv-rust can be little tricky to install. Follow the instructions from rust opencv

You will need the "clang-runtime" feature if you experience problems with your clang environment .

cargo build --release

or

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

Run the example:

cargo run --example main --release

or

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

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.

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,
   },
)?;

Depending on the parameters the ecc_match() is much slower, but also more accurate.

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,
   },
)?;

Todo

  • Figure out the docs.rs problem
  • Figure out what to do with .reshape() in keypoint_match()
  • Figure out some opencv parameters responsibility sneakily shifted to end user.
  • Complete the sharpness_tenengrad() function. Mat not square?
  • Command line options in the example

License

Licensed under either of

at your option.

libstacker.rs's People

Contributors

eadf avatar nico-abram avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

nico-abram

libstacker.rs's Issues

docs.rs fails to build opencv-rust

I've tried to make docs.rs able to compile opencv-rust by adding libopencv-dev to their docker image.

But there seems to be something else missing. It could be pkg-config, but judging from the build log it does not look like it is missing, it just can't find the installed OpenCV.

Failing build log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.