| 24 | } |
| 25 | |
| 26 | int 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 | } |
nothing calls this directly
no test coverage detected