help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave 4.0.3: normxcorr2 producing unexpected result


From: Hartmut
Subject: Re: Octave 4.0.3: normxcorr2 producing unexpected result
Date: Sun, 22 Jan 2017 12:10:56 -0800 (PST)

Hey Manual,

it is nice to hear that the Octave image toolbox is being used for a
computer vision course on Udacity.

Your image input s is 14 elements long, and your template t is 3 elements
long. So the result of normxcorr2 has a correct length of 14+3-1=16
elements. This is because of the padding done in the underlying convn
function [1].

The maximum correlation value is to be expected at position 6+1 then, when
the center element of the template fits the pattern in the image (padded by
1 element on both sides). But there are also other positions with maximum
correlation (of value 1), because the image is normalized before doing the
correlation.

The inf value in the output occurs at a position where the variance of the
corresponding image part becomes zero, in your case this is [1 1 1]. This
result might be expected because of the definition of the "normalized cross
correlation", but Matlab deals with this special case by returning a zero
value instead [2]. I have therefore filed a bug report for this [3]. As a
quick fix you could easily change the code of your normxcorr2.m file for
now, as described there.

I hope this helps.

    Hartmut


[1] http://de.mathworks.com/help/matlab/ref/convn.html
[2] http://de.mathworks.com/help/images/ref/normxcorr2.html
[3] https://savannah.gnu.org/bugs/index.php?50122



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Octave-4-0-3-normxcorr2-producing-unexpected-result-tp4681543p4681554.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]