pub struct ChannelHistogram {
pub bins: [u32; 256],
pub channel: u8,
pub min_value: u8,
pub max_value: u8,
pub mean: f64,
pub std_dev: f64,
}Expand description
Per-channel histogram data with summary statistics.
Fields§
§bins: [u32; 256]Raw bin counts; bins[v] is the number of pixels with value v.
channel: u8Channel index (0-based).
min_value: u8Minimum pixel value present in this channel.
max_value: u8Maximum pixel value present in this channel.
mean: f64Mean pixel value.
std_dev: f64Standard deviation of pixel values.
Implementations§
Source§impl ChannelHistogram
impl ChannelHistogram
Sourcepub fn compute(
data: &[u8],
channel: u8,
stride: usize,
num_channels: usize,
) -> Self
pub fn compute( data: &[u8], channel: u8, stride: usize, num_channels: usize, ) -> Self
Compute a histogram for one channel of a packed multi-channel image.
§Arguments
data- Raw pixel bytes for the whole image.channel- Zero-based channel index (e.g. 0=R, 1=G, 2=B).stride- Offset between the start of consecutive rows in bytes (usewidth * num_channelsfor packed images).num_channels- Total number of interleaved channels per pixel.
Sourcepub fn percentile(&self, p: f64) -> u8
pub fn percentile(&self, p: f64) -> u8
Return the pixel value at the given percentile.
§Arguments
p- Percentile in[0.0, 1.0](e.g. 0.5 for the median).
Trait Implementations§
Source§impl Clone for ChannelHistogram
impl Clone for ChannelHistogram
Source§fn clone(&self) -> ChannelHistogram
fn clone(&self) -> ChannelHistogram
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ChannelHistogram
impl RefUnwindSafe for ChannelHistogram
impl Send for ChannelHistogram
impl Sync for ChannelHistogram
impl Unpin for ChannelHistogram
impl UnsafeUnpin for ChannelHistogram
impl UnwindSafe for ChannelHistogram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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