[Top][All Lists]

[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

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.



View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

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