Until now, the accurate keypoints are localized by removing the points with low contrast or along edges. The next step is to assign an orientation to each keypoint.
The gradient magnitude and orientation of the Gaussian smoothed image L(x, y), which is obtained by using the scale a of the keypoint, can be calculated by
The orientations of sample points within a window around the keypoint are stored in one of 36 bins covering the 360°. Each point weighted by its gradient magnitude within a circular window with aw = 1.5a around the keypoint, is added to the bin corresponding to the point’s orientation. The highest peaks in the histogram is the dominant directions of the keypoint. Some other peaks with higher than 80 % of the highest one can also be used to create a keypoint with corresponding orientation. At last, a parabola is fitted to the three histogram values closest to each peak for generating the orientation with higher accuracy.
The location and orientation of keypoints in an image are shown in Fig.2.14. By assigning orientation to each keypoint based on local image natures, the capability of invariance to image rotation can be obtained.