A lens detection preprocessing method and detection system

By adjusting the angle between the light source and the lens and making the lens move at a constant speed under the light source, and acquiring and fusing images, the problem of incomplete lens detection in the prior art is solved, and the integrity and accuracy of global lens detection are achieved.

CN118603508BActive Publication Date: 2024-11-05FITOW (TIANJIN) DETECTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411074667.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-11-05
Estimated Expiration
2044-08-07

AI Technical Summary

Technical Problem

The existing lens detection technology cannot ensure that the entire lens area can be detected, especially due to the different lens degree and thickness of the lens, some areas cannot be fully reflected and cannot be captured by the camera.

Method used

By adjusting the angle between the light source and the lens, and causing the lens to move at a constant speed in the horizontal direction under the light source, multiple images are acquired and combined, and affine transformation is used to generate a synthetic image to achieve global detection.

Benefits of technology

Global detection of the entire lens is achieved, ensuring that total reflection can occur in all areas and is captured, thereby improving the integrity and accuracy of the detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118603508B_ABST
    Figure CN118603508B_ABST
Patent Text Reader

Abstract

This invention discloses a lens inspection preprocessing method and inspection system. The method includes adjusting the angle between the light source and the horizontal direction according to the thickness and material of the lens under test, controlling the angle within a preset angle range to illuminate the lens under test; controlling the lens under test to move at a constant speed along the horizontal direction below the light source, and simultaneously acquiring multiple images of the lens under test during the constant speed movement; fusing the multiple images of the lens under test; and using the fused image for lens defect detection. This application uses the form of the lens under test continuously moving within the camera's field of view to acquire images of total internal reflection at different positions of the lens under test, and then fusing them to achieve defect detection of the entire lens. This application uses positioning blocks to provide positioning marks, which facilitates coordinate calculation. The algorithm is simple, and the optical structure used to implement the algorithm is simple, and significant results can be obtained through simple calculations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of lens detection, and in particular to a lens detection preprocessing method and a detection system. Background Art

[0002] Lenses are generally made of optical materials such as glass or resin, and are transparent materials with one or more curved surfaces. Therefore, lenses have good light transmittance and a strong refractive index. When light shines vertically on the lens, 80%-100% of the light will penetrate through and cannot reach the camera's photosensitive chip. Only under certain conditions, when the lens is fully reflected, can light reach the camera.

[0003] In the existing lens inspection technology, a fixed angle is used to illuminate and photograph the lens, and multiple images are obtained. The surface defects are judged separately by comparing the multiple images as the inspection result. For example, in the patent application document with application number: 202211411880.2 and name "Resin Lens Defect Detection Device and Method", the lens is fixed in position and photographed at four positions to form two complete lens images. The surface defects are judged separately by comparing the two images. In the actual inspection process, due to the different lens degrees, the thickness of lenses with different degrees in different areas is also different. When the lens to be inspected is photographed at a fixed angle, it will inevitably result in only part of the area being fully reflected and captured by the camera, and other areas cannot be fully reflected and cannot be captured by the camera.

[0004] Therefore, in the prior art, it is impossible to ensure that all areas of the entire lens can be detected. Therefore, the present application proposes a lens detection preprocessing method and a detection system to perform global detection on the lens. Summary of the invention

[0005] Therefore, the object of the present invention is to provide a lens detection preprocessing method and detection system, which can detect the defects of transparent lenses by obtaining a synthetic image by making the entire lens to be tested undergo total reflection.

[0006] The present invention provides a lens detection preprocessing method, comprising the following steps:

[0007] S1. According to the thickness and material of the lens to be tested, adjust the angle between the light source and the lens to be tested in the horizontal direction, and control the angle within a preset angle range to illuminate the lens to be tested;

[0008] S2, controlling the lens to be tested to move at a uniform speed in a horizontal direction below the light source, and simultaneously acquiring multiple images of the lens to be tested during the uniform speed movement;

[0009] S3, fusing multiple images of the lenses to be tested, and using the fused images for defect detection;

[0010] The fusion includes:

[0011] S301, generating a reference image using the first image in which a complete positioning mark appears;

[0012] S302, according to the coordinate correspondence between the next lens image to be tested and the positioning mark in the reference image, affine transform the next lens image to be tested onto the reference image as a whole to generate a new reference image;

[0013] S303, traversing the images of all the lenses to be tested, and finally obtaining the reference image is the final composite image.

[0014] Further preferably, in S1, adjusting the light source according to a preset angle range according to the thickness and material of the lens to be tested includes:

[0015] According to the law of refraction:

[0016]

[0017] According to the angle of incidence When , total reflection occurs;

[0018] Critical Angle ;

[0019] The preset angle range is ≤ ≤90;

[0020] in, is the angle between the tangent line of the incident point on the upper surface and the tangent line of the reflection point on the lower surface, is the critical angle, is the exit angle, is the refractive index of the optically dense medium, is the refractive index of the optically sparse medium.

[0021] Further preferably, in S3, two positioning blocks are respectively clamped on the left and right sides of the lens to be tested, and three types of positioning marks, namely large, medium and small, are set on each positioning block.

[0022] Further preferably, the two positioning blocks clamped on the left and right sides of the lens to be tested have different heights on the Y coordinate.

[0023] Further preferably, in S301, generating a reference image using the first image in which a complete positioning mark appears includes:

[0024] Extract all the positioning mark areas in the first image where the positioning mark appears in the camera field of view;

[0025] Calculating the center coordinates of the positioning mark in the extracted positioning mark area;

[0026] According to the center coordinates of the positioning mark, the entire image is translated to the reference line on the other side of the camera field of view, and the translated image is used as the reference image.

[0027] Further preferably, in S302, the method further includes: searching for a positioning mark having the same radius and a similar Y coordinate as that in the reference image in the next lens image to be tested, and determining the number of positioning marks found on each positioning block;

[0028] A positioning block area with a large number of positioning marks is selected to calculate the angle of the affine transformation between the current image and the reference image.

[0029] Further preferably, in S302, it further includes: comparing the grayscale values ​​of the current image after affine transformation and the reference image pixel by pixel, and selecting pixels with larger grayscale values ​​between the two to generate a new reference image.

[0030] The present invention also provides a lens detection system for implementing the lens detection preprocessing method, comprising: a light source, a positioning block, a camera, a horizontal motion device and an image processor;

[0031] The light source is used to illuminate the lens to be tested within a preset angle range;

[0032] The positioning block is used to clamp on the left and right sides of the lens to be tested and display positioning marks;

[0033] The horizontal motion device is used to drive the lens to be tested to move at a constant speed below the light source;

[0034] The camera is used to capture images of the lens to be tested when it moves at a uniform speed;

[0035] The image processor is used to fuse multiple images of the lenses to be tested and perform defect detection based on the fused images;

[0036] The fusion includes:

[0037] The first image in which the positioning mark appears is used to generate a reference image; the coordinates of the positioning mark in the next image of the lens to be tested are affine transformed to the position of the positioning mark in the reference image to generate a new reference image; and the images of all the lenses to be tested are traversed to obtain a final composite image.

[0038] Further preferably, there are two light sources, which are symmetrically arranged on both sides of the camera, and the angle range between the two light sources and the lens is: ≤ ≤90.

[0039] The present invention also provides an electronic device, comprising: a memory storing computer program instructions; and a processor, which implements the steps of the above-mentioned lens detection preprocessing method when the computer program instructions are executed by the processor.

[0040] The present invention also provides a computer-readable storage medium, which is used to store instructions. When the stored instructions are run on a computer, the computer is enabled to execute the steps of the above-mentioned lens detection preprocessing method.

[0041] The lens detection preprocessing method and detection system disclosed in the present application have at least the following advantages over the prior art:

[0042] The present application uses the form of continuous movement of the lens to be tested within the camera's field of view to obtain images of total reflection occurring at different positions of the lens to be tested, and fuses the images, and uses the fused images to achieve defect detection of the entire lens.

[0043] The present application adopts a positioning block to provide a positioning mark, which is convenient for coordinate calculation. The algorithm is simple, and the optical structure used to implement the algorithm is simple, and obvious effects can be obtained through simple calculations. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a schematic diagram of the flow chart of the lens detection preprocessing method of the present invention.

[0045] Figure 2 It is a schematic diagram of the total reflection principle of the lens of the present invention.

[0046] Figure 3 It is a schematic diagram of the total reflection principle of lenses at different positions in the lens detection preprocessing method of the present invention.

[0047] Figure 4 Schematic diagram of the optical environment of the lens detection system of the present invention.

[0048] Figure 5 It is a structural schematic diagram of the positioning block of the lens detection preprocessing method of the present invention. DETAILED DESCRIPTION

[0049] The present invention is further described in detail below through the accompanying drawings and specific embodiments.

[0050] like Figure 1 As shown, an embodiment of one aspect of the present invention provides a lens detection preprocessing method, comprising the following steps:

[0051] S1. According to the thickness and material of the lens to be tested, the angle between the light source and the lens to be tested in the horizontal direction is adjusted, and the angle is controlled within a preset angle range to illuminate the lens to be tested; further, the light source is a strip light source; in S1, according to the thickness and material of the lens to be tested, the strip light source is adjusted to illuminate the lens to be tested within a preset angle range, including:

[0052] According to the law of refraction:

[0053]

[0054] Angle of incidence Total reflection occurs when

[0055]

[0056] The preset angle range is ≤ ≤90, is the angle between the tangent line of the incident point on the upper surface and the tangent line of the reflection point on the lower surface, is the critical angle, is the exit angle, is the refractive index of the optically dense medium, is the refractive index of the optically rarefying medium; It is the angle between the light source and the horizontal direction of the lens to be tested, that is, the incident angle.

[0057] The refractive index of air is about 1.00029, and the refractive index of lenses is usually greater than 1. The specific value depends on the material of the lens. For example, the refractive index of common resin lenses is generally between 1.49 and 1.74. Light enters the lens from the air and refracts on the upper surface. Most of the light enters the lens and reaches the lower surface of the lens. At this time, the light exits the lens into the air. Figure 2 As shown, it is from the light-dense medium (lens) to the light-sparse medium (air). According to the total reflection condition, when the incident angle is When the refraction angle is equal to 90°, total reflection begins to occur. is the critical angle.

[0058] Assuming the lens is a uniform medium, light propagates in a straight line in the lens, and the refracted light on the upper surface is the incident light on the lower surface. With the incident angle The relationship is related to the thickness of the lens. The thickness of the lens mainly depends on the refractive index and degree of the lens. Generally, the higher the degree, the thicker the lens, and the higher the refractive index, the thinner the lens. Generally, the center of myopia lenses is thin, the periphery is thick, and the center is symmetrical.

[0059] The cut surfaces of the upper and lower surfaces of the lens are at a certain angle at the point where refraction or reflection occurs. The closer to the edge, the greater the angle, e.g. Figure 3is the optical path diagram of a certain point on the lens. The dotted line L1 and the dotted line L2 are the normal lines of the section of the lens surface where refraction or reflection occurs, respectively. The horizontal dotted line is the parallel line of the section of the reflection point. At this time, we have:

[0060]

[0061] According to the law of refraction

[0062]

[0063] Therefore, under the premise that the incident angle of the lower surface is greater than the critical angle, The smaller, The larger the refraction angle, the closer the upper and lower surfaces of the lens are to parallel. , the incident angle on the upper surface Close to 90°.

[0064] S2, controlling the lens to be tested to move at a uniform speed in a horizontal direction below the strip light source, and simultaneously acquiring multiple images of the lens to be tested during the uniform speed movement; Figure 4 This is an optical environment map. Two strip light sources illuminate the lens at a certain angle. Since the thickness of different areas of the lens are different, the lens needs to move at a constant speed under the light source. The camera takes pictures multiple times in succession to capture the image when the total reflection condition is reached. Since each image captures a different area of ​​the lens, all the captured areas need to be taken out and fused into a complete lens.

[0065] like Figure 5 As shown, the following embodiments describe in detail the fusion process of multiple lenses to be tested.

[0066] S3, fusing the images of the multiple lenses to be tested, wherein the fusing includes:

[0067] The present application uses two positioning blocks clamped on the left and right sides of the lens to be tested. Three types of positioning marks, large, medium and small, are set on each positioning block. Each type can be set to one or more. The centers of the positioning marks on each positioning block are on the same horizontal line. The positioning marks can be circular or square, etc. In the present application, a circle is selected as an embodiment. The two positioning blocks clamped on the left and right sides of the lens to be tested have different heights on the Y coordinate, which further causes the centers of the positioning marks on the two positioning blocks to be at different heights.

[0068] S301, generating a reference image using the first image in which a complete positioning mark appears;

[0069] These include:

[0070] Extracting the positioning mark area in the first image in which the positioning mark appears in the camera field of view;

[0071] Calculating the center coordinates of the positioning mark in the extracted positioning mark area;

[0072] According to the center coordinates of the positioning mark, the entire image is translated to the reference line on the other side of the camera field of view, and the translated image is used as the reference image. The reference line is artificially drawn on one of the left and right sides.

[0073] S302, according to the coordinate correspondence between the next lens image to be tested and the positioning mark in the reference image, affine transform the next lens image to be tested onto the reference image as a whole to generate a new reference image;

[0074] Specifically:

[0075] In the next lens image to be tested, search for positioning marks with the same radius and similar Y coordinates as those in the reference image, and determine the number of positioning marks found on each positioning block; in order to more accurately distinguish the positioning marks on the two positioning blocks, the height data of the Y coordinate is fully utilized here.

[0076] A positioning block area with a large number of positioning marks is selected to calculate the angle of the affine transformation between the current image and the reference image, because when the number of positioning marks is large, the calculated affine transformation angle is more accurate.

[0077] Compare the grayscale values ​​of the current image after affine transformation with the reference image pixel by pixel, and select the pixel with the larger grayscale value between the two to generate a new reference image;

[0078] S303, traversing the images of all the lenses to be tested, and finally obtaining the reference image is the final composite image.

[0079] like Figure 2 As shown, the present application also provides a lens detection system for implementing the above lens detection preprocessing method, including: a bar light source 1, a positioning block 2, a camera 3, a horizontal motion device 5 and an image processor;

[0080] The strip light source is used to illuminate the lens 4 to be tested according to a preset angle range; there are two strip light sources, which are symmetrically arranged on both sides of the camera, and the angle ranges between the two strip light sources and the lens are: ≤ ≤90.

[0081] The positioning block is used to clamp on the left and right sides of the lens to be tested and display a positioning circle;

[0082] The horizontal motion device is used to drive the lens to be tested to move at a constant speed below the light source;

[0083] The camera is used to capture images of the lens to be tested when it moves at a uniform speed;

[0084] The image processor is used to fuse multiple images of the lenses to be tested and perform defect detection based on the fused images;

[0085] The fusion includes:

[0086] The first image in which the positioning circle 201 appears is used to generate a reference image; the coordinates of the positioning circle in the next image of the lens to be tested are affine transformed to the position of the positioning circle in the reference image to generate a new reference image; the images of all the lenses to be tested are traversed, and the reference image finally obtained is the final composite image.

[0087] The present application also relates to an electronic device, comprising: a memory storing computer program instructions; and a processor, which implements the steps of the above-mentioned lens detection preprocessing method when the computer program instructions are executed by the processor.

[0088] The present application also relates to a computer-readable storage medium, wherein the computer-readable storage medium is used to store instructions. When the stored instructions are executed on a computer, the computer is enabled to execute the steps of the above-mentioned lens detection preprocessing method.

[0089] Obviously, the above embodiments are only examples for clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived from them are still within the protection scope of the invention.

Claims

1. A lens detection preprocessing method, characterized in that: The following steps are involved: S1. According to the thickness and material of the lens to be tested, adjust the angle between the light source and the lens to be tested in the horizontal direction, and control the angle within a preset angle range to illuminate the lens to be tested; S2, controlling the lens to be tested to move at a uniform speed in a horizontal direction below the light source, and simultaneously acquiring multiple images of the lens to be tested during the uniform speed movement; S3, fusing multiple images of the lenses to be tested, and using the fused images for defect detection; The fusion comprises: using two positioning blocks to clamp the left and right sides of the lens to be tested respectively, and setting three types of positioning marks, large, medium and small, on each positioning block; S301, generating a reference image using the first image in which a complete positioning mark appears; comprising: Extracting the positioning mark area in the first image where the positioning mark appears in the camera field of view; Calculating the center coordinates of the positioning mark in the extracted positioning mark area; According to the center coordinates of the positioning mark, the entire image is translated to the reference line on the other side of the camera field of view, and the translated image is used as the reference image; S302, according to the coordinate correspondence between the next lens image to be tested and the positioning mark in the reference image, affine transform the next lens image to be tested onto the reference image as a whole to generate a new reference image; S303, traversing the images of all the lenses to be tested, and finally obtaining the reference image is the final composite image.

2. The lens detection preprocessing method according to claim 1, characterized in that: In S1, adjusting the angle between the light source and the lens to be tested in the horizontal direction according to the thickness and material of the lens to be tested, and controlling the angle to illuminate the lens to be tested within a preset angle range; including: According to the law of refraction: According to the angle of incidence When , total reflection occurs; Critical Angle ; The preset angle range is ≤ ≤90; in, is the angle between the light source and the horizontal direction of the lens to be tested, is the angle between the tangent line of the incident point on the upper surface and the tangent line of the reflection point on the lower surface, is the critical angle, is the exit angle, is the refractive index of the optically denser medium, is the refractive index of the optically sparse medium.

3. The lens detection preprocessing method according to claim 1, characterized in that: The two positioning blocks clamped on the left and right sides of the lens to be tested have different heights on the Y coordinate.

4. The lens detection preprocessing method according to claim 1, characterized in that: In S302, it also includes: Searching for positioning marks with the same radius and similar Y coordinates as those in the reference image in the next lens image to be tested, and determining the number of positioning marks found on each positioning block; A positioning block area with a large number of positioning marks is selected to calculate the angle of the affine transformation between the current image and the reference image.

5. The lens detection preprocessing method according to claim 1, characterized in that: In S302, it also includes: comparing the grayscale values ​​of the current image and the reference image after affine transformation pixel by pixel, and selecting pixels with larger grayscale values ​​from the two to generate a new reference image.

6. A lens detection system, characterized in that: A lens detection preprocessing method for implementing any one of claims 1 to 5, comprising: a light source, a positioning block, a camera, a horizontal motion device and an image processor; The light source is used to illuminate the lens to be tested within a preset angle range; The positioning block is used to clamp on the left and right sides of the lens to be tested and display positioning marks; The horizontal motion device is used to drive the lens to be tested to move at a constant speed below the light source; The camera is used to capture images of the lens to be tested when it moves at a uniform speed; The image processor is used to fuse multiple images of the lenses to be tested and perform defect detection based on the fused images; The fusion includes: A reference image is generated by taking the first image in which a complete positioning mark appears; based on the coordinate correspondence between the next image of the lens to be tested and the positioning mark in the reference image, the next image of the lens to be tested is affine transformed onto the reference image as a whole to generate a new reference image; all images of the lenses to be tested are traversed, and the reference image finally obtained is the final composite image.

7. The lens detection system according to claim 6, characterized in that: There are two light sources, and the two strip light sources are symmetrically arranged on both sides of the camera. The angle range between the two light sources and the lens is: ≤ ≤90, where is the angle between the light source and the horizontal direction of the lens to be tested, is the angle between the tangent line of the incident point on the upper surface and the tangent line of the reflection point on the lower surface, is the critical angle, is the exit angle, is the refractive index of the optically denser medium, is the refractive index of the optically sparse medium.

8. An electronic device, characterized in that: include: a memory storing computer program instructions; A processor, when the computer program instructions are executed by the processor, implements the steps of the lens detection preprocessing method according to any one of claims 1 to 5.