A method for immediately determining incorrect pixel values of a captured
image on an optical mouse, which determines a quality of an image in a
video stream captured by the optical mouse and accordingly finds a motion
distance for the optical mouse. The method first computes a set of match
values for possible motion vectors of a sample image with respect to a
reference image and applies a filtering operation to compute a respective
smooth coefficient for each match value. The method further computes a
locally minimum number in the set of match values according to a first
rule, such that the sample image is regarded as a qualified image when
the locally minimum number is smaller than a threshold and accordingly a
global minimum in the set of match values is found as a motion vector of
the sample image.