Energy calculated from an image doesn't match with the energy calculated from its Fourier transform

2 ビュー (過去 30 日間)
Parseval's theorem (link below) says that these energies will be same. Here's how I calculate energy from image and Fourier domain respectively:
a. Energy (from image) =
sum (image.^2)
b. Energy (from FT) =
sum ( abs(fft2(image)) .^2)
I was wondering if there are more steps required for option b.

採用された回答

ImageProcNaive
ImageProcNaive 2017 年 1 月 18 日
Follow up: Found this file which shows the correct way of calculating energy in Option B. It turns out that you have to take the square of the fft first and then abs value.

その他の回答 (1 件)

David Goodmanson
David Goodmanson 2017 年 1 月 17 日
編集済み: David Goodmanson 2017 年 1 月 17 日
Hello IPN, I assume you mean sum(sum(...)) rather than sum(...). It appears that you are assuming a constant of proportionality of 1 between the two summations you show above. That's not the case, nor should it be. The specific definition of the transform, the factor in front of that, affects the form of the Parseval result. For example in the link you provided, there is a factor of 1/2pi in front of the energy summation (in frequency), due to their definition of the transform itself.
For the Matlab fft there is a factor of the number of elements in each dimension. If you divide your expression b (only with two sums) by prod(size(image)), the results should agree.
p.s. Go Aggies
  2 件のコメント
ImageProcNaive
ImageProcNaive 2017 年 1 月 18 日
Hi David, sorry I wanted to mean sum(I(:)) which is the same as sum(sum(I)) where I is an image (i.e. 2D). And dividing by the factor also doesn't help. It turns out that I might be doing a wrong calculation in Option B. I found a file (link below) where they take the square of the fft first and then take the abs value, which gives the same result as Option A. But thanks anyway for your answer.
abs( fft2(image).^2 )
instead of
abs(fft2(image)) .^2
David Goodmanson
David Goodmanson 2017 年 1 月 19 日
編集済み: David Goodmanson 2017 年 1 月 19 日
Hi IPN, Well, I don't believe there is any difference between the two lines of code you show above. For a complex number,
abs(z)^2 = abs(z^2)
so the same is true for a sum of them. Just to make sure, I checked on an image. And for a square image the factor of N^2 they divided by is the same as prod(size(image)). What counts, though, is that you got the result you were looking for.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by