Try running it! :)

Now we've got V(x,y) working well here!  I wrote a function to visualize
the short lines showing the gradient orientation and removed some
variables that have never been used. And I use a matrix "display"
whenever I call imshow() so the original matrix won't be ruined by
convertScaleAbs().
Well I can't find the method that this paper used to visualize the
direction. It still looks weird. My friend also couldn't find an
appropriate function for this. But anyway it won't affect the
correctness of the values. It's just the visualization. Maybe just
forget about it before we've done everything else.
I'm gonna rearrange the program and put everything in main() except the
initialization and loading part into an function later so we can call
this method to deal with the average face image to get its V(x,y) as
well. But now it's too late for bed :)
I won't have time to work on this project on Saturday cuz I have to work
for another course with my group. But I'll always be ok if you wanna
talk with me. Just no schedule for programming :P