WO2021102959A1 - Focus adjustment method, camera module, and computer readable storage medium - Google Patents

Focus adjustment method, camera module, and computer readable storage medium Download PDF

Info

Publication number
WO2021102959A1
WO2021102959A1 PCT/CN2019/122104 CN2019122104W WO2021102959A1 WO 2021102959 A1 WO2021102959 A1 WO 2021102959A1 CN 2019122104 W CN2019122104 W CN 2019122104W WO 2021102959 A1 WO2021102959 A1 WO 2021102959A1
Authority
WO
WIPO (PCT)
Prior art keywords
focus
camera module
frame image
distance
value
Prior art date
Application number
PCT/CN2019/122104
Other languages
French (fr)
Chinese (zh)
Inventor
韩守谦
Original Assignee
深圳市大疆创新科技有限公司
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 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2019/122104 priority Critical patent/WO2021102959A1/en
Publication of WO2021102959A1 publication Critical patent/WO2021102959A1/en

Links

Images

Classifications

    • GPHYSICS
    • G03PHOTOGRAPHY; CINEMATOGRAPHY; ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ELECTROGRAPHY; HOLOGRAPHY
    • G03BAPPARATUS OR ARRANGEMENTS FOR TAKING PHOTOGRAPHS OR FOR PROJECTING OR VIEWING THEM; APPARATUS OR ARRANGEMENTS EMPLOYING ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ACCESSORIES THEREFOR
    • G03B21/00Projectors or projection-type viewers; Accessories therefor
    • G03B21/14Details
    • G03B21/32Details specially adapted for motion-picture projection
    • G03B21/34Change-over arrangements
    • G03B21/36Fades, dissolves, or wipes

Definitions

  • This application relates to the field of photography technology, and in particular to a focus adjustment method, camera module, and computer-readable storage medium.
  • an auto focus (AF) mode is usually used to realize the camera focusing.
  • AF auto focus
  • the camera focusing speed is slower and the focusing time is longer in the existing auto-focusing scheme.
  • the focus quality of the camera is not high, resulting in low definition of the shooting picture, which affects the user experience.
  • the embodiments of the present application provide a focus adjustment method, a camera module, and a computer-readable storage medium, which can automatically adjust the focus of the camera module when the object distance changes without affecting the user experience.
  • an embodiment of the present application provides a focus adjustment method, and the method includes:
  • the first frame image, the second frame image, and the third frame image determine the focus adjustment direction and focus adjustment distance of the camera module; adjust the current focus of the camera module according to the focus adjustment direction and focus adjustment distance of the camera module.
  • the method before acquiring the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus, the method further includes: determining the camera The front focus and back focus of the module shooting.
  • the specific implementation for determining the front focus and the rear focus of the camera module is to obtain the shooting parameters of the camera module when shooting at the current focus.
  • the shooting parameters include the aperture value and the lens aperture. Diameter and step length factor.
  • the step length factor is used to indicate the movement step length of the camera module lens within a unit distance; distance conversion is performed on the shooting parameters to obtain the distance threshold for the current focus to support movement; the current focus is moved to the first direction
  • the front focus is obtained by one distance
  • the rear focus is obtained by moving the current focus in the second direction by a second distance.
  • the first direction is opposite to the second direction, and both the first distance and the second distance are less than or equal to the distance threshold.
  • both the first distance and the second distance are equal to the distance threshold.
  • the distance conversion is performed on the shooting parameters to obtain the distance threshold value of the current focus support movement: according to the aperture value and the diameter of the lens aperture, the out-of-focus distance of the camera module is calculated; according to the out-of-focus The distance and step factor are calculated to obtain the distance threshold for the current focus to support movement.
  • the specific implementation manner of identifying the first frame image, the second frame image, and the third frame image, and determining the focus adjustment direction and focus adjustment distance of the camera module is: Perform image recognition on the second frame of image and the third frame of image, and calculate the corresponding current focus value, front focus value and back focus value.
  • the focus value is used to reflect the definition of the frame image corresponding to the focus value; if the current focus value is defined Between the front focus value and the rear focus value, and the front focus value is greater than the rear focus value, it is determined that the focus adjustment direction of the camera module is the first direction from the current focus to the front focus adjustment, and the focus adjustment distance is The distance between the current focus and the front focus; the current focus of the camera module is adjusted to the front focus along the first direction.
  • the specific implementation of identifying the first frame image, the second frame image, and the third frame image, and determining the focus adjustment direction and focus adjustment distance of the camera module is as follows: The image and the third frame of image are recognized, and the current focus value, front focus value and back focus value are calculated correspondingly.
  • the focus value is used to reflect the sharpness of the frame image corresponding to the focus value; if the current focus value is between the front focus value Between the focus value and the rear focus value, and the front focus value is less than the rear focus value, the focus adjustment direction of the camera module is determined to be the second direction of the current focus to the rear focus adjustment, and the focus adjustment distance of the camera module Is the distance between the current focus and the rear focus; the current focus of the camera module is adjusted to the rear focus along the second direction.
  • the first frame of image, the second frame of image, and the third frame of image are identified, and the focus adjustment direction and focus adjustment distance of the camera module are determined.
  • the specific implementation is as follows: And the third frame of image for image recognition, correspondingly calculate the current focus value, front focus value and back focus value, the focus value is used to reflect the definition of the frame image corresponding to the focus value; if the current focus value is greater than the front focus Value and the rear focus value, it is determined that there is no need to adjust the current focus of the camera module, and the focus adjustment direction and focus adjustment distance of the camera module are both empty.
  • an embodiment of the present application provides a camera system, the camera system includes a memory and a processor, wherein:
  • the memory is used to store a computer program
  • the processor calls a computer program for:
  • the first frame image, the second frame image, and the third frame image determine the focus adjustment direction and focus adjustment distance of the camera module; adjust the current focus of the camera module according to the focus adjustment direction and focus adjustment distance of the camera module.
  • an embodiment of the present application provides a camera module that is deployed in the camera system described in the embodiment of the present application in the second aspect, and the camera system is used for:
  • the first frame image, the second frame image, and the third frame image determine the focus adjustment direction and focus adjustment distance of the camera module; adjust the current focus of the camera module according to the focus adjustment direction and focus adjustment distance of the camera module.
  • an embodiment of the present application provides a computer-readable storage medium having a computer program stored on the computer-readable storage medium, and when the computer program is executed, it implements the same as described in the embodiment of the present application in the first aspect.
  • the focus adjustment method is not limited to:
  • the camera system obtains the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus.
  • the current focus is between the front focus and the back focus.
  • Between the focus and the rear focus identify the first frame image, the second frame image and the third frame image, determine the focus adjustment direction and focus adjustment distance of the camera module; according to the focus adjustment direction and focus adjustment distance of the camera module, Adjust the current focus of the camera module.
  • the focus adjustment direction and focus adjustment distance of the camera module are determined by the current focus, front focus, and rear focus of the camera module, so that the focus of the camera module can be adjusted. auto-adjust.
  • the current focus is between the front focus and the rear focus, so the impact on the clarity of the image is small, and the user experience may not be affected.
  • FIG. 1 is a schematic diagram of a focus adjustment direction provided by an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a focus adjustment method provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of an ideal lens imaging principle provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of the positions of a front focus and a rear focus provided by an embodiment of the present application
  • FIG. 5 is a schematic diagram of a possible motor movement provided by an embodiment of the present application.
  • FIG. 6(a) is a schematic diagram of a possible focus adjustment direction and focus adjustment distance provided by an embodiment of the present application.
  • FIG. 6(b) is a schematic diagram of a possible focus adjustment direction and focus adjustment distance provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a camera system provided by an embodiment of the present application.
  • the auto focus mode mainly judges whether to trigger continuous focus based on the change of AF statistics.
  • the camera module in the camera needs to collect images at three focal points to determine the focus direction.
  • FIG. 1 is a schematic diagram of a focus adjustment direction provided by an embodiment of the present application.
  • the first focus, the second focus, and the third focus represent the three focus points that the camera module needs to collect images, and the first focus represents the focus currently used by the camera module to capture images. It can be seen that when the current scheme is collecting images, the camera system controls the motors to move in one direction when the camera module adjusts the focus.
  • the change of the focus will affect the clarity of the image, and the change in one direction will cause the focus to change more, and the impact on the clarity of the image is also greater, affecting the user experience; especially during the recording process, due to the target object If there is a change, or the object distance of the target object is changed due to the shaking of the lens, the sharpness of the image will not be high during the focusing process of the camera, which will seriously affect the user experience.
  • the focus adjustment method may include: a camera system obtains the current focus, front focus, and rear focus of the camera module.
  • the focus point corresponds to the first frame image, the second frame image, and the third frame image taken.
  • the current focus point is between the front focus and the back focus; and the first frame image, the second frame image, and the third frame image are identified.
  • Frame image determine the focus adjustment direction and focus adjustment distance of the camera module; the camera system adjusts the current focus of the camera module according to the focus adjustment direction and focus adjustment distance of the camera module, so that the camera module is combined to get a clear Take pictures.
  • the focus adjustment method can automatically adjust the focus of the camera module when the object distance changes without affecting the user experience.
  • the camera system includes, but is not limited to, cameras with a function of recording images, such as digital cameras, drone cameras, and handheld pan-tilt cameras, which are not limited in the embodiments of the present application.
  • FIG. 2 is a schematic flowchart of a focus adjustment method provided by an embodiment of the present application.
  • the focus adjustment method may include, but is not limited to, the following steps:
  • the camera system acquires the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus.
  • the current focus is between the front focus and the back focus. between.
  • the camera system determines the front focus and the back focus of the camera module according to the current focus.
  • the camera system obtains the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus.
  • the current focus reflects the image distance set by the current image captured by the camera module.
  • the front focus can reflect the image distance of the camera module after the focus is reduced based on the current focus; the rear focus can reflect the image distance of the camera module after the focus is increased based on the current focus. Therefore, the current focus is introduced Between the front focus and the back focus.
  • focusing is generally achieved by controlling the movement of the lens by a motor.
  • the camera system When the camera system is triggered to perform autofocus, the camera module takes the first frame of images at the current focus, and the camera system acquires the camera module at the current focus.
  • the shooting parameters when shooting.
  • the specific implementation for determining the front focus and the back focus may include steps S11-S13.
  • the camera system acquires shooting parameters of the camera module when shooting at the current focus.
  • the shooting parameters are the basic parameters of the camera module.
  • the shooting parameters include the aperture value, the diameter of the lens aperture (Sensor Pixel), and the step length factor.
  • the shooting parameters can be pre-stored in the memory, so the camera system can obtain them from the memory, or can be obtained by the processor of the camera system by analyzing the first frame of image.
  • the aperture value is a relative value obtained from the focal length and the diameter of the lens aperture; the diameter of the lens aperture is determined by the lens itself; the step length factor is used to indicate the movement step length of the lens of the camera module within a unit distance.
  • the camera system performs distance conversion on the shooting parameters to obtain a distance threshold for the current focus to support movement.
  • the camera system calculates the out-of-focus distance of the camera module according to the aperture value and the diameter of the lens aperture; according to the out-of-focus distance and the step-length factor, calculates the distance threshold for the current focus to support movement.
  • the distance threshold is the maximum distance allowed to move the lens in the camera module when a clear image can be obtained, and a clear image cannot be obtained if the distance threshold is exceeded.
  • the camera module can obtain a clear image within a certain distance before and after the target object. This distance range can be called the depth of field, including the foreground depth and the back depth of field. The depth of field is on the side of the object.
  • the side like this can be called the depth of focus, which corresponds to the front and back focal depths. If you want to obtain a clear image, you do not need to be absolutely in focus, but a certain amount of out of focus can be allowed. As long as the distance of out of focus does not exceed the depth of focus range, the user is difficult to perceive. Therefore, the solution distance threshold can be converted into the solution range of the out-of-focus distance. Then through the step factor, the maximum distance allowed for the lens to move can be obtained by formula (2).
  • Smax represents the distance threshold
  • Defocus represents the out-of-focus distance
  • FIG. 3 is a schematic diagram of an ideal lens imaging principle provided by an embodiment of the present application.
  • the Gaussian imaging principle can be expressed by formula (2).
  • a is the image distance
  • b is the object distance
  • f is the focal length.
  • the object distance b will be equal to f, that is, the object at infinity is absolutely in focus.
  • a point at infinity after imaging through the lens, is still a point when it is absolutely in focus. If the point disperses into a round spot, it is because it is out of focus.
  • the round spot can be called a circle of confusion; the more severe the loss of focus, the larger the circle of confusion.
  • the out-of-focus distance can be expressed by formula (3).
  • Blur_Width represents the diameter of the circle of confusion
  • the value of the diameter of the circle of confusion is only exemplary and does not form a limitation.
  • the value of the diameter of the circle of confusion depends on the size of the display that displays the image and the observation distance of the user. Therefore, the size of the diameter D of the lens aperture of the CMOS sensor is obtained, and the aperture value F is obtained, and then the range of the allowable out-of-focus distance can be determined, that is, the distance threshold value of the current focus support movement is obtained.
  • the camera system obtains the distance S 0 the motor takes one step, and can obtain the maximum number of steps S of the motor at a time when the human eyes cannot see the obvious image blurring.
  • the value of S 0 is set by the motor. If S 0 is 1mm and the distance threshold S max is 5mm, the motor needs to take 5 steps.
  • the camera system moves the current focus in the first direction by the first distance to obtain the front focus, and moves the current focus in the second direction by the second distance to obtain the rear focus.
  • the first direction is opposite to the second direction, and the first distance is opposite to the first distance. Both distances are less than or equal to the distance threshold.
  • FIG. 4 is a schematic diagram of the positions of a front focus and a rear focus provided by an embodiment of the present application.
  • the first direction and the second direction are self-defined settings by the system, and do not form a limitation.
  • the direction in which the current focus moves to the front focus can also be referred to as the second direction, and the direction in which the current focus moves to the rear focus is referred to as the second direction.
  • the first direction is opposite to the second direction, so that the current focus is between the front focus and the back focus.
  • both the first distance and the second distance are less than or equal to the distance threshold.
  • the machine system moves the current focus in the first direction by a first distance to obtain the front focus, and moves the current focus in the second direction by a second distance to obtain the rear focus.
  • the specific implementation is as follows.
  • the first distance and the second distance are both smaller than the distance threshold, and the first distance and the second distance are equal. Therefore, the camera system can obtain the number s of steps taken by the camera through the distance S 0 between the first distance and the motor step.
  • the camera system controls the motor to move in the first direction for s steps to reach the front focus, and shoot the second frame of image at the front focus. Since the first distance and the second distance are equal, the camera system controls the motor to move in the second direction for 2 seconds to reach the rear focus, and the third frame of image is captured at the rear focus.
  • the first distance and the second distance are both equal to the distance threshold, that is, both the first distance and the second distance are equal to S max . Therefore, the camera system controls the motor to move in the first direction for S steps to reach the front focus, and shoot the second frame of image at the front focus. Since both the first distance and the second distance are equal to the distance threshold, the camera system controls the motor to move in the second direction for 2S steps to reach the rear focus, and the third frame of image is captured at the rear focus.
  • FIG. 5 is a schematic diagram of a possible motor movement provided by an embodiment of the present application. As shown in the figure, the camera system determines a point on the left and right of the current focus, and shoots a frame of image each. It is possible to reduce the impact on the user during the focusing process.
  • S202 The camera system recognizes the first frame image, the second frame image, and the third frame image, and determines the focus adjustment direction and the focus adjustment distance of the camera module.
  • the camera system performs image recognition on the first frame image, the second frame image, and the third frame image, and calculates the corresponding current focus value, front focus value, and back focus value.
  • the focus value is used to reflect the corresponding focus value.
  • the sharpness of the frame image Specifically, the camera system obtains the current focus value at the current focus by recognizing the first frame of image, which can also be referred to as the AF statistical value A; the camera system obtains the front focus value at the front focus by recognizing the second frame of image, It can also be referred to as the AF statistical value B; the camera system obtains the rear focus value at the rear focus by identifying the third frame of image, which can also be referred to as the AF statistical value C.
  • the focus adjustment direction and focus adjustment distance of the camera module during auto focus are determined.
  • the following exemplarily provides specific implementations for intensively determining the focus adjustment direction and focus adjustment distance of the camera module during autofocus.
  • FIG. 6(a) is a schematic diagram of a possible focus adjustment direction and focus adjustment distance provided by an embodiment of the present application.
  • FIG. 6(b) is a schematic diagram of a possible focus adjustment direction and focus adjustment distance provided by an embodiment of the present application.
  • the current focus value is greater than the front focus value and the back focus value, that is, A>B and A>C, it is determined that the current focus of the camera module does not need to be adjusted, and the focus adjustment direction of the camera module And the focus adjustment distance is empty.
  • the camera system adjusts the current focus of the camera module according to the focus adjustment direction and the focus adjustment distance of the camera module.
  • the camera system adjusts the current focus of the camera module according to the focus adjustment direction and the focus adjustment distance of the camera module to complete the focusing process.
  • the camera system adjusts the current focus of the camera module to the front focus along the first direction according to the focus adjustment direction and the focus adjustment distance of the camera module.
  • the camera system adjusts the current focus of the camera module to the rear focus along the second direction according to the focus adjustment direction and the focus adjustment distance of the camera module.
  • the camera system since the focus adjustment direction and the focus adjustment distance are both empty, the camera system does not adjust the current focus.
  • the auto focus can be triggered again. Then the camera system uses the adjusted focus as the current focus, and re-executes the focus adjustment method provided in FIG. 2 in the embodiment of the present application.
  • the camera system obtains the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus.
  • the current focus is between the front focus and the back focus.
  • Between the focus and the rear focus identify the first frame image, the second frame image and the third frame image, determine the focus adjustment direction and focus adjustment distance of the camera module; according to the focus adjustment direction and focus adjustment distance of the camera module, Adjust the current focus of the camera module.
  • the focus adjustment direction and focus adjustment distance of the camera module are determined by the current focus, front focus, and rear focus of the camera module, so that the focus of the camera module can be adjusted. auto-adjust.
  • the current focus is between the front focus and the rear focus, so the impact on the clarity of the image is small, and the user experience may not be affected.
  • FIG. 7 is a schematic structural diagram of another camera system provided by an embodiment of the present application.
  • the camera system 70 described in the embodiment of the present application includes: a processor 701, a memory 702, a communication interface 703, and a camera module 704.
  • the processor 701, the memory 702, the communication interface 703, and the camera module 704 are connected by one or more communication buses.
  • the aforementioned processor 701 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), application specific integrated circuits (ASICs). ), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
  • the processor 701 is configured to support the camera system to perform the corresponding functions of the camera system in the method described in FIG. 4.
  • the aforementioned memory 702 may include a read-only memory and a random access memory, and provides computer programs and data to the processor 701. A part of the memory 702 may also include a non-volatile random access memory. Wherein, the processor 701 calls the program instructions in the memory 702 to execute the following steps:
  • the current focus of the camera module 704 is adjusted.
  • the processor 701 is used to obtain the first frame image, the second frame image, and the third frame image corresponding to the camera module 704 at the current focus, the front focus, and the back focus. , Used to: determine the front focus and the back focus of the camera module 704 shooting.
  • the processor 701 is configured to: obtain the shooting parameters of the camera module 704 when shooting at the current focus, the shooting parameters include the aperture value, the diameter of the lens aperture, and the step factor, and the step factor is used to indicate The movement step length of the lens of the camera module 704 within a unit distance; the distance conversion of the shooting parameters is carried out to obtain the distance threshold of the current focus support movement; the current focus is moved in the first direction by the first distance to obtain the front focus, and the current focus is The rear focus is obtained by moving the second distance in the second direction, the first direction is opposite to the second direction, and both the first distance and the second distance are less than or equal to the distance threshold.
  • both the first distance and the second distance are equal to the distance threshold.
  • the processor 701 is configured to: calculate the out-of-focus distance of the camera module 704 according to the aperture value and the diameter of the lens aperture; and calculate the distance supported by the current focus to move according to the out-of-focus distance and the step factor. Threshold.
  • the processor 701 is configured to: perform image recognition on the first frame image, the second frame image, and the third frame image, and calculate the corresponding current focus value, front focus value, and back focus value.
  • the focus value is used to reflect the clarity of the frame image corresponding to the focus value; if the current focus value is between the front focus value and the back focus value, and the front focus value is greater than the back focus value, the camera module 704 is determined
  • the focus adjustment direction of is the first direction from the current focus to the front focus adjustment, and the focus adjustment distance is the distance between the current focus and the front focus; the current focus of the camera module 704 is adjusted to the front focus along the first direction .
  • the processor 701 is configured to: perform image recognition on the first frame image, the second frame image, and the third frame image, and correspondingly calculate the current focus value, the front focus value, and the back focus value.
  • the value is used to reflect the sharpness of the frame image corresponding to the focus value; if the current focus value is between the front focus value and the back focus value, and the front focus value is less than the back focus value, the camera module 704 is determined to be
  • the focus adjustment direction is the second direction of the current focus to the rear focus adjustment
  • the focus adjustment distance of the camera module 704 is the distance between the current focus and the rear focus
  • the current focus of the camera module 704 is adjusted along the second direction To the rear focus.
  • the processor 701 is configured to: perform image recognition on the first frame image, the second frame image, and the third frame image, and correspondingly calculate the current focus value, the front focus value, and the back focus value.
  • the value is used to reflect the sharpness of the frame image corresponding to the focus value; if the current focus value is greater than the front focus value and the rear focus value, it is determined that there is no need to adjust the current focus of the camera module 704, and the focus adjustment direction of the camera module 704 And the focus adjustment distance is empty.
  • the embodiment of the present application also provides a readable storage medium, and the readable storage medium stores a computer program.
  • the computer program When the computer program is executed by a processor, it can be used to implement the description in the embodiment corresponding to FIG. 4 of the embodiment of the present application. The focus adjustment method will not be repeated here.
  • the computer-readable storage medium may be an internal storage unit of the camera system described in any of the foregoing embodiments, such as a hard disk or memory of a device.
  • the computer-readable storage medium may also be an external storage device of the camera system, such as a plug-in hard disk equipped on the device, a smart memory card (SMC), or a secure digital (SD) Card, Flash Card, etc.
  • the computer-readable storage medium may also include both an internal storage unit of the camera system and an external storage device.
  • the computer-readable storage medium is used to store the computer program and other programs and data required by the camera system.
  • the computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
  • the program can be stored in a readable storage medium, and the program can be stored in a readable storage medium. When executed, it may include the procedures of the above-mentioned method embodiments.
  • the storage medium may be a magnetic disk, an optical disc, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM), etc.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Studio Devices (AREA)
  • Automatic Focus Adjustment (AREA)

Abstract

A focus adjustment method, a camera module, and a computer readable storage medium. The focus adjustment method comprises: acquiring a first image frame, a second image frame, and a third image frame that are correspondingly photographed by a camera module at a current focal point, a front focal point, and a rear focal point (S201), the current focal point being between the front focal point and the rear focal point; identifying the first image frame, the second image frame, and the third image frame, and determining the focal point adjustment direction and the focal point adjustment distance of the camera module (S202); and adjusting the current focal point of the camera module according to the focal point adjustment direction and the focal point adjustment distance of the camera module (S203). Therefore, the focal point of the camera module can be automatically adjusted when the object distance changes, and user experience is not affected.

Description

一种焦点调整方法、摄像模组及计算机可读存储介质Focus adjustment method, camera module and computer readable storage medium 技术领域Technical field
本申请涉及拍照技术领域,尤其涉及一种焦点调整方法、摄像模组及计算机可读存储介质。This application relates to the field of photography technology, and in particular to a focus adjustment method, camera module, and computer-readable storage medium.
背景技术Background technique
目前在拍照时,例如数码相机在拍照时,通常采用自动对焦(auto focus,AF)模式实现相机对焦,无需用户频繁对相机的触摸屏上物体进行点击对焦,由相机自身触发并完成自动对焦。At present, when taking pictures, for example, when a digital camera takes a picture, an auto focus (AF) mode is usually used to realize the camera focusing. There is no need for the user to frequently tap an object on the camera's touch screen to focus, and the camera itself triggers and completes the auto focusing.
然而在实践中发现,现有自动对焦方案中相机对焦速度较慢、对焦时间较长。尤其在拍摄物体的物距存在变化时,相机对焦质量不高,导致拍摄画面的清晰度不高,影响用户体验。However, it has been found in practice that the camera focusing speed is slower and the focusing time is longer in the existing auto-focusing scheme. Especially when there is a change in the object distance of the shooting object, the focus quality of the camera is not high, resulting in low definition of the shooting picture, which affects the user experience.
发明内容Summary of the invention
本申请实施例提供了焦点调整方法、摄像模组及计算机可读存储介质,可以在物距存在变化时,对摄像模组的焦点进行自动调整,且不影响用户体验。The embodiments of the present application provide a focus adjustment method, a camera module, and a computer-readable storage medium, which can automatically adjust the focus of the camera module when the object distance changes without affecting the user experience.
第一方面,本申请实施例提供一种焦点调整方法,所述方法包括:In a first aspect, an embodiment of the present application provides a focus adjustment method, and the method includes:
获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像,该当前焦点介于前置焦点和后置焦点之间;识别第一帧图像、第二帧图像及第三帧图像,确定摄像模组的焦点调整方向及焦点调整距离;按照摄像模组的焦点调整方向及焦点调整距离,调整摄像模组的当前焦点。Acquire the first frame image, the second frame image, and the third frame image corresponding to the camera module at the current focus, the front focus, and the back focus, and the current focus is between the front focus and the back focus; The first frame image, the second frame image, and the third frame image determine the focus adjustment direction and focus adjustment distance of the camera module; adjust the current focus of the camera module according to the focus adjustment direction and focus adjustment distance of the camera module.
在一种实现方式中,获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像之前,所述方法还包括:确定摄像模组拍摄的前置焦点和后置焦点。In an implementation manner, before acquiring the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus, the method further includes: determining the camera The front focus and back focus of the module shooting.
在一种实现方式中,确定摄像模组拍摄的前置焦点和后置焦点的具体实施方式为:获取摄像模组在当前焦点处拍摄时的拍摄参数,该拍摄参数包括光圈值、镜头口径的直径和步长因子,步长因子用于指示单位距离内摄像模组的镜 头的移动步长;对拍摄参数进行距离转换,得到当前焦点支持移动的距离阈值;将当前焦点向第一方向移动第一距离得到前置焦点,将当前焦点向第二方向移动第二距离得到后置焦点,第一方向与第二方向相反,第一距离与第二距离均小于或等于距离阈值。In one implementation, the specific implementation for determining the front focus and the rear focus of the camera module is to obtain the shooting parameters of the camera module when shooting at the current focus. The shooting parameters include the aperture value and the lens aperture. Diameter and step length factor. The step length factor is used to indicate the movement step length of the camera module lens within a unit distance; distance conversion is performed on the shooting parameters to obtain the distance threshold for the current focus to support movement; the current focus is moved to the first direction The front focus is obtained by one distance, and the rear focus is obtained by moving the current focus in the second direction by a second distance. The first direction is opposite to the second direction, and both the first distance and the second distance are less than or equal to the distance threshold.
在一种实现方式中,第一距离和第二距离均与距离阈值相等。In one implementation, both the first distance and the second distance are equal to the distance threshold.
在一种实现方式中,对拍摄参数进行距离转换,得到当前焦点支持移动的距离阈值的具体实施方式为:根据光圈值和镜头口径的直径,计算得到摄像模组的失焦距离;根据失焦距离和步长因子,计算得到当前焦点支持移动的距离阈值。In one implementation, the distance conversion is performed on the shooting parameters to obtain the distance threshold value of the current focus support movement: according to the aperture value and the diameter of the lens aperture, the out-of-focus distance of the camera module is calculated; according to the out-of-focus The distance and step factor are calculated to obtain the distance threshold for the current focus to support movement.
在一种实现方式中,识别所述第一帧图像、第二帧图像及第三帧图像,确定摄像模组的焦点调整方向及焦点调整距离的具体实施方式为:对第一帧图像、第二帧图像及第三帧图像进行图像识别,计算得到对应的当前焦点值、前置焦点值和后置焦点值,焦点值用于反映焦点值对应的帧图像的清晰度;若当前焦点值介于前置焦点值和后置焦点值之间,且前置焦点值大于后置焦点值,则确定摄像模组的焦点调整方向为当前焦点向前置焦点调整的第一方向,焦点调整距离为当前焦点与前置焦点之间的距离;将摄像模组的当前焦点沿着第一方向调整至前置焦点。In an implementation manner, the specific implementation manner of identifying the first frame image, the second frame image, and the third frame image, and determining the focus adjustment direction and focus adjustment distance of the camera module is: Perform image recognition on the second frame of image and the third frame of image, and calculate the corresponding current focus value, front focus value and back focus value. The focus value is used to reflect the definition of the frame image corresponding to the focus value; if the current focus value is defined Between the front focus value and the rear focus value, and the front focus value is greater than the rear focus value, it is determined that the focus adjustment direction of the camera module is the first direction from the current focus to the front focus adjustment, and the focus adjustment distance is The distance between the current focus and the front focus; the current focus of the camera module is adjusted to the front focus along the first direction.
在一种实现方式中,识别第一帧图像、第二帧图像及第三帧图像,确定摄像模组的焦点调整方向及焦点调整距离的具体实施方式为:对第一帧图像、第二帧图像及第三帧图像进行图像识别,对应计算得到当前焦点值、前置焦点值和后置焦点值,焦点值用于反映焦点值对应的帧图像的清晰度;若当前焦点值介于前置焦点值和后置焦点值之间,且前置焦点值小于后置焦点值,则确定摄像模组的焦点调整方向为当前焦点向后置焦点调整的第二方向,摄像模组的焦点调整距离为当前焦点与后置焦点之间的距离;将摄像模组的当前焦点沿着第二方向调整至后置焦点。In one implementation, the specific implementation of identifying the first frame image, the second frame image, and the third frame image, and determining the focus adjustment direction and focus adjustment distance of the camera module is as follows: The image and the third frame of image are recognized, and the current focus value, front focus value and back focus value are calculated correspondingly. The focus value is used to reflect the sharpness of the frame image corresponding to the focus value; if the current focus value is between the front focus value Between the focus value and the rear focus value, and the front focus value is less than the rear focus value, the focus adjustment direction of the camera module is determined to be the second direction of the current focus to the rear focus adjustment, and the focus adjustment distance of the camera module Is the distance between the current focus and the rear focus; the current focus of the camera module is adjusted to the rear focus along the second direction.
在一种实现方式中,识别第一帧图像、第二帧图像及第三帧图像,确定摄像模组的焦点调整方向及焦点调整距离具体实施方式为:对第一帧图像、第二帧图像及第三帧图像进行图像识别,对应计算得到当前焦点值、前置焦点值和后置焦点值,焦点值用于反映焦点值对应的帧图像的清晰度;若当前焦点值均 大于前置焦点值和后置焦点值,则确定无需调整摄像模组的当前焦距,摄像模组的焦点调整方向及焦点调整距离均为空。In one implementation, the first frame of image, the second frame of image, and the third frame of image are identified, and the focus adjustment direction and focus adjustment distance of the camera module are determined. The specific implementation is as follows: And the third frame of image for image recognition, correspondingly calculate the current focus value, front focus value and back focus value, the focus value is used to reflect the definition of the frame image corresponding to the focus value; if the current focus value is greater than the front focus Value and the rear focus value, it is determined that there is no need to adjust the current focus of the camera module, and the focus adjustment direction and focus adjustment distance of the camera module are both empty.
第二方面,本申请实施例提供一种相机系统,所述相机系统包括存储器和处理器,其中:In a second aspect, an embodiment of the present application provides a camera system, the camera system includes a memory and a processor, wherein:
所述存储器,用于存储计算机程序;The memory is used to store a computer program;
所述处理器,调用计算机程序,用于:The processor calls a computer program for:
获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像,该当前焦点介于前置焦点和后置焦点之间;识别第一帧图像、第二帧图像及第三帧图像,确定摄像模组的焦点调整方向及焦点调整距离;按照摄像模组的焦点调整方向及焦点调整距离,调整摄像模组的当前焦点。Acquire the first frame image, the second frame image, and the third frame image corresponding to the camera module at the current focus, the front focus, and the back focus, and the current focus is between the front focus and the back focus; The first frame image, the second frame image, and the third frame image determine the focus adjustment direction and focus adjustment distance of the camera module; adjust the current focus of the camera module according to the focus adjustment direction and focus adjustment distance of the camera module.
第三方面,本申请实施例提供一种摄像模组,所述摄像模组部署在如第二方面本申请实施例所述的相机系统,所述相机系统用于:In a third aspect, an embodiment of the present application provides a camera module that is deployed in the camera system described in the embodiment of the present application in the second aspect, and the camera system is used for:
获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像,该当前焦点介于前置焦点和后置焦点之间;识别第一帧图像、第二帧图像及第三帧图像,确定摄像模组的焦点调整方向及焦点调整距离;按照摄像模组的焦点调整方向及焦点调整距离,调整摄像模组的当前焦点。Acquire the first frame image, the second frame image, and the third frame image corresponding to the camera module at the current focus, the front focus, and the back focus, and the current focus is between the front focus and the back focus; The first frame image, the second frame image, and the third frame image determine the focus adjustment direction and focus adjustment distance of the camera module; adjust the current focus of the camera module according to the focus adjustment direction and focus adjustment distance of the camera module.
第四方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序在被执行时,实现如第一方面本申请实施例所述的焦点调整方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored on the computer-readable storage medium, and when the computer program is executed, it implements the same as described in the embodiment of the present application in the first aspect. The focus adjustment method.
在本申请实施例中,相机系统获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像,该当前焦点介于前置焦点和后置焦点之间;识别第一帧图像、第二帧图像及第三帧图像,确定摄像模组的焦点调整方向及焦点调整距离;按照摄像模组的焦点调整方向及焦点调整距离,调整摄像模组的当前焦点。通过本申请实施例,在物距存在变化时,通过摄像模组的当前焦点、前置焦点和后置焦点确定摄像模组的焦点调整方向及焦点调整距离,可以实现对摄像模组的焦点进行自动调整。当前焦点介于前置焦点和后置焦点之间,因此对图像的清晰度影响较小,能够不影响用户体验。In the embodiment of the present application, the camera system obtains the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus. The current focus is between the front focus and the back focus. Between the focus and the rear focus; identify the first frame image, the second frame image and the third frame image, determine the focus adjustment direction and focus adjustment distance of the camera module; according to the focus adjustment direction and focus adjustment distance of the camera module, Adjust the current focus of the camera module. Through the embodiments of the present application, when the object distance changes, the focus adjustment direction and focus adjustment distance of the camera module are determined by the current focus, front focus, and rear focus of the camera module, so that the focus of the camera module can be adjusted. auto-adjust. The current focus is between the front focus and the rear focus, so the impact on the clarity of the image is small, and the user experience may not be affected.
附图说明Description of the drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present application or the technical solutions in the prior art more clearly, the following will briefly introduce the drawings that need to be used in the embodiments. Obviously, the drawings in the following description are only some of the present application. Embodiments, for those of ordinary skill in the art, without creative work, other drawings can be obtained based on these drawings.
图1是本申请实施例提供的一种一种焦点调整方向示意图;FIG. 1 is a schematic diagram of a focus adjustment direction provided by an embodiment of the present application;
图2是本申请实施例提供的一种焦点调整方法的流程示意图;2 is a schematic flowchart of a focus adjustment method provided by an embodiment of the present application;
图3是本申请实施例提供的一种理想透镜成像原理示意图;FIG. 3 is a schematic diagram of an ideal lens imaging principle provided by an embodiment of the present application;
图4是本申请实施例提供的一种前置焦点和后置焦点的位置示意图;4 is a schematic diagram of the positions of a front focus and a rear focus provided by an embodiment of the present application;
图5是本申请实施例提供的一种可能的电机运动示意图;FIG. 5 is a schematic diagram of a possible motor movement provided by an embodiment of the present application;
图6(a)是本申请实施例提供的一种可能的焦点调整方向及焦点调整距离的示意图;FIG. 6(a) is a schematic diagram of a possible focus adjustment direction and focus adjustment distance provided by an embodiment of the present application;
图6(b)是本申请实施例提供的一种可能的焦点调整方向及焦点调整距离的示意图;FIG. 6(b) is a schematic diagram of a possible focus adjustment direction and focus adjustment distance provided by an embodiment of the present application;
图7是本申请实施例提供的一种相机系统的结构示意图。FIG. 7 is a schematic structural diagram of a camera system provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
在现代社会生活中,人们越来越想要将美好和重要的时刻记录成图像。早期相机需要使用底片(即录像带)来进行记录,随着数码相机的发明,使图像能直接储存在快闪存储器内。最新的相机,则是将图像资料直接储存在机身的硬盘中,不仅可以静态拍摄,也可以动态录影。随着技术的发展,人们对图像清晰度的要求越来越高。若想获得清晰的图像,则需要相机对目标物体聚焦。相机通过改变物距和像距的位置,使目标物体成像清晰的过程可称为对焦。当前相机常见的对焦模式为连续对焦(auto focus-continue,AF-c),用户不需要 频繁去点屏幕进行对焦,而是由相机判断是否触发自动对焦(auto focus,AF),并自动完成对焦。In modern social life, people increasingly want to record beautiful and important moments as images. Early cameras needed to use negatives (that is, video tapes) to record. With the invention of digital cameras, images can be stored directly in flash memory. The latest cameras store the image data directly in the hard disk of the body, which can not only shoot statically, but also record dynamically. With the development of technology, people have higher and higher requirements for image clarity. If you want to get a clear image, you need the camera to focus on the target object. The process of the camera changing the position of the object distance and the image distance to make the target object clear can be called focusing. The common focus mode of the current camera is auto focus-continue (AF-c). The user does not need to tap the screen frequently to focus. Instead, the camera determines whether to trigger auto focus (AF) and automatically completes the focus. .
目前自动聚焦模式主要通过AF统计值变化来判断是否触发连续对焦,当触发连续对焦后,相机中的摄像模组需要采集三个焦点处的图像,以判断合焦方向。请参见图1,图1是本申请实施例提供的一种焦点调整方向示意图。如图1所示,以第一焦点、第二焦点、第三焦点表示摄像模组需要采集图像的三个焦点,第一焦点表示摄像模组当前拍摄图像采用的焦点。可以看目前方案在采集图像时,摄像模组调整焦点时相机系统控制电机都朝一个方向运动。由于焦点的变化会对图像画面的清晰度产生影响,而朝一个方向变化会导致焦点的变化更大,对图像清晰度的影响也更大,影响用户体验;尤其是录像过程中,由于目标对象发生变化,或者由于镜头晃动导致目标对象的物距产生变化,相机对焦过程中将导致图像画面清晰度不高,严重影响用户体验。At present, the auto focus mode mainly judges whether to trigger continuous focus based on the change of AF statistics. When continuous focus is triggered, the camera module in the camera needs to collect images at three focal points to determine the focus direction. Please refer to FIG. 1, which is a schematic diagram of a focus adjustment direction provided by an embodiment of the present application. As shown in FIG. 1, the first focus, the second focus, and the third focus represent the three focus points that the camera module needs to collect images, and the first focus represents the focus currently used by the camera module to capture images. It can be seen that when the current scheme is collecting images, the camera system controls the motors to move in one direction when the camera module adjusts the focus. Because the change of the focus will affect the clarity of the image, and the change in one direction will cause the focus to change more, and the impact on the clarity of the image is also greater, affecting the user experience; especially during the recording process, due to the target object If there is a change, or the object distance of the target object is changed due to the shaking of the lens, the sharpness of the image will not be high during the focusing process of the camera, which will seriously affect the user experience.
为了解决上述问题,本申请实施例提供了一种焦点调整方法、摄像模组及计算机可读存储介质,其中,焦点调整方法可以包括:相机系统获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像,该当前焦点介于前置焦点和后置焦点之间;进而识别第一帧图像、第二帧图像及第三帧图像,确定摄像模组的焦点调整方向及焦点调整距离;相机系统按照摄像模组的焦点调整方向及焦点调整距离,调整摄像模组的当前焦点,以使该摄像模组合焦,得到清晰的拍摄图像。该焦点调整方法可以在物距存在变化时,对摄像模组的焦点进行自动调整,且不影响用户体验。In order to solve the above-mentioned problems, embodiments of the present application provide a focus adjustment method, a camera module, and a computer-readable storage medium. The focus adjustment method may include: a camera system obtains the current focus, front focus, and rear focus of the camera module. The focus point corresponds to the first frame image, the second frame image, and the third frame image taken. The current focus point is between the front focus and the back focus; and the first frame image, the second frame image, and the third frame image are identified. Frame image, determine the focus adjustment direction and focus adjustment distance of the camera module; the camera system adjusts the current focus of the camera module according to the focus adjustment direction and focus adjustment distance of the camera module, so that the camera module is combined to get a clear Take pictures. The focus adjustment method can automatically adjust the focus of the camera module when the object distance changes without affecting the user experience.
其中,相机系统包括不限于数码相机、无人机相机以及手持云台相机等具有记录图像功能的相机,本申请实施例对此不作限定。Among them, the camera system includes, but is not limited to, cameras with a function of recording images, such as digital cameras, drone cameras, and handheld pan-tilt cameras, which are not limited in the embodiments of the present application.
请参见图2,图2是本申请实施例提供的一种焦点调整方法的流程示意图,该焦点调整方法可以包括但不限于如下步骤:Please refer to FIG. 2. FIG. 2 is a schematic flowchart of a focus adjustment method provided by an embodiment of the present application. The focus adjustment method may include, but is not limited to, the following steps:
S201、相机系统获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像,该当前焦点介于前置焦点和后置焦点之间。S201. The camera system acquires the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus. The current focus is between the front focus and the back focus. between.
当触发相机系统进行自动对焦后,相机系统则根据当前焦点确定摄像模组拍摄的前置焦点和后置焦点。其中,当检测到启用相机系统进行拍摄时,或每 次拍摄图像之前等,都会触发相机系统进行自动对焦。进而相机系统获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像。其中,当前焦点反映了摄像模组当前拍摄图像设定的像距。相应地,前置焦点可反映以当前焦点为标准调小焦距后摄像模组的像距;后置焦点可反映以当前焦点为标准调大焦距后摄像模组的像距,因此,当前焦点介于前置焦点和后置焦点之间。When the camera system is triggered to perform autofocus, the camera system determines the front focus and the back focus of the camera module according to the current focus. Among them, when it is detected that the camera system is activated for shooting, or before each image is taken, the camera system will be triggered to perform autofocus. Furthermore, the camera system obtains the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus. Among them, the current focus reflects the image distance set by the current image captured by the camera module. Correspondingly, the front focus can reflect the image distance of the camera module after the focus is reduced based on the current focus; the rear focus can reflect the image distance of the camera module after the focus is increased based on the current focus. Therefore, the current focus is introduced Between the front focus and the back focus.
具体地,在实际应用中,一般通过电机控制镜头移动来实现对焦,当触发相机系统进行自动对焦后,摄像模组于当前焦点拍摄第一帧图像,进而相机系统获取摄像模组在当前焦点处拍摄时的拍摄参数。为了使用户在对焦过程中感知度较低,即保证图像画面清晰度没有明显变化,则需对拍摄参数进行距离转换,得到当前焦点支持移动的距离阈值,即计算和调试出电机一次走多少步。从而相机系统将当前焦点向第一方向移动第一距离得到前置焦点,将当前焦点向第二方向移动第二距离得到后置焦点。Specifically, in practical applications, focusing is generally achieved by controlling the movement of the lens by a motor. When the camera system is triggered to perform autofocus, the camera module takes the first frame of images at the current focus, and the camera system acquires the camera module at the current focus. The shooting parameters when shooting. In order to make the user's perception low during the focusing process, that is, to ensure that the image clarity does not change significantly, it is necessary to perform distance conversion on the shooting parameters to obtain the distance threshold of the current focus support movement, that is, calculate and debug how many steps the motor takes at a time . Therefore, the camera system moves the current focus in the first direction by a first distance to obtain the front focus, and moves the current focus in the second direction by a second distance to obtain the rear focus.
其中,确定前置焦点和后置焦点的具体实施方式可包括步骤S11-S13。Among them, the specific implementation for determining the front focus and the back focus may include steps S11-S13.
S11、相机系统获取摄像模组在当前焦点处拍摄时的拍摄参数。S11. The camera system acquires shooting parameters of the camera module when shooting at the current focus.
拍摄参数为摄像模组的基本参数,该拍摄参数包括光圈值、镜头口径的直径(Sensor Pixel)和步长因子。拍摄参数可以预存在存储器中,因此相机系统从存储器获取得到,也可由相机系统的处理器通过解析第一帧图像得到。其中,光圈值为焦距与镜头口径的直径得到的相对值;镜头口径的直径由镜头自身决定;步长因子用于指示单位距离内摄像模组的镜头的移动步长。例如,摄像模组中的传感器(sensor)端需要移动1mm才能合焦,那么如果传感器不动,只移动摄像模组中的镜头,那么镜头需要移动x mm才能合焦,则步长因子k-value=x mm/1mm=x。The shooting parameters are the basic parameters of the camera module. The shooting parameters include the aperture value, the diameter of the lens aperture (Sensor Pixel), and the step length factor. The shooting parameters can be pre-stored in the memory, so the camera system can obtain them from the memory, or can be obtained by the processor of the camera system by analyzing the first frame of image. Among them, the aperture value is a relative value obtained from the focal length and the diameter of the lens aperture; the diameter of the lens aperture is determined by the lens itself; the step length factor is used to indicate the movement step length of the lens of the camera module within a unit distance. For example, the sensor end of the camera module needs to move 1mm to achieve focus. If the sensor does not move and only the lens in the camera module is moved, then the lens needs to move x mm to achieve focus, and the step length factor is k- value=x mm/1mm=x.
S12、相机系统对拍摄参数进行距离转换,得到当前焦点支持移动的距离阈值。S12. The camera system performs distance conversion on the shooting parameters to obtain a distance threshold for the current focus to support movement.
相机系统根据光圈值和镜头口径的直径,计算得到摄像模组的失焦距离;根据失焦距离和步长因子,计算得到当前焦点支持移动的距离阈值。其中,距离阈值为在能够获取清晰的图像清下摄像模组中的镜头允许移动的最大距离,超过该距离阈值则不能获取清晰的图像。在实际应用中,以人眼为标准,在目 标物体前后一定距离范围内摄影模组都能够获取清晰的图像,该距离范围可称为景深,包括前景深和后景深。景深在物一侧,相应地,像这一侧,可称为焦深,对应有前焦深和后焦深。若想获取清晰的图像不需要绝对合焦,可以允许有一定的失焦,只要失焦的距离没有超出焦深范围,则用户是难以感知的。因此,可将求解距离阈值转换为求解失焦距离的范围。然后通过步长因子,就能由公式(2)得到镜头允许移动的最大距离。The camera system calculates the out-of-focus distance of the camera module according to the aperture value and the diameter of the lens aperture; according to the out-of-focus distance and the step-length factor, calculates the distance threshold for the current focus to support movement. Wherein, the distance threshold is the maximum distance allowed to move the lens in the camera module when a clear image can be obtained, and a clear image cannot be obtained if the distance threshold is exceeded. In practical applications, with the human eye as the standard, the camera module can obtain a clear image within a certain distance before and after the target object. This distance range can be called the depth of field, including the foreground depth and the back depth of field. The depth of field is on the side of the object. Correspondingly, the side like this can be called the depth of focus, which corresponds to the front and back focal depths. If you want to obtain a clear image, you do not need to be absolutely in focus, but a certain amount of out of focus can be allowed. As long as the distance of out of focus does not exceed the depth of focus range, the user is difficult to perceive. Therefore, the solution distance threshold can be converted into the solution range of the out-of-focus distance. Then through the step factor, the maximum distance allowed for the lens to move can be obtained by formula (2).
S max=Defocus/K-value           公式(1) S max = Defocus/K-value formula (1)
其中,Smax表示距离阈值,Defocus表示失焦距离。Among them, Smax represents the distance threshold, and Defocus represents the out-of-focus distance.
求解失焦距离具体实施方式不做限制,下面示例性的给出一种可能的实施方式。The specific implementation manner for solving the out-of-focus distance is not limited, and a possible implementation manner is exemplarily given below.
请参见图3,图3是本申请实施例提供的一种理想透镜成像原理示意图,如图所示,高斯成像原理可由公式(2)表示。Please refer to FIG. 3, which is a schematic diagram of an ideal lens imaging principle provided by an embodiment of the present application. As shown in the figure, the Gaussian imaging principle can be expressed by formula (2).
1/a+1/b=1/f公式  (2)1/a+1/b=1/f formula (2)
其中,a为像距,b为物距,f为焦距。当目标物体在无穷远时,则物距b将等于f,即无穷远物体绝对合焦。无穷远一个点,在经过透镜成像后,在绝对合焦的情况下还是一个点。如果该点弥散成一个圆斑,则是因为一定失焦,该圆斑可称为弥散圆;失焦越厉害,弥散圆越大。失焦距离可由公式(3)表示。Among them, a is the image distance, b is the object distance, and f is the focal length. When the target object is at infinity, the object distance b will be equal to f, that is, the object at infinity is absolutely in focus. A point at infinity, after imaging through the lens, is still a point when it is absolutely in focus. If the point disperses into a round spot, it is because it is out of focus. The round spot can be called a circle of confusion; the more severe the loss of focus, the larger the circle of confusion. The out-of-focus distance can be expressed by formula (3).
Defocus=b-f             (3)Defocus=b-f (3)
由于问物距b不可测得,因此,根据三角形相似原理计算失焦距离。假设弥散圆的直径可由公式(4)表示。Since the inter-object distance b is not measurable, the out-of-focus distance is calculated according to the triangle similarity principle. It is assumed that the diameter of the circle of confusion can be expressed by formula (4).
Blur_Width=Defocus×D/f           公式(4)Blur_Width=Defocus×D/f Formula (4)
其中,Blur_Width表示弥散圆的直径,D表示镜头口径的直径。由于光圈值由公式F=f/D得到。因此,弥散圆的直径可由公式(5)表示。Among them, Blur_Width represents the diameter of the circle of confusion, and D represents the diameter of the lens aperture. Because the aperture value is obtained by the formula F=f/D. Therefore, the diameter of the circle of confusion can be expressed by formula (5).
Blur_Width=Defocus/F      公式(5)Blur_Width=Defocus/F Formula (5)
其中,F表示光圈值。因此失焦距离可由公式(6)表示。Among them, F represents the aperture value. Therefore, the out-of-focus distance can be expressed by formula (6).
Defocus=F×Blur_Width       公式(6)Defocus=F×Blur_Width Formula (6)
举例来说,若镜头成像采用CMOS传感器,则一般弥散圆的直径取值为Blur_Width=2×Pixel_size。该弥散圆的直径取值仅为示例性地,不形成限制, 弥散圆的直径取值取决于显示图像的显示器尺寸,以及用户的观察距离。因此,获取CMOS传感器镜头口径的直径D的大小,从而得到光圈值F,则允许的失焦距离的范围就可以确定,即得到了当前焦点支持移动的距离阈值。For example, if a CMOS sensor is used for lens imaging, the diameter of the circle of confusion is generally Blur_Width=2×Pixel_size. The value of the diameter of the circle of confusion is only exemplary and does not form a limitation. The value of the diameter of the circle of confusion depends on the size of the display that displays the image and the observation distance of the user. Therefore, the size of the diameter D of the lens aperture of the CMOS sensor is obtained, and the aperture value F is obtained, and then the range of the allowable out-of-focus distance can be determined, that is, the distance threshold value of the current focus support movement is obtained.
进一步地,相机系统获取电机走一步的距离S 0,就能在人眼看不出明显的图像画面变模糊时,得到电机一次最大运动步数S。其中,S 0的取值由电机自定义设置。加入S 0为1mm,距离阈值S max为5mm,则电机需要走5步。 Further, the camera system obtains the distance S 0 the motor takes one step, and can obtain the maximum number of steps S of the motor at a time when the human eyes cannot see the obvious image blurring. Among them, the value of S 0 is set by the motor. If S 0 is 1mm and the distance threshold S max is 5mm, the motor needs to take 5 steps.
S13、相机系统将当前焦点向第一方向移动第一距离得到前置焦点,将当前焦点向第二方向移动第二距离得到后置焦点,第一方向与第二方向相反,第一距离与第二距离均小于或等于距离阈值。S13. The camera system moves the current focus in the first direction by the first distance to obtain the front focus, and moves the current focus in the second direction by the second distance to obtain the rear focus. The first direction is opposite to the second direction, and the first distance is opposite to the first distance. Both distances are less than or equal to the distance threshold.
请参见图4,图4是本申请实施例提供的一种前置焦点和后置焦点的位置示意图。其中,第一方向与第二方向为系统自定义设置的,并不形成限定,也可将当前焦点向前置焦点移动的方向称为第二方向,将当前焦点向后置焦点移动的方向称为第一方向。并且第一方向与第二方向相反,以此使当前焦点介于前置焦点与后置焦点中间。其次,第一距离与第二距离均小于或等于距离阈值。机系统将当前焦点向第一方向移动第一距离得到前置焦点,将当前焦点向第二方向移动第二距离得到后置焦点的具体实施方式如下。Please refer to FIG. 4, which is a schematic diagram of the positions of a front focus and a rear focus provided by an embodiment of the present application. Among them, the first direction and the second direction are self-defined settings by the system, and do not form a limitation. The direction in which the current focus moves to the front focus can also be referred to as the second direction, and the direction in which the current focus moves to the rear focus is referred to as the second direction. For the first direction. And the first direction is opposite to the second direction, so that the current focus is between the front focus and the back focus. Secondly, both the first distance and the second distance are less than or equal to the distance threshold. The machine system moves the current focus in the first direction by a first distance to obtain the front focus, and moves the current focus in the second direction by a second distance to obtain the rear focus. The specific implementation is as follows.
在一种实现方式中,第一距离与第二距离均小于距离阈值,且第一距离与第二距离相等。因此,相机系统可以通过第一距离与电机走一步的距离S 0得到相机走的步数s。相机系统控制电机先向第一方向运动s步到达前置焦点,在前置焦点处拍摄得到第二帧图像。由于第一距离和第二距离相等,进而相机系统控制电机再向第二方向运动2s步到达后置焦点,在后置焦点处拍摄得到第三帧图像。 In an implementation manner, the first distance and the second distance are both smaller than the distance threshold, and the first distance and the second distance are equal. Therefore, the camera system can obtain the number s of steps taken by the camera through the distance S 0 between the first distance and the motor step. The camera system controls the motor to move in the first direction for s steps to reach the front focus, and shoot the second frame of image at the front focus. Since the first distance and the second distance are equal, the camera system controls the motor to move in the second direction for 2 seconds to reach the rear focus, and the third frame of image is captured at the rear focus.
在一种实现方式中,第一距离和第二距离均与距离阈值相等,即第一距离和第二距离均等于S max。因此,相机系统控制电机先向第一方向运动S步到达前置焦点,在前置焦点处拍摄得到第二帧图像。由于第一距离和第二距离均与距离阈值相等,进而相机系统控制电机再向第二方向运动2S步到达后置焦点,在后置焦点处拍摄得到第三帧图像。请参见图5,图5是本申请实施例提供的一种可能的电机运动示意图。如图所示,相机系统在当前焦点左右各确定了一个点,并各拍摄了一帧图像。可以实现在对焦过程中,降低对用户的影响。 In an implementation manner, the first distance and the second distance are both equal to the distance threshold, that is, both the first distance and the second distance are equal to S max . Therefore, the camera system controls the motor to move in the first direction for S steps to reach the front focus, and shoot the second frame of image at the front focus. Since both the first distance and the second distance are equal to the distance threshold, the camera system controls the motor to move in the second direction for 2S steps to reach the rear focus, and the third frame of image is captured at the rear focus. Please refer to FIG. 5, which is a schematic diagram of a possible motor movement provided by an embodiment of the present application. As shown in the figure, the camera system determines a point on the left and right of the current focus, and shoots a frame of image each. It is possible to reduce the impact on the user during the focusing process.
S202、相机系统识别第一帧图像、第二帧图像及第三帧图像,确定摄像模组的焦点调整方向及焦点调整距离。S202: The camera system recognizes the first frame image, the second frame image, and the third frame image, and determines the focus adjustment direction and the focus adjustment distance of the camera module.
相机系统分别对第一帧图像、第二帧图像及第三帧图像进行图像识别,计算得到对应的当前焦点值、前置焦点值和后置焦点值,该焦点值用于反映焦点值对应的帧图像的清晰度。具体地,相机系统通过识别第一帧图像,得到当前焦点处的当前焦点值,也可称为AF统计值A;相机系统通过识别第二帧图像,得到前置焦点处的前置焦点值,也可称为AF统计值B;相机系统通过识别第三帧图像,得到后置焦点处的后置焦点值,也可称为AF统计值C。通过比较当前焦点值、前置焦点值和后置焦点值的大小,确定自动对焦时摄像模组的焦点调整方向及焦点调整距离。以下示例性的给出集中确定自动对焦时摄像模组的焦点调整方向及焦点调整距离的具体实施方式。The camera system performs image recognition on the first frame image, the second frame image, and the third frame image, and calculates the corresponding current focus value, front focus value, and back focus value. The focus value is used to reflect the corresponding focus value. The sharpness of the frame image. Specifically, the camera system obtains the current focus value at the current focus by recognizing the first frame of image, which can also be referred to as the AF statistical value A; the camera system obtains the front focus value at the front focus by recognizing the second frame of image, It can also be referred to as the AF statistical value B; the camera system obtains the rear focus value at the rear focus by identifying the third frame of image, which can also be referred to as the AF statistical value C. By comparing the current focus value, the front focus value and the back focus value, the focus adjustment direction and focus adjustment distance of the camera module during auto focus are determined. The following exemplarily provides specific implementations for intensively determining the focus adjustment direction and focus adjustment distance of the camera module during autofocus.
在一种实现方式中,若当前焦点值介于前置焦点值和后置焦点值之间,且前置焦点值大于后置焦点值,即A<B、A<C且C<B,则确定摄像模组的焦点调整方向为当前焦点向前置焦点调整的第一方向,焦点调整距离为当前焦点与前置焦点之间的距离。请参见图6(a),图6(a)是本申请实施例提供的一种可能的焦点调整方向及焦点调整距离的示意图。In one implementation, if the current focus value is between the front focus value and the rear focus value, and the front focus value is greater than the rear focus value, that is, A<B, A<C, and C<B, then It is determined that the focus adjustment direction of the camera module is the first direction from the current focus to the front focus adjustment, and the focus adjustment distance is the distance between the current focus and the front focus. Please refer to FIG. 6(a). FIG. 6(a) is a schematic diagram of a possible focus adjustment direction and focus adjustment distance provided by an embodiment of the present application.
在一种实现方式中,若当前焦点值介于前置焦点值和后置焦点值之间,且前置焦点值小于后置焦点值,即A<B、A<C且B<C,则确定摄像模组的焦点调整方向为当前焦点向后置焦点调整的第二方向,摄像模组的焦点调整距离为当前焦点与后置焦点之间的距离。请参见图6(b),图6(b)是本申请实施例提供的一种可能的焦点调整方向及焦点调整距离的示意图。In one implementation, if the current focus value is between the front focus value and the back focus value, and the front focus value is less than the back focus value, that is, A<B, A<C, and B<C, then It is determined that the focus adjustment direction of the camera module is the second direction of the current focus to the rear focus adjustment, and the focus adjustment distance of the camera module is the distance between the current focus and the rear focus. Please refer to FIG. 6(b). FIG. 6(b) is a schematic diagram of a possible focus adjustment direction and focus adjustment distance provided by an embodiment of the present application.
在一种实现方式中,若当前焦点值均大于前置焦点值和后置焦点值,即A>B且A>C,则确定无需调整摄像模组的当前焦距,摄像模组的焦点调整方向及焦点调整距离均为空。In one implementation, if the current focus value is greater than the front focus value and the back focus value, that is, A>B and A>C, it is determined that the current focus of the camera module does not need to be adjusted, and the focus adjustment direction of the camera module And the focus adjustment distance is empty.
S203、相机系统按照摄像模组的焦点调整方向及焦点调整距离,调整摄像模组的当前焦点。S203. The camera system adjusts the current focus of the camera module according to the focus adjustment direction and the focus adjustment distance of the camera module.
相机系统按照摄像模组的焦点调整方向及焦点调整距离,调整摄像模组的当前焦点,以完成对焦过程。以下示出几种可能的实施方式。The camera system adjusts the current focus of the camera module according to the focus adjustment direction and the focus adjustment distance of the camera module to complete the focusing process. Several possible implementations are shown below.
在一种实现方式中,相机系统按照摄像模组的焦点调整方向及焦点调整距 离,将摄像模组的当前焦点沿着第一方向调整至前置焦点。In one implementation, the camera system adjusts the current focus of the camera module to the front focus along the first direction according to the focus adjustment direction and the focus adjustment distance of the camera module.
在一种实现方式中,相机系统按照摄像模组的焦点调整方向及焦点调整距离将摄像模组的当前焦点沿着第二方向调整至后置焦点。In one implementation, the camera system adjusts the current focus of the camera module to the rear focus along the second direction according to the focus adjustment direction and the focus adjustment distance of the camera module.
在一种实现方式中,由于焦点调整方向及焦点调整距离均为空,因此相机系统不对当前焦点进行调整。In an implementation manner, since the focus adjustment direction and the focus adjustment distance are both empty, the camera system does not adjust the current focus.
可选地,若调整后摄像模组在调整后的焦点拍摄出的画面依旧不清晰,可再次触发自动对焦。则相机系统将该调整后的焦点作为当前焦点,重新执行本申请实施例中图2提供的焦点调整方法。Optionally, if the image captured by the camera module at the adjusted focus is still not clear after the adjustment, the auto focus can be triggered again. Then the camera system uses the adjusted focus as the current focus, and re-executes the focus adjustment method provided in FIG. 2 in the embodiment of the present application.
在本申请实施例中,相机系统获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像,该当前焦点介于前置焦点和后置焦点之间;识别第一帧图像、第二帧图像及第三帧图像,确定摄像模组的焦点调整方向及焦点调整距离;按照摄像模组的焦点调整方向及焦点调整距离,调整摄像模组的当前焦点。通过本申请实施例,在物距存在变化时,通过摄像模组的当前焦点、前置焦点和后置焦点确定摄像模组的焦点调整方向及焦点调整距离,可以实现对摄像模组的焦点进行自动调整。当前焦点介于前置焦点和后置焦点之间,因此对图像的清晰度影响较小,能够不影响用户体验。In the embodiment of the present application, the camera system obtains the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus. The current focus is between the front focus and the back focus. Between the focus and the rear focus; identify the first frame image, the second frame image and the third frame image, determine the focus adjustment direction and focus adjustment distance of the camera module; according to the focus adjustment direction and focus adjustment distance of the camera module, Adjust the current focus of the camera module. Through the embodiments of the present application, when the object distance changes, the focus adjustment direction and focus adjustment distance of the camera module are determined by the current focus, front focus, and rear focus of the camera module, so that the focus of the camera module can be adjusted. auto-adjust. The current focus is between the front focus and the rear focus, so the impact on the clarity of the image is small, and the user experience may not be affected.
请参见图7,图7是本申请实施例提供的又一种相机系统的结构示意图。本申请实施例中所描述的相机系统70,包括:处理器701、存储器702、通信接口703、摄像模组704。处理器701、存储器702、通信接口703、摄像模组704通过一条或多条通信总线连接。Please refer to FIG. 7, which is a schematic structural diagram of another camera system provided by an embodiment of the present application. The camera system 70 described in the embodiment of the present application includes: a processor 701, a memory 702, a communication interface 703, and a camera module 704. The processor 701, the memory 702, the communication interface 703, and the camera module 704 are connected by one or more communication buses.
上述处理器701可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,处理器701被配置为支持相机系统执行图4所述方法中相机系统的相应的功能。The aforementioned processor 701 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), application specific integrated circuits (ASICs). ), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The processor 701 is configured to support the camera system to perform the corresponding functions of the camera system in the method described in FIG. 4.
上述存储器702可以包括只读存储器和随机存取存储器,并向处理器701提供计算机程序和数据。存储器702的一部分还可以包括非易失性随机存取存 储器。其中,处理器701调用存储器702中的程序指令用于执行以下步骤:The aforementioned memory 702 may include a read-only memory and a random access memory, and provides computer programs and data to the processor 701. A part of the memory 702 may also include a non-volatile random access memory. Wherein, the processor 701 calls the program instructions in the memory 702 to execute the following steps:
获取摄像模组704在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像,该当前焦点介于前置焦点和后置焦点之间;Acquiring the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module 704 at the current focus, the front focus, and the back focus, where the current focus is between the front focus and the back focus;
识别第一帧图像、第二帧图像及第三帧图像,确定摄像模组704的焦点调整方向及焦点调整距离;Identify the first frame image, the second frame image, and the third frame image, and determine the focus adjustment direction and focus adjustment distance of the camera module 704;
按照摄像模组704的焦点调整方向及焦点调整距离,调整摄像模组704的当前焦点。According to the focus adjustment direction and focus adjustment distance of the camera module 704, the current focus of the camera module 704 is adjusted.
在一种实现方式中,所述处理器701在用于获取摄像模组704在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像之前,用于:确定摄像模组704拍摄的前置焦点和后置焦点。In an implementation manner, the processor 701 is used to obtain the first frame image, the second frame image, and the third frame image corresponding to the camera module 704 at the current focus, the front focus, and the back focus. , Used to: determine the front focus and the back focus of the camera module 704 shooting.
在一种实现方式中,处理器701用于:获取摄像模组704在当前焦点处拍摄时的拍摄参数,该拍摄参数包括光圈值、镜头口径的直径和步长因子,步长因子用于指示单位距离内摄像模组704的镜头的移动步长;对拍摄参数进行距离转换,得到当前焦点支持移动的距离阈值;将当前焦点向第一方向移动第一距离得到前置焦点,将当前焦点向第二方向移动第二距离得到后置焦点,第一方向与第二方向相反,第一距离与第二距离均小于或等于距离阈值。In one implementation, the processor 701 is configured to: obtain the shooting parameters of the camera module 704 when shooting at the current focus, the shooting parameters include the aperture value, the diameter of the lens aperture, and the step factor, and the step factor is used to indicate The movement step length of the lens of the camera module 704 within a unit distance; the distance conversion of the shooting parameters is carried out to obtain the distance threshold of the current focus support movement; the current focus is moved in the first direction by the first distance to obtain the front focus, and the current focus is The rear focus is obtained by moving the second distance in the second direction, the first direction is opposite to the second direction, and both the first distance and the second distance are less than or equal to the distance threshold.
在一种实现方式中,第一距离和第二距离均与距离阈值相等。In one implementation, both the first distance and the second distance are equal to the distance threshold.
在一种实现方式中,处理器701用于:根据光圈值和镜头口径的直径,计算得到摄像模组704的失焦距离;根据失焦距离和步长因子,计算得到当前焦点支持移动的距离阈值。In one implementation, the processor 701 is configured to: calculate the out-of-focus distance of the camera module 704 according to the aperture value and the diameter of the lens aperture; and calculate the distance supported by the current focus to move according to the out-of-focus distance and the step factor. Threshold.
在一种实现方式中,处理器701用于:对第一帧图像、第二帧图像及第三帧图像进行图像识别,计算得到对应的当前焦点值、前置焦点值和后置焦点值,焦点值用于反映焦点值对应的帧图像的清晰度;若当前焦点值介于前置焦点值和后置焦点值之间,且前置焦点值大于后置焦点值,则确定摄像模组704的焦点调整方向为当前焦点向前置焦点调整的第一方向,焦点调整距离为当前焦点与前置焦点之间的距离;将摄像模组704的当前焦点沿着第一方向调整至前置焦点。In an implementation manner, the processor 701 is configured to: perform image recognition on the first frame image, the second frame image, and the third frame image, and calculate the corresponding current focus value, front focus value, and back focus value. The focus value is used to reflect the clarity of the frame image corresponding to the focus value; if the current focus value is between the front focus value and the back focus value, and the front focus value is greater than the back focus value, the camera module 704 is determined The focus adjustment direction of is the first direction from the current focus to the front focus adjustment, and the focus adjustment distance is the distance between the current focus and the front focus; the current focus of the camera module 704 is adjusted to the front focus along the first direction .
在一种实现方式中,处理器701用于:对第一帧图像、第二帧图像及第三帧图像进行图像识别,对应计算得到当前焦点值、前置焦点值和后置焦点值, 焦点值用于反映焦点值对应的帧图像的清晰度;若当前焦点值介于前置焦点值和后置焦点值之间,且前置焦点值小于后置焦点值,则确定摄像模组704的焦点调整方向为当前焦点向后置焦点调整的第二方向,摄像模组704的焦点调整距离为当前焦点与后置焦点之间的距离;将摄像模组704的当前焦点沿着第二方向调整至后置焦点。In an implementation manner, the processor 701 is configured to: perform image recognition on the first frame image, the second frame image, and the third frame image, and correspondingly calculate the current focus value, the front focus value, and the back focus value. The value is used to reflect the sharpness of the frame image corresponding to the focus value; if the current focus value is between the front focus value and the back focus value, and the front focus value is less than the back focus value, the camera module 704 is determined to be The focus adjustment direction is the second direction of the current focus to the rear focus adjustment, the focus adjustment distance of the camera module 704 is the distance between the current focus and the rear focus; the current focus of the camera module 704 is adjusted along the second direction To the rear focus.
在一种实现方式中,处理器701用于:对第一帧图像、第二帧图像及第三帧图像进行图像识别,对应计算得到当前焦点值、前置焦点值和后置焦点值,焦点值用于反映焦点值对应的帧图像的清晰度;若当前焦点值均大于前置焦点值和后置焦点值,则确定无需调整摄像模组704的当前焦距,摄像模组704的焦点调整方向及焦点调整距离均为空。In one implementation, the processor 701 is configured to: perform image recognition on the first frame image, the second frame image, and the third frame image, and correspondingly calculate the current focus value, the front focus value, and the back focus value. The value is used to reflect the sharpness of the frame image corresponding to the focus value; if the current focus value is greater than the front focus value and the rear focus value, it is determined that there is no need to adjust the current focus of the camera module 704, and the focus adjustment direction of the camera module 704 And the focus adjustment distance is empty.
本申请实施例还提供一种可读存储介质,所述可读存储介质存储有计算机程序,所述计算机程序被处理器执行时,可以用于实现本申请实施例图4所对应实施例中描述的焦点调整方法,在此不再赘述。The embodiment of the present application also provides a readable storage medium, and the readable storage medium stores a computer program. When the computer program is executed by a processor, it can be used to implement the description in the embodiment corresponding to FIG. 4 of the embodiment of the present application. The focus adjustment method will not be repeated here.
所述计算机可读存储介质可以是前述任一实施例所述的相机系统的内部存储单元,例如设备的硬盘或内存。所述计算机可读存储介质也可以是所述相机系统的外部存储设备,例如所述设备上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述计算机可读存储介质还可以既包括所述相机系统的内部存储单元也包括外部存储设备。所述计算机可读存储介质用于存储所述计算机程序以及所述相机系统所需的其他程序和数据。所述计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。The computer-readable storage medium may be an internal storage unit of the camera system described in any of the foregoing embodiments, such as a hard disk or memory of a device. The computer-readable storage medium may also be an external storage device of the camera system, such as a plug-in hard disk equipped on the device, a smart memory card (SMC), or a secure digital (SD) Card, Flash Card, etc. Further, the computer-readable storage medium may also include both an internal storage unit of the camera system and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the camera system. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于可读取存储介质中,所述程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing relevant hardware through a computer program. The program can be stored in a readable storage medium, and the program can be stored in a readable storage medium. When executed, it may include the procedures of the above-mentioned method embodiments. Wherein, the storage medium may be a magnetic disk, an optical disc, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM), etc.
以上所揭露的仅为本申请较佳实施例而已,当然不能以此来限定本申请之权利范围,因此依本申请权利要求所作的等同变化,仍属本申请所涵盖的范围。The above-disclosed are only the preferred embodiments of the application, which of course cannot be used to limit the scope of rights of the application. Therefore, equivalent changes made in accordance with the claims of the application still fall within the scope of the application.

Claims (10)

  1. 一种焦点调整方法,其特征在于,所述方法包括:A focus adjustment method, characterized in that the method includes:
    获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像,所述当前焦点介于所述前置焦点和所述后置焦点之间;Acquire the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus, where the current focus is between the front focus and the back focus Between focus
    识别所述第一帧图像、所述第二帧图像及所述第三帧图像,确定所述摄像模组的焦点调整方向及焦点调整距离;Identifying the first frame image, the second frame image, and the third frame image, and determining the focus adjustment direction and focus adjustment distance of the camera module;
    按照所述摄像模组的焦点调整方向及焦点调整距离,调整所述摄像模组的当前焦点。Adjust the current focus of the camera module according to the focus adjustment direction and the focus adjustment distance of the camera module.
  2. 如权利要求1所述的方法,其特征在于,所述获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像之前,所述方法还包括:The method according to claim 1, characterized in that, before acquiring the first frame image, the second frame image, and the third frame image correspondingly taken by the camera module at the current focus, the front focus, and the back focus, The method also includes:
    确定所述摄像模组拍摄的所述前置焦点和所述后置焦点。Determine the front focus and the rear focus captured by the camera module.
  3. 如权利要求2所述的方法,其特征在于,所述确定所述摄像模组拍摄的所述前置焦点和所述后置焦点包括:The method of claim 2, wherein the determining the front focus and the back focus captured by the camera module comprises:
    获取所述摄像模组在所述当前焦点处拍摄时的拍摄参数,所述拍摄参数包括光圈值、镜头口径的直径和步长因子,所述步长因子用于指示单位距离内所述摄像模组的镜头的移动步长;Acquire the shooting parameters when the camera module is shooting at the current focus, the shooting parameters include the aperture value, the diameter of the lens aperture, and a step factor, and the step factor is used to indicate the camera module within a unit distance The movement step length of the group's lens;
    对所述拍摄参数进行距离转换,得到所述当前焦点支持移动的距离阈值;Performing distance conversion on the shooting parameters to obtain a distance threshold for the current focus to support movement;
    将所述当前焦点向第一方向移动第一距离得到所述前置焦点,将所述当前焦点向第二方向移动第二距离得到所述后置焦点,所述第一方向与所述第二方向相反,所述第一距离与所述第二距离均小于或等于所述距离阈值。Move the current focus in a first direction by a first distance to obtain the front focus, move the current focus in a second direction by a second distance to obtain the rear focus, and the first direction is the same as the second The directions are opposite, and the first distance and the second distance are both less than or equal to the distance threshold.
  4. 如权利要求3所述的方法,其特征在于,所述第一距离和所述第二距离均与所述距离阈值相等。The method of claim 3, wherein the first distance and the second distance are both equal to the distance threshold.
  5. 如权利要求3所述的方法,其特征在于,所述对所述拍摄参数进行距离转换,得到所述当前焦点支持移动的距离阈值包括:The method according to claim 3, wherein the performing distance conversion on the shooting parameter to obtain the distance threshold for the current focus to support movement comprises:
    根据所述光圈值和所述镜头口径的直径,计算得到所述摄像模组的失焦距离;Calculating the out-of-focus distance of the camera module according to the aperture value and the diameter of the lens aperture;
    根据所述失焦距离和所述步长因子,计算得到所述当前焦点支持移动的距离阈值。According to the out-of-focus distance and the step size factor, a distance threshold for the current focus to support movement is calculated.
  6. 如权利要求1-5中任一项所述的方法,其特征在于,所述识别所述第一帧图像、所述第二帧图像及所述第三帧图像,确定所述摄像模组的焦点调整方向及焦点调整距离包括:The method according to any one of claims 1-5, wherein the identifying the first frame image, the second frame image, and the third frame image, and determining the camera module Focus adjustment direction and focus adjustment distance include:
    对所述第一帧图像、所述第二帧图像及所述第三帧图像进行图像识别,计算得到对应的当前焦点值、前置焦点值和后置焦点值,所述焦点值用于反映所述焦点值对应的帧图像的清晰度;Perform image recognition on the first frame image, the second frame image, and the third frame image, and calculate the corresponding current focus value, front focus value, and back focus value. The focus value is used to reflect The definition of the frame image corresponding to the focus value;
    若所述当前焦点值介于所述前置焦点值和所述后置焦点值之间,且所述前置焦点值大于所述后置焦点值,则确定所述摄像模组的焦点调整方向为所述当前焦点向所述前置焦点调整的第一方向,所述焦点调整距离为所述当前焦点与所述前置焦点之间的距离;If the current focus value is between the front focus value and the back focus value, and the front focus value is greater than the back focus value, determine the focus adjustment direction of the camera module Is the first direction in which the current focus is adjusted to the front focus, and the focus adjustment distance is the distance between the current focus and the front focus;
    所述按照所述摄像模组的焦点调整方向及焦点调整距离,调整所述摄像模组的当前焦点包括:将所述摄像模组的当前焦点沿着所述第一方向调整至所述前置焦点。The adjusting the current focus of the camera module according to the focus adjustment direction and the focus adjustment distance of the camera module includes: adjusting the current focus of the camera module along the first direction to the front focus.
  7. 如权利要求1-5中任一项所述的方法,其特征在于,所述识别所述第一帧图像、所述第二帧图像及所述第三帧图像,确定所述摄像模组的焦点调整方向及焦点调整距离包括:The method according to any one of claims 1-5, wherein the identifying the first frame image, the second frame image, and the third frame image, and determining the camera module Focus adjustment direction and focus adjustment distance include:
    对所述第一帧图像、所述第二帧图像及所述第三帧图像进行图像识别,对应计算得到当前焦点值、前置焦点值和后置焦点值,所述焦点值用于反映所述焦点值对应的帧图像的清晰度;Perform image recognition on the first frame image, the second frame image, and the third frame image, and correspondingly calculate the current focus value, the front focus value, and the back focus value. The focus value is used to reflect all The definition of the frame image corresponding to the focus value;
    若所述当前焦点值介于所述前置焦点值和所述后置焦点值之间,且所述前置焦点值小于所述后置焦点值,则确定所述摄像模组的焦点调整方向为所述当前焦点向所述后置焦点调整的第二方向,所述摄像模组的焦点调整距离为所述当前焦点与所述后置焦点之间的距离;If the current focus value is between the front focus value and the back focus value, and the front focus value is less than the back focus value, then the focus adjustment direction of the camera module is determined Is the second direction in which the current focus is adjusted to the rear focus, and the focus adjustment distance of the camera module is the distance between the current focus and the rear focus;
    所述按照所述摄像模组的焦点调整方向及焦点调整距离,调整所述摄像模组的当前焦点包括:将所述摄像模组的当前焦点沿着所述第二方向调整至所述后置焦点。The adjusting the current focus of the camera module according to the focus adjustment direction and the focus adjustment distance of the camera module includes: adjusting the current focus of the camera module to the rear position along the second direction focus.
  8. 如权利要求1-5中任一项所述的方法,其特征在于,所述识别所述第 一帧图像、所述第二帧图像及所述第三帧图像,确定所述摄像模组的焦点调整方向及焦点调整距离包括:The method according to any one of claims 1-5, wherein the identifying the first frame image, the second frame image, and the third frame image, and determining the camera module Focus adjustment direction and focus adjustment distance include:
    对所述第一帧图像、所述第二帧图像及所述第三帧图像进行图像识别,对应计算得到当前焦点值、前置焦点值和后置焦点值,所述焦点值用于反映所述焦点值对应的帧图像的清晰度;Perform image recognition on the first frame image, the second frame image, and the third frame image, and correspondingly calculate the current focus value, the front focus value, and the back focus value. The focus value is used to reflect all The definition of the frame image corresponding to the focus value;
    若所述当前焦点值均大于所述前置焦点值和所述后置焦点值,则确定无需调整所述摄像模组的当前焦距,所述摄像模组的焦点调整方向及焦点调整距离均为空。If the current focus value is greater than the front focus value and the rear focus value, it is determined that there is no need to adjust the current focus of the camera module, and the focus adjustment direction and focus adjustment distance of the camera module are both air.
  9. 一种相机系统,其特征在于,包括存储器和处理器;A camera system, characterized in that it comprises a memory and a processor;
    所述存储器,用于存储计算机程序;The memory is used to store a computer program;
    所述处理器,调用所述计算机程序,用于:The processor calls the computer program for:
    获取摄像模组在当前焦点、前置焦点和后置焦点处对应拍摄的第一帧图像、第二帧图像及第三帧图像,所述当前焦点介于所述前置焦点和所述后置焦点之间;Acquire the first frame image, the second frame image, and the third frame image correspondingly captured by the camera module at the current focus, the front focus, and the back focus, where the current focus is between the front focus and the back focus Between focus
    识别所述第一帧图像、所述第二帧图像及所述第三帧图像,确定所述摄像模组的焦点调整方向及焦点调整距离;Identifying the first frame image, the second frame image, and the third frame image, and determining the focus adjustment direction and focus adjustment distance of the camera module;
    按照所述摄像模组的焦点调整方向及焦点调整距离,调整所述摄像模组的当前焦点。Adjust the current focus of the camera module according to the focus adjustment direction and the focus adjustment distance of the camera module.
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序在被执行时,实现如权利要求1-7任一项所述的焦点调整方法。A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed, the focus adjustment method according to any one of claims 1-7 is realized .
PCT/CN2019/122104 2019-11-29 2019-11-29 Focus adjustment method, camera module, and computer readable storage medium WO2021102959A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/122104 WO2021102959A1 (en) 2019-11-29 2019-11-29 Focus adjustment method, camera module, and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/122104 WO2021102959A1 (en) 2019-11-29 2019-11-29 Focus adjustment method, camera module, and computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2021102959A1 true WO2021102959A1 (en) 2021-06-03

Family

ID=76129068

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/122104 WO2021102959A1 (en) 2019-11-29 2019-11-29 Focus adjustment method, camera module, and computer readable storage medium

Country Status (1)

Country Link
WO (1) WO2021102959A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101794056A (en) * 2010-02-05 2010-08-04 明基电通有限公司 Photographing setting control method and photographing device
CN104730804A (en) * 2015-02-17 2015-06-24 苏州佳世达电通有限公司 Camera device and automatic focusing method
US9148557B2 (en) * 2010-07-16 2015-09-29 Canon Kabushiki Kaisha Focus adjustment apparatus and method, and image capturing apparatus and control method thereof
CN106154688A (en) * 2015-04-07 2016-11-23 中兴通讯股份有限公司 A kind of method and device of auto-focusing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101794056A (en) * 2010-02-05 2010-08-04 明基电通有限公司 Photographing setting control method and photographing device
US9148557B2 (en) * 2010-07-16 2015-09-29 Canon Kabushiki Kaisha Focus adjustment apparatus and method, and image capturing apparatus and control method thereof
CN104730804A (en) * 2015-02-17 2015-06-24 苏州佳世达电通有限公司 Camera device and automatic focusing method
CN106154688A (en) * 2015-04-07 2016-11-23 中兴通讯股份有限公司 A kind of method and device of auto-focusing

Similar Documents

Publication Publication Date Title
JP7145208B2 (en) Method and Apparatus and Storage Medium for Dual Camera Based Imaging
WO2019105214A1 (en) Image blurring method and apparatus, mobile terminal and storage medium
US10021307B2 (en) Processing apparatus for camera shake correction
CN107710735B (en) System and method for autofocus triggering
JP2020528622A (en) Image processing methods, equipment and devices
US11682107B2 (en) Depth of field adjustment in images based on time of flight depth maps
WO2014153950A1 (en) Quick automatic focusing method and image acquisition device
JP2013070164A (en) Imaging device and imaging method
US11128805B2 (en) Zoom control device, zoom control method, control program, and imaging apparatus equipped with zoom control device
JP2008288975A (en) Imaging apparatus, imaging method and imaging program
CN110708463B (en) Focusing method, focusing device, storage medium and electronic equipment
US9451149B2 (en) Processing apparatus, processing method, and program
WO2018228329A1 (en) Focusing control method and device, computer storable medium and mobile terminal
JP6432038B2 (en) Imaging device
WO2016197494A1 (en) Method and device for adjusting focusing area
WO2017054475A1 (en) Image capturing method, device, and terminal
CN108289170B (en) Photographing apparatus, method and computer readable medium capable of detecting measurement area
TW201541143A (en) Auto-focus system for multiple lens and method thereof
JP2015031726A (en) Imaging device, control method of imaging device, control program of imaging device, and recording medium
JP5257969B2 (en) Focus position control device, focus position control method, focus position control program
JPWO2014080682A1 (en) Imaging apparatus, focusing method thereof and focusing control program
JP2014215476A (en) Imaging apparatus and method for controlling the same
WO2021102959A1 (en) Focus adjustment method, camera module, and computer readable storage medium
JPH05211625A (en) Image pickup device
JP2013085239A (en) Imaging apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19954077

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19954077

Country of ref document: EP

Kind code of ref document: A1