0
$\begingroup$

I am doing template maching using Normalized Cross-Correlation for measuring similarity between template and image.

However, some images from my dataset contain saturated pixels (overshoot) which should be avoided in the measurement.

How to update the cross-correlation computation to avoid saturated pixels?

enter image description here

$\endgroup$
1
  • $\begingroup$ Would setting the saturated pixel values to zero work? $\endgroup$ Commented Sep 17, 2014 at 21:11

1 Answer 1

0
$\begingroup$

I have finally found an aswer in a technical report "Image Alignment and Stitching: A Tutorial" from Richard Szeliski.

A weighted SSD (Sum of Suqared Differences) function is presented on page 13:

$$E_{WSSD}(u)=\sum_{i}w_{0}(x)w_{1}(x_{i}+u)\left[I_{1}(x_{i}+u)-I_{0}(x_{i})\right]^{2}$$

where $w_{0},w_{1}$ are spatially-varying weight functions (for template and the image). $u$ is a template offset.

The result may be divided by the overlap area to avoid bias towards smaller overlap.

This however works for SSD metric, not NCC. But it may suffice once images are normalized beforehand (using contrast/brightness adjustment computed using linear regression over corresponding pixel intensities).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.