A method comprises detecting edges in at least a region of a captured
focus image, using adjacent pixels of the region to obtain first edge
detection results and filtering the first edge detection results. The
first filtering comprises comparing differences in pixel contrast in the
first edge detection results with a first threshold value and removing
the differences in pixel contrast that are less than the first threshold
value from the first edge detection results. The method further comprises
detecting edges in at least the region, using non-adjacent pixels of the
region to obtain second edge detection results and filtering the second
edge detection results. The second filtering comprising comparing
differences in pixel contrast in the second edge detection results with a
second threshold value and removing the differences in pixel contrast
that are less than the second threshold value from the second edge
detection results.