In order to solve the problems of slow convergence and low accuracy of the algorithm for thread pitch diameter measurement based on image processing at this stage, we proposed a thread steel wire head pitch diameter measurement method based on improved Harris hawk optimization algorithm. Firstly, the cubic spline interpolation method is used for sub-pixel edge detection, and the parameters such as the peak and valley of the thread are extracted accurately, then the pitch diameter fitness function is constructed. Finally, the spiral updating mechanism and nonlinear energy decreasing strategy are introduced into Harris hawk optimization algorithm (HHO) to solve the pitch diameter fitness function. The experimental results show that the improved Harris hawk optimization algorithm has better stability and higher accuracy, in which the standard deviation of diameter measurement is 59. 33% lower than the traditional HHO algorithm, the absolute mean error of pitch diameter measurement is 5. 08% lower than the three needle measurement method, and 37. 78% lower than the HHO algorithm.