Device and method for detecting optical-axis offset of lens in equipment

The invention discloses a device and a method for detecting optical-axis offset of a lens in equipment. The device comprises a standard image acquiring module, a reference coordinate system setup module, a test image acquiring module, a test cursor position determining module and an optical-axis offset detecting module, wherein the standard image acquiring module is used for focusing a standard lens assembled in the equipment at a pickup position, picking up an image sample and acquiring a standard image of the image sample; the reference coordinate system setup module is used for taking the center of the standard image as coordinate origin and setting up a reference coordinate system; the test image acquiring module is used for focusing a to-be-detected lens assembled in the equipment at the pickup position, picking up the image sample and acquiring a test image of the image sample; the test cursor position determining module is used for taking the center of the test image as test cursor and determining the position of the test cursor in the reference coordinate system; and the optical-axis offset detecting module is used for determining optical-axis offset and/or optical-axis offset angle of the to-be-detected lens according the position. The device and the method for detecting optical-axis offset of the lens can solve the technical problem that the optical-axis offset of the lens in the equipment cannot be detected during assembly.