MCPcopy Create free account
hub / github.com/daniel-e/rustml / from_file

Method from_file

src/opencv/mod.rs:466–481  ·  view source on GitHub ↗
(fname: &str)

Source from the content-addressed store, hash-verified

464impl RgbImage {
465
466 pub fn from_file(fname: &str) -> Option<RgbImage> {
467
468 unsafe {
469 let mut s = fname.to_string();
470 s.push('\0');
471 // 1 = return a 3-channel color imge
472 // http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imread
473 let r = cvLoadImage(s.as_ptr() as *const c_char, 1 as c_int);
474 let i = RgbImage{ iplimage: r };
475
476 if r.is_null() || i.depth() != 8 || i.channels() != 3 {
477 return None;
478 }
479 Some(i)
480 }
481 }
482
483 pub fn from_raw(image: *const IplImage) -> RgbImage {
484

Callers

nothing calls this directly

Calls 3

to_stringMethod · 0.80
depthMethod · 0.80
channelsMethod · 0.80

Tested by

no test coverage detected