pub trait Demosaic {
// Required method
fn demosaic_into(
&self,
raw: &RawImage,
output: &mut [u16],
) -> Result<(), DemosaicError>;
// Provided method
fn demosaic(&self, raw: &RawImage) -> RgbImage { ... }
}Expand description
Trait for demosaicing algorithms.
Implementors should override demosaic_into as the primary method.
The demosaic method provides a convenience wrapper that allocates output.
§Example
ⓘ
use rawshift::processing::demosaic::{Bilinear, Demosaic};
let demosaiced = Bilinear.demosaic(&raw_image);Required Methods§
Sourcefn demosaic_into(
&self,
raw: &RawImage,
output: &mut [u16],
) -> Result<(), DemosaicError>
fn demosaic_into( &self, raw: &RawImage, output: &mut [u16], ) -> Result<(), DemosaicError>
Demosaic a raw image into a pre-allocated RGB buffer.
This is the primary method that implementors must override.
The output buffer must have exactly width * height * 3 elements.
§Arguments
raw- The raw image to demosaicoutput- Pre-allocated buffer for RGB output (interleaved R, G, B, R, G, B, …)
§Errors
Returns DemosaicError::BufferSizeMismatch if buffer size is incorrect.
Provided Methods§
Sourcefn demosaic(&self, raw: &RawImage) -> RgbImage
fn demosaic(&self, raw: &RawImage) -> RgbImage
Demosaic a raw image into a newly allocated RGB image.
This is a convenience wrapper that allocates the output buffer
and calls demosaic_into.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".