1) First divide the normalized image into blocks of size 16*16 2) Find the gradients Gx and Gy at each pixel 3) Estimate the orientation of each block centered at pixel (i,j), but this orientation may not be always correct due to the presence of noise in the original image so convert them into vector field. 4) Estimate the smooth orientation field by using 5*5 gaussian fillter.....................

In estimating this orientaion I am getting a problem that the matrix index is starting with negative indices. Can anyone please sort out this problem