Re: fft2 and ifft2 outputs
- From: "Dave Robinson" <dave.robinson@xxxxxxxxxxxxx>
- Date: Mon, 15 May 2006 11:35:59 -0400
nick wrote:
X = (A3.*r)/(abs(A3).*abs(r));
should read
X = (A3.*conj(r))./(abs(A3).*abs(r));
Whoops sorry
Dave Robinson
when i sub this line for the old one i get a
"divide by zero warning"
Why should i use this line over my original of
X=A3.*r; ???
my understanding of ur line is
A3 element by element mult of the complex conjugate of r,
./ is this element by element divide?
then taking the absolute value of A3 and r and .* them
I understand the sections of this lione of code, but not what it
actually does as a whole.
cheers
Nick
Yes ./ is the element by element divide.
Unfortunately I just copied and pasted from your original note, and
didn't notice that the conj() function was missing. In the frequency
domain convolution is undertaken by doing a .* of two vectors,
whereas correlation requires the conjugation of the second vector.
The reason that you are getting a divide by zero error is because you
have got some zeros in your data (i.e frequency components that
contain no data/energy). Normally in this position you have a 0/0
condition. How I usually fix that (and I warn you at the start it is
a bit of a bodge), I calculate abs(a).*abs(b) seperately, then hunt
out all locations which contain zeros, and replace them with a very
small number (say max(a)/1000000.0)This prevents the divide by zero,
and as the chances are the top deck is also 0, results in a 0 in the
final quotient.
Zero_points = find(Abs_Product==0);
Abs_Product(Zero_points) = little_number;
One could argue that you could get a better result by adding in a
very small random number to both the spectra before doing the
correlation (e.g. making it slightly noisy) The correlation will
remove most of the effect of this, although there is still the
possibility that the random noise will have an exactly 0 value still
leaving you with your problem.
What the algorithm actual does is a phase correlation. This makes it
very much more robust, and unlike the standard correlation which is
dependent on the relative intensity of the template and target, this
algorithm is not.
Hope that helps - comeback I would like to know the outcome of your
tests
Dave Robinson
.
- Follow-Ups:
- Re: fft2 and ifft2 outputs
- From: Nick
- Re: fft2 and ifft2 outputs
- References:
- Re: fft2 and ifft2 outputs
- From: Dave Robinson
- Re: fft2 and ifft2 outputs
- From: nick
- Re: fft2 and ifft2 outputs
- From: Dave Robinson
- Re: fft2 and ifft2 outputs
- From: Dave Robinson
- Re: fft2 and ifft2 outputs
- From: nick
- Re: fft2 and ifft2 outputs
- Prev by Date: can i save image as datatype in access?
- Next by Date: Re: Setting color of an object from color coordinates
- Previous by thread: Re: fft2 and ifft2 outputs
- Next by thread: Re: fft2 and ifft2 outputs
- Index(es):
Relevant Pages
|