MATLAB: Problem with the class of the data

classdeconvdoubleimageImage Processing Toolboxmatrixuint8

Hello, I am working with images and using 'deconvreg','deconvblind','deconvvwnr','deconvlucy'.
My images are '.bmp', so the matrix which I'm working are of the class 'uint8'.
If I work with the default values of DAMPAR, WEIGHT, ecc... it's ok, but when I want to change these I have always the same error, because DAMPAR or WEIGHT are double and they have to be of the same class of the matrix (I have been searching and I found this: I and PSF can be uint8, uint16, int16, double,or single. DAMPAR and READOUT musthave the same class as the input image. Other inputs have to be double.The output image J (or the first array of the outputcell) has the same class as the input image I)
The problem come when I change the class, using 'uint8', for example:
x=8; %double
x=uint8(x)
x=8 %now x's class is uint8. That's ok
y=8.3
y=uint8(y)
y=8 *%THIS IS THE PROBLEM*
For working with deconvlucy and the WEIGHT, I could work with values from 0.0 to 1, but I lose the decimals if I changed to uint8 class. What can I do? (change the class of the matrix could be a disaster, I think, because this part it's a little part of my program)

Best Answer

Just cast (the badly-named) "I" to be a double before using it in any convolution routine.
Related Question