freqshow
A Rust library for converting images to and from the 2D frequency domain via FFT.
Usage
Add to your Cargo.toml:
[]
= "0.1.0"
Example
use FreqImage;
API overview
| Method | Description |
|---|---|
FreqImage::open(path) |
Load an image from disk (returns Result) |
FreqImage::from_image(img) |
Convert a DynamicImage to a complex buffer |
fi.fft_forward() |
2D forward FFT in-place |
fi.fft_inverse() |
2D inverse FFT in-place (normalized) |
fi.fftshift() / fi.ifftshift() |
Center / uncenter the DC component |
fi.to_image() |
Convert back to a GrayImage |
fi.view_fft_norm() |
Log-scale magnitude visualization |
fi.low_pass_mask(cutoff, smoothing) |
Generate a low-pass filter mask |
fi.high_pass_mask(cutoff, smoothing) |
Generate a high-pass filter mask |
fi.apply_filter(mask) |
Apply a filter mask in-place |
Running the example
This produces spectrum.png, low_pass.png, and high_pass.png in the working directory.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.