The present invention relates to a method for controlling color lighting of a vision system using a random search algorithm and, more specifically, to a method for automatically setting an optimum lighting condition in the least amount of time by analyzing a camera image in a grey level to apply a random search algorithm to search for a point having maximum sharpness. The method for controlling color lighting of a vision system using a random search algorithm includes the steps of: setting a minimum range and a maximum range of each element for an input voltage; generating a change rate by generating random numbers in the minimum range and the maximum range; determining whether the change rate is out of a boundary condition by substituting the change rate for a current voltage; acquiring a digital image of a pixel unit from an inspection object image which is irradiated onto a camera, and then converting the digital image to grey level image to calculate sharpness, and acquiring minus sharpness; comparing minus sharpness for a current input voltage and the minus sharpness acquired by supplying the input voltage including the random numbers to determine suitability of the random numbers; resetting the input voltage if it is determined that the random numbers are suitable; and repeating the above steps until a termination condition is met.
展开▼