Focusing adjustment method, system, device and medium for contact lens full-view visual equipment
By setting calibration parts and performing pixel accuracy calculations in the contact lens full inspection visual equipment, the problem of inconsistent focusing of multiple camera lenses was solved, achieving clear imaging and reliable inspection.
Patent Information
- Application Number
- CN202410425581.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-10
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-04-10
AI Technical Summary
In existing contact lens full inspection systems, it is difficult to ensure the focus consistency between the focusing planes of multiple camera lenses and multiple full inspection systems, resulting in unclear imaging.
By setting a calibration piece under the camera lens, the camera lens is focused and adjusted based on the calibration piece, the pixel accuracy of the target image is calculated, and the camera height is adjusted when it does not meet the preset accuracy range until it reaches the preset accuracy range.
It simplifies the difficulty of visual system debugging, quantifies the imaging magnification, improves detection reliability, and reduces the professional requirements for debugging personnel.
Smart Images

Figure CN118379360B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine vision technology, and in particular to a focus adjustment method, system, equipment and medium for contact lens full inspection vision equipment. Background Art
[0002] In the prior art, the inspection object of the contact lens full inspection system is the contact lens. Since the contact lens is in the shape of a hemispherical shell, it is necessary to ensure that the center and edge of the contact lens are simultaneously located within the depth of field of the lens in order to obtain a clear image of the contact lens.
[0003] In the existing system debugging method, the focus plane of each camera lens is judged only by the human eye's visual sense. This method cannot effectively ensure the consistency of the focus planes of multiple camera lenses or the focus consistency between multiple full inspection systems. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a focus adjustment method, system, equipment and medium for contact lens full inspection visual equipment to solve the problem that the debugging means in the existing technology cannot ensure the consistency of the focusing surfaces of multiple camera lenses and the focus consistency between multiple full inspection systems.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] The focus adjustment method of the contact lens full inspection visual equipment of the present invention comprises:
[0007] Focusing the camera lens based on the calibration piece so that the camera lens can capture a target image with a clarity reaching a preset value;
[0008] Calculating the pixel accuracy of the target image and comparing the pixel accuracy with a preset accuracy range;
[0009] When the pixel accuracy of the target image is not within the preset accuracy range, the height of the camera is adjusted, and the focus adjustment of the camera lens is returned to based on the calibration part until the pixel accuracy of the re-captured target image falls within the preset accuracy range; when the pixel accuracy of the target image falls within the preset accuracy range, the focus adjustment of the camera lens is completed.
[0010] In one embodiment of the present application, focusing of a camera lens is adjusted based on a calibration element, including:
[0011] Determine the maximum clarity of the camera lens when photographing the calibration object;
[0012] The focus ring of the camera lens is adjusted based on the maximum clarity so that the difference between the clarity of the image of the calibration part captured by the camera lens after the focus adjustment and the maximum clarity is less than a preset threshold.
[0013] In one embodiment of the present application, determining the maximum clarity of a camera lens when photographing a calibration object includes:
[0014] Acquire a first image and a second image of the calibration object, wherein the second image is an image captured by rotating the focus ring of the lens in a first direction by a target angle after the lens captures the first image;
[0015] calculating the clarity of the first image and the clarity of the second image;
[0016] When the clarity of the second image is greater than that of the first image, the focus ring of the lens is continued to be rotated to the first direction to the end, and multiple frames of process images are acquired during the process of the focus ring being rotated to the first direction to the end; when the clarity of the second image is less than that of the first image, the focus ring of the lens is rotated to the second direction to the end, and multiple frames of the first process images are acquired during the process of the focus ring being rotated to the second direction to the end, wherein the second direction is opposite to the first direction;
[0017] The sharpness of the multiple frames of the first process image is calculated, and the maximum sharpness value thereof is screened out.
[0018] In one embodiment of the present application, adjusting the focus ring of the camera lens based on the maximum clarity includes:
[0019] Rotating a focus ring of the lens along the second direction or the first direction, and acquiring a second process image in real time during the rotation of the focus ring and calculating the clarity of the second process image;
[0020] The difference between the clarity of the second process image and the maximum clarity value is calculated, and when the difference between the clarity of the second process image and the maximum clarity value is less than a preset threshold, the focus ring is stopped from rotating, and the focus adjustment is completed.
[0021] In one embodiment of the present application, a plurality of evenly distributed circular patterns are provided on the surface of the calibration object; wherein calculating the pixel accuracy of the target image includes:
[0022] Converting the target image into a first grayscale image;
[0023] Extracting a region of interest in the first grayscale image, wherein the region of interest includes all circular patterns of the calibration object;
[0024] contour extraction is performed on the region of interest in the first grayscale image to obtain a plurality of contours, a plurality of circular contours are selected from the plurality of contours and marked;
[0025] Elliptical fitting is performed on the marked circular contours to obtain the center positions of all the marked circular contours;
[0026] The pixel distance between the center positions of any two marked circular contours corresponding to the row direction and the column direction is calculated, and the average value of all the pixel distances is calculated;
[0027] The pixel precision is calculated based on the average value of all the pixel distances and the physical distance of the circular patterns in the calibration member, wherein, .
[0028] In an embodiment of the present application, the surface of the calibration member is provided with a plurality of uniformly distributed circular patterns; wherein the calculation method of the sharpness comprises:
[0029] The image to be calculated is converted into a second grayscale image, wherein the image to be calculated is one of the first image, the second image, the first process image and the second process image;
[0030] The region of interest in the first grayscale image is extracted, wherein the region of interest contains all the circular patterns of the calibration member;
[0031] Based on the sobel operator, a plurality of image gradients in the region of interest in the first grayscale image are extracted;
[0032] The variance of the plurality of image gradients is calculated to obtain the sharpness of the image to be calculated.
[0033] In an embodiment of the present application, the calibration member is placed in a carrier, and the calibration member is located directly below the camera lens.
[0034] The present application also provides a focusing adjustment system of a contact lens full-view visual equipment, comprising:
[0035] The focusing adjustment module is used for focusing adjustment of the camera lens based on the calibration member, so that the camera lens can capture a target image with a sharpness reaching a preset value;
[0036] The calculation comparison module is used for calculating the pixel precision of the target image and comparing the pixel precision with a preset precision range;
[0037] The height adjustment module is used to adjust the height of the camera when the pixel accuracy of the target image is not within the preset accuracy range, and return to focusing the camera lens based on the calibration component until the pixel accuracy of the re-captured target image falls within the preset accuracy range; when the pixel accuracy of the target image falls within the preset accuracy range, the focus adjustment of the camera lens is completed.
[0038] The present application also provides an electronic device, comprising:
[0039] one or more processors;
[0040] A storage device is used to store one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the focus adjustment method of the contact lens full inspection visual equipment as described above.
[0041] The present application also provides a computer-readable storage medium, characterized in that a computer program is stored thereon, and when the computer program is executed by a computer processor, the computer executes the focus adjustment method of the contact lens full inspection visual equipment as described above.
[0042] The beneficial effects of the present invention are as follows: the focus adjustment method, system, device and medium of the contact lens full inspection visual equipment of the present invention, by setting a calibration piece under the camera lens, and adjusting the focus of the camera lens based on the calibration piece, so that the camera lens can capture a target image with a clarity reaching a preset value; calculating the pixel accuracy of the target image, and comparing the pixel accuracy with a preset accuracy range; when the pixel accuracy of the target image is not within the preset accuracy range, adjusting the height of the camera, and returning to focusing the camera lens based on the calibration piece until the pixel accuracy of the re-captured target image falls within the preset accuracy range; when the pixel accuracy of the target image falls within the preset accuracy range, completing the focus adjustment of the camera lens. The present application eliminates the negative influence of human factors, is conducive to simplifying the difficulty of visual system debugging, quantifying the imaging magnification of the visual system, improving the detection reliability of the visual system, and reducing the professional requirements for debugging personnel. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:
[0044] Figure 1 This is a diagram illustrating an application scenario of a focus adjustment method for a contact lens full inspection visual device according to an embodiment of the present application;
[0045] Figure 2 is a schematic diagram of a calibration component shown in an embodiment of the present application;
[0046] Figure 31 is a schematic structural diagram of a calibration piece, a calibration fixture, and a carrier bowl shown in an embodiment of the present application;
[0047] Figure 4 is a flow chart of a focus adjustment method of a contact lens full inspection vision device shown in one embodiment of the present application;
[0048] Figure 5 Schematic diagram of a process for adjusting the focus of a camera lens in one embodiment of the present application;
[0049] Figure 6 Schematic diagram of the process of pixel accuracy calculation in one embodiment of the present application;
[0050] Figure 7 is a schematic diagram of a region of interest in a first grayscale image in an embodiment of the present application;
[0051] Figure 8 is a schematic diagram of a plurality of marked circular contours in an embodiment of the present application;
[0052] Figure 9 Schematic diagram of a flow chart of clarity calculation in one embodiment of the present application;
[0053] Figure 10 is a schematic diagram of a region of interest in a second grayscale image in an embodiment of the present application;
[0054] Figure 11 is a schematic diagram of an image gradient in one embodiment of the present application;
[0055] Figure 12 1 is a structural diagram of a focus adjustment system of a contact lens full inspection visual equipment shown in one embodiment of the present application. DETAILED DESCRIPTION
[0056] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.
[0057] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention. Therefore, the drawings only show the layers related to the present invention and are not drawn according to the number, shape and size of the layers in actual implementation. In actual implementation, the type, quantity and proportion of each layer can be changed arbitrarily, and the layer layout type may also be more complicated.
[0058] In the following description, numerous details are set forth to provide a more thorough explanation of the embodiments of the present invention; however, it is apparent to one skilled in the art that the embodiments of the present invention may be practiced without these specific details.
[0059] Figure 1 This is an application scenario diagram of the focus adjustment method of the contact lens full inspection visual equipment shown in one embodiment of the present application, such as Figure 1 The structure of the contact lens inspection device described in this application is shown in the figure. The calibration component is placed in a small carrier bowl using a calibration fixture. Multiple carrier bowls are placed on a tray and placed on a testing table. Multiple camera lenses are mounted above the calibration component using brackets. This application aims to uniformly adjust the focus of multiple camera lenses.
[0060] Figure 2 is a schematic diagram of a calibration component shown in an embodiment of the present application, such as Figure 2 As shown in the figure, the calibration piece is used to evaluate the focus clarity and pixel accuracy of the camera lens. The calibration piece is made of optical glass with 3*3 opaque marking circles evenly distributed on it through a photolithography process. When in use, the camera lens images the calibration piece, and the image clarity is evaluated by calculating the edge gradient intensity of the marking circles on the image. The pixel accuracy is calculated by calculating the ratio of the pixel spacing between adjacent marking circles to the actual spacing.
[0061] Figure 3 This is a structural diagram of a calibration piece, a calibration fixture, and a small carrier bowl shown in an embodiment of the present application. Figure 3 As shown in the figure, the calibration fixture is used to install the calibration part. After installation, the calibration part can be placed in the small bowl of the carrier so that the surface where the marked circle on the calibration part is located is exactly the imaging surface of the contact lens. On this imaging surface, the center and edge of the lens can be located within the depth of field of the lens, and the lens can obtain a clear image; the calibration fixture is a metal processing part, and the distance between the calibration part installation surface and the top of the small bowl of the carrier is measured experimentally. Placing the calibration fixture on different small bowls can ensure that the focusing surfaces of multiple camera lenses are consistent.
[0062] The object to be measured of the full inspection vision system is placed in a small bowl carrier, and the focal plane of the system is inside the small bowl of the carrier, so the following is designed: Figure 3 The calibration piece and calibration fixture shown are installed on the calibration fixture, and the calibration fixture is placed in a small bowl. The distance from the upper surface of the calibration piece to the mouth of the small bowl is measured experimentally, so that when the lens is focused on the surface of the calibration piece, the contact lens can be clearly imaged, and the center and edge of the lens are clear.
[0063] After completing the hardware assembly as described above, you can adjust the focus according to the following process.
[0064] Figure 4FIG. 1 is a flow chart of a focus adjustment method for a contact lens full inspection visual device according to an embodiment of the present application. Figure 4 As shown, this application includes:
[0065] S410, focusing the camera lens based on the calibration component, so that the camera lens can capture a target image with a clarity reaching a preset value;
[0066] S420, calculating the pixel accuracy of the target image, and comparing the pixel accuracy with a preset accuracy range;
[0067] S430, when the pixel accuracy of the target image is not within the preset accuracy range, adjust the height of the camera and return to adjusting the focus of the camera lens based on the calibration part until the pixel accuracy of the re-captured target image falls within the preset accuracy range; when the pixel accuracy of the target image falls within the preset accuracy range, complete the focus adjustment of the camera lens.
[0068] The focus adjustment in this application includes the adjustment of the focus ring of the camera lens and the height adjustment of the camera lens. Figure 2 As shown, this application first focuses the camera lens on the calibration piece to adjust the focus of the camera lens. The focus adjustment is measured by image clarity. Then calibrate the pixel accuracy of the target image. If the pixel accuracy falls within the preset range of 0.0095±0.0005, it means that the height is appropriate. If the pixel accuracy is less than 0.0095, it is necessary to raise the position of the camera and then refocus until the pixel accuracy meets the requirements; if the pixel accuracy is greater than 0.0095, it is necessary to lower the position of the camera and then refocus until the pixel accuracy meets the requirements.
[0069] In this application, to adjust the focus of the camera lens, it is necessary to first rotate the focus ring and continuously capture images of the calibration part to determine the maximum clarity of the camera lens when capturing the calibration part; then, based on the maximum clarity, the focus ring of the camera lens is rotated and adjusted so that the difference between the clarity of the image of the calibration part captured by the camera lens after the focus adjustment is completed and the maximum clarity is less than a preset threshold.
[0070] Figure 5 FIG. 1 is a flow chart of focusing adjustment of a camera lens in an embodiment of the present application. Figure 5 As shown in FIG, the specific process of adjusting the focus of the camera lens includes:
[0071] (1) Acquire a first image and a second image of the calibration part, wherein the second image is an image captured by rotating the focus ring of the lens in a first direction to a target angle after the lens captures the first image; equivalently, the first image is the previous image, and the second image is the next image captured after rotating the focus ring to a specific angle;
[0072] (2) Calculating the clarity of the first image and the clarity of the second image; specifically, the clarity of the first image may be calculated when the first image is acquired, or may be calculated together with the clarity of the second image;
[0073] (3) When the clarity of the second image is greater than that of the first image, continue to rotate the focus ring of the lens to the first direction until it is fully rotated, and acquire multiple frames of process images during the process of rotating the focus ring to the first direction until it is fully rotated; when the clarity of the second image is less than that of the first image, rotate the focus ring of the lens to the second direction until it is fully rotated, and acquire multiple frames of the first process images during the process of rotating the focus ring to the second direction until it is fully rotated, wherein the second direction is the opposite direction of the first direction;
[0074] For example, if the clarity of the subsequent image becomes greater than that of the previous image, continue to turn the focus ring to the bottom in the first direction (clockwise); if the clarity of the subsequent image becomes less than that of the previous image, continue to turn the focus ring to the bottom in the second direction (counterclockwise).
[0075] (4) Calculating the clarity of the multiple frames of the first process image and screening out the maximum clarity value therein.
[0076] Specifically, while the focus ring is rotated for the first time, multiple first process images are collected in real time, and the clarity values of the first process images are calculated in real time, thereby obtaining multiple clarity values, and then screening out the maximum clarity value.
[0077] (5) rotating the focus ring of the lens along the second direction or the first direction, and acquiring a second process image in real time during the rotation of the focus ring and calculating the clarity of the second process image;
[0078] Since the focus ring is rotated clockwise or counterclockwise in step (3), it can be rotated in the opposite direction at this time. A frame of the second process image is obtained every time it is rotated by a specific angle, and the clarity of the second process image is calculated.
[0079] (6) Calculating the difference between the clarity of the second process image and the maximum clarity value, and when the difference between the clarity of the second process image and the maximum clarity value is less than a preset threshold, stopping the rotation of the focus ring and completing the focus adjustment.
[0080] Each time the sharpness of a second-process image is calculated, it is compared with the maximum sharpness value. If the difference between the two is greater than or equal to a preset threshold of 0.1, the focus ring has not yet reached the optimal focus position. Rotation continues, acquiring a second-process image, calculating the sharpness and comparing the values. When the difference between the sharpness of the second-process image and the maximum sharpness value falls below a preset threshold, indicating that the focus ring has reached the optimal focus position, rotation of the focus ring is stopped, completing the focus adjustment.
[0081] Specifically in this embodiment, when focusing, the calibration fixture is placed in the small bowl, the lens aperture is fixed to 8, the camera collects and calculates the image clarity in real time, and the lens focus ring is first turned clockwise: if the clarity index on the image changes from small to large, turn the lens focus ring to the bottom in this direction; if the clarity index on the image changes from large to small, turn the lens focus ring to the bottom in the opposite direction; in this process, the maximum clarity value in the focusing process can be obtained. After that, turn the lens focus ring in the opposite direction and stop when the difference between the real-time clarity value of the image and the maximum clarity value is within 0.1, then you can confirm that the system is focused clearly.
[0082] Figure 6 FIG. 1 is a flow chart of pixel accuracy calculation in an embodiment of the present application. Figure 6 As shown, in one embodiment of the present application, a plurality of evenly distributed circular patterns are provided on the surface of the calibration piece; wherein, calculating the pixel accuracy of the target image includes:
[0083] (1) converting the target image into a first grayscale image;
[0084] (2) extracting a region of interest from the first grayscale image, wherein the region of interest includes all circular patterns of the calibration part;
[0085] Figure 7 is a schematic diagram of a region of interest in a first grayscale image in an embodiment of the present application. In this embodiment, the region of interest extracted from the first grayscale image is as follows: Figure 7 shown.
[0086] (3) performing contour extraction on the region of interest in the first grayscale image to obtain a plurality of contours, screening the plurality of contours to obtain a plurality of circular contours and marking them;
[0087] Figure 8 is a schematic diagram of a plurality of marked circular contours in an embodiment of the present application. The plurality of marked circular contours in this embodiment are as follows: Figure 8 shown.
[0088] (4) Perform ellipse fitting on the marked circular contours to obtain the center positions of all marked circular contours;
[0089] (5) Calculate the pixel distance between the center positions of any two marked circular contours in the row and column directions, and calculate the average value of all pixel distances;
[0090] (6) Calculating pixel accuracy based on the average of all pixel distances and the physical spacing of the circular pattern in the calibration part, where: .
[0091] Figure 9 This is a flow chart of the clarity calculation process in one embodiment of the present application. Figure 9 As shown, in one embodiment of the present application, a plurality of evenly distributed circular patterns are provided on the surface of the calibration piece; wherein the method for calculating the clarity includes:
[0092] (1) converting the image to be calculated into a second grayscale image, wherein the image to be calculated is one of the first image, the second image, the first process image, and the second process image;
[0093] (2) extracting a region of interest from the second grayscale image, wherein the region of interest includes all circular patterns of the calibration part;
[0094] Figure 10 is a schematic diagram of a region of interest in a second grayscale image in an embodiment of the present application. In this embodiment, the region of interest extracted from the second grayscale image is as follows: Figure 10 shown.
[0095] (3) extracting multiple image gradients within the region of interest in the second grayscale image based on the Sobel operator;
[0096] Figure 11 This is a schematic diagram of an image gradient in an embodiment of the present application. In this embodiment, multiple image gradients extracted by the Sobel operator are as follows: Figure 11 shown.
[0097] (4) Calculate the variance of the multiple image gradients to obtain the clarity of the image to be calculated.
[0098] The focusing adjustment method of the contact lens full inspection visual equipment provided by the application adjusts the focusing of the camera lens based on the calibration piece, so that the camera lens can capture a target image with a preset sharpness; the pixel accuracy of the target image is calculated and compared with a preset accuracy range; when the pixel accuracy of the target image is not in the preset accuracy range, the height of the camera is adjusted, and the focusing of the camera lens is adjusted based on the calibration piece again until the pixel accuracy of the newly captured target image falls into the preset accuracy range; when the pixel accuracy of the target image falls into the preset accuracy range, the focusing adjustment of the camera lens is completed. The application excludes the negative influence of human factors, is beneficial to simplifying the visual system debugging difficulty, quantifying the imaging magnification of the visual system, improving the detection reliability of the visual system, and reducing the professional requirements for the debugging personnel.
[0099] As shown in Figure 12 The application also provides a focusing adjustment system of a contact lens full inspection visual equipment, which comprises:
[0100] A focusing adjustment module is configured to adjust the focusing of the camera lens based on the calibration piece, so that the camera lens can capture a target image with a preset sharpness;
[0101] A calculation and comparison module is configured to calculate the pixel accuracy of the target image and compare the pixel accuracy with a preset accuracy range;
[0102] A height adjustment module is configured to adjust the height of the camera when the pixel accuracy of the target image is not in the preset accuracy range, and return to the focusing adjustment of the camera lens based on the calibration piece until the pixel accuracy of the newly captured target image falls into the preset accuracy range; when the pixel accuracy of the target image falls into the preset accuracy range, the focusing adjustment of the camera lens is completed.
[0103] The focusing adjustment system of the contact lens full inspection visual equipment provided by the application adjusts the focusing of the camera lens based on the calibration piece, so that the camera lens can capture a target image with a preset sharpness; the pixel accuracy of the target image is calculated and compared with a preset accuracy range; when the pixel accuracy of the target image is not in the preset accuracy range, the height of the camera is adjusted, and the focusing of the camera lens is adjusted based on the calibration piece again until the pixel accuracy of the newly captured target image falls into the preset accuracy range; when the pixel accuracy of the target image falls into the preset accuracy range, the focusing adjustment of the camera lens is completed. The application excludes the negative influence of human factors, is beneficial to simplifying the visual system debugging difficulty, quantifying the imaging magnification of the visual system, improving the detection reliability of the visual system, and reducing the professional requirements for the debugging personnel.
[0104] This embodiment further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, any one of the methods in this embodiment is implemented, wherein the method is the execution logic of this system.
[0105] This embodiment also provides an electronic terminal, including: a processor and a memory;
[0106] The memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory, so that the terminal executes any one of the methods in this embodiment.
[0107] Regarding the computer-readable storage medium in this embodiment, those skilled in the art will appreciate that all or part of the steps in the aforementioned method embodiments can be implemented using hardware associated with the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When executed, the program performs the steps in the aforementioned method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0108] The electronic terminal provided in this embodiment includes a processor, a memory, a transceiver and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication with each other. The memory is used to store computer programs, the communication interface is used for communication, and the processor and the transceiver are used to run computer programs so that the electronic terminal executes the various steps of the above method.
[0109] In this embodiment, the memory may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage.
[0110] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0111] In the above embodiments, although the present invention has been described in conjunction with specific embodiments of the present invention, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. The embodiments of the present invention are intended to cover all such replacements, modifications and variations that fall within the broad scope of the appended claims.
[0112] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.
Claims
1. A method for adjusting the focus of a contact lens inspection device, characterized in that: Including steps: Focusing the camera lens based on the calibration piece so that the camera lens can capture a target image with a clarity reaching a preset value; Calculating the pixel accuracy of the target image and comparing the pixel accuracy with a preset accuracy range; The surface of the calibration piece is provided with a plurality of evenly distributed circular patterns; wherein, calculating the pixel accuracy of the target image comprises: converting the target image into a first grayscale image; extracting a region of interest in the first grayscale image, wherein the region of interest includes all circular patterns of the calibration piece; performing contour extraction on the region of interest in the first grayscale image to obtain a plurality of contours, screening a plurality of circular contours from the plurality of contours and marking them; performing ellipse fitting on the marked circular contours to obtain the center positions of all marked circular contours; calculating the pixel distance between the center positions of any two marked circular contours corresponding to the row direction and the column direction, and calculating the average value of all pixel distances; calculating the pixel accuracy based on the average value of all pixel distances and the physical spacing of the circular patterns in the calibration piece, wherein, ; When the pixel accuracy of the target image is not within the preset accuracy range, the height of the camera is adjusted, and the focus adjustment of the camera lens is returned to based on the calibration part until the pixel accuracy of the re-captured target image falls within the preset accuracy range; when the pixel accuracy of the target image falls within the preset accuracy range, the focus adjustment of the camera lens is completed.
2. The focus adjustment method of the contact lens full inspection vision equipment according to claim 1, characterized in that: Adjust the focus of the camera lens based on the calibration parts, including: Determine the maximum clarity of the camera lens when photographing the calibration object; The focus ring of the camera lens is adjusted based on the maximum clarity so that the difference between the clarity of the image of the calibration part captured by the camera lens after the focus adjustment and the maximum clarity is less than a preset threshold.
3. The focus adjustment method of the contact lens full inspection visual equipment according to claim 2, characterized in that: Determine the maximum clarity of the camera lens when photographing the calibration object, including: Acquire a first image and a second image of the calibration object, wherein the second image is an image captured by rotating the focus ring of the lens in a first direction by a target angle after the lens captures the first image; calculating the clarity of the first image and the clarity of the second image; When the clarity of the second image is greater than that of the first image, the focus ring of the lens is continued to be rotated to the first direction to the end, and multiple frames of first process images are acquired during the process of the focus ring being rotated to the first direction to the end; when the clarity of the second image is less than that of the first image, the focus ring of the lens is rotated to the second direction to the end, and multiple frames of first process images are acquired during the process of the focus ring being rotated to the second direction to the end, wherein the second direction is opposite to the first direction; The sharpness of the multiple frames of the first process image is calculated, and the maximum sharpness value thereof is screened out.
4. The focus adjustment method of the contact lens full inspection visual equipment according to claim 3, characterized in that: Adjusting a focus ring of a camera lens based on the maximum clarity includes: Rotating a focus ring of the lens in a direction opposite to the first direction or in a direction opposite to the second direction, and acquiring a second process image in real time and calculating the clarity of the second process image during the reverse rotation of the focus ring; The difference between the clarity of the second process image and the maximum clarity value is calculated, and when the difference between the clarity of the second process image and the maximum clarity value is less than a preset threshold, the focus ring is stopped from rotating, and the focus adjustment is completed.
5. The focus adjustment method of the contact lens full inspection vision equipment according to claim 3 or 4, characterized in that: The surface of the calibration piece is provided with a plurality of evenly distributed circular patterns; wherein the method for calculating the clarity includes: Converting the image to be calculated into a second grayscale image, wherein the image to be calculated is one of the first image, the second image, the first process image, and the second process image; Extracting a region of interest in the second grayscale image, wherein the region of interest includes all circular patterns of the calibration object; extracting a plurality of image gradients within a region of interest in the second grayscale image based on a Sobel operator; The variance of the multiple image gradients is calculated to obtain the clarity of the image to be calculated.
6. The focus adjustment method of the contact lens full inspection visual equipment according to claim 1, characterized in that: The calibration piece is placed in the carrier, and the calibration piece is located directly below the camera lens.
7. A focus adjustment system for a contact lens inspection device, characterized in that: include: A focus adjustment module, configured to adjust the focus of the camera lens based on the calibration component so that the camera lens can capture a target image with a clarity reaching a preset value; A calculation and comparison module, configured to calculate the pixel accuracy of the target image and compare the pixel accuracy with a preset accuracy range; The surface of the calibration piece is provided with a plurality of evenly distributed circular patterns; wherein, calculating the pixel accuracy of the target image comprises: converting the target image into a first grayscale image; extracting a region of interest in the first grayscale image, wherein the region of interest includes all circular patterns of the calibration piece; performing contour extraction on the region of interest in the first grayscale image to obtain a plurality of contours, screening a plurality of circular contours from the plurality of contours and marking them; performing ellipse fitting on the marked circular contours to obtain the center positions of all marked circular contours; calculating the pixel distance between the center positions of any two marked circular contours corresponding to the row direction and the column direction, and calculating the average value of all pixel distances; calculating the pixel accuracy based on the average value of all pixel distances and the physical spacing of the circular patterns in the calibration piece, wherein, ; A height adjustment module is used to adjust the height of the camera when the pixel accuracy of the target image is not within a preset accuracy range, and return to focusing the camera lens based on the calibration component until the pixel accuracy of the re-captured target image falls within the preset accuracy range; when the pixel accuracy of the target image falls within the preset accuracy range, the focus adjustment of the camera lens is completed.
8. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the focus adjustment method of the contact lens full inspection visual equipment as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the focus adjustment method of the contact lens full inspection visual equipment according to any one of claims 1 to 6.
Citation Information
Patent Citations
Internet-of-things binocular vision zoom dynamic target tracking test system platform and Internet-of-things binocular vision zoom dynamic target tracking ranging method
CN104880154A
Focusing method and device, electronic equipment and storage medium
CN111432125A