Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
help on normxcorr2

Subject: help on normxcorr2

From: Sam

Date: 23 Aug, 2013 22:09:07

Message: 1 of 3

Hi, I have a question regarding normxcorr2. It works when I use 2 orignal images A and B, but when I increase the resolution of images by using interp2 and plug the new image C and D into the fuction, I got the following error. What does this error mean?

Error using normxcorr2
Expected input number 1, T, to be finite.

Thanks!

Sam

Subject: help on normxcorr2

From: Steven_Lord

Date: 26 Aug, 2013 14:46:47

Message: 2 of 3



"Sam " <sam_xu@hotmail.com> wrote in message
news:kv8mi3$8tn$1@newscl01ah.mathworks.com...
> Hi, I have a question regarding normxcorr2. It works when I use 2 orignal
> images A and B, but when I increase the resolution of images by using
> interp2 and plug the new image C and D into the fuction, I got the
> following error. What does this error mean?
>
> Error using normxcorr2
> Expected input number 1, T, to be finite.

There's a nonfinite value (Inf, -Inf, or NaN) in the variable that you pass
into NORMXCORR2 as the first input. To locate the nonfinite values, assuming
that the name of the variable you're using is T:

locationOfNonfiniteValues = find(~isfinite(T));

My guess is that around the edges you're trying to "interpolate" outside the
region where you have data and so you receive NaN values.

http://www.mathworks.com/help/matlab/ref/interp2.html?searchHighlight=NaNs

"ZI = interp2(X,Y,Z,XI,YI) returns matrix ZI containing elements
corresponding to the elements of XI and YI and determined by interpolation
within the two-dimensional function specified by matrices X, Y, and Z. X and
Y must be monotonic, and have the same format ("plaid") as if they were
produced by meshgrid. Matrices X and Y specify the points at which the data
Z is given. Out of range values are returned as NaNs."

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: help on normxcorr2

From: Sam

Date: 26 Aug, 2013 15:32:09

Message: 3 of 3

Thanks, Steve! After I converted the image to binary, it worked.

Sam


"Steven_Lord" <slord@mathworks.com> wrote in message <kvfpom$3n2$1@newscl01ah.mathworks.com>...
>
>
> "Sam " <sam_xu@hotmail.com> wrote in message
> news:kv8mi3$8tn$1@newscl01ah.mathworks.com...
> > Hi, I have a question regarding normxcorr2. It works when I use 2 orignal
> > images A and B, but when I increase the resolution of images by using
> > interp2 and plug the new image C and D into the fuction, I got the
> > following error. What does this error mean?
> >
> > Error using normxcorr2
> > Expected input number 1, T, to be finite.
>
> There's a nonfinite value (Inf, -Inf, or NaN) in the variable that you pass
> into NORMXCORR2 as the first input. To locate the nonfinite values, assuming
> that the name of the variable you're using is T:
>
> locationOfNonfiniteValues = find(~isfinite(T));
>
> My guess is that around the edges you're trying to "interpolate" outside the
> region where you have data and so you receive NaN values.
>
> http://www.mathworks.com/help/matlab/ref/interp2.html?searchHighlight=NaNs
>
> "ZI = interp2(X,Y,Z,XI,YI) returns matrix ZI containing elements
> corresponding to the elements of XI and YI and determined by interpolation
> within the two-dimensional function specified by matrices X, Y, and Z. X and
> Y must be monotonic, and have the same format ("plaid") as if they were
> produced by meshgrid. Matrices X and Y specify the points at which the data
> Z is given. Out of range values are returned as NaNs."
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us