# normalized sum of squared differences

I want to search for a patch in a region of image, and I will use the normalized sum of squared differences.

I know that the sum of the squared differences is:

$SSD = \sum {\left(F - I\right)^2}$

Where: $F$: is the reference patch and $I$ is the patch from the image to match with $F$

My question is: what does it means normalized? is it the same as normalized correlation?

• What's $F$, what's $I$? – Marcus Müller Aug 6 '17 at 10:03
• $F$ is the reference patch, and the $I$ is the patch from the image to match with $F$ – Slh47 Aug 6 '17 at 10:09
• ah well; edit your question to include that info. – Marcus Müller Aug 6 '17 at 10:35

In an attempt to solve the question on why to normalize, and implicitly how to normalize:

$F$ is your reference patch, $I$ is the patch under inspection.

So make $I$ only consist of the maximum possible value in your image format. Then, your $SSD$ becomes very large, although $I$ isn't "similar" to $F$ at all.

Now, for comparison, set $I=F$. In theory, this should give a large (if making any sense at all, the largest) $SSD$ possible, right?

So, obviously, your $SSD$ formula as is isn't useful at all for comparing things, because an $I$ with a high average amplitude will just come out as a "winner", always. So, you need to get the energy of the $I$ out of your formula first. That's easy: Just divide $I$ by the sum of the squares of all its values.

• Thanks a lot, must I do the same thing to $F$ (dividing by the sum of squares)? – Slh47 Aug 6 '17 at 13:04
• That can be easily solved by you actually writing down what happens when you do (hint: sum is a linear operation)! So, I'm going to leave that up to you, as it depends on what you do with things after you compared patches. – Marcus Müller Aug 6 '17 at 13:09