CN115242982B - Lens focusing method and system - Google Patents

Lens focusing method and system Download PDF

Info

Publication number
CN115242982B
CN115242982B CN202210899136.5A CN202210899136A CN115242982B CN 115242982 B CN115242982 B CN 115242982B CN 202210899136 A CN202210899136 A CN 202210899136A CN 115242982 B CN115242982 B CN 115242982B
Authority
CN
China
Prior art keywords
focusing
module
focal length
focus
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210899136.5A
Other languages
Chinese (zh)
Other versions
CN115242982A (en
Inventor
陈韦安
管益章
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Interface Optoelectronics Shenzhen Co Ltd
Interface Technology Chengdu Co Ltd
General Interface Solution Ltd
Original Assignee
Interface Optoelectronics Shenzhen Co Ltd
Interface Technology Chengdu Co Ltd
Yecheng Optoelectronics Wuxi Co Ltd
General Interface Solution Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Interface Optoelectronics Shenzhen Co Ltd, Interface Technology Chengdu Co Ltd, Yecheng Optoelectronics Wuxi Co Ltd, General Interface Solution Ltd filed Critical Interface Optoelectronics Shenzhen Co Ltd
Priority to CN202210899136.5A priority Critical patent/CN115242982B/en
Priority to TW111129095A priority patent/TWI815584B/en
Publication of CN115242982A publication Critical patent/CN115242982A/en
Application granted granted Critical
Publication of CN115242982B publication Critical patent/CN115242982B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30204Marker
    • G06T2207/30208Marker matrix
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30244Camera pose

Abstract

The invention is a lens focusing method and its system, the lens focusing method utilizes the electronic computing unit to carry on the following steps in the course of focusing, every time adjust the focal length position of the photographic module, the photographic module captures the focusing goal image and produces the focusing image, obtain the gray value of the primitive point of all positions or local positions of the focusing image, calculate the discrete distribution degree of gray value of every primitive point obtained, calculate the average standard deviation of the discrete distribution degree, when finishing the average standard deviation of all focal length positions of all photographic modules, wherein the focal length position that the maximum average standard deviation corresponds to is the goal focal length position, and the system to carry out this method.

Description

Lens focusing method and system
Technical Field
The present invention relates to a focusing method and a focusing system, and more particularly to a focusing method and a focusing system using a lens to obtain a maximum average standard deviation of an image.
Background
The conventional Chip On Board (COB) camera module includes a circuit Board (or substrate), an image capturing die, a lens mount and an optical lens, wherein the image capturing die is disposed On the circuit Board, the lens mount is disposed On the circuit Board at a position corresponding to the image capturing die, and the optical lens is movably disposed On the lens mount, so that the optical lens can move On the lens mount to adjust a distance between the optical lens and the image capturing die, thereby achieving the purpose of adjusting a focusing position of the image capturing die in an image capturing.
Referring to fig. 1 or 2, when the optical lens performs focal length adjustment, the photographing module is usually started to capture an image, and then the human eye determines whether the captured image is clear or blurred, if so, the distance between the optical lens and the image capturing die is adjusted until the human eye determines that the image is clear.
But the resolution of the photography module is higher and higher, the manual focusing method is likely to be misjudged or the consistency of the focal length of the photography module is error, and the other optical lens focusing method is a defocusing depth method (DFD, depth From Defocus). The defocusing depth method is to build a proper mathematical model for a photographing module in advance by capturing images of two or more different defocusing positions and calculate the defocusing depth of a target object in combination with various parameters of the photographing module, so as to judge the focus position to realize focusing. Another method is a focusing depth method (DFF, depthFrom Focus), which is to collect a series of blurred to clear digital images through a computer (or a special circuit system), process the evaluation function of the definition of each frame of image, judge whether the focusing is accurate, that is, whether the imaging is clear, and give feedback signals to control the focal length of the optical lens until the collected digital images reach the clearest, and finally finish focusing.
Common evaluation functions are gradient evaluation functions, spectrum evaluation functions and statistical evaluation functions. The gradient function is used for extracting edge information of the image, the image with high focusing degree is clearer, a more obvious sharp edge is presented, and the image has a larger gradient function value; the spectrum evaluation function is provided with two functions of discrete cosine transformation and Fourier transformation, and a high-frequency component in the image is extracted as an evaluation function; the statistical evaluation function mainly includes an ac power function, a dc power function, a Range function, a menmayfunction, a Masgrn function, and an image gray variance function, and one of the image gray variance functions (D (f)) is that the image is the sharpest when fully focused, and has a larger gray difference than the blurred image, so that the gray change can be used as the basis of focus evaluation, and the formula is as follows:
D(f)=∑ yx (|f(x,y)-μ| 2 )
wherein x is the coordinate position of the pixel point in the horizontal direction, y is the coordinate position of the pixel point in the vertical direction, f (x, y) is the gray value of the pixel point at a certain position in the image, and mu is the average gray value of the whole image.
As mentioned above, the automatic focusing process of the gray variance function of the image needs to collect a lot of images, and the gray variance processing data is to increase the gray variance, so in practical application, the calculation of the square variance is still a more complex operation processing mode, and therefore how to simplify the calculation so as to achieve the fast and efficient processing requirements is the current urgent problem to be solved.
Disclosure of Invention
In view of the background art, an objective of the present invention is to provide a focusing process for finding out a target focal length position of a camera module with a simpler and faster evaluation process.
According to the present invention, the electronic computing unit is utilized to perform the following steps during the focusing process, the photographing module captures a focusing target image to generate a focusing image, the image processing module analyzes the focusing image to obtain gray values of all or part of the pixel points, the focusing analysis module calculates the discrete distribution degree of the gray values of all the pixel points, calculates the average standard deviation of the discrete distribution degree, and each time adjusts the focal position of the photographing module, i.e. circularly and sequentially performs all the steps until the average standard deviation of all the focal positions of the photographing module is obtained, and then the focusing analysis module finds the largest of all the average standard deviations, i.e. the focal position corresponding to the largest of the average standard deviations is the target focal position.
The focusing target image is formed by staggered arrangement of dark square grids and light square grids in the longitudinal direction and the transverse direction respectively, wherein the dark square grids are black square grids, and the light square grids are white square grids. Or the focusing target image is a one-dimensional bar code with different thickness, or the focusing target image is a two-dimensional bar code, or the focusing target image is a combination of the one-dimensional bar code and the two-dimensional bar code.
The method for calculating the discrete distribution degree of the gray values of the obtained primitive points is to calculate the gray values of all primitive points and average the gray values to obtain the average gray value, and the formula is as follows:
where α represents an average gray value, m is a transverse coordinate value of the focusing image, n is a transverse coordinate value of the focusing image, and G (m, n) is a gray value of the coordinates (m, n).
Subtracting absolute values from the average gray values of all the primitive points to obtain discrete distribution degrees, wherein the formula is as follows:
β(m,n)=|G(m,n)-α|
where β (m, n) is the degree of discrete distribution of the gradation values of the respective primitive points, G (m, n) is the gradation value of the coordinates (m, n), and α represents the average gradation value.
The average standard deviation of each focal length position of the photographing module is obtained by calculating all discrete distribution degrees in an average way, and the formula is as follows:
wherein delta is the average standard deviation of each focal length position, beta (m, n) is the discrete distribution degree of gray values of each primitive point, m is the transverse coordinate value of the focusing image, and n is the transverse coordinate value of the focusing image.
According to the invention, the lens focusing system comprises a photographing module, an image processing module, a focusing analysis module and a focus adjustment module, wherein the photographing module photographs a focusing target image to generate a focusing image, the image processing module is connected with the photographing module and receives the focusing image, the focusing analysis module processes the focusing image to obtain gray values of all or partial primitive points, the focusing analysis module is connected with the image processing module and receives the gray values of all primitive points, the discrete distribution degree of the gray values of all primitive points is calculated, the average standard deviation of the discrete distribution degree is calculated, the focus adjustment module is connected with the photographing module, the focus adjustment module adjusts the photographing module to a plurality of focus positions, and the photographing module photographs a focusing target image at all focus positions and respectively generates respective focusing images.
The focusing adjustment module is further connected with the focusing analysis module, and sends a focusing adjustment signal to the focusing adjustment module after the focusing analysis module finishes obtaining the average standard deviation of the current focus position each time, the focusing adjustment module adjusts the photographing module to the next focus position, the focusing adjustment module finishes adjusting to the next focus position, and then a photographing signal is generated to the photographing module, and the photographing module photographs a focusing target image to generate the next focusing image.
The focusing analysis module analyzes that the variation trend of the average standard deviation of all the currently obtained focal length positions gradually increases to the average standard deviation of one of the focal length positions, and then gradually decreases, namely stops sending out the focal length adjusting signal, and takes the focal length position with the largest average standard deviation as the target focal length position.
The focus adjustment module adjusts the focus position of the photographing module according to a plurality of focus adjustment signals, the focus analysis module analyzes that the variation trend of the average standard deviation of each focus position is gradually reduced, the focus adjustment signals sent by the focus adjustment module enable the focus adjustment module to reversely adjust the focus position, the variation trend of the average standard deviation is gradually increased to the average standard deviation of one focus position and then gradually reduced, and the focus position with the largest average standard deviation is taken as a target focus position.
In summary, the image processing module of the present invention analyzes the focusing image to obtain the gray values of the primitive points at all or part of the positions, and then calculates the discrete degree and the average standard deviation of each gray value, without calculating the variance, thereby reducing the difficulty of calculation and accelerating the processing speed.
Drawings
FIG. 1 is a schematic diagram of a lens focusing system according to the present invention;
FIG. 2 is a schematic cross-sectional view of a camera module according to the present invention;
FIG. 3A is a schematic view of a focus target image (a focus image of a target focus position) according to the present invention;
FIG. 3B is a schematic view of a focusing image at a non-target focusing position according to the present invention;
FIG. 3C is a schematic view of a focusing image at a non-target focusing position according to the present invention;
FIG. 4A is a schematic diagram illustrating a gray scale distribution of one of the pixel points in the same horizontal direction in FIG. 3A;
FIG. 4B is a schematic diagram illustrating a gray scale distribution of one of the pixel points in the same horizontal direction in FIG. 3B;
FIG. 4C is a schematic diagram illustrating a gray level distribution of one of the pixel points in the same horizontal direction in FIG. 3C;
FIG. 5 is a flow chart of a lens focusing method according to the present invention;
FIG. 6 is a graph showing gray value distribution of all primitive points of FIG. 3A;
FIG. 7 is a graph showing gray value distribution of all primitive points of FIG. 3C;
FIG. 8 is a graph showing the degree of discrete distribution of FIG. 3A;
fig. 9 is a schematic view of the degree of discrete distribution of fig. 3C.
Description of the drawings:
1: photographic module
10: circuit board
12: image capturing bare chip
14: lens carrier
16: optical lens
2: image processing module
3: focusing analysis module
4: focal length adjusting module
The flow steps are as follows: s100 to S105
Detailed Description
Embodiments of the present invention will be further illustrated by the following description in conjunction with the accompanying drawings. Wherever possible, the same reference numbers will be used throughout the drawings and the description to refer to the same or like parts. In the drawings, the shape and thickness may be exaggerated for simplicity and convenience. It is to be understood that components not specifically shown in the drawings or described in the specification are in forms known to those of ordinary skill in the art. Many variations and modifications may be made by one of ordinary skill in the art in light of the disclosure herein.
When a component is referred to as being "on …," it can be broadly interpreted as referring to the component as being directly on the other component or as having other components present in both. Conversely, when one component is referred to as being "directly on" another component, it cannot have other components in between. As used herein, the term "and/or" includes any combination of one or more of the listed associated items.
The following description of "one embodiment" or "an embodiment" refers to a particular component, structure, or feature associated with at least one embodiment. Thus, the appearances of the phrase "one embodiment" or "an embodiment" in various places in the following are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, and characteristics of the embodiments may be combined in any suitable manner.
The present invention is described with respect to the following examples which are intended to be illustrative only, since it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the following claims. Throughout the specification and claims, the terms "a" and "an" include the inclusion of "one or at least one" of the element or component unless the context clearly dictates otherwise. Furthermore, as used in this application, the singular articles also include a recitation of a plurality of elements or components unless it is apparent from the specific context that the plural is excluded. Moreover, as used in this description and throughout the claims that follow, the meaning of "in" may include "in" and "on" unless the context clearly dictates otherwise. The terms (terms) used throughout the specification and claims, unless otherwise indicated, shall generally be construed from a plain meaning of each term used in this field, in the context of the disclosure, and in the special context. Certain terms used to describe the present invention are discussed below, or elsewhere in this specification, to provide additional guidance to the practitioner (practioner) in describing the present invention. The use of examples anywhere throughout this specification including any examples of words discussed herein is illustrative only, and certainly not limiting of the scope and meaning of the invention or any exemplary words. As such, the invention is not limited to the various embodiments set forth in this specification.
It will be appreciated that the terms "comprising," "including," "having," "containing," and the like as used herein are open-ended, and are meant to include, but not be limited to. Furthermore, not all of the objects, advantages, or features of the present disclosure are required to be achieved by any one embodiment or claim of the present disclosure. Furthermore, the abstract sections and headings are for assistance in patent document searching only and are not intended to limit the claims of the invention.
Furthermore, the term "electrically coupled" or "electrically connected" as used herein includes any direct or indirect electrical connection. For example, if a first device is electrically coupled to a second device, that connection may be made directly to the second device or indirectly to the second device through other devices or connection means. In addition, while the transmission and provision of electrical signals have been described with respect to their transmission, it will be understood by those skilled in the art that the transmission of electrical signals may be accompanied by attenuation or other non-ideal variations, the source and the receiving end of the transmission or provision of electrical signals should be considered substantially the same signal unless specifically stated. For example, if an electrical signal S is transmitted (or provided) from terminal a of the electronic circuit to terminal B of the electronic circuit, wherein a voltage drop may occur through a source/drain of a transistor switch and/or possibly stray capacitance, the purpose of the design is to achieve certain specific technical effects without deliberately using attenuation or other non-ideal variations in the transmission (or provision), the electrical signal S should be considered to be substantially the same signal at both terminals a and B of the electronic circuit.
Unless specifically stated otherwise, some terms or words such as "can", "possible", "about", "may", "about", or "about" are generally intended to mean that the present embodiment has, but may also be construed as possibly unwanted features, elements, or steps. In other embodiments, these features, components, or steps may not be required.
Referring to fig. 1, the present invention is a lens focusing system, which includes a photographing module 1, an image processing module 2, a focusing analysis module 3 and a focusing adjustment module 4, wherein the photographing module 1 is located at a predetermined position relative to a focusing target image, and photographs the focusing target image to generate a focusing image. The image processing module 2 is connected to the photographing module 1 and receives the focusing image, and the image processing module processes the focusing image to obtain gray values of the primitive points at all or part of the positions. The focusing analysis module 3 is connected with the image processing module 2, receives the gray values of the primitive points, calculates the discrete distribution degree of the gray values of the primitive points, and calculates the average standard deviation of the discrete distribution degree.
Referring to fig. 2, in the present invention, a photographing module 1 includes a circuit board 10 (or a substrate), an image capturing die 12, a lens mount 14 and an optical lens 16, wherein the image capturing die 12 is disposed on the circuit board 10, the lens mount 14 is disposed around the image capturing die 12, the optical lens 16 is movably disposed on the lens mount 14, the distance between the optical lens 16 and the image capturing die 12 can be adjusted by adjusting the optical lens 16 to rotate on the lens mount, and the focal distance position can be manually adjusted or automatically adjusted by adjusting the focal distance position, in order to automatically adjust the focal distance, in the present invention, the focal distance adjusting module 4 is connected to the photographing module 1, and the photographing module 1 is connected to a plurality of focal distance positions, and the photographing module 1 photographs a focusing target image at each focal distance position and generates respective focusing images. The lens mount 14 and the optical lens 16 are usually screwed together, so that the distance between the optical lens 16 and the image capturing die 12 can be adjusted by rotating the optical lens 16.
In the present invention, referring to fig. 3A, the focusing target image may be a regular or irregular image with high gray scale contrast, for example, the focusing target image may be formed by alternately arranging dark square cells and light square cells in the longitudinal direction and the transverse direction, and in particular, the dark square cells are black square cells, and the light square cells are white square cells. Or the focusing target image is a one-dimensional bar Code with different thickness, or the focusing target image is a two-dimensional bar Code, or the focusing target image is a combination of the one-dimensional bar Code and the two-dimensional bar Code, wherein the two-dimensional bar Code can be a quick response image Code (Quick Response Code, QR Code for short).
In the present invention, taking a focusing target image formed by dark square grids as black square grids and light square grids as white square grids as an example, the reason why an image with high gray scale contrast ratio is adopted as the focusing target image is described, when the photographing module 1 photographs the focusing target image formed by staggered arrangement of the dark square grids and the light square grids, the gray scale value of each pixel point of the focusing image corresponding to black ziegler is approximately 0 or equal to 0, and the gray scale value of each pixel point corresponding to white ziegler is approximately 255 or equal to 255, therefore, when the gray scale value difference of each pixel point of the focusing image is larger, the focusing image is shown to be clearer, and the focusing image with the largest gray scale value difference in different focusing images is the target focal length position.
In order to more clearly solve the difference between gray values of the primitive points of the focusing image and the corresponding relation between the focusing images shot at different focal positions, the focusing images shot at different focal positions and the gray distribution thereof are provided for explanation, please refer to fig. 3A to 3C, which respectively show the focusing images shot at the target focal positions and the focusing images shot at the three non-target focal positions, and fig. 4A to 4C show the distribution diagrams of gray values of the primitive points of the lowest X-direction coordinates.
In order to enable the focus adjustment module 4 to further perform focus adjustment after the focus analysis module 3 obtains the average standard deviation of the current focus position each time, in the present invention, the focus adjustment module 4 is further connected to the focus analysis module 3, the focus analysis module 3 sends a focus adjustment signal to the focus adjustment module 4 after each time the focus analysis module 3 completes obtaining the average standard deviation of the current focus position, the focus adjustment module 4 adjusts the photographing module 1 to the next focus position again, the focus adjustment module 4 completes adjusting to the next focus position, and then generates a photographing signal to the photographing module 1, and the photographing module 1 photographs the focus adjustment target image to generate the next focusing image.
However, in practical implementation of the present invention, the focal length adjusting module 4 may not necessarily receive the focal length adjusting signal sent by the focusing analyzing module 3 to adjust the focal length position of the photographing module 1, and the focal length adjusting module 4 may also receive the photographing signal from the photographing module 1 as the focal length adjusting signal after the photographing module 1 finishes photographing one focusing image each time.
In the present invention, the focal length adjustment module 4 may adjust the optical module of the photographing module 1 from the focal length position of 0 to 360 degrees to focus at the same angle, for example: the focusing images of all angles can be obtained by adjusting 1 degree for 360 times, and the average standard deviation of the discrete distribution degree is obtained from the focusing images, wherein the largest focusing image is the target focal length position. However, if the focal length of the photographing module 1 is adjusted in the same direction, the distance between the optical module and the image capturing die 12 is increased or decreased, and the corresponding focusing image is also gradually clearer or more blurred, so that according to such trend change, when the trend of the average standard deviation of the focal length positions obtained at present is gradually increased to the average standard deviation of one of the focal length positions, the focusing analysis module 3 starts to gradually decrease, i.e. stops sending the focal length adjusting signal, and takes the focal length position with the largest average standard deviation as the target focal length position.
Or, when the focal length adjusting module 4 adjusts the focal length position of the photographing module 1 according to the plurality of focal length adjusting signals, the focusing analyzing module 3 analyzes that the obtained variation trend of the average standard deviation of each focal length position is gradually reduced, the focal length adjusting signal sent by the focal length adjusting module 4 is to make the focal length adjusting module 4 reversely adjust the focal length position, and the variation trend of the average standard deviation is changed to gradually increase to the average standard deviation of one of the focal length positions and then gradually decrease, and the focal length position with the largest average standard deviation is taken as the target focal length position.
By the above adjustment method, the camera module 1 can adjust the focal length position according to the trend without focusing from 0 to 360 degrees, so as to reduce the adjustment times and speed up focusing.
Referring to fig. 5, the present invention is a lens focusing method, in which an electronic computing unit is used to perform the following steps:
(S100) adjusting the focal length position of the photographing module 1;
(S101) capturing a focusing target image by the photographing module 1 to generate a focusing image;
(S102) the image processing module 2 analyzes the focusing image to obtain gray values of the primitive points at all positions or partial positions;
(S103) the focusing analysis module 3 calculates the discrete distribution degree of the gray value of each acquired primitive point, and calculates the average standard deviation of the discrete distribution degree;
(S104) judging whether the adjustment of the focal length positions of the photographing module 1 is completed, if yes, performing the step (S105), otherwise, performing the step (S100);
and (S105) the focusing analysis module finds out the largest one of all the average standard deviations, and the focal length position corresponding to the largest one of the average standard deviations is the target focal length position.
In the present invention, the focusing target image is formed by alternately arranging dark square grids and light square grids in the longitudinal direction and the transverse direction respectively, wherein the dark square grids are black square grids, and the light square grids are white square grids. Or the focusing target image is a one-dimensional bar code with different thickness, or the focusing target image is a two-dimensional bar code, or the focusing target image is a combination of the one-dimensional bar code and the two-dimensional bar code. The electronic computing unit can be an electronic device with computing capability such as a desktop computer, a notebook computer or a tablet computer.
In the present invention, the gray value of each pixel point is calculated to average the gray value of all pixel points to obtain an average gray value, and the formula is as follows:
where α represents an average gray value, m represents a horizontal coordinate value of the focusing image, n represents a horizontal coordinate value of the focusing image, G (m, n) represents a gray value of the coordinates (m, n), as shown in fig. 6, which is a schematic diagram illustrating a distribution state of gray values of each pixel point in fig. 3A, a line below α represents an average gray value, as shown in fig. 7, which is a schematic diagram illustrating a distribution state of gray values of each pixel point in fig. 3C, and a line below α represents an average gray value.
Subtracting absolute values from the average gray values of all the primitive points to obtain discrete distribution degrees, wherein the formula is as follows:
β(m,n)=|G(m,n)-α|
where β (m, n) is the degree of discrete distribution of the gradation values of the respective primitive points, G (m, n) is the gradation value of the coordinates (m, n), and α represents the average gradation value. Fig. 8 is a schematic diagram of the degree of discrete distribution of fig. 6, and fig. 9 is a schematic diagram of the degree of discrete distribution of fig. 7.
The average standard deviation of all focal length positions of the imaging module 1 is obtained by calculating the average of all discrete distribution degrees, and the formula is as follows:
wherein delta is the average standard deviation of each focal length position, beta (m, n) is the discrete distribution degree of gray values of each primitive point, m is the transverse coordinate value of the focusing image, and n is the transverse coordinate value of the focusing image.
In addition, in order to reduce the calculation amount of the gray value, the average gray value, the discrete distribution degree and the average standard deviation of the focusing image, the invention can only take the local image of the focusing image for calculation, but is not limited to take the local image of the focusing image for calculation, and the invention can still calculate the whole image of the whole focusing image.
As described above, the present invention can accomplish the adjustment of the focal length in a simple and rapid manner, and the evaluation function is simpler than the conventional evaluation function, so that the present invention can accomplish the operation more rapidly, and the focusing operation of the photographing module 1 is completed.
The foregoing description is only illustrative of the preferred embodiments of the present invention and is not to be construed as limiting the scope of the invention, which is defined by the appended claims and their equivalents.

Claims (8)

1. A lens focusing method, characterized in that the following steps are performed by an electronic computing unit during focusing:
adjusting the focal length position of the photographing module;
capturing a focusing target image by using a photographing module to generate a focusing image;
using an image processing module to analyze the focusing image and take out gray values of the primitive points at all positions or local positions;
calculating the discrete distribution degree of the gray value of each acquired primitive point by using a focusing analysis module, and calculating the average standard deviation of the discrete distribution degree;
the focusing analysis module calculates the discrete distribution degree of the gray value of each obtained primitive point to average the gray value of each primitive point to obtain an average gray value, and the formula is as follows:
wherein α represents an average gray value, m is a transverse coordinate value of the focus target image, n is a transverse coordinate value of the focus target image, and G (m, n) is a gray value of coordinates (m, n);
the gray value of each primitive point is subtracted from the average gray value to obtain an absolute value as a discrete distribution degree, and the formula is as follows:
β(m,n)=|G(m,n)-α|;
wherein β (m, n) is the degree of discrete distribution of the gray values of each primitive point, G (m, n) is the gray value of the coordinates (m, n), and α represents the average gray value;
the average standard deviation of all focal length positions of the photographing module is obtained by calculating all discrete distribution degrees in an average way, and the formula is as follows:
wherein delta is the average standard deviation of each focal length position, beta (m, n) is the discrete distribution degree of gray values of each primitive point, m is the transverse coordinate value of the focusing image, and n is the transverse coordinate value of the focusing image;
judging whether the adjustment of the focal length positions of the photographing module is finished or not;
when judging that the adjustment of each focal length position of the photographing module is finished, the focusing analysis module finds out the largest one of all average standard deviations, and takes the focal length position corresponding to the largest one of the average standard deviations as a target focal length position; and
and when judging that the adjustment of each focal length position of the photographic module is not completed, sequentially repeating the steps of adjusting the focal length position of the photographic module for processing.
2. The lens focusing method of claim 1, wherein the focusing target image is formed by alternately arranging dark square and light square in a longitudinal direction and a transverse direction respectively.
3. The lens focusing method of claim 2, wherein the dark squares are black squares and the light squares are white squares.
4. The lens focusing method according to claim 1, wherein the focusing target image is a one-dimensional bar code of different thickness, or the focusing target image is a two-dimensional bar code, or the focusing target image is a combination of a one-dimensional bar code and a two-dimensional bar code.
5. A lens focusing system, comprising:
the shooting module shoots a focusing target image to generate a focusing image;
the image processing module is connected with the photographing module, receives the focusing image and processes the focusing image to obtain gray values of the primitive points at all positions or local positions;
the focusing analysis module is connected with the image processing module, receives the gray values of the primitive points, calculates the discrete distribution degree of the gray values of the primitive points, and calculates the average standard deviation of the discrete distribution degree; a kind of electronic device with high-pressure air-conditioning system
The focal length adjusting module is connected with the photographing module, and is used for adjusting the photographing module to a plurality of focal length positions, and the photographing module photographs the focusing target image once at each focal length position and respectively generates the respective focusing images;
the focusing analysis module calculates the discrete distribution degree of the gray value of each obtained primitive point to average the gray value of each primitive point to obtain an average gray value, and the formula is as follows:
wherein α represents an average gray value, m is a transverse coordinate value of the focus target image, n is a transverse coordinate value of the focus target image, and G (m, n) is a gray value of coordinates (m, n);
the gray value of each primitive point is subtracted from the average gray value to obtain an absolute value as a discrete distribution degree, and the formula is as follows:
β(m,n)=|G(m,n)-α|;
wherein β (m, n) is the degree of discrete distribution of the gray values of the respective primitive points, G (m, n) is the gray value of coordinates 9m, n), and α represents the average gray value;
the average standard deviation of all focal length positions of the photographing module is obtained by calculating all discrete distribution degrees in an average way, and the formula is as follows:
wherein delta is the average standard deviation of each focal length position, beta (m, n) is the discrete distribution degree of gray values of each primitive point, m is the transverse coordinate value of the focusing image, and n is the transverse coordinate value of the focusing image.
6. The lens focusing system of claim 5, wherein the focus adjustment module is connected to the focus analysis module, and the focus analysis module sends a focus adjustment signal to the focus adjustment module each time the focus analysis module completes obtaining the average standard deviation of the current focus position, the focus adjustment module readjusts the photographing module to the next focus position, the focus adjustment module completes adjusting to the next focus position, and then generates a photographing signal to the photographing module, and the photographing module then photographs the focus target image to generate the next focus image.
7. The lens focusing system of claim 5, wherein the focus analysis module analyzes that the trend of the average standard deviation of each of the focal length positions obtained at present is gradually decreasing after gradually increasing the average standard deviation of one of the focal length positions, i.e. stops sending out the focus adjustment signal, and takes the focal length position with the largest average standard deviation as the standard focal length position.
8. The lens focusing system according to claim 5, wherein the focus adjustment module adjusts the focus position of the photographing module according to a plurality of focus adjustment signals, and the focus analysis module analyzes that the obtained variation trend of the average standard deviation of each focus position is gradually reduced, and the focus adjustment signal sent by the focus adjustment module is for making the focus adjustment module reversely adjust the focus position, and makes the variation trend of each average standard deviation change to gradually increase to the average standard deviation of one of the focus positions, and then starts gradually decrease, and takes the focus position with the largest average standard deviation as a target focus position.
CN202210899136.5A 2022-07-28 2022-07-28 Lens focusing method and system Active CN115242982B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210899136.5A CN115242982B (en) 2022-07-28 2022-07-28 Lens focusing method and system
TW111129095A TWI815584B (en) 2022-07-28 2022-08-03 Lens focusing method and system performing the same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210899136.5A CN115242982B (en) 2022-07-28 2022-07-28 Lens focusing method and system

Publications (2)

Publication Number Publication Date
CN115242982A CN115242982A (en) 2022-10-25
CN115242982B true CN115242982B (en) 2023-09-22

Family

ID=83677044

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210899136.5A Active CN115242982B (en) 2022-07-28 2022-07-28 Lens focusing method and system

Country Status (2)

Country Link
CN (1) CN115242982B (en)
TW (1) TWI815584B (en)

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003046778A (en) * 2001-08-01 2003-02-14 Olympus Optical Co Ltd Image processing system
US6693669B1 (en) * 2000-06-16 2004-02-17 Motorola, Inc. Method for reducing image blurring
CN1641397A (en) * 2004-12-24 2005-07-20 中国科学院上海技术物理研究所 Microscopic automatic focusing device and method suitable for space application
TW201308998A (en) * 2011-07-01 2013-02-16 Apex Internat Financial Engineering Res & Tech Co Image capturing control system utilizing map and method thereof
CN103237173A (en) * 2013-04-28 2013-08-07 中国空间技术研究院 Adaptive quick focusing device and method for optical camera
JP2014010803A (en) * 2012-07-03 2014-01-20 Acutelogic Corp All-in-focus image generation method, all-in-focus image generation device, all-in-focus image generation program, object height information acquisition method, object height information acquisition device and object height information acquisition program
CN103905714A (en) * 2012-12-26 2014-07-02 中国电子科技集团公司第五十研究所 Focusing method based on edge spreading function measurement and device
CN104133339A (en) * 2013-05-02 2014-11-05 聚晶半导体股份有限公司 Automatic focusing method and automatic focusing device
TW201502681A (en) * 2013-07-10 2015-01-16 Acer Inc Image capturing devices and methods
CN105072330A (en) * 2015-07-17 2015-11-18 电子科技大学 Linear array camera automatic focusing method
CN106773495A (en) * 2016-12-14 2017-05-31 深圳奥比中光科技有限公司 The automatic focusing method and system of projector with multiple lamp light source
CN108259711A (en) * 2016-12-28 2018-07-06 聚晶半导体股份有限公司 Image capturing device and its quick focusing method
CN108833770A (en) * 2018-05-23 2018-11-16 释码融和(上海)信息科技有限公司 Image definition calculation method, calculating equipment and focusing system for focusing
CN111901531A (en) * 2020-08-31 2020-11-06 浙江水晶光电科技股份有限公司 Focusing method, device and equipment during lens assembly
CN113628169A (en) * 2021-07-15 2021-11-09 暨南大学 Infrared image automatic focusing evaluation method, system and medium based on false color
WO2021255819A1 (en) * 2020-06-16 2021-12-23 株式会社日立ハイテク Image processing method, shape inspection method, image processing system, and shape inspection system

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3058781B2 (en) * 1993-07-30 2000-07-04 松下電器産業株式会社 Focusing point detection method
JP2004309739A (en) * 2003-04-07 2004-11-04 Canon Inc Focus detection device
TWI407179B (en) * 2009-02-03 2013-09-01 Univ Nat Yunlin Sci & Tech Auto-focus method of image
JP6611576B2 (en) * 2015-11-30 2019-11-27 キヤノン株式会社 Image processing apparatus and image processing method
DE102016202928B4 (en) * 2016-02-25 2018-08-09 Carl Zeiss Industrielle Messtechnik Gmbh Improved autofocus method for a coordinate measuring machine
CN111198466B (en) * 2018-11-16 2022-06-21 北京图森智途科技有限公司 Manual focusing auxiliary method, imaging device and automobile
CN113805304B (en) * 2021-11-16 2022-03-18 浙江双元科技股份有限公司 Automatic focusing system and method for linear array camera

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6693669B1 (en) * 2000-06-16 2004-02-17 Motorola, Inc. Method for reducing image blurring
JP2003046778A (en) * 2001-08-01 2003-02-14 Olympus Optical Co Ltd Image processing system
CN1641397A (en) * 2004-12-24 2005-07-20 中国科学院上海技术物理研究所 Microscopic automatic focusing device and method suitable for space application
TW201308998A (en) * 2011-07-01 2013-02-16 Apex Internat Financial Engineering Res & Tech Co Image capturing control system utilizing map and method thereof
JP2014010803A (en) * 2012-07-03 2014-01-20 Acutelogic Corp All-in-focus image generation method, all-in-focus image generation device, all-in-focus image generation program, object height information acquisition method, object height information acquisition device and object height information acquisition program
CN103905714A (en) * 2012-12-26 2014-07-02 中国电子科技集团公司第五十研究所 Focusing method based on edge spreading function measurement and device
CN103237173A (en) * 2013-04-28 2013-08-07 中国空间技术研究院 Adaptive quick focusing device and method for optical camera
CN104133339A (en) * 2013-05-02 2014-11-05 聚晶半导体股份有限公司 Automatic focusing method and automatic focusing device
TW201502681A (en) * 2013-07-10 2015-01-16 Acer Inc Image capturing devices and methods
CN105072330A (en) * 2015-07-17 2015-11-18 电子科技大学 Linear array camera automatic focusing method
CN106773495A (en) * 2016-12-14 2017-05-31 深圳奥比中光科技有限公司 The automatic focusing method and system of projector with multiple lamp light source
CN108259711A (en) * 2016-12-28 2018-07-06 聚晶半导体股份有限公司 Image capturing device and its quick focusing method
CN108833770A (en) * 2018-05-23 2018-11-16 释码融和(上海)信息科技有限公司 Image definition calculation method, calculating equipment and focusing system for focusing
WO2021255819A1 (en) * 2020-06-16 2021-12-23 株式会社日立ハイテク Image processing method, shape inspection method, image processing system, and shape inspection system
CN111901531A (en) * 2020-08-31 2020-11-06 浙江水晶光电科技股份有限公司 Focusing method, device and equipment during lens assembly
CN113628169A (en) * 2021-07-15 2021-11-09 暨南大学 Infrared image automatic focusing evaluation method, system and medium based on false color

Non-Patent Citations (7)

* Cited by examiner, † Cited by third party
Title
A Realtime Auto-focus Microscope System Based on a Visual Programming Software;Yi Zhang 等;《IEEE》;全文 *
A Study on Pixel-wise Parallel Calculation for Depth from Focus Using Gray Level Variance;Yoichi Matsubara 等;《IEEE》;全文 *
Realization of Auto-focusing Model in FPGA;Chen Guojin 等;《IEEE》;全文 *
基于图像处理的自动调焦技术研究;王健;《中国优秀博士学位论文全文数据库电子期刊》;全文 *
基于图像处理的自动调焦技术研究;郝思嘉,陆红刚,王晓涵;《电子元器件与信息技术》;第4卷(第4期);全文 *
基于图像处理的镜头模组自动调焦算法研究;施筱筱;《中国优秀硕士学位论文全文数据库(电子期刊)》;全文 *
视觉反馈的微装配自动调焦系统;王乃葭;陈佳品;李振波;;自动化仪表(06);全文 *

Also Published As

Publication number Publication date
CN115242982A (en) 2022-10-25
TWI815584B (en) 2023-09-11

Similar Documents

Publication Publication Date Title
US20120242796A1 (en) Automatic setting of zoom, aperture and shutter speed based on scene depth map
CN111932636B (en) Calibration and image correction method and device for binocular camera, storage medium, terminal and intelligent equipment
CN107888819B (en) Automatic focusing method and device
US20150043808A1 (en) Image processing apparatus, image processing method, and imaging apparatus
EP2252088A1 (en) Image processing method and system
US20080297648A1 (en) Focus detection apparatus
CN109085113B (en) Automatic focusing method and device for cervical exfoliated cell detection device
CN112672039B (en) Multi-zone active transformation focusing method and equipment
CN112243484B (en) Method and apparatus for absolute and relative depth measurement using camera focal length
CN113099135B (en) Infrared image focusing, terminal device and computer readable storage medium
CN106031148B (en) Imaging device, method of auto-focusing in an imaging device and corresponding computer program
US8433187B2 (en) Distance estimation systems and method based on a two-state auto-focus lens
RU2389050C1 (en) Automatic focusing method
EP3668083A1 (en) Image processing method, image processing device, and image pickup apparatus
CN114363522A (en) Photographing method and related device
CN115242982B (en) Lens focusing method and system
CN106842496A (en) The method for automatically adjusting focus based on frequency domain comparison method
Mannan et al. Optimal camera parameters for depth from defocus
CN114845050A (en) Focusing method, camera device, unmanned aerial vehicle and storage medium
CN114785953A (en) SFR-based camera automatic focusing method and device
US20070147819A1 (en) System and method for indicating sharpness of images
Yang et al. Analysis of disparity error for stereo autofocus
TW202405520A (en) Lens focusing method and system performing the same
CN116233604B (en) Image focusing method and device, electronic equipment and storage medium
CN106888352B (en) Coke pushing position determining method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240116

Address after: 518109, Building E4, 101, Foxconn Industrial Park, No. 2 East Ring 2nd Road, Fukang Community, Longhua Street, Longhua District, Shenzhen City, Guangdong Province (formerly Building 1, 1st Floor, G2 District), H3, H1, and H7 factories in K2 District, North Shenchao Optoelectronic Technology Park, Minqing Road, Guangdong Province

Patentee after: INTERFACE OPTOELECTRONICS (SHENZHEN) Co.,Ltd.

Patentee after: Interface Technology (Chengdu) Co., Ltd.

Patentee after: GENERAL INTERFACE SOLUTION Ltd.

Address before: No.689 Hezuo Road, West District, high tech Zone, Chengdu City, Sichuan Province

Patentee before: Interface Technology (Chengdu) Co., Ltd.

Patentee before: INTERFACE OPTOELECTRONICS (SHENZHEN) Co.,Ltd.

Patentee before: Yicheng Photoelectric (Wuxi) Co.,Ltd.

Patentee before: GENERAL INTERFACE SOLUTION Ltd.