SetMValue

Trait SetMValue 

Source
pub trait SetMValue {
    // Required method
    fn set_2d<T: DataType>(
        &mut self,
        row: i32,
        col: i32,
        value: T,
    ) -> Result<(), StackerError>;
}
Expand description

Trait for setting value in a 2d Mat<T> Todo:There must be a better way to do this

Required Methods§

Source

fn set_2d<T: DataType>( &mut self, row: i32, col: i32, value: T, ) -> Result<(), StackerError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SetMValue for Mat

Source§

fn set_2d<T: DataType>( &mut self, row: i32, col: i32, value: T, ) -> Result<(), StackerError>

let mut m = unsafe { opencv::core::Mat::new_rows_cols(1, 3, opencv::core::CV_64FC1).unwrap() };
m.set_2d::<f64>(0, 0, -1.0).unwrap();
m.set_2d::<f64>(0, 1, -2.0).unwrap();
m.set_2d::<f64>(0, 2, -3.0).unwrap();
assert_eq!(-1.0, *m.at_2d::<f64>(0,0).unwrap());
assert_eq!(-2.0, *m.at_2d::<f64>(0,1).unwrap());
assert_eq!(-3.0, *m.at_2d::<f64>(0,2).unwrap());

Implementors§