Patent ID: 7343047

Claim:
A method comprising: detecting edges in at least a region of a captured focus image, using adjacent pixels of said region to obtain first edge detection results; filtering said first edge detection results, the first filtering comprising: comparing differences in pixel contrast in said first edge detection results with a first threshold value; and removing said differences in pixel contrast that are less than said first threshold value from said first edge detection results; detecting edges in at least said region, using non-adjacent pixels of said region to obtain second edge detection results; filtering said second edge detection results, the second filtering comprising: comparing differences in pixel contrast in said second edge detection results with a second threshold value; and removing said differences in pixel contrast that are less than said second threshold value from said second edge detection results; applying a soft window that weights pixels of the region to discount sharp edges at boundaries of the region in each of the results provided by the edge detection; amplifying the results of the filterings; separately summing the results of the amplifying for each color of pixel; and determining an optimal lens focus position.