When image digitalization device translate fastener into fastener image, the fastener image is always skewed to some extent, which will result in failure of the subsequent processing. The correction of the fastener image is the important step in its automatic recognition. In order to overcome the heavy computing burdens of hough transform, a new usage of hough transform is introduced in this paper. The algorithm works by first doing certain process on input image, the close edge of the image is gotten. Then a two-stage Hough transform algorithm is applied to the image to calculate the angle of the main edge line. This angle is thought as the declining angle of the fastener image. Lastly, the orientated image is rectified using rotation method. This algorithm is validated through experimental results.