In the automated production line for suspended insulators, precise alignment of the U-shaped notch in iron caps is crucial for effective gluing. This study introduces a system based on machine vision that automates the alignment process. The system initially preprocesses the images of iron caps to segment the U-shaped contour. It utilizes the method of quadratic maximum contour connectivity domain to accurately identify the target U-shaped region. The alignment process involves calculating the coordinates of the largest external rectangle's longest edge and the external circle's center point. These coordinates are instrumental in determining the necessary rotation angle for proper notch alignment. The fixture then adjusts the iron cap based on this calculated angle, ensuring precise alignment. Experimental validations of this system have demonstrated a notch alignment error within 0.5 degrees with 96.51% accuracy and an error within 1 degree with 100% accuracy. The algorithm's execution time is a swift 0.034 seconds. Both the error margins and operational speed satisfy the stringent requirements of the automatic production line.