# Remove brighter regions in an image on frequency domain

I'm newbie and maybe this is not the right place to ask this question, or this question has no sense.

I'm very interested in working on filtering images on frequency domain. I have found a few filters on frequency domain and I wondering if it is possible to remove bright regions on an image (with white colour) using filters on frequency domain.

Imagine you have a greyscale image and you want to remove the pixels with white colour.

How can I do that?

• You should probably start with the question - has brightness got anything to do with frequency? – Paddy Jan 18 '20 at 19:08
• If I know what I’m asking, I wouldn’t asked. – VansFannel Jan 19 '20 at 7:43

It is important to understand what the frequency domain means. The bright regions in an image correspond to pixels with a certain value, whether it be color or gray scale. Frequency domain has the interpretation of looking at how fast the values change, not their values. For example, think about an image of a dark blue car against a white background. The pixels along the edge may change from dark blue to white just by moving a few pixels, this is high frequency because the change in pixel value is high over a just a few pixels. This is different from a picture where you have dark blue which slowly fades to white over many pixels. Filtering in the frequency domain on an image would be affecting how the pixels change in value. For example, using a low pass filter on the dark blue car picture I mentioned, would block the high frequency components. This means the sharp changes in pixel value, like on the edge between the dark blue car and white background, would be smoothed (blurred) out.

Is it possible to remove white pixels from an image with frequency domain filter? No, and if you need to do that it would be better to just scan the image for pixels with a white value or value above some threshold and remove those pixels.

• Thanks a lot for your answer. Do you know if there is a book, article, etc. where I can learn more about frequency domain? Thanks again. – VansFannel Dec 20 '19 at 15:52
• You say you're a "newbie" so I think you'd benefit from a general introduction to image processing techniques. When I started to learn about this topic I watched this lecture series ecse.rpi.edu/%7Erjradke/improccourse.html and played with MATLAB trying to implement things I learned. Look at Lecture 8 for frequency domain. – Engineer Dec 20 '19 at 16:07

Of course you could. But I cannot find a useful manner.

Because of duality, product or convolution in the image domain can be re-expressed as a convolution or product in the frequency domain. Also because if you apply it locally, components of a frequency transformation generally produce a value akin to intensity. In the extreme and trivial case, a one-point DFT leave the image invariant, and you can filter bright regions any way you want. But you are not sure it will be efficient.

The actual question is how your "tools" (interested in working on filtering images on frequency domain) and purposes (remove brighter regions) match. Unless you rely on clever Fourier inequality tricks, I am not aware of practical brightness removal in the Fourier domain. If you multiply image values by a constant above $$1$$ (brighter), through linearity, the Fourier transform will multiplied by a constant as well. And most algorithms work because they emphasize a component more than an other, which is not the case here.

No it's not possible... [YES it's possible as the code below shows]

The discrete Fourier transform of an image is a decomposition of it into an orthogonal set of periodic sine (complex exponential) waves. Intensity domain information is best dealt with spatial domain processing, which can be nonlinear type of operations without a (useful or simple) frequency domain counterpart, except some trivial cases (as below).

EDIT: [I'm sorry but I was wrong] Now after Royi's comment, I realised the fact that I was plain wrong in what I meant. The correct answer is that yes of course you can remove the bright pixels (or any selected set of pixels, as given by a spatial mask) in an image through frequency domain manipulation. The only thing to note is that, however, that's plain inefficient when compared to the equivalent spatial-domain processing...

Indeed the following MATLAB/OCTAVE excerpt just shows it:

x = double(imread('Cameraman.tif')); % image range in [0:255]
S = size(x);

N = S(1);
M = S(2);

h = double( x > 200);  % select a set of pixels into mask

y = x.*h;       % apply spatial-domain masking

% perform the masking in freq domain:
X = fft2(x);
H = fft2(h);
ylin = conv2(X,H);       % get the linear convolution

yc = zeros(N,M);        % yc is the periodic conv

yc = ylin(1:N,1:M) + [ ylin(N+1:end,1:M); zeros(1,M)] +  ...
[ylin(1:N,M+1:end) ,zeros(N,1)] + [ylin(N+1:end,M+1:end),zeros(N-1,1); zeros(1,M)];

Yc = real(ifft2(yc)/(N*M));

figure,imshow(x/255);    % original image