MCPcopy Index your code
hub / github.com/arrayfire/arrayfire-rust / main

Function main

examples/histogram.rs:7–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5#[allow(unused_variables)]
6#[allow(unused_must_use)]
7fn main() {
8 set_device(0);
9 info();
10
11 let assets_dir = PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap())
12 .join("arrayfire")
13 .join("assets")
14 .join("examples")
15 .join("images");
16
17 let img_wnd = Window::new(480, 640, String::from("Input Image"));
18 img_wnd.set_position(100, 100);
19
20 let hst_wnd = Window::new(512, 512, String::from("Input Image Histogram"));
21 hst_wnd.set_position(600, 100);
22
23 let man = load_image::<f32>(format!("{}/man.jpg", assets_dir.display()), false);
24 let hst = histogram(&man, 256, 0.0, 255.0);
25
26 let disp_img = div(&man, &constant(255_f32, man.dims()), false);
27
28 loop {
29 img_wnd.draw_image(&disp_img, None);
30 hst_wnd.draw_hist(&hst, 0.0, 255.0, None);
31
32 if img_wnd.is_closed() {
33 break;
34 }
35 if hst_wnd.is_closed() {
36 break;
37 }
38 }
39}

Callers

nothing calls this directly

Calls 10

set_deviceFunction · 0.85
infoFunction · 0.85
varFunction · 0.85
histogramFunction · 0.85
constantFunction · 0.85
set_positionMethod · 0.80
dimsMethod · 0.80
draw_imageMethod · 0.80
draw_histMethod · 0.80
is_closedMethod · 0.80

Tested by

no test coverage detected