help-octave
[Top][All Lists]

## Re: Normalisation

 From: Joel Holder Subject: Re: Normalisation Date: Tue, 29 Aug 2017 06:34:45 -0700 (MST)

```This really makes clear what's going on here.

Thank you, Harmut.

On Mon, Aug 28, 2017 at 12:35 PM Hartmut [via Octave] <

> Welcome to Octave!
>
> Please have a look here [1] where this question of your Udacity course has
>
> Short summary:
>
> Your Udacity course works with an old version of Octave's image package.
> Those results where buggy, and have now been (mostly) corrected.
>
> Try this Octave code:
>
> clear
> pkg load image                        % using image 2.6.1 release
> s = [-1 0 0 1 1 1 0 -1 -1 0 1 0 0 -1]
> t = [1 1 0]
> x = normxcorr2(t,s);
> x(~isfinite(x))=0                       % to fix inf values (bug 50151)
> [maxVal maxRawIndex] = max(x)
>
> The resulting output is (slightly rounded):
> x = 1 -0.5 -0.5 -1 -0.5 0 1 0.87 0.5 -1 -0.87 0.5 0.5 1 -0.5 -0.5
> maxVal = 1
> maxRawIndex = 7
>
> The maxRawIndex could equally well be 1 or 14 instead of this 7. Those are
> all the positions where x has the value 1 (the position 7 seems to be
> closest to 1 because of machine precision).
>
> The index 7 position corresponds to "1 1 0" in s, and the index 14
> position corresponds to "0 0 -1" in s. Both have the same maximum
> normalized cross correlation to t. The index position 1 is just an artifact
> of padding the borders (those padded borders are also currently not
> perfectly Matlab compatible).
>
> This raw index can the be transferred to the index in the original array s
> if you like. You might do something like "index =
> rawIndex-(length(t)-1)/2". Then you will get the center element in s that
> corresponds to your matching substring. This value would then be 6 and
> would properly correspond to the part "1 1 0" in s.
>
> Have fun with Octave and the image package
>
>     Hartmut
>
> [1]
> http://octave.1599824.n4.nabble.com/Octave-4-0-3-normxcorr2-producing-unexpected-result-td4681543.html
>
> ------------------------------
> below:
> http://octave.1599824.n4.nabble.com/Normalisation-tp4682870p4684700.html
> <http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4682870&code=amNsb3N1cmVAZ21haWwuY29tfDQ2ODI4NzB8MzI1MTExODY2>
> .
> NAML
>
--
Sent from Gmail Mobile

--
View this message in context:
http://octave.1599824.n4.nabble.com/Normalisation-tp4682870p4684708.html
Sent from the Octave - General mailing list archive at Nabble.com.

```