The quality of the rebar thread head is crucial for the connection between the rebars, thereby affecting the public safety of the building. The edge extraction of the thread image is the most important step in obtaining the accurate size parameters, which helps to complete online inspection of quality. Here, an edge detection method based on improved Canny operator is proposed to solve the problems on sensitivity to noise, existence of false edges, and lack of self‐adaptability. Firstly, an improved adaptive median filtering algorithm is used to denoise the image. Then replace Sobel with Scharr to enhance the gap between pixel values, add 45° and 135° directional templates to prevent edge information loss as well. Besides, introduce a scale factor to improve the interpolation method for non‐maximum suppression and reduce false edges. Finally, use Ostu operator to achieve adaptive extraction of high and low thresholds to complete adaptive edge detection. The qualitative analysis and quantitative results show that the improved algorithm can not only have a good visual effect, have good robustness and feasibility, but also be faster than other algorithms, which provide a basic guarantee for real‐time online quality detection of the thread head.