The invention discloses a real-time adjustment camera focusing method and
system, and aims to solve the problem of poor anti-interference capability of an existing focusing mode. The method comprises the following steps: off-line construction of an optimization
lookup table and on-line real-time focusing: in an off-line stage, constructing a fixed-focus platform, generating an original
lookup table through
light spot anti-interference preprocessing and
centroid calculation, and then constructing an efficient retrieval
data structure to obtain the optimization
lookup table; in the online stage, images are collected in real time, the
center of mass is obtained through anti-interference
processing, compensation is conducted through a preset prediction
algorithm during shielding, target reference points are matched through an efficient retrieval
data structure, and focusing is triggered according to deviation of the
center of mass. The
system comprises a hardware module and a
software module which cooperatively realize the method. The method improves the anti-interference capability of
light spot processing and the matching efficiency of the lookup table, adapts to the interference of illumination fluctuation, shielding and the like of an industrial environment, meets the real-time focusing requirements of high-speed production, is compatible with existing hardware, and is convenient to deploy.