As you can see there are 2 images from the Tom and Jerry cartoon program. enter image description here

enter image description here

In the 1st image both Tom and Jerry are present. But in the 2nd one,only Tom is present.Now,we can clearly see this difference in spatial domain. But i want to compare these images in Frequency domain.

  • So can anybody explain how do we compare these 2 images and find out the missing part from the 2nd image i.e. image of Jerry using Fourier transform ?

  • Also,is it possible to find out location of Jerry in the image using any frequency transform method? If yes can you explain how?

  • $\begingroup$ Transform 1st and 2nd image into frequency domain and subtract second from the first. the result should be the difference... $\endgroup$
    – Steffen
    May 27, 2015 at 7:30
  • $\begingroup$ @Steffen how could you subtract 2 frequency spectrums? Can you explain it with matlab or opencv code in the answer box? $\endgroup$
    – pandu
    May 27, 2015 at 7:57
  • $\begingroup$ No you can't , you can find some different freequency value. But it does not represent the position. $\endgroup$
    – gmotree
    Jul 26, 2015 at 10:49
  • $\begingroup$ How about trying wavelet? It can be both localized and frequency domain. $\endgroup$
    – aghd
    Oct 18, 2017 at 14:14

3 Answers 3


1st question: there are some simple steps to change the spatial domain to freq domain, exp adding some zero to avoid ISI, you can read the procedure from a source book, you can use fft2 command in matlab

2nd question: Surely you can not see the differences in freq domain as clear as spatial domain, because to determine the value of one pixel in freq domain all the pixels in the spatial domain will be effective


Fourier Transom of these two surely would be different, but remember Fourier gives a global representation(features) of the images and you need local features to compare those, it is like that you want to compare similarity of two whole images only through comparing their histograms. However, the better approach is to segment the image into smaller blocks and take Fourier of those block and compare that. Now, you can both tell which blocks are different and their correspondent location.


Because the Fourier Transform is a linear operation, you can add and subtract images either in the spatial domain or in the frequency domain.

If you would like to isolate Jerry in the first image, perform the following steps:

  1. Take the Fourier transform of each image.
  2. Subtract the Fourier transform of the second image from the Fourier transform of the first image.
  3. Take the inverse Fourier transform of the result from Step 2. The result may be complex valued, so display the magnitude. This should show an image of only Jerry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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