Why do we need to normalize a filter?

In C1_W3_Lab_2_exploring_convolutions, there is a comment in the workbook:

“If all the digits in the filter don’t add up to 0 or 1, you should probably do a weight to get it to do so, for example, if your weights are 1,1,1 1,2,1 1,1,1. They add up to 10, so you would set a weight of .1 if you want to normalize them.”

My question is why we need to normalize a filter to make all its digits add up to 0 or 1.

Hi CCCC,

If I’m not wrong, this is to ensure that the average pixel in the modified image is as bright as the average pixel in the original image. You can give a try!

filter = [ [1,1,1], [1, 2, 1], [1,1,1]]
weight = 0.1

vs.

filter = [ [1,1,1], [1, 2, 1], [1,1,1]]
weight = 1.0

You can take a look about kernels & image processing here

Hope it helps!

1 Like