[][src]Trait nshare::ToNdarray3

pub trait ToNdarray3 {
    type Out;
    pub fn to_ndarray3(self) -> Self::Out;
}

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

Loading content...

Required methods

pub fn to_ndarray3(self) -> Self::Out[src]

Loading content...

Implementations on Foreign Types

impl<P> ToNdarray3 for ImageBuffer<P, Vec<P::Subpixel>> where
    P: Pixel + 'static, 
[src]

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));

type Out = Array3<P::Subpixel>

Loading content...

Implementors

Loading content...