Hamming filter to reduce ringing artifact in image

H
Harrison · Jan 15, 2021 · 2K views
Question
I have a low-resolution image (sLR) which is generated by selecting the central part of the reference high-resolution image (sHR) in the frequency (k-space) domain in row-direction. When I zero-pad this low-resolution  image in frequency-domain, I get ringing artifact in the spatial domain as it is expected. I try to remove this artifact by filtering the image using Hamming window. Please see my code below. I have doubts about applying fft and ifft to the image and also filtering process, and I would be thankful if someone could please review my code. My second question is when I use iffft, the output image usually has negative intensities. For further processing in the Spatial domain, is that okay if I normalize the image intensity in a way that the minimum intensity of the image is 0? or should I use the absolute of the image?   % sHR: HR reference image n = size(sHR,1); kspHR = fftshift(fft(sHR,n,1),1)/n; % HR image in k-space % Generating LR image (LR in row-direction) kspLR = kspHR((n/2)-(n/4)+1:(n/2)+(n/4),:); sLR = real(ifft(ifftshift(kspLR,1),n,1)))*n; % this image has negative intensity values? % Zero-padding a = floor(size(kspLR,1)/2); kspZP = padarray(kspLR, a ,'both'); sZP = real(ifft(ifftshift(kspZP,1),n,1)))*n;% image with Ringing artifact % Apply Hamming filter to Zero-padded kspace image (kspZP) [r,c]=size(abs(kspZP)); w = hamming(r); W = repmat(w,[1,c]); kspHM = W.*kspZP sHM = real(ifft(ifftshift(kspHM,1),n,1)))*n; % Filtered image in spatial domain  
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Nov 20, 2025
Windows are designed to smooth out the transition between the content and the zero-padded region, so apply them just to the data itself before zero-padding. I've tweaked your code to use that instead and a Kaiser window (experiment with beta values between zero and, say, four).
 
Maybe something like:
load penny;
sHR = -del2(P);
subplot(1,2,1);
imagesc(sHR);
colormap copper
shading flat
axis equal

% sHR: HR reference image
n = size(sHR,1);
kspHR = fftshift(fft(sHR,n,1),1)/n; % HR image in k-space

% Generating LR image (LR in row-direction)
kspLR = kspHR((n/2)-(n/4)+1:(n/2)+(n/4),:); 

% ZP'd lr
beta = 4; % roughly equivalent to Hann
w = kaiser(size(kspLR,1),beta);
% wKspLR = w .* kspLR;  % may work directly if you have R2016b or later.
wKspLR = bsxfun(@times, w, kspLR); 

% continue onwards...
a = floor(size(wKspLR,1)/2);
wKspZP = padarray(wKspLR, a ,'both');
wsZP = real(ifft(ifftshift(wKspZP,1),n,1))*n;

subplot(1,2,2);
imagesc(wsZP);
shading flat
axis equal

As for the negative intensity question... a lot depends on how you want to process the image afterwards. Maybe someone else in the community can comment on that.

Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!