weiner filter coding explanation
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen

Antworten (1)
Hari
am 6 Jan. 2025
Hi Hassan,
I understand that you are seeking an explanation of the Wiener filter code provided for image deconvolution, specifically in the context of noise and image power spectrum calculations.
Here are the detailed explanation:
Noise Power Spectrum Calculation:
The noise power spectrum Sn is computed using the Fast Fourier Transform (FFT) of the noise. The abs(fft2(noise)).^2 calculates the power spectrum, and nA computes the average power of the noise.Sn = abs(fft2(noise)).^2;
nA = sum(Sn(:)) / numel(noise);
Image Power Spectrum Calculation:
Similarly, the image power spectrum Sf is calculated for the original image Imm. The average power fA of the image is obtained.
Sf = abs(fft2(Imm)).^2;
fA = sum(Sf(:)) / numel(Imm);
Noise to Signal Power Ratio (NSPR):
The NSPR is the ratio of the noise average power to the image average power. This ratio is used in the Wiener filter.
NSPR = nA / fA;
Wiener Filter Application:
The deconvwnr function is used to apply the Wiener filter:
fr is the result of the Wiener filter without considering NSPR.
fr = deconvwnr(g_noise, PSF);
fr2 uses the NSPR for the Wiener filter, which helps in better noise handling.
fr2 = deconvwnr(g_noise, PSF, NSPR);
Correlation-Based Wiener Filter:
NCORR and ICORR are noise and image correlation functions calculated using inverse FFT. These are used in a more advanced Wiener filtering approach to handle specific noise characteristics.
NCORR = fftshift(real(ifft2(Sn)));
ICORR = fftshift(real(ifft2(Sf)));
fr3 = deconvwnr(g_noise, PSF, NCORR, ICORR);
Refer to the documentation of fft2 for more details: https://www.mathworks.com/help/matlab/ref/fft2.html
Refer to the documentation of deconvwnr for more details: https://www.mathworks.com/help/images/ref/deconvwnr.html
Hope this helps!
0 Kommentare
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!