Skip to content

Commit

Permalink
chore: update version; update readme; add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
lily-mosquitoes committed Aug 7, 2023
1 parent 4c11776 commit 5bc8f94
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

## [v0.2.0](https://github.com/lily-mosquitoes/image-recovery/compare/v0.1.0...v0.2.0) (2023-08-07)

### ⚠ BREAKING CHANGE

* new api for library use


### Features

* implemented new imagearray struct with associated traits as main library
object, changes denoise solver to use the new struct and operations
([4c11776](https://github.com/lily-mosquitoes/image-recovery/commit/4c117762cdd187f581f1f9da2d0100cefb083327))
* **image_array:** implement ImageArray as concrete type over trait
DifferentiableArray
([db8462e](https://github.com/lily-mosquitoes/image-recovery/commit/db8462e3b25a0ee30be152658fd84b714ae29caa))
* **differentiable_array:** create new trait DifferentiableArray and implement
for Array generically
([46775c8](https://github.com/lily-mosquitoes/image-recovery/commit/46775c8a836273110e0807826b7a2f78744dfe7f))
* add log crate; make print statement a debug log
([2071911](https://github.com/lily-mosquitoes/image-recovery/commit/2071911328cfc10c01b88cab7330a5935cefcb4c))

## v0.1.0 (2022-04-18)
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "image-recovery"
version = "0.1.1"
version = "0.2.10"
edition = "2021"
authors = ["Lílian Ferreira de Freitas <[email protected]>", "Emilia L. K. Blåsten <[email protected]>"]
description = "Image recovery algorithms, implemented in Rust."
Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,30 @@ Declare the dependency in you Cargo.toml

```toml
[dependencies]
image-recovery = "0.1"
image-recovery = "0.2"
```

## Examples:

Examples for each solver can be found in the [`examples` folder](https://github.com/lily-mosquitoes/image-recovery/tree/main/examples), and those can be run with `cargo run --example example_name`. However, a quick example usage is shown below:
Only the `denoise` solver is currently implemented. The examples for it can be found in the [`examples` folder](https://github.com/lily-mosquitoes/image-recovery/tree/main/examples), and can be run with `cargo run --example denoise`. Furthermore, a quick example usage is shown below:

### Image denoising (multichannel)

```rust
use image_recovery::{
image, // re-exported `image` crate
img::Manipulation, // trait for image::RgbImage manipulation
solvers, // module with image recovery algorithms
ImageArray, // struct for holding images
};

fn main() {
// the `image` crate provides functionality to decode images
let img = image::open("examples/source_images/angry_birb_noisy.png")
.expect("image could not be open")
.into_rgb8(); // the algorithms in this library are implemented for RGB images
.into_rgb8(); // the algorithms in this library are implemented for the Luma and Rgb types

// load the RGB image into an object which is composed
// of 3 matrices, one for each channel
let img_matrices = img.to_matrices();
let img_array = ImageArray::from(&img);

// choose inputs for the denoising solver:
// according to Chambolle, A. and Pock, T. (2011),
Expand All @@ -68,20 +67,23 @@ fn main() {
// choose bounds for denoising solver
// the algorithm will run for at most `max_iter` iterations
let max_iter: u32 = 500;

// the algorithm will stop running if:
// `convergence_threshold < norm(current - previous) / norm(previous)`
// where `current` is the output candidate for the current iteration,
// and `previous` is the output candidate of the previous iteration.
let convergence_threshold = 10_f64.powi(-10);

// now we can call the denoising solver with the chosen variables
let denoised = solvers::denoise_multichannel(&img_matrices, lambda, tau, sigma, gamma, max_iter, convergence_threshold);
let denoised_array = image_array
.denoise(lambda, tau, sigma, gamma, max_iter, convergence_threshold)
.unwrap(); // will fail if image is 1 pixel in either x or y

// we convert the solution into an RGB image format
let new_img = image::RgbImage::from_matrices(&denoised);
let denoised_img = denoised_array.into_rgb();

// encode it and save it to a file
new_img.save("examples/result_images/angry_birb_denoised_multichannel.png")
new_img.save("examples/result_images/angry_birb_denoised.png")
.expect("image could not be saved");
}
```
Expand All @@ -90,7 +92,7 @@ This should provide the following result:

Source image: | Output image:
---|---
![source image, noisy](examples/source_images/angry_birb_noisy.png) | ![output image, denoised](examples/result_images/angry_birb_denoised_multichannel.png)
![source image, noisy](examples/source_images/angry_birb_noisy.png) | ![output image, denoised](examples/result_images/angry_birb_denoised.png)

## Testing

Expand All @@ -106,7 +108,7 @@ Benchmarking can be run with `cargo bench`.

Image recovery algorithms to implement:

- [x] Denoising (single and multichannel variants)
- [x] Denoising
- [ ] Zooming
- [ ] Deblurring
- [ ] Dequantization
Expand All @@ -115,7 +117,7 @@ Image recovery algorithms to implement:

## Copyright

This code is licensed under the GNU Affero General Public License version 3 or later. See [LICENSE](https://github.com/lily-mosquitoes/image-recovery/blob/main/LICENSE) or https://www.gnu.org/licenses/agpl-3.0.en.html.
This code is licensed under the GNU Affero General Public License version 3 or later. See [LICENSE](https://github.com/lily-mosquitoes/image-recovery/blob/main/LICENSE) or [gnu.org/licenses/agpl-3.0.en.html](https://gnu.org/licenses/agpl-3.0.en.html).

## Acknowledgements

Expand Down

0 comments on commit 5bc8f94

Please sign in to comment.