1
$\begingroup$

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?

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

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.

| improve this answer | |
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – VansFannel Dec 20 '19 at 15:52
  • 1
    $\begingroup$ 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. $\endgroup$ – Engineer Dec 20 '19 at 16:07
1
$\begingroup$

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.

| improve this answer | |
$\endgroup$
1
$\begingroup$

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
figure,imshow(y/255);    % masked in spatial-domain 
figure,imshow(Yc/255);   % masked in frequency domain
figure,stem3(y-Yc);      % the difference sequence
| improve this answer | |
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – VansFannel Dec 20 '19 at 15:52
  • $\begingroup$ Take any book on signals and systems or if you wish the book Fourier Transform and its applications $\endgroup$ – Fat32 Dec 20 '19 at 21:03
  • $\begingroup$ Thanks. I have also found this course from Stanford: see.stanford.edu/Course/EE261 $\endgroup$ – VansFannel Dec 22 '19 at 7:45
  • $\begingroup$ I want to leave it floating. $\endgroup$ – VansFannel Dec 25 '19 at 15:34
  • 1
    $\begingroup$ The funny is that for any given image (Specifically) you can find operation in Frequency Domain to do any operation (Which doesn't change the size of the image). Yet operation as the OP asked for can not be done for all images in the same (Which is what people after). $\endgroup$ – Royi Jan 19 at 18:30
-2
$\begingroup$

Low pass filtering will be helpful

| improve this answer | |
$\endgroup$
  • 4
    $\begingroup$ Can you explain a bit more about how low pass filtering an image can remove the white pixel values? $\endgroup$ – Engineer Dec 19 '19 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.