In order to solve the problem of complex coding and complex structure of traditional optical encoders,an angle sensor based on image recognition is proposed.The center point coordinates of the spot are obtained by the least squares circle fitting curve algorithm,and the coordinate point is used as the center point position of the spot,and a virtual ellipse is obtained after the spot rotates a circle with the rotation axis and the center coordinate of the virtual ellipse is obtained by calculating the motion trajectory of the spot,and then the relationship between the coordinates of the spot center point and the output angle is calculated.The angle of the Hall angle sensor is used as a reference value to verify the measurement precision of this design.Experimental result shows that the mean nonlinear error of photoelectric angle sensor based on image recognition is 8.52%,and the measurement precision reaches 2.624°.