Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mpizenberg/rust_mls
Image Deformation Using Moving Least Squares (Schaefer 2006) in Rust
https://github.com/mpizenberg/rust_mls
Last synced: about 2 months ago
JSON representation
Image Deformation Using Moving Least Squares (Schaefer 2006) in Rust
- Host: GitHub
- URL: https://github.com/mpizenberg/rust_mls
- Owner: mpizenberg
- License: mpl-2.0
- Created: 2021-09-21T15:44:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-25T09:32:42.000Z (over 2 years ago)
- Last Synced: 2024-10-07T03:43:54.479Z (3 months ago)
- Language: Rust
- Size: 67.4 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Image Deformation Using Moving Least Squares
Rust implementation of the paper ["Image Deformation Using Moving Least Squares", Schaefer 2006][pdf].
![mls demo output][img]
[pdf]: https://people.engr.tamu.edu/schaefer/research/mls.pdf
[img]: https://mpizenberg.github.io/resources/moving-least-squares/mls-demo.jpgThis repository contains the MLS warping code inside `moving-least-squares/`, an application to image warping inside `moving-least-squaers-image/` as well as a demo with example usage producing the above figure inside the `moving-least-squares-demo/` directory.
To run the demo:```sh
cd moving-least-squares-demo/
cargo run --release
```The optional `rayon` feature enables parallel iterators for the generation of the warped image.
```sh
cargo run --release --features rayon
```Here is what using the library looks like:
```rust
// Open an image from disk.
let img = image::open("data/woody.jpg")?.into_rgb8();// Define the source control points.
let controls_src: &[(f32, f32)] = &[
(20.0, 160.0),
...
(250.0, 369.0),
];// Define the destination control points.
let controls_dst: &[(f32, f32)] = &[
(20.0, 250.0),
...
(250.0, 369.0),
];// Create new warped image.
let warped_img_affine =
mls_image::reverse_dense(&img, controls_src, controls_dst, mls::deform_affine);
```