Clear Filters
Clear Filters

How to remove correct illumination band in frequency domain image?

4 views (last 30 days)
I ran this code for x-ray medical images and get high pass filtering and low pass filtering images in MatLab R2013a to remove illumination.But I don't know how to find correct illumination band to remove.How can I find it and remove illumination by filtering?
Then I tried to convert images into spatial domain using inverse FFT function.But didn't work correctly.Can you please suggest a code for this conversion also.
img = imread('cephalogram.bmp');
img2 = imnoise(img,'salt & pepper',0.025);
img3 = img2;
for c = 1 : 3
img3(:, :, c) = medfilt2(img2(:, :, c), [5, 5]);%add median filter
I=rgb2gray(img3); % convert the image to grey
A = fft2(double(I)); % compute FFT of the grey image
A1=fftshift(A); % frequency scaling
% Gaussian Filter Response Calculation
[M N]=size(A); % image size
R=10; % filter size parameter
[X Y]=meshgrid(X,Y);
Hi=1-Lo; % High pass filter=1-low pass filter
% Filtered image=ifft(filter response*fft(original image))
%---------visualizing the results----------------------------------------------
imshow(I);colormap gray
title('original image','fontsize',14)
imshow(abs(A1),[-12 300000]), colormap gray
title('fft of original image','fontsize',14)
imshow(abs(B1),[12 290]), colormap gray
title('low pass filtered image','fontsize',14)
imshow(abs(B2),[12 290]), colormap gray
title('High pass filtered image','fontsize',14)
%%%-----------------Converting to spatial domain--------------------------------------------------------
%fftInverse = REAL_PART(FFT(ffTransform, /INVERSE))
% invimg = ifft2(A1);
%imshow(abs(invimg),[12 290]), colormap gray
%title('Inverse lowpass image','fontsize',14)

Answers (1)

Image Analyst
Image Analyst on 20 Oct 2018
Generally changes in illumination / exposure are slowly varying so you'd want to use a high pass filter to remove low spatial frequencies. You can do this in the spatial, with conv2(), or Fourier domain with fft2(). Attach 'cephalogram.bmp' if you need more help.
  1 Comment
Nayana R
Nayana R on 20 Oct 2018
Thank you so much Image Analyst for your valuable answer.I want to do it in Fourier domain. How can I use fft2() to remove illumination.I am attaching my 'cephalogram.bmp'.It's resolution is 1935*2400.I reduce it to 560 pixels.Can you give me a example code for this filtering technique?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!