Skip to main content

RawImage

Struct RawImage 

Source
pub struct RawImage {
Show 21 fields pub camera: Camera, pub make: String, pub model: String, pub clean_make: String, pub clean_model: String, pub width: usize, pub height: usize, pub cpp: usize, pub bps: usize, pub wb_coeffs: [f32; 4], pub whitelevel: WhiteLevel, pub blacklevel: BlackLevel, pub xyz_to_cam: [[f32; 3]; 4], pub photometric: RawPhotometricInterpretation, pub active_area: Option<Rect>, pub crop_area: Option<Rect>, pub blackareas: Vec<Rect>, pub orientation: Orientation, pub data: RawImageData, pub color_matrix: HashMap<Illuminant, FlatColorMatrix>, pub dng_tags: HashMap<u16, Value>,
}
Expand description

All the data needed to process this raw image, including the image data itself as well as all the needed metadata

Fields§

§camera: Camera

Camera definition

§make: String

camera make as encoded in the file

§model: String

camera model as encoded in the file

§clean_make: String

make cleaned up to be consistent and short

§clean_model: String

model cleaned up to be consistent and short

§width: usize

width of the full image

§height: usize

height of the full image

§cpp: usize

number of components per pixel (1 for bayer, 3 for RGB images)

§bps: usize

Bits per pixel

§wb_coeffs: [f32; 4]

whitebalance coefficients encoded in the file in RGBE order

§whitelevel: WhiteLevel

image whitelevels in RGBE order

§blacklevel: BlackLevel

image blacklevels in RGBE order

§xyz_to_cam: [[f32; 3]; 4]

matrix to convert XYZ to camera RGBE

§photometric: RawPhotometricInterpretation

Photometric interpretation

§active_area: Option<Rect>

how much to crop the image to get all the usable (non-black) area

§crop_area: Option<Rect>

how much to crop the image to get all the recommended area

§blackareas: Vec<Rect>

Areas of the sensor that is masked to prevent it from receiving light. Used to calculate black levels and noise.

§orientation: Orientation

orientation of the image as indicated by the image metadata

§data: RawImageData

image data itself, has width*height*cpp elements

§color_matrix: HashMap<Illuminant, FlatColorMatrix>§dng_tags: HashMap<u16, Value>

Implementations§

Source§

impl RawImage

Source

pub fn calc_black_levels<T>( cfa: &CFA, blackareas: &[Rect], width: usize, _height: usize, image: &[T], ) -> Option<BlackLevel>
where T: SubPixel,

Source

pub fn dim(&self) -> Dim2

Source

pub fn pixels_u16(&self) -> &[u16]

Source

pub fn pixels_u16_mut(&mut self) -> &mut [u16]

Source

pub fn apply_scaling(&mut self) -> Result<()>

Apply blacklevel and whitelevel scaling, replacing raw image data with floating point values in range 0.0 .. 1.0. Internal blacklevel and whitelevel is reset to 0.0 and 1.0 to match image data.

Source

pub fn develop_params(&self) -> Result<DevelopParams>

Source

pub fn add_dng_tag<T: TiffTag, V: Into<Value>>(&mut self, tag: T, value: V)

Add a DNG tag override

Source

pub fn linearize(&self) -> Result<Self>

Source

pub fn cam_to_xyz(&self) -> [[f32; 4]; 3]

Outputs the inverted matrix that converts pixels in the camera colorspace into XYZ components.

Source

pub fn cam_to_xyz_normalized(&self) -> [[f32; 4]; 3]

Outputs the inverted matrix that converts pixels in the camera colorspace into XYZ components normalized to be easily used to convert to Lab or a RGB output space

Source

pub fn neutralwb(&self) -> [f32; 4]

Not all cameras encode a whitebalance so in those cases just using a 6500K neutral one is a good compromise

Source

pub fn cropped_cfa(&self) -> CFA

Returns the CFA pattern after the crop has been applied (and thus the pattern potentially shifted)

Source

pub fn is_monochrome(&self) -> bool

Checks if the image is monochrome

Trait Implementations§

Source§

impl Clone for RawImage

Source§

fn clone(&self) -> RawImage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RawImage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&RawImage> for RawParams

Source§

fn from(rawimage: &RawImage) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more