Focus depth detection method and device based on chromatics

Through the focal depth detection method based on color science, the pre-clear image of the color target and the color knife edge image are used to calculate the size of the circle of confusion to determine the focal depth position of the lens module, which solves the problem of low detection efficiency in the existing technology. Fast and efficient focus depth position recognition is achieved.

CN119338904APending Publication Date: 2025-01-21YUYAO SUNNY OPTICAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310904065.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-21
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

The existing depth of focus position detection method requires multiple imaging images to be processed, resulting in low detection efficiency.

Method used

Provides a depth-of-focus detection method based on color science. By obtaining a pre-clear image of a color target, intercepting color knife edge images of different colors, calculating the size of the circle of confusion, and determining the depth of focus of the lens module based on the size relationship of the circle of confusion. Location.

Benefits of technology

This method can quickly and efficiently identify the current focal depth position of the lens module and improve detection efficiency, requiring only one pre-cleared image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119338904A_ABST
    Figure CN119338904A_ABST
Patent Text Reader

Abstract

The invention relates to a focal depth detection method and device based on chromatics. The method comprises the following steps: acquiring a pre-clear image of a color target plate; wherein the color target plate is provided with at least three color blocks with different colors and at least four black dots; the distance between the central point of each colored color block and the central point of the colored target plate is consistent; the black dots are symmetrically arranged on the colored target plate in pairs; intercepting colored knife edge images with different colors from the pre-clear image; calculating the size of a confusion circle based on the colored knife edge image to obtain the sizes of the confusion circles of different colors; and determining the focal depth position of the lens module based on the size relationship of the confusion circles of different colors. With the adoption of the method, the current focal depth position of the lens module can be quickly and accurately identified through one imaged image by virtue of different refractive indexes of the color light source.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method and device for detecting depth of focus based on chromatology. Background Art

[0002] The resolution of a camera, also known as clarity, is an important parameter that reflects the quality of the camera. During the production process, the best resolution can be obtained by running out of focus during AA (Active Alignment) of the lens module, that is, adjusting the distance between the lens and the chip in the lens module to find the distance that makes the lens module image clearest. At this time, the chip is in the quasi-focus position relative to the lens. Usually, pre-clearing means are used to make the lens module quickly reach the vicinity of the quasi-focus position, and the distance between the lens and the chip can continue to be finely adjusted near the quasi-focus position. Due to the difference in the focal length of different lens modules, the focal depth positions reached by different lens modules after pre-clearing are not the same. The chip may be before the quasi-focus position or after the quasi-focus position. In different positions, the subsequent adjustment methods required are also different.

[0003] In order to determine the current focal depth position of the lens module after pre-clarification, the prior art uses at least two imaging images for comparison, and combines different imaging characteristics before and after the quasi-focus position to determine the current focal depth position of the lens module.

[0004] However, the above-mentioned depth of focus position detection method needs to add an algorithm with logical judgment to process multiple imaging images, resulting in low detection efficiency. Summary of the invention

[0005] Based on this, it is necessary to provide a method and device for focal depth detection based on color science that can improve the efficiency of focal depth position detection in order to solve the above technical problems.

[0006] In a first aspect, the present application provides a method for detecting depth of focus based on chromatology, the method comprising:

[0007] Acquire a pre-clear image of a color standard plate; wherein the color standard plate is provided with color blocks of at least three different colors and at least four black dots; the center point of each color block is at the same distance from the center point of the color standard plate; the black dots are symmetrically arranged on the color standard plate in pairs;

[0008] intercepting color knife-edge images of different colors from the pre-clear image;

[0009] Calculating the size of the circle of confusion based on the color knife-edge image to obtain the sizes of the circles of confusion of different colors;

[0010] Based on the size relationship of the confusion circles of different colors, the focal depth position of the lens module is determined.

[0011] In one embodiment, the color blocks are red, green and blue blocks.

[0012] In one of the embodiments, the minimum acute angle formed by the edge of the color block and the horizontal direction or the vertical direction is 8 degrees.

[0013] In one embodiment, the step of obtaining a pre-clear image of a color standard plate includes:

[0014] In the process of adjusting the lens module, the imaging image of the color standard plate is acquired in real time, and the distance between two ellipse points on the imaging image is calculated; the ellipse point is the image formed by the black dot;

[0015] When the distance between the ellipse points meets a preset threshold, the imaging image of the color standard plate acquired by the lens module is used as a pre-clear image; and the lens module is located at a preset position.

[0016] In one embodiment, the extracting color knife-edge images of different colors from the pre-clear image comprises:

[0017] Calculating the optical center position based on the pre-clear image;

[0018] Drawing a circle on the pre-clear image with the optical center position as the center, wherein the circle intersects with the edge of the color block on the pre-clear image;

[0019] Color knife edge images of different colors are intercepted with the intersection of the circle and the color block as the center point.

[0020] In one embodiment, the calculating the optical center position based on the pre-clear image comprises:

[0021] The coordinates of the optical center position are obtained by calculating the mean of the coordinates of the four ellipse points on the pre-clear image; wherein the ellipse points are images formed by the black dots.

[0022] In one embodiment, the calculating the size of the circle of confusion based on the color knife-edge image to obtain the size of the circle of confusion of different colors includes:

[0023] Calculating edge extension functions of the color knife-edge images of different colors;

[0024] Based on the calculation result of the edge spread function, a line spread function is calculated;

[0025] The sizes of the confusion circles of different colors are obtained based on the line spread function.

[0026] In one embodiment, determining the focal depth position of the lens module based on the size relationship of the confusion circles of different colors includes:

[0027] When the red circle of confusion is larger than the green and blue circles of confusion, the lens module is at a front focal depth position;

[0028] When the blue circle of confusion is larger than the green and red circles of confusion, the lens module is at a back focus depth position.

[0029] In a second aspect, the present application further provides a focal depth detection device based on chromatology, the device comprising:

[0030] A pre-clear image acquisition module is used to acquire a pre-clear image of a color standard plate; wherein the color standard plate is provided with color blocks of at least three different colors and at least four black dots; the center point of each color block is at the same distance from the center point of the color standard plate; the black dots are symmetrically arranged on the color standard plate in pairs;

[0031] A knife-edge image interception module, used for intercepting color knife-edge images of different colors from the pre-clear image;

[0032] A module for calculating a circle of confusion, used for calculating the size of the circle of confusion based on the color knife-edge image, and obtaining the size of the circle of confusion of different colors;

[0033] The module for determining the focal depth position is used to determine the focal depth position of the lens module based on the size relationship of the confusion circles of different colors.

[0034] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of any one of the above-mentioned color science-based depth of focus detection methods when executing the computer program.

[0035] The above-mentioned depth of focus detection method and device based on color science obtains a pre-clear image by using a color standard plate for pre-clear imaging, and captures color knife-edge images of different colors from the pre-clear image, calculates the size of the confusion circle based on the color knife-edge image, and determines the focal depth position of the lens module according to the size relationship of the confusion circles of different colors. Only one pre-clear image is required, and with the help of the different refractive indices of light beams of different colors and the different focal positions behind the lens, the current focal depth position of the lens module can be quickly and efficiently identified. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0037] Figure 1 is a hardware structure block diagram of a method for detecting depth of focus based on color science in one embodiment;

[0038] Figure 2 is a schematic flow chart of a method for detecting depth of focus based on color science in one embodiment;

[0039] Figure 3 is a schematic diagram of a color label plate in one embodiment;

[0040] Figure 4 A schematic diagram of a pre-clear image and a captured color knife-edge image in one embodiment;

[0041] Figure 5 A schematic diagram of a method for calculating a circle of confusion in one embodiment;

[0042] Figure 6 A schematic diagram of the sizes of diffusion circles of light beams of different colors in one embodiment;

[0043] Figure 7 1 is a structural block diagram of a depth of focus detection device based on color science in one embodiment. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0045] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as the content disclosed in this application is insufficient.

[0046] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0047] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0048] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1 is a hardware structure block diagram of the depth of focus detection method based on color science in this embodiment. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 and memory 104 for storing data, wherein processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1More or fewer components as shown, or with Figure 1 Different configurations shown.

[0049] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the color science-based depth of focus detection method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0050] The transmission device 106 is used to receive or send data via a network. The above network includes a wireless network provided by the communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0051] In this embodiment, a method for detecting depth of focus based on color science is provided. Figure 2 is a flow chart of the method for detecting depth of focus based on color science in this embodiment, such as Figure 2 As shown, the process includes the following steps:

[0052] Step S210, obtaining a pre-clear image of a color standard plate; wherein the color standard plate is provided with color blocks of at least three different colors and at least four black dots; the center point of each color block is at the same distance from the center point of the color standard plate; and the black dots are symmetrically arranged on the color standard plate in pairs.

[0053] Specifically, a pre-stored pre-cleared image may be obtained from a database, or may be acquired in real time during the pre-clearing process.

[0054] Specifically, in the process of adjusting the lens module, the imaging image of the color standard plate is acquired in real time, and two ellipse points that are symmetrical left and right or symmetrical up and down are selected on the imaging image, and the distance between the two ellipse points on the imaging image is calculated; the ellipse points are images formed by black dots; when the distance between the ellipse points meets a preset threshold, the imaging image of the color standard plate acquired by the lens module is used as a pre-clear image; the lens module is located at a preset position.

[0055] Figure 3 This is a schematic diagram of a color label. The color label is not limited to Figure 3 There are two cases of color standard plate A and color standard plate B shown. Several color blocks are set on the color standard plate, including black blocks and color blocks, of which there are at least three color blocks, and the center points of the color blocks are at the same distance from the center point of the color standard plate, which is convenient for capturing the knife-edge image with the same field of view and eliminating interference from the lens field area.

[0056] Preferably, the color blocks are red, green and blue blocks. Based on the different wavelengths of the red, green and blue light beams, the different convergence positions after passing through the lens facilitate calculation and distinction of the respective diffusion circles.

[0057] Preferably, the color blocks are respectively located at the upper right, lower left and lower right directions of the color standard plate.

[0058] Preferably, the minimum acute angle formed by the edge of the color block and the horizontal direction or the vertical direction of the color standard is 8 degrees, so as to avoid abnormality when calculating ESF (Edge Spread Function).

[0059] Step S220, capturing color knife-edge images of different colors from the pre-clear image.

[0060] Specifically, since the pre-clear image is an image of the color standard plate formed by the lens module near the quasi-focus position, the pre-clear image includes the imaged color blocks and the elliptical points formed by the black dots. Figure 4 , calculate the centroid mean of the four ellipse points Point_1, Point_2, Point_3 and Point_4, and obtain the optical center coordinates OC (Cx, Cy) of the lens module. The calculation formula is as follows:

[0061] Cx=(Point_4_x+Point_3_x+Point_2_x+Point_1_x) / 4;

[0062] Cy=(Point_4_y+Point_3_y+Point_2_y+Point_1_y) / 4;

[0063] Among them, Point_4_x, Point_3_x, Point_2_x, and Point_1_x are the horizontal coordinates of the center of mass of the ellipse point, and Point_4_y, Point_3_y, Point_2_y, and Point_1_y are the vertical coordinates of the center of mass of the ellipse point.

[0064] A circle is drawn with the optical center OC as the center, and the circumference of the circle is made to intersect with the edge of the color block, and the color knife edge image is intercepted with the intersection as the center point.

[0065] Step S230, calculating the size of the circle of confusion based on the color knife-edge image to obtain the sizes of the circles of confusion of different colors.

[0066] For details, see Figure 5 The point spread function PSF (Point Spread Function) is the brightness distribution function after the light source is imaged. The Gaussian function can be used to approximate the section of the PSF. The radius of the imaging spot can be obtained by calculating the σ parameter of the Gaussian function. Therefore, the edge spread function ESF (Edge Spread Function) of the color knife-edge image of different colors is calculated, and the ESF is differentiated to obtain the corresponding line spread function LSF (Line Spread Function). According to the characteristics of the Gaussian function, the positions corresponding to the ESF functions 0.8413 and 0.1587 of the color knife-edge image can be extracted. The spacing of the positions in the LSF function is 2σ (the area in the horizontal axis interval (μ-σ, μ+σ) is 68.27%), and 2σ is the size of the imaging spot, that is, the diameter of the diffusion circle.

[0067] In step S240, the focal depth position of the lens module is determined based on the size relationship of the confusion circles of different colors.

[0068] For details, see Figure 6 , light sources of different colors have different refractive indices, so at a certain imaging position behind the lens, the sizes of the diffusion circles of various colors obtained are also different. When the incident light contains blue, green and red light, after refraction by the lens, the deflection directions of the three colors of light are different, such as Figure 6 As shown in the figure, three converging light spots appear behind the lens, from the direction close to the lens to the direction far from the lens, they are the blue light converging light spot, the green light converging light spot, and the red light converging light spot. Therefore, at a position close to the lens, the blue diffusion circle will be the smallest, the green diffusion circle will be larger than the blue diffusion circle, and the red diffusion circle will be the largest; if at a certain position far from the lens, the red diffusion circle will be the smallest, the green diffusion circle will be larger than the red diffusion circle, and the blue diffusion circle will be the largest.

[0069] When the color standard contains red, green and blue blocks, there are four typical confusion circle size relationships for the pre-clear image: 1. Confusion circle_blue <confusion circle_green <confusion circle_red; 2. Confusion circle_green <confusion circle_blue <confusion circle_red; 3. Confusion circle_green <confusion circle_red <confusion circle_blue; 4. Confusion circle_red <confusion circle_green <confusion circle_blue. The position relationship between the current lens and the chip can be determined based on the spot size, that is, whether the chip is in front of the lens's quasi-focus position or behind the quasi-focus position in the lens module, that is, the focal depth position of the current lens module.

[0070] Specifically, when 1. Blur circle_blue<blur circle_green<blur circle_red and 2. Blur circle_green<blur circle_blue<blur circle_red appear, it can be judged that the imaging position is before the quasi-focus position of the lens. When 3. Blur circle_green<blur circle_red<blur circle_blue and 4. Blur circle_red<blur circle_green<blur circle_blue appear, it can be judged that the imaging position is after the quasi-focus position of the lens. Therefore, the focal depth position of the lens module can be determined by only one pre-clear image of the color standard.

[0071] In the above-mentioned depth of focus detection method based on color science, a pre-clear image is obtained by using a color standard for pre-clear imaging, and color knife-edge images of different colors are captured from the pre-clear image. The size of the confusion circle is calculated based on the color knife-edge image, and the focal depth position of the lens module is determined according to the size relationship of the confusion circles of different colors. Only one pre-clear image is needed. With the help of the different refractive indices of light beams of different colors and the different focal positions behind the lens, the current focal depth position of the lens module can be identified quickly and efficiently.

[0072] In one embodiment, based on the above step S210, obtaining a pre-clear image of the color standard plate includes:

[0073] Step S211, in the process of adjusting the lens module, the imaging image of the color standard plate is acquired in real time, and the distance between two ellipse points on the imaging image is calculated; the ellipse point is the image formed by the black dot.

[0074] For details, see Figure 3 For the color standard plate shown in the figure, after acquiring the imaging image of the color standard plate, two ellipse points that are symmetrical left and right or two ellipse points that are symmetrical up and down are selected on the imaging image, and the distance between the two ellipse points on the imaging image is calculated. Compared with two ellipse points in other positional relationships, using two ellipse points in symmetrical left and right or symmetrical up and down positions to calculate the distance has a better effect on pre-sharpening.

[0075] Step S212, when the distance between the ellipse points meets a preset threshold, the imaging image of the color standard plate acquired by the lens module is used as a pre-clear image; the lens module is located at a preset position.

[0076] Specifically, in the process of adjusting the lens module, the lens will gradually approach the chip to find the quasi-focus position and obtain the clearest image. Usually, as the image distance decreases, the distance between the two points in the image will also decrease. The threshold of the distance between the two symmetrical ellipse points can be pre-set, and the chip and the lens can be adjusted with reference to the threshold. When the distance between the two ellipse points on the image reaches the preset value, the chip in the lens module is near the quasi-focus position of the lens, that is, the preset position of the lens module.

[0077] This embodiment can quickly position the lens module at a preset position by monitoring the distance of the ellipse point in real time and comparing it with a preset distance, thereby improving the efficiency of the lens module resolution test.

[0078] In one embodiment, based on the above step S220, extracting color knife edge images of different colors from the pre-clear image includes:

[0079] Step S221, calculating the optical center position based on the pre-clear image.

[0080] Specifically, the mean value of the coordinates of four ellipse points on the pre-clear image is calculated to obtain the coordinates of the optical center position; wherein the ellipse points are images formed by black dots in the color standard plate.

[0081] Step S222 , drawing a circle on the pre-clear image with the optical center position as the center, wherein the circle intersects with the edge of the color block on the pre-clear image.

[0082] Step S223, taking the intersection of the circle and the color block as the center point, intercepting color knife edge images of different colors.

[0083] Among them, the color knife edge image includes some pixels of the color block after imaging and some pixels in the color standard background. There is a transition area between the color block and the color standard background. The wider the transition area, the more blurred the imaging, and the narrower the transition area, the clearer the imaging.

[0084] This embodiment can quickly obtain various color knife-edge images in the same field of view by calculating the optical center and drawing a circle.

[0085] In one embodiment, based on the above step S230, the size of the confusion circle is calculated based on the color knife edge image to obtain the sizes of the confusion circles of different colors, including:

[0086] Step S231, calculating edge extension functions of color knife-edge images of different colors.

[0087] Step S232: Calculate and obtain a line spread function based on the calculation result of the edge spread function.

[0088] Step S233, obtaining the sizes of diffusion circles of different colors based on the line spread function.

[0089] Specifically, the point spread function PSF (Point Spread Function) is the brightness distribution function after the light source is imaged. The Gaussian function can be used to approximate the section of the PSF. The radius of the imaging spot can be obtained by calculating the σ parameter of the Gaussian function. Therefore, the edge spread function ESF (Edge Spread Function) of the color knife-edge image of different colors is calculated, and the ESF is differentiated to obtain the corresponding line spread function LSF (Line Spread Function). According to the characteristics of the Gaussian function, the positions corresponding to the ESF functions 0.8413 and 0.1587 of the color knife-edge image can be extracted. The spacing of the positions in the LSF function is 2σ (the area in the horizontal axis interval (μ-σ, μ+σ) is 68.27%), and 2σ is the size of the imaging spot, that is, the diameter of the diffusion circle.

[0090] This embodiment can accurately calculate the diameter of the circle of confusion through the ESF function and the LSF function.

[0091] In one embodiment, based on the above step S240, the focal depth position of the lens module is determined based on the size relationship of the confusion circles of different colors, including:

[0092] Step S241, when the red circle of confusion is larger than the green and blue circles of confusion, the lens module is at the front focal depth position.

[0093] Step S242, when the blue circle of confusion is larger than the green and red circles of confusion, the lens module is at a back focus depth position.

[0094] Specifically, when the color knife edge image includes a red knife edge, a green knife edge, and a blue knife edge, the following four sizes of the diffusion circle can be obtained:

[0095] 1. Dispersion circle_blue<dispersion circle_green<dispersion circle_red;

[0096] 2. Dispersion circle_green<dispersion circle_blue<dispersion circle_red;

[0097] 3. Dispersion circle_green<dispersion circle_red<dispersion circle_blue;

[0098] 4. Dispersion circle_red<dispersion circle_green<dispersion circle_blue.

[0099] When situations 1 and 2 occur, it can be determined that the chip in the lens module is before the in-focus position of the lens; when situations 3 and 4 occur, it can be determined that the chip in the lens module is after the in-focus position of the lens.

[0100] In this embodiment, by analyzing the sizes of the diffusion circles of different colors and combining the imaging rules, the focal depth position of the lens module can be quickly and accurately determined only through the analysis result of one imaging image.

[0101] The present embodiment is described and illustrated below through preferred embodiments.

[0102] Step S1, in the process of adjusting the lens module, an imaging image of a color standard is obtained in real time; wherein the color standard is provided with color blocks of at least three different colors and at least four black dots; the center point of each color block is at the same distance from the center point of the color standard; the black dots are symmetrically arranged on the color standard in pairs; the color blocks include red blocks, green blocks and blue blocks.

[0103] Step S2, and calculate the distance between two ellipse points on the imaging image; the ellipse points are images formed by black dots; when the distance between the ellipse points meets a preset threshold, the imaging image of the color standard plate obtained by the lens module is used as a pre-clear image.

[0104] Step S3, calculating the optical center position based on the pre-clear image; drawing a circle on the pre-clear image with the optical center position as the center, wherein the circle intersects with the edge of the color block on the pre-clear image; taking the intersection of the circle and the color block as the center point, intercepting the red, green and blue color knife edge images.

[0105] Step S4, respectively calculating the edge spread functions of the red, green and blue color knife-edge images; calculating the line spread function based on the calculation results of the edge spread function; and respectively obtaining the sizes of the red, green and blue diffusion circles based on the line spread function.

[0106] Step S5, comparing the sizes of the red, green and blue blur circles; when the blue blur circle is less than the green blur circle and less than the red blur circle, or the green blur circle is less than the blue blur circle and less than the red blur circle, outputting the result that the lens module is located at the front focal depth position; when the green blur circle is less than the red blur circle and less than the blue blur circle, or the red blur circle is less than the green blur circle and less than the blue blur circle, outputting the result that the lens module is located at the rear focal depth position.

[0107] In this preferred embodiment, a pre-clear image is obtained and the optical center is calculated therefrom, a color knife-edge image is obtained by drawing a circle, the influence of the lens field area is eliminated, and the sizes of the diffusion circles of light sources of different colors are calculated based on the knife-edge image. The focal depth position of the lens module is obtained by comparison, and a quick and accurate judgment can be made on the focal depth position after pre-clearing using only one image, thereby simplifying the algorithm for judging the focal depth position and improving detection efficiency.

[0108] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0109] Based on the same inventive concept, a depth of focus detection device based on chromaticity is also provided in this embodiment. The system is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. The terms "module", "unit", "subunit", etc. used below can implement a combination of software and / or hardware for predetermined functions. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0110] In one embodiment, if Figure 7 As shown, a focal depth detection device based on color science is provided, including: a module 71 for obtaining a pre-clear image, a module 72 for capturing a knife edge image, a module 73 for calculating a circle of confusion, and a module 74 for determining a focal depth position, wherein:

[0111] The pre-clear image acquisition module 71 is used to acquire a pre-clear image of a color standard plate; wherein the color standard plate is provided with color blocks of at least three different colors and at least four black dots; the center point of each color block is at the same distance from the center point of the color standard plate; and the black dots are symmetrically arranged on the color standard plate in pairs.

[0112] The knife-edge image interception module 72 is used to intercept color knife-edge images of different colors from the pre-clear image.

[0113] The module for calculating the circle of confusion 73 is used to calculate the size of the circle of confusion based on the color knife-edge image, and obtain the sizes of the circles of confusion of different colors.

[0114] The focus depth position determination module 74 is used to determine the focus depth position of the lens module based on the size relationship of the confusion circles of different colors.

[0115] In one embodiment, the color blocks in the pre-clear image acquisition module 71 are red blocks, green blocks and blue blocks.

[0116] In one embodiment, the minimum acute angle formed by the edge of the color block in the pre-clear image acquisition module 71 and the horizontal direction or the vertical direction is 8 degrees.

[0117] In one of the embodiments, the module 71 for obtaining a pre-clear image is also used to obtain an imaging image of a color plate in real time during the process of adjusting the lens module, and calculate the distance between two ellipse points on the imaging image; the ellipse points are images formed by black dots; when the distance between the ellipse points meets a preset threshold, the imaging image of the color plate obtained by the lens module is used as a pre-clear image; the lens module is located at a preset position.

[0118] In one embodiment, the knife edge image capture module 72 is also used to calculate the optical center position based on the pre-clear image; draw a circle on the pre-clear image with the optical center position as the center, wherein the circle intersects with the edge of the color block on the pre-clear image; and capture color knife edge images of different colors with the intersection of the circle and the color block as the center point.

[0119] In one embodiment, the knife-edge image interception module 72 is further used to calculate the average of the coordinates of four ellipse points on the pre-clear image to obtain the coordinates of the optical center position; wherein the ellipse points are images formed by black dots.

[0120] In one embodiment, the module for calculating the circle of confusion 73 is further used to calculate the edge spread function of the color knife-edge image of different colors; based on the calculation result of the edge spread function, the line spread function is calculated; based on the line spread function, the size of the circle of confusion of different colors is obtained.

[0121] In one embodiment, the focal depth position determining module 74 is further used to determine that when the red circle of confusion is larger than the green and blue circles of confusion, the lens module is in the front focal depth position; when the blue circle of confusion is larger than the green and red circles of confusion, the lens module is in the rear focal depth position.

[0122] Each module in the above-mentioned depth of focus detection device based on color science can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.

[0123] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of any one of the above-mentioned methods for depth of focus detection based on color science are implemented.

[0124] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the above-mentioned methods for depth of focus detection based on color science are implemented.

[0125] In one embodiment, a computer program product is provided, comprising a computer program, which implements the steps of any one of the above-mentioned methods for detecting depth of focus based on color science when executed by a processor.

[0126] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0127] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0128] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0129] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for detecting depth of focus based on color science, characterized in that: The method comprises: Acquire a pre-clear image of a color standard plate; wherein the color standard plate is provided with color blocks of at least three different colors and at least four black dots; the center point of each color block is at the same distance from the center point of the color standard plate; the black dots are symmetrically arranged on the color standard plate in pairs; intercepting color knife-edge images of different colors from the pre-clear image; Calculating the size of the circle of confusion based on the color knife-edge image to obtain the sizes of the circles of confusion of different colors; Based on the size relationship of the confusion circles of different colors, the focal depth position of the lens module is determined.

2. The method for detecting depth of focus based on color science according to claim 1, characterized in that: The color blocks are respectively a red block, a green block and a blue block.

3. The method for detecting depth of focus based on color science according to claim 2, characterized in that: The minimum acute angle formed by the edge of the color block and the horizontal direction or the vertical direction is 8 degrees.

4. The method for detecting depth of focus based on color science according to claim 1, characterized in that: The step of obtaining a pre-clear image of a color standard plate comprises: In the process of adjusting the lens module, the imaging image of the color standard plate is acquired in real time, and the distance between two ellipse points on the imaging image is calculated; the ellipse point is the image formed by the black dot; When the distance between the ellipse points meets a preset threshold, the imaging image of the color standard plate acquired by the lens module is used as a pre-clear image; and the lens module is located at a preset position.

5. The method for detecting depth of focus based on color science according to claim 1, characterized in that: The step of intercepting color knife-edge images of different colors from the pre-clear image comprises: Calculating the optical center position based on the pre-clear image; Drawing a circle on the pre-clear image with the optical center position as the center, wherein the circle intersects with the edge of the color block on the pre-clear image; Color knife edge images of different colors are intercepted with the intersection of the circle and the color block as the center point.

6. The method for detecting depth of focus based on color science according to claim 5, characterized in that: The calculating the optical center position based on the pre-clear image comprises: The coordinates of the optical center position are obtained by calculating the mean of the coordinates of the four ellipse points on the pre-clear image; wherein the ellipse points are images formed by the black dots.

7. The method for detecting depth of focus based on color science according to claim 1, characterized in that: The step of calculating the size of the circle of confusion based on the color knife-edge image to obtain the sizes of the circles of confusion of different colors includes: Calculating edge extension functions of the color knife-edge images of different colors; Based on the calculation result of the edge spread function, a line spread function is calculated; The sizes of the confusion circles of different colors are obtained based on the line spread function.

8. The method for detecting depth of focus based on color science according to claim 1, characterized in that: The determining of the focal depth position of the lens module based on the size relationship of the confusion circles of different colors includes: When the red circle of confusion is larger than the green and blue circles of confusion, the lens module is at a front focal depth position; When the blue circle of confusion is larger than the green and red circles of confusion, the lens module is at a back focus depth position.

9. A focal depth detection device based on chromatology, characterized in that: The device comprises: A pre-clear image acquisition module is used to acquire a pre-clear image of a color standard plate; wherein the color standard plate is provided with color blocks of at least three different colors and at least four black dots; the center point of each color block is at the same distance from the center point of the color standard plate; the black dots are symmetrically arranged on the color standard plate in pairs; A knife-edge image interception module, used for intercepting color knife-edge images of different colors from the pre-clear image; A module for calculating a circle of confusion, used for calculating the size of the circle of confusion based on the color knife-edge image, and obtaining the size of the circle of confusion of different colors; The module for determining the focal depth position is used to determine the focal depth position of the lens module based on the size relationship of the confusion circles of different colors.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.