From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: pattern matching among two matrix
Date: Fri, 25 Nov 2011 19:17:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <jaopjk$t2p$>
References: <jam3h8$sj1$> <jam7q5$b9b$> <>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1322248628 29785 (25 Nov 2011 19:17:08 GMT)
NNTP-Posting-Date: Fri, 25 Nov 2011 19:17:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:750477

ImageAnalyst <> wrote in message <>...
> .......
> template = bigMatrix(3:5, 7:9)
> .......
- - - - - - - - - -
  You have given the 'template' equality to a portion of 'bigMatrix' in stating that

 template = bigMatrix(3:5, 7:9)

However the counterexample I mentioned shows that you can get a correlation of 1 at that relative location even where you might only have something like

 template = 10*bigMatrix(3:5, 7:9)-100

holding true there.

  It is a consequence of the Cauchy–Bunyakovsky–Schwarz inequality theorem that equality of the correlation to 1 or -1 is true if and only if the two matrix portions are linearly dependent.  They do not have to be equal.

  Of course if the notion of pattern matching is satisfied by merely having linearly related patterns, then searching for a correlation of 1 would be a good method of detecting such a condition.  It all hinges on the meaning to be ascribed to a "match" of two patterns.

Roger Stafford