Hi Gulfam,
I understand that you are getting an error while using the “imgaussfilt” function in MATLAB.
The error message in the question indicates that the “imgaussfilt” function expects the input image A to be real, but it seems to be receiving a complex-valued image.
The potential reason for this issue is the use of “ifft2” function on the variable “raw_data” for each of the slices. Fourier transform operates in the frequency domain, where the data can have both real and imaginary components. When performing an inverse Fourier transform using “ifft2” function in MATLAB, the resulting image may be complex-valued. This can happen in the following cases:
- If the input is complex-valued
- If the input data is not symmetric or centered
- Even when the input data is real-valued, the output may have small imaginary components that are close to zero due to numerical precision limitations.
To resolve this issue, you can use the ‘real’ function in MATLAB to extract the real part of the complex valued images before passing them to the “getMSSIM” function.
psnr_=getPSNR(image1,image2);
ssim_=getMSSIM(image1,image2);
fprintf('PSNR= %f - SSIM= %f\n',psnr_,ssim_);
Please refer to the following documentations for more information:
Hope this helps.