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

Function main

examples/image_processing/deconvolution.cpp:26–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26int main(int argc, char *argv[]) {
27 int device = argc > 1 ? atoi(argv[1]) : 0;
28
29 try {
30 af::setDevice(device);
31 af::info();
32
33 printf("** ArrayFire Image Deconvolution Demo **\n");
34 af::Window myWindow("Image Deconvolution");
35
36 array in = loadImage(ASSETS_DIR "/examples/images/house.jpg", false);
37 array kernel = gaussianKernel(13, 13, 2.25, 2.25);
38 array blurred = convolve(in, kernel);
39 array tikhonov =
40 inverseDeconv(blurred, kernel, 0.05, AF_INVERSE_DECONV_TIKHONOV);
41
42 array landweber =
43 iterativeDeconv(blurred, kernel, ITERATIONS, RELAXATION_FACTOR,
44 AF_ITERATIVE_DECONV_LANDWEBER);
45
46 array richlucy =
47 iterativeDeconv(blurred, kernel, ITERATIONS, RELAXATION_FACTOR,
48 AF_ITERATIVE_DECONV_RICHARDSONLUCY);
49
50 while (!myWindow.close()) {
51 myWindow.grid(2, 3);
52
53 myWindow(0, 0).image(normalize(in), "Input Image");
54 myWindow(1, 0).image(normalize(blurred), "Blurred Image");
55 myWindow(0, 1).image(normalize(tikhonov), "Tikhonov");
56 myWindow(1, 1).image(normalize(landweber), "Landweber");
57 myWindow(0, 2).image(normalize(richlucy), "Richardson-Lucy");
58
59 myWindow.show();
60 }
61
62 } catch (af::exception &e) {
63 fprintf(stderr, "%s\n", e.what());
64 throw;
65 }
66
67 return 0;
68}

Callers

nothing calls this directly

Calls 12

infoFunction · 0.85
loadImageFunction · 0.85
inverseDeconvFunction · 0.85
iterativeDeconvFunction · 0.85
closeMethod · 0.80
gridMethod · 0.80
imageMethod · 0.80
showMethod · 0.80
normalizeFunction · 0.70
setDeviceFunction · 0.50
gaussianKernelFunction · 0.50
convolveFunction · 0.50

Tested by

no test coverage detected