A histogram of gradient orientations is a weighted histogram where the bin index is determined by gradient orientation. By using the Gradient Magnitude feature above, we can get the structure of the coupler yoke, but the structure information alone is not enough to detect the component accurately; we also need to use the gradient orientation information. The local object appearance and shape can often be characterized rather well by the distribution of the local intensity gradients or edge directions, even without precise knowledge of the corresponding gradient or edge positions. The orientation analysis is robust to lighting changes since the histogram gives translational invariance. This histogram of gradient orientations’ feature summarizes the distribution of measurements within the image regions and is particularly useful for the detection of textured objects with deformable shapes. Thus, it can extract more textural details of the coupler yoke. Compared with the more complicated HOG feature, our histogram of gradient orientations feature is also simpler and faster, and the feature can be calculated more quickly. In our project, we quantized the gradient angle to six orientations. To compute the histogram of gradient orientation features, first, the gradient orientation is calculated from the image of the pixels Display Formula
(3)where , . Next, by using the calculated gradient orientation , gradient orientations at each pixel are discretized into six orientations and we code as with different numbers ranging from 1 to 6 Display Formula
(4)Finally, these discretized gradient orientations are then aggregated into a dense grid of nonoverlapping square image regions, each containing . Each of these regions is thus represented by a 6-bin histogram of gradient orientations, and each bin of the histogram represents one orientation. We use to denote the six bins of the histogram, respectively, then we get six vectors representing the gradient feature on six orientations.