# Normalizing Gabor Filter Output

I am a student at Colorado State University. I'm currently studying computer vision and got very excited with HMAX. I've read alsmost every paper and all information available on-line. Perhaps, due to my math skills I have trouble understanding one of the ideas behind S1 cells. I'm currently using Gabor kernel for filtering from OpenCV. Of course the values produced on the final image are very high (ranging from ~-1000 to ~1000) with sigma (1.0), lambda(15) gamma(0.02). In your paper it says the following:

"At each pixel of the input image, filters of each size and orientation are centered. The filters are sum-normalized to zero and square-normalized to 1, and the result of the convolu- tion of an image patch with a filter is divided by the power (sum of squares) of the image patch. This yields an S1 activity between -1 and 1."

I'm having trouble specifically with "sum-normalized to zero and square-normalized to 1". I've searched everywhere but still puzzled with this. I would greatly appreciate if you could help or point me in the right direction.