#include <stdio.h>
#include <cstdlib>
const unsigned ITERATIONS = 96;
const float RELAXATION_FACTOR = 0.05f;
return (in - mn) / (mx - mn);
}
int main(int argc, char *argv[]) {
int device = argc > 1 ? atoi(argv[1]) : 0;
try {
printf("** ArrayFire Image Deconvolution Demo **\n");
while (!myWindow.close()) {
myWindow.grid(2, 3);
myWindow(0, 0).image(normalize(in), "Input Image");
myWindow(1, 0).image(normalize(blurred), "Blurred Image");
myWindow(0, 1).image(normalize(tikhonov), "Tikhonov");
myWindow(1, 1).image(normalize(landweber), "Landweber");
myWindow(0, 2).image(normalize(richlucy), "Richardson-Lucy");
myWindow.show();
}
fprintf(stderr,
"%s\n", e.
what());
throw;
}
return 0;
}
Window object to render af::arrays.
A multi dimensional data container.
const array as(dtype type) const
Casts the array into another data type.
An ArrayFire exception class.
virtual const char * what() const
Returns an error message for the exception in a string format.
@ f32
32-bit floating point values
@ AF_ITERATIVE_DECONV_LANDWEBER
Landweber Deconvolution.
@ AF_ITERATIVE_DECONV_RICHARDSONLUCY
Richardson-Lucy Deconvolution.
@ AF_INVERSE_DECONV_TIKHONOV
Tikhonov Inverse deconvolution.
void setDevice(const int device)
Sets the current device.
array gaussianKernel(const int rows, const int cols, const double sig_r=0, const double sig_c=0)
C++ Interface for generating gausian kernels.
array inverseDeconv(const array &in, const array &psf, const float gamma, const inverseDeconvAlgo algo)
C++ Interface for Tikhonov deconvolution algorithm.
array iterativeDeconv(const array &in, const array &ker, const unsigned iterations, const float relaxFactor, const iterativeDeconvAlgo algo)
C++ Interface for Iterative deconvolution algorithm.
array loadImage(const char *filename, const bool is_color=false)
C++ Interface for loading an image.
array max(const array &in, const int dim=-1)
C++ Interface to return the maximum along a given dimension.
array min(const array &in, const int dim=-1)
C++ Interface to return the minimum along a given dimension.
array convolve(const array &signal, const array &filter, const convMode mode=AF_CONV_DEFAULT, const convDomain domain=AF_CONV_AUTO)
C++ Interface for convolution any(one through three) dimensional signals.