[−][src]Trait nshare::ToNdarray3
Converts a 3d type to a ndarray 2d array type.
Coordinates are in (channel, row, col)
, where channel is typically a color channel,
or they are in (z, y, x)
.
This uses an associated type to avoid ambiguity for the compiler. By calling this, the compiler always knows the returned type.
Associated Types
type Out
Required methods
fn to_ndarray3(self) -> Self::Out
Implementations on Foreign Types
impl<P> ToNdarray3 for ImageBuffer<P, Vec<P::Subpixel>> where
P: Pixel + 'static,
[src]
P: Pixel + 'static,
use image::RgbImage; use nshare::ToNdarray3; use ndarray::s; let zeros = RgbImage::new(2, 4); let mut nd = zeros.to_ndarray3(); nd.fill(255); // ndarray uses (channel, row, col), so the dims get flipped. assert_eq!(nd.dim(), (3, 4, 2));