MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / main

Function main

examples/image_processing/gradient_diffusion.cpp:51–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51int main(int argc, char *argv[]) {
52 int device = argc > 1 ? atoi(argv[1]) : 0;
53
54 try {
55 setDevice(device);
56 info();
57
58 printf("** ArrayFire Gradient Anisotropic Smoothing Demo **\n");
59
60 Window myWindow("Gradient Anisotropic Smoothing");
61
62 in = loadImage(ASSETS_DIR "/examples/images/man.jpg", false);
63
64 array sEdges = sobelFilter(in);
65
66 anisotropicSmoothing();
67
68 array Gx, Gy;
69 sobel(Gx, Gy, smoothed, 3);
70
71 edges = normalize(hypot(Gx, Gy));
72
73 while (!myWindow.close()) {
74 myWindow.grid(2, 2);
75
76 myWindow(0, 0).image(in / 255.0f, "Input Image");
77 myWindow(0, 1).image(normalize(smoothed),
78 "Anisotropically smooted Input");
79 myWindow(1, 0).image(normalize(sEdges),
80 "Gradient Magnitude after gaussian blur t=64");
81 myWindow(1, 1).image(normalize(edges),
82 "Gradient Magnitude after diffusion t=64");
83
84 myWindow.show();
85 }
86
87 printf(
88 "\nAnisotropic Diffusion avg runtime for current image in Seconds: "
89 "%g\n",
90 timeit(anisotropicSmoothing));
91
92 } catch (af::exception &e) {
93 fprintf(stderr, "%s\n", e.what());
94 throw;
95 }
96
97 return 0;
98}

Callers

nothing calls this directly

Calls 13

infoFunction · 0.85
loadImageFunction · 0.85
anisotropicSmoothingFunction · 0.85
hypotFunction · 0.85
timeitFunction · 0.85
closeMethod · 0.80
gridMethod · 0.80
imageMethod · 0.80
showMethod · 0.80
sobelFilterFunction · 0.70
normalizeFunction · 0.70
setDeviceFunction · 0.50

Tested by

no test coverage detected