← all work classical-computer-vision

Template matching

[![Python 3.10+](https://img.shields.io/badge/python-3.10+-3776AB?logo=python&logoColor=white)](https://www.python.org/)

Result

SrSceneSSDSSD normalisedCross-correlationNCC**ZNCC**
1hippo in green water · entropy 5.322534222599**0**
2elephants and grooms · entropy 7.4**0**111111305**0**
3two at a railing · entropy 7.6239239239**0****0**
4monks at a noticeboard · entropy 7.9154144144**0****0**

The finding

The invariances, and the sign that reveals them

**At a tenth of the brightness NCC still localises every template and SSD normalised localises none.** Dividing by the standard deviation is exactly a scale invariance, and the sweep has to reach 10× before the claim is visible at all — at the usual gentle 0.9 every method still works.

> ZNCC holds 1.000 at every negative offset; NCC falls to 0.458. Subtracting > the mean is exactly an offset invariance, and NCC does not subtract the mean. > > It takes a negative offset to show it. Brightening clips at white and > destroys the structure for everyone — at +0.4 NCC and ZNCC both sit at 0.958 > and the difference between them is invisible. Darkening clips only in the > shadows, which leaves enough for a mean-subtracting method and not enough for > anything else. A sweep over positive offsets alone would have reported that > NCC and ZNCC are equivalent.

The algebra says the same thing with no image search involved. ZNCC of a patch against a·patch + b is 1.0 for any positive a and any b:

---

Figures

matches.png
matches

Elsewhere

Code and full results on GitHub (code private)

Every number is read from the file the run produced. github.com/hammasbuilds · kaggle.com/muhammadhammas13