| 49 | } |
| 50 | |
| 51 | int 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 | } |
nothing calls this directly
no test coverage detected