Abstract:In order to solve the problem of poor definition and poor realtime performance of artificial focusing when multiple lamps were chasing light on the stage at the same time, a twolevel intelligent focusing algorithm based on machine vision was proposed. Firstly, the cam curve of the zoom optical system was mechanically compensated to position the lens group directly near the focal plane to achieve rough and fast focusing; then, combining with antinoise threshold setting, the discrete Fourier transform evaluation function and mountain climbing search algorithm were used to realize fine focusing in a narrow range, the unimodality of the spectrum evaluation function curve was used to judge if the lamp was in focus, ensuring the definition of the projected image.This method was applied to a variety of moving head light autofocus systems. Through running tests, the focus accuracy is ±0.023 mm, and the autofocus time is reduced by more than 78%. The algorithm can meet the autofocus requirements of the stage lamp under the image definition and realtime, and has good application value.