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

Function main

examples/image_grid.rs:6–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4use rustml::opencv::{GrayImage, Image, Window};
5
6fn main() {
7 let test = MnistDigits::default_test_set().unwrap().0;
8
9 let images = test
10 .map(|&x| 255 - x) // invert the data
11 .row_iter()
12 .take(100)
13 .map(|r| GrayImage::from_slice(r, 28, 28).unwrap())
14 .collect::<Vec<GrayImage>>();
15
16 let grid = GrayImage::grid(&images, 10, 0).unwrap();
17
18 grid.to_file("/tmp/grid.png");
19
20 println!("The image has been saved in /tmp/grid.png.");
21 println!("Press any key to quit.");
22
23 Window::new().show_image(&grid).wait_key();
24}

Callers

nothing calls this directly

Calls 6

gridFunction · 0.85
mapMethod · 0.80
row_iterMethod · 0.80
wait_keyMethod · 0.80
show_imageMethod · 0.80
to_fileMethod · 0.45

Tested by

no test coverage detected