An image based autofocus method and system that includes receiving image
data; monitoring and analyzing the contrast between different portions of
the image data in determining the location of a target wherein the
different portions of the image data contain at least one type of image
pixel information and the monitoring and analyzing are performed using at
least one kernel filter to determine a focus measure; adjusting a focus
mechanism that is focusing on the image data; observing an image quality
of the image data that has been focused; and continuously outputting an
image to support an image processing frame rate and adjusting the focus
mechanism to obtain an improved focus image by adjusting the focus
mechanism in a positive direction, a negative direction or a zero (0)
direction based upon effectuating a desired change in the observed image
quality of the image data.