Camera focusing method and camera calibration method

By calibrating the reference defocus conversion coefficient in the electronic camera and adjusting it according to the changes in optical parameters, the problem of the cumbersome optical parameter variable lens in the prior art needs to perform the DCC calibration process for each parameter is solved, and a fast and simplified camera focus process is achieved and continuously adjustable optical parameters are supported.

WO2025119231A1PCT designated stage expired Publication Date: 2025-06-12HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/136836
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-08
Filing Date
2024-12-04
Publication Date
2025-06-12

AI Technical Summary

Technical Problem

In prior art, in electronic cameras using optical parameter variable lenses, the defocus conversion coefficient (DCC) calibration process needs to be performed separately for each optical parameter, resulting in cumbersome, time-consuming and inability to support continuously adjustable optical parameters.

Method used

By calibrating the reference defocus conversion coefficient when the camera adopts reference optical parameters, and adjusting the reference defocus conversion coefficient according to the changes in real-time optical parameters, the current defocus conversion coefficient corresponding to the current optical parameters is determined, thereby realizing automatic focus on the camera lens.

Benefits of technology

The camera is simplified in DCC calibration process, saves calibration time, and supports the camera to have continuously adjustable optical parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024136836_12062025_PF_FP_ABST
    Figure CN2024136836_12062025_PF_FP_ABST
Patent Text Reader

Abstract

A camera focusing method and a camera calibration method, relating to the technical field of computer vision. The camera focusing method comprises: an electronic device acquires current optical parameters of a camera and, on the basis of the current optical parameters, focuses a lens of the camera, a focusing displacement being determined on the basis of the current defocus conversion coefficient, the current defocus conversion coefficient being determined on the basis of an adjustment coefficient and a reference defocus conversion coefficient, the adjustment coefficient being determined on the basis of the current optical parameters and reference optical parameters, and the reference defocus conversion coefficient being calibrated when the camera uses the reference optical parameters. The electronic device can calibrate the reference defocus conversion coefficient only when the camera uses the reference optical parameters, and does not need to perform a DCC calibration process for each optical parameter of the camera, which can not only simplify the DCC calibration process of the camera and save the time for DCC calibration of the camera, but also support continuously adjustable optical parameters of the camera.
Need to check novelty before this filing date? Find Prior Art

Description

Camera focusing method and camera calibration method

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of the People's Republic of China on December 8, 2023, with application number 202311693296.5 and application name "A Camera Focusing Method and Camera Calibration Method", the entire contents of which are incorporated by reference into this application. Technical Field

[0003] The present application relates to the field of computer vision technology, and in particular to a camera focusing method and a camera calibration method. Background Art

[0004] With the development of electronic cameras, users have an increasing demand for taking photos or videos with electronic cameras, and the requirements for the shooting quality of electronic cameras are also getting higher and higher. In order to make the target object captured by the electronic camera clearer, the target object can be used as a focus point and autofocus is performed based on the focus point.

[0005] Phase detection auto focus (PDAF) is an autofocus technology. When electronic cameras use PDAF for autofocus, they need to use a defocus conversion coefficient (DCC). Therefore, the DCC of the electronic camera needs to be calibrated in advance.

[0006] If the lens used in an electronic camera is a zoom lens or other lens with variable optical parameters, the lens has different DCCs under different optical parameters. Therefore, the electronic camera needs to perform a DCC calibration process for each optical parameter to obtain the DCC corresponding to each optical parameter. Repeating the DCC calibration process for an electronic camera is not only cumbersome and time-consuming, but also cannot support continuously adjustable optical parameters. Summary of the Invention

[0007] The present application provides a camera focusing method and a camera calibration method, which can save the time of camera DCC calibration and support the camera to have continuously adjustable optical parameters.

[0008] In a first aspect, a camera focusing method is provided. The execution subject of the method may be an electronic device or a chip, chip system or circuit located in the electronic device. The electronic device may be, but is not limited to, an electronic camera, a smart phone, a wearable device, etc. The following description will be made by taking the electronic device executing the method as an example. The method can be implemented by the following steps: the electronic device obtains the current optical parameters of the camera, and focuses the lens of the camera based on the current optical parameters of the camera. The displacement used to focus the lens of the camera is determined based on the current defocus conversion coefficient; the current defocus conversion coefficient is determined based on the adjustment coefficient and the reference defocus conversion coefficient; the adjustment coefficient is determined based on the current optical parameters and the reference optical parameters of the camera; the reference defocus conversion coefficient is calibrated when the camera adopts the reference optical parameters.

[0009] The above-mentioned electronic device can calibrate the reference defocus conversion coefficient when the camera adopts the reference optical parameters. The current defocus conversion coefficient corresponding to the current optical parameters can be determined by the adjustment coefficient determined by the real-time changing current optical parameters and the reference optical parameters, and the calibrated reference defocus conversion coefficient. Then, based on the current defocus conversion coefficient, the displacement used to focus the camera lens can be determined. It can be seen from this that the present application can calibrate the reference defocus conversion coefficient only when the camera adopts the reference optical parameters, without having to perform a DCC calibration process for each optical parameter of the camera. This not only simplifies the process of DCC calibration of the camera and saves the time of DCC calibration of the camera, but also supports the camera with continuously adjustable optical parameters.

[0010] In an optional implementation, the electronic device can determine the displacement in the following manner: obtaining the current phase difference of the camera; adjusting the reference defocus conversion coefficient according to the adjustment coefficient to obtain the current defocus conversion coefficient corresponding to the current optical parameters; and determining the displacement used to focus the camera lens based on the current defocus conversion coefficient and the current phase difference.

[0011] In the above implementation method, the electronic device can calibrate the reference defocus conversion coefficient when the camera uses reference optical parameters, and only save the reference defocus conversion coefficient corresponding to the reference optical parameters. When using the camera to take an image, the reference defocus conversion coefficient is adjusted according to the adjustment coefficient to obtain the current defocus conversion coefficient corresponding to the current optical parameters. There is no need to save the defocus conversion coefficient corresponding to each optical parameter, which can save storage space of the electronic device.

[0012] In another optional implementation, the electronic device can determine the displacement by: obtaining the current phase difference of the camera; obtaining a pre-stored current defocus conversion coefficient corresponding to the current optical parameters; and determining the displacement used to focus the camera lens based on the current defocus conversion coefficient and the current phase difference. The current defocus conversion coefficient is obtained by adjusting the reference defocus conversion coefficient based on the adjustment coefficient.

[0013] In the above implementation, the electronic device can calibrate the reference defocus conversion coefficient when the camera adopts the reference optical parameters, and then adjust the reference defocus conversion coefficient according to the adjustment coefficient to obtain the defocus conversion coefficient corresponding to any optical parameter, and save the defocus conversion coefficient corresponding to each optical parameter. Through this method, there is no need to perform a DCC calibration process for each optical parameter of the camera, which not only simplifies the process of DCC calibration of the camera, but also saves the time of DCC calibration of the camera.

[0014] In an optional implementation manner, the electronic device may obtain the current phase difference of the camera in the following manner: the electronic device captures an initial image; and determines the current phase difference of the camera based on the initial image.

[0015] In an optional implementation, the adjustment coefficient for adjusting the reference defocus conversion coefficient is determined based on a ratio of the current optical parameter to the reference optical parameter.

[0016] Since the ratio between optical parameters can reflect the conversion relationship between DCCs corresponding to different optical parameters, the adjustment coefficient can be determined based on the ratio of the current optical parameter to the reference optical parameter. The reference defocus conversion coefficient can be adjusted using the adjustment coefficient to obtain the current defocus conversion coefficient corresponding to the current optical parameter.

[0017] In an optional implementation, the adjustment coefficient for adjusting the reference defocus conversion coefficient is determined based on the mth power of the ratio of the current optical parameter to the reference optical parameter.

[0018] The value of m can be adjusted according to the actual physical parameters of the lens. Based on the m-th power of the ratio of the current optical parameter to the reference optical parameter, the adjustment coefficient can be accurately determined for different lenses.

[0019] In an optional implementation, the optical parameters of the camera may include at least one or a combination of the following optical parameters: aperture number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, and ratio of focal length to entrance pupil diameter.

[0020] There is a conversion relationship between different optical parameters of the camera, so the optical parameters used in this application can be part or all of the above optical parameters.

[0021] In an optional implementation, the optical parameters of the camera may include a linear combination of the following optical parameters: aperture number, focal length, and the reciprocal of the entrance pupil diameter.

[0022] In another optional implementation, the optical parameters of the camera may include a linear combination of the following optical parameters: focal length, the reciprocal of the entrance pupil diameter, and the ratio of the focal length to the entrance pupil diameter.

[0023] In a second aspect, a camera calibration method is provided. The execution subject of the method can be an electronic device or a chip, chip system or circuit located in the electronic device. The electronic device can be, but is not limited to, an electronic camera, a smart phone, a wearable device, etc. The following is an example of an electronic device executing the method. The method can be implemented by the following steps: when the camera adopts reference optical parameters, calibrating the reference defocus conversion coefficient of the camera; based on the adjustment coefficient, adjusting the reference defocus conversion coefficient to obtain a target defocus conversion coefficient corresponding to any optical parameter; wherein the adjustment coefficient is determined based on the any optical parameter and the reference optical parameter.

[0024] In an optional implementation, the adjustment coefficient is determined based on a ratio of any one of the optical parameters to a reference optical parameter.

[0025] In an optional implementation, the adjustment coefficient is determined based on the mth power of a ratio of any one of the optical parameters to a reference optical parameter.

[0026] In an optional implementation, the optical parameters of the camera may include at least one or a combination of the following optical parameters: aperture number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, and ratio of focal length to entrance pupil diameter.

[0027] In an optional implementation, the optical parameters of the camera may include a linear combination of the following optical parameters: aperture number, focal length, and the reciprocal of the entrance pupil diameter.

[0028] In another optional implementation, the optical parameters of the camera may include a linear combination of the following optical parameters: focal length, the reciprocal of the entrance pupil diameter, and the ratio of the focal length to the entrance pupil diameter.

[0029] In a third aspect, a camera focusing device is provided, which includes corresponding functional modules, each of which is used to implement the steps in the camera focusing method provided in the first aspect. For details, please refer to the detailed description in the method example, which will not be repeated here. The function can be implemented by hardware, or the corresponding software can be executed by hardware. The hardware or software includes one or more modules corresponding to the above functions. For example, the camera focusing device may include a parameter acquisition unit and a camera focusing unit. The parameter acquisition unit can be used to acquire the current optical parameters of the camera; the camera focusing unit can be used to focus the camera lens based on the current optical parameters of the camera; wherein the displacement used to focus the camera lens is determined based on the current defocus conversion coefficient; the current defocus conversion coefficient is determined based on the adjustment coefficient and the reference defocus conversion coefficient; the adjustment coefficient is determined based on the current optical parameters and the reference optical parameters of the camera; the reference defocus conversion coefficient is calibrated when the camera adopts the reference optical parameters.

[0030] In a fourth aspect, a camera calibration device is provided, which includes corresponding functional modules, which are respectively used to implement the steps in the camera calibration method provided in the second aspect. Please refer to the detailed description in the method example for details, which will not be repeated here. The functions can be implemented by hardware, or by executing corresponding software implementations through hardware. The hardware or software includes one or more modules corresponding to the above functions. For example, the camera focusing device may include a camera calibration unit and a conversion unit. The camera calibration unit can be used to calibrate the reference defocus conversion coefficient of the camera when the camera adopts reference optical parameters; the conversion unit can be used to adjust the reference defocus conversion coefficient based on the adjustment coefficient to obtain the target defocus conversion coefficient corresponding to any optical parameter; the adjustment coefficient is determined based on any of the optical parameters and the reference optical parameters.

[0031] In a fifth aspect, a chip is provided, which can be used in the above-mentioned electronic device. The chip may include a processor and a power supply circuit, wherein the power supply circuit is used to power the processor, and the processor is used to execute a computer program to implement any of the methods described in the first aspect or any of the methods described in the second aspect.

[0032] In the sixth aspect, an electronic device is provided, which may include a processor and a memory; the memory stores a computer program, and the processor is used to execute the computer program in the memory to implement any one of the methods recorded in the first aspect above, or any one of the methods recorded in the second aspect.

[0033] In the seventh aspect, the present application provides a computer-readable storage medium, which stores a computer program or instruction. When the computer program or instruction is executed by a processor, the processor executes any one of the methods recorded in the first aspect or any one of the methods recorded in the second aspect.

[0034] In an eighth aspect, the present application provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the processor executes any one of the methods recorded in the first aspect or any one of the methods recorded in the second aspect.

[0035] The technical effects that can be achieved in any of the second to eighth aspects mentioned above can refer to the description of the beneficial effects in the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] FIG1 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0037] FIG2 is a schematic diagram of a flow chart of a DCC calibration process according to an embodiment of the present application;

[0038] FIG3 is a schematic diagram of a camera in focus and out of focus state;

[0039] FIG4 is a schematic diagram of the phase difference corresponding to imaging when the camera lens is in different positions;

[0040] FIG5 is a schematic diagram of a flow chart of a camera focusing method provided in an embodiment of the present application;

[0041] FIG6 is a schematic diagram showing the principle of camera imaging;

[0042] FIG7 is a schematic diagram showing the principle of forming a phase difference during camera imaging;

[0043] FIG8 is a schematic flow chart of another camera focusing method provided in an embodiment of the present application;

[0044] FIG9 is a structural block diagram of a camera focusing device provided in an embodiment of the present application;

[0045] FIG10 is a structural block diagram of a camera calibration device provided in an embodiment of the present application;

[0046] FIG11 is a schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below with reference to the accompanying drawings. The terms used in the implementation methods of this application are only used to explain the specific embodiments of the present application and are not intended to limit this application. Obviously, the embodiments described are only some embodiments of the present application, not all embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0048] Before introducing the specific solutions provided by the embodiments of the present application, some of the terms in the present application are generally explained to facilitate understanding by those skilled in the art, and the terms in the present application are not limited.

[0049] (1) Circle of confusion: When an object point is imaged, in the focused state, the imaging light beam of the object point converges at one point, and the image is clear; in the defocused state, the imaging light beam of the object point cannot converge at one point, but forms a diffuse circular projection on the imaging plane, which is visually a phantom. This circular projection can be called the circle of confusion.

[0050] (2) Phase difference (PD): When an object is imaged on the camera's imaging plane in a defocused state, the pixel imaging positions on the left half of the imaging plane are offset from those on the right half. This offset is called the phase difference. When using PDAF for autofocus, the required lens movement can be determined based on the product of the phase difference and the defocus conversion factor.

[0051] In the embodiments of the present application, "multiple" refers to two or more. In view of this, in the embodiments of the present application, "multiple" can also be understood as "at least two". "At least one" can be understood as one or more, for example, one, two or more. For example, including at least one means including one, two or more, and does not limit which ones are included. For example, including at least one of A, B and C, then the included ones may be A, B, C, A and B, A and C, B and C, or A, B and C. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / ", unless otherwise specified, generally indicates that the previous and subsequent associated objects are in an "or" relationship.

[0052] Unless otherwise specified, ordinal numbers such as "first" and "second" in the embodiments of the present application are used to distinguish multiple objects and are not used to limit the order, timing, priority or importance of multiple objects.

[0053] The embodiments of the present application can be applied to electronic cameras using optically variable lens or other electronic devices including camera functions. The electronic camera can provide users with the function of taking photos or shooting videos. For example, the electronic device including camera functions can be a smart camera, a smart phone, a wearable device (such as a smart watch), a tablet computer, a personal computer (PC), a personal digital assistant (PDA), an in-vehicle terminal, a drone, an aerial camera, a computer, etc.

[0054] FIG1 shows an optional hardware structure diagram of an electronic device 100 applicable to an embodiment of the present application. As shown in FIG1 , the electronic device 100 may include a processor 110 , a memory 120 , a camera 130 , a power module 140 , a display screen 150 and a button 160 .

[0055] The processor 110 of the electronic device 100 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.

[0056] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0057] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory, also known as a memory. The memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the instruction or data again, it can directly access the memory, avoiding repeated access and reducing the waiting time of processor 110.

[0058] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, and / or a universal serial bus (USB) interface.

[0059] The USB interface is an interface that complies with USB standards and specifications, and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, etc. The USB interface can be used to connect a charger to charge the electronic device 100, to transfer data between the electronic device 100 and peripheral devices, or to connect headphones to play audio through the headphones.

[0060] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0061] The memory 120 of the electronic device 100 can be set inside the electronic device 100 for storing computer executable program code, which includes instructions. The memory 120 inside the electronic device 100 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a camera application), etc. The data storage area can store data created during the use of the electronic device 100 (such as images taken by a camera, etc.). In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the memory 120 and / or instructions stored in a memory provided in the processor. The memory 120 may also store relevant data of the DCC provided in the embodiment of the present application. The memory 120 may also store code for executing a camera calibration process, and code for executing a camera autofocus process according to a pre-stored DCC. When the code for executing the camera auto-focusing process stored in the memory 120 is executed by the processor 110, the electronic device 100 can automatically focus according to the real-time changes of the optical parameters of the camera.

[0062] In some embodiments, the memory 120 of the electronic device 100 may also be replaced by an external memory or an external memory card. For example, the electronic device 100 may be provided with an external memory interface, which may be used to connect an external memory or an external memory card, such as a Micro SD card, etc., to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface to implement a data storage function. For example, files such as images or videos taken by a camera may be saved in an external memory or an external memory card. Of course, the code for executing the camera calibration process provided in the embodiment of the present application, as well as the code for executing the camera autofocus process according to the pre-stored DCC, may also be stored in an external memory or an external memory card. In this case, the processor 110 may run the corresponding code stored in the external memory or the external memory card through the external memory interface to implement the corresponding camera calibration or autofocus function.

[0063] The electronic device 100 can implement a shooting function through an image signal processing unit (ISP), a camera 130, a DSP, etc. The camera 130 can be understood as a camera head, which can include a lens and a photosensitive element. The lens can include one or more lenses, for example, a lens group consisting of multiple lenses.

[0064] The ISP processes data fed back by camera 130. For example, when taking a photo, the shutter is opened, and light passes through the lens of camera 130 and is transmitted to the camera's photosensitive element. The light signal is converted into an electrical signal, which the photosensitive element then transmits to the ISP for processing, transforming it into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and skin tone. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 130.

[0065] The camera 130 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto a photosensitive element (sensor). The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The surface of the photosensitive element can include multiple microlenses. The process of converting a light signal into an electrical signal by a photosensitive element can be called photosensitivity. After the light signal is converted into an electrical signal, the electrical signal can be passed to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard format such as RGB, YUV, etc.

[0066] In some embodiments, the processor 110 can trigger the camera 130 according to the program or instructions in the memory 120, capture at least one image through the camera 130, and perform corresponding processing on the at least one image according to the program or instructions, such as image enhancement processing, image post-processing, etc. After processing, the processed image can be displayed by the display screen 150. In some embodiments, the camera 130 of the electronic device 100 can include 1 or N cameras, where N is a positive integer greater than 1. For example, the electronic device 100 can include at least one front camera and at least one rear camera. For another example, the electronic device 100 can also include a side camera.

[0067] In some embodiments, camera 130 may employ a lens with variable optical parameters. The camera's optical parameters may also be referred to as the camera's lens optical parameters. These parameters may include, but are not limited to, focal length, optical zoom ratio, aperture number, the inverse of the entrance pupil diameter, and the ratio of focal length to entrance pupil diameter. Focal length, also known as focal length, is a measure of light convergence or divergence. It refers to the distance from the lens center to the focal point where parallel light rays converge when incident on the lens. Generally, cameras with shorter focal lengths have better light-gathering capabilities than cameras with longer focal lengths. Optical zoom ratio refers to the magnification of a lens and is proportional to the focal length. The longer the focal length, the greater the optical zoom ratio. The entrance pupil diameter refers to the effective aperture that limits the incoming light beam and is related to the amount of light entering the lens. It can be understood as the diameter of the current light-transmitting portion of the lens. The aperture number is the ratio of the focal length to the entrance pupil diameter and is proportional to the amount of light entering the lens. A larger aperture number indicates greater light entry. For example, camera 130 may employ a zoom lens with a variable focal length.

[0068] The camera 130 may further include a focus motor, which is used to drive the camera lens to move so that the camera can reach a focused state and capture clear images.

[0069] The power module 140 of the electronic device 100 may include a charging management module, a power management module, and a battery. The charging management module is configured to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module may receive charging input from the wired charger via a USB port. In some wireless charging embodiments, the charging management module may receive wireless charging input via the wireless charging coil of the electronic device 100. While the charging management module charges the battery, it can also power the electronic device through the power management module.

[0070] The power management module is used to connect the battery, charging management module, and processor 110. The power management module receives input from the battery and / or charging management module and provides power to processor 110, memory 120, display 150, camera 130, and the like. The power management module can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module can also be provided in processor 110. In other embodiments, the power management module and charging management module can also be provided in the same device.

[0071] Electronic device 100 implements display functionality through a graphics processing unit (GPU), display screen 150, and an application processor. A GPU is a microprocessor for image processing that connects display screen 150 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0072] The display screen 150 is used to display images, videos, etc. The display screen 150 includes a display panel, which can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or more display screens.

[0073] The electronic device 100 may further include buttons 160, such as a power button, a camera confirmation button, a volume button, and a parameter adjustment button. The buttons may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0074] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0075] Exemplarily, the electronic device 100 may further include an audio module, a speaker, a microphone, a headphone jack, and an application processor to implement audio functions. The audio module is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module can also be used to encode and decode audio signals. In some embodiments, the audio module can be provided in the processor 110, or some functional modules of the audio module can be provided in the processor 110. The speaker, also known as a "speaker", is used to convert audio electrical signals into sound signals. The microphone, also known as a "microphone" or "microphone", is used to convert sound signals into electrical signals. The headphone jack is used to connect wired headphones. The headphone jack can be a USB interface, or it can be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0076] The electronic device 100 can provide the user with the function of taking photos through the camera 130. When the user uses the electronic device 100 to take photos, the user can adjust the optical parameters of the camera 130 in real time as needed. For example, the image size of the photographed object can be enlarged or reduced by adjusting the optical zoom ratio of the camera 130. When the optical zoom ratio of the camera 130 changes, the clear image of the photographed object may become blurred. At this time, PDAF technology can be used for autofocus. The autofocus process converts the detected PD into the displacement required for the lens to move. This conversion process requires the use of DCC, so the DCC needs to be calibrated in advance.

[0077] If the lens used in an electronic device has variable optical parameters, the lens will have different DCC values ​​under different optical parameters. Therefore, the electronic device needs to perform a DCC calibration process for each optical parameter to obtain the DCC corresponding to each optical parameter. Repeating the DCC calibration process for the electronic device is not only cumbersome and time-consuming, but also cannot support continuously adjustable optical parameters.

[0078] Based on this, an embodiment of the present application provides a camera focusing method, which can be executed by an electronic camera or other electronic device containing a camera, or by a chip or chip system located in the electronic camera or electronic device.

[0079] The camera focusing method provided in an embodiment of the present application may include the following steps: obtaining current optical parameters of the camera, and focusing the camera lens based on the current optical parameters of the camera. The displacement used to focus the camera lens is determined based on the current defocus conversion coefficient. The current defocus conversion coefficient is determined based on an adjustment coefficient and a reference defocus conversion coefficient, wherein the adjustment coefficient is determined based on the current optical parameters and the reference optical parameters of the camera, and the reference defocus conversion coefficient is calibrated when the camera uses the reference optical parameters.

[0080] The embodiment of the present application can calibrate the reference defocus conversion coefficient when the camera adopts the reference optical parameters. The current defocus conversion coefficient corresponding to the current optical parameters can be determined by the adjustment coefficient determined by the real-time changing current optical parameters and the reference optical parameters, as well as the calibrated reference defocus conversion coefficient. Then, based on the current defocus conversion coefficient, the displacement used to focus the camera lens can be determined. It can be seen that the embodiment of the present application can calibrate the reference defocus conversion coefficient only when the camera adopts the reference optical parameters, without having to perform a DCC calibration process for each optical parameter of the camera. This not only simplifies the camera calibration process and saves camera calibration time, but also supports continuously adjustable optical parameters.

[0081] The camera focusing method provided by this application is described below through specific embodiments.

[0082] In some embodiments, the electronic device of the present application can pre-calibrate the DCC corresponding to one or more reference optical parameters, that is, pre-calibrate the reference defocus conversion coefficient corresponding to one reference optical parameter, or pre-calibrate the reference defocus conversion coefficients corresponding to multiple reference optical parameters. Taking the aperture number as an example of an optical parameter, in one embodiment, the electronic device can perform a DCC calibration process when the camera uses the reference aperture number F0_number. The process may include the following steps shown in Figure 2:

[0083] S201, moving the camera lens to position L1.

[0084] The electronic device fixes the aperture number of the camera at the reference aperture number F0_number. While the position of the reference object to be photographed and the position of the imaging plane of the camera's photosensitive component remain unchanged, the position of the lens is moved by the focus motor, and the position of the lens is first moved to position L1.

[0085] S202: Acquire a phase difference corresponding to the current position based on the captured image.

[0086] As shown in Figure 3, when an object is imaged, in the focused state, the object is clearly imaged on the camera's imaging plane. The pixel imaging position a1 on the left half of the imaging plane coincides with the pixel imaging position a2 on the right half. At this point, the phase difference PD = a1 - a2 = 0. Therefore, the position of the camera lens in the focused state can be called the lens's focused position. In the out-of-focus state, the object's image on the camera's imaging plane is diffuse, and there is an offset between the pixel imaging position b1 on the left half of the imaging plane and the pixel imaging position b2 on the right half. This offset is PD, and in this case, PD = b1 - b2 ≠ 0. When the lens is located at different positions between the object and the imaging plane, the offset between the pixel imaging position in the left half of the imaging plane and the pixel imaging position in the right half is different, and the clarity of the object imaging picture is also different; that is, when the distance between the lens and the object, and the distance between the lens and the imaging plane change, the offset between the pixel imaging position in the left half of the imaging plane and the pixel imaging position in the right half also changes accordingly, that is, the clarity of the object imaging picture can reflect the size of the phase difference.

[0087] When the lens of the camera is located at position L1, an image of the reference object is captured by the camera, and the phase difference PD1 corresponding to the position L1 can be determined based on the clarity of the image.

[0088] S203, determining whether the acquired phase difference reaches a set number; if yes, executing step S205; if not, executing step S204.

[0089] S204, change the position of the lens; return to step S202.

[0090] As shown in Figure 4, after obtaining the phase difference PD1 corresponding to position L1, the lens position can be changed and moved to position L2. When the camera lens is at position L2, an image of a reference object is captured by the camera. Based on the clarity of the image, the phase difference PD2 corresponding to position L2 can be determined. The lens can then be moved to position L3, and so on, until a set number of phase differences are obtained. For example, the set number can be n, where n is a positive integer greater than 1. If the set number is n, the lens is moved to positions L2, L3, and Ln in sequence, and the phase differences PD1 to PDn corresponding to each of the n positions are obtained.

[0091] S205 , determining a reference defocus conversion coefficient corresponding to the reference optical parameter according to the acquired set number of phase differences and the position of the lens.

[0092] Assuming the number is n, in one embodiment, a curve can be fitted based on the phase differences PD1 to PDn corresponding to each of the n lens positions to determine the relationship between phase difference and lens position. Based on this curve, a reference DCC corresponding to the reference aperture number F0_number can be determined. In another embodiment, the in-focus position corresponding to a phase difference of 0 can be predicted based on the phase differences PD1 to PDn corresponding to each of the n lens positions. Then, for each of the n positions, the distance between that position and the in-focus position is determined, i.e., the lens shift required to adjust the lens from that position to the in-focus position. Since the lens shift required to adjust the lens to the in-focus position satisfies the following relationship: Lens shift = DCC * PD, the distance between that position and the in-focus position can be divided by the phase difference corresponding to that position, and the resulting quotient can be used as a DCC: DCC = Lens shift / PD. For n positions, n DCCs can be obtained, and the average of these n DCCs is used as the reference defocus conversion coefficient DCC0 corresponding to the reference aperture number F0_number.

[0093] After obtaining the reference defocus conversion coefficient corresponding to the reference optical parameter, the electronic device may save the reference defocus conversion coefficient corresponding to the reference optical parameter. For example, after obtaining the reference defocus conversion coefficient corresponding to the reference aperture number F0_number, the electronic device may save the reference defocus conversion coefficient DCC0 corresponding to the reference aperture number F0_number.

[0094] In an optional embodiment, since DCC is related to the camera's optical parameters, for example, DCC can be determined by the focal length, entrance pupil diameter, and aperture number of the camera lens. Different optical parameters correspond to different DCCs. The electronic device can calibrate reference defocus conversion coefficients corresponding to multiple reference optical parameters using the camera calibration method shown in FIG2 .

[0095] When a user turns on the camera function of an electronic device and uses the camera to capture an image, the user can adjust the camera's optical parameters at any time as needed. The camera can focus the camera lens in a timely manner based on the real-time changes in the optical parameters. This process may include the following steps as shown in Figure 5:

[0096] S501, obtaining the current optical parameters of the camera.

[0097] The optical parameters of the camera may include at least one or a combination of the following optical parameters: aperture number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, and ratio of focal length to entrance pupil diameter. In this embodiment, the optical parameters of the camera including the aperture number are still used as an example for description.

[0098] S502: Acquire an initial image captured by the camera under current optical parameters, and determine the current phase difference of the camera based on the initial image.

[0099] When the camera uses its current optical parameters, it captures an initial image and determines the camera's current phase difference based on the clarity of the initial image. For example, when the camera uses its current aperture number F_number, the camera's current phase difference PD can be determined based on the initial image captured by the camera. The camera's current phase difference can reflect the distance between the camera lens and the in-focus position.

[0100] S503: Obtain a reference defocus conversion coefficient corresponding to a pre-stored reference optical parameter.

[0101] If a reference defocus conversion coefficient corresponding to a reference optical parameter is pre-stored in the electronic device, the electronic device can directly read the reference defocus conversion coefficient corresponding to the reference optical parameter. If a plurality of reference defocus conversion coefficients corresponding to reference optical parameters are pre-stored in the electronic device, the electronic device can read the reference defocus conversion coefficient corresponding to any one of the reference optical parameters; or, the electronic device can select a reference optical parameter closest to the current optical parameter from the plurality of reference optical parameters, that is, a reference optical parameter with the smallest absolute value of the difference from the current optical parameter, and read the reference defocus conversion coefficient corresponding to the selected reference optical parameter. Selecting the reference optical parameter closest to the current optical parameter can reduce the error of the calculated current defocus conversion coefficient and improve the accuracy of the obtained current defocus conversion coefficient.

[0102] When the optical parameters of the camera include an aperture number, the electronic device may obtain a reference defocus conversion coefficient corresponding to a pre-stored reference aperture number F0_number.

[0103] S504: Determine an adjustment coefficient according to the current optical parameters and the reference optical parameters.

[0104] S505 , adjusting the reference defocus conversion coefficient according to the adjustment coefficient to obtain a current defocus conversion coefficient corresponding to the current optical parameter.

[0105] In one embodiment, the adjustment coefficient is determined based on the ratio of the current optical parameter to the reference optical parameter. Exemplarily, the adjustment coefficient can be determined based on the mth power of the ratio of the current optical parameter to the reference optical parameter. According to the adjustment coefficient, the reference defocus conversion coefficient DCC0 is adjusted to obtain the current defocus conversion coefficient DCC corresponding to the current optical parameter. The determination formula of the current optical parameter DCC can be expressed as DCC=DCC0*f(opt^m), where opt represents the ratio of the current optical parameter to the reference optical parameter, f(opt^m) is the adjustment coefficient, and the adjustment coefficient is a function of the mth power of opt, and the value of the function can be the product of the mth power of opt and a set constant, for example, f(opt^m)=a0*opt^m, and a0 is a set constant.

[0106] In an optional embodiment, based on the relationship between the camera's optical parameters, it can be determined that the value of m can be 2. The principle is as follows: Taking the camera's optical parameters including the aperture number as an example, as shown in FIG6 , lens 602 can be understood as the camera's lens. Arrow 601 located to the left of lens 602 represents the object to be photographed by the camera, and arrow 603 located to the right of lens 602 represents the image of the object on the camera's imaging plane. In other words, the left side of lens 602 is the object side, and the right side is the image side. As explained above, when the camera's lens is out of focus, a circle of confusion exists in the physical image. Since the object distance is typically much greater than the image distance in actual camera usage scenarios, the object distance can remain approximately constant when the camera lens moves. Therefore, based on the optical path geometry, the ratio between the lens shift required for the camera lens to reach the in-focus position and the size of the circle of confusion can be described as: Lens shift / circle of confusion = focal length / 0.5 entrance pupil diameter = 2 * F_number; where F_number is the aperture number, and F_number = focal length / entrance pupil diameter. Therefore, the distance the camera lens needs to move to reach the focus position is calculated as: Lens shift = focal length / 0.5 entrance pupil diameter * circle of confusion = 2 * F_number * circle of confusion. The above-mentioned Lens shift distance can be understood as the amount of movement the lens needs to move when focusing.

[0107] As shown in Figure 7, the energy distribution of the circle of confusion generated by the lens optical path is characterized by high energy at the center and gradually decreasing energy on both sides, with the center of the circle of confusion representing the location of the object in the image. The surface of the photosensitive element comprises multiple microlenses. After light passes through the microlenses on the photosensitive element, the pixels on the left half are superimposed with a responsivity distribution with high energy on the left and low energy on the right, while the pixels on the right half are superimposed with a responsivity distribution with high energy on the right and low energy on the left. Alternatively, as indicated by the arrows in Figure 7, the sensitivity of the microlenses on the left half decreases from left to right, while the sensitivity of the microlenses on the right half increases from left to right. Therefore, the sensitivity slopes of the left and right halves of the photosensitive element are of the same magnitude but opposite signs. The sensitivity slope reflects the changing trend of sensitivity. The sensitivity slope is related to the focal length and entrance pupil diameter, being the ratio of entrance pupil diameter to focal length. It can be expressed as: the sensitivity slope is inversely proportional to the aperture number F_number: slope = a / F_number. Here, a is a constant related to the optical properties of the microlenses within the photosensitive element. Because the sensitivity of the left and right halves of the photosensitive element varies differently, the energy peaks of the circles of confusion obtained for the left and right halves are offset. The distance between the energy peaks of the two circles of confusion is the phase difference, PD, which can be expressed as PD = a * circle of confusion / F_number. Therefore, the circle of confusion = PD * F_number / a.

[0108] Since the required lens shift is Lens shift = focal length / 0.5 entrance pupil diameter * circle of confusion = 2*F_number* circle of confusion, the relationship between the required lens shift and the phase difference PD can be expressed as: Lens shift = 2 / a*focal length 2 / entrance pupil diameter 2 *PD=2 / a*F_number 2 *PD.

[0109] Since Lens shift = DCC * PD, we can get DCC = Lens shift / PD = 2 / a * focal length 2 / entrance pupil diameter 2 =2 / a*F_number 2 . It can be seen that DCC and F_number 2 Therefore, the adjustment coefficient can be determined based on the square of the ratio of the current optical parameter to the reference optical parameter. The adjustment coefficient can be expressed as f(opt^2), and the current optical parameter DCC can be expressed as DCC=DCC0*f(opt^2).

[0110] In actual use, affected by the differences in physical parameters of the lens, in DCC=DCC0*f(opt^m), the value of m may fluctuate around 2, with a fluctuation range of plus or minus 1.5 times, that is, the value of m may be between 1.3 and 3.

[0111] In one embodiment, the formula for determining the current optical parameter DCC can include additional parameters. For example, the formula for determining the current optical parameter DCC can be modified to: DCC = a1*DCC0*f(opt^m)^a2+a3. Here, a1, a2, and a3 are constants or include other variable factors. The following relationship is satisfied between a1, a2, and a3: the values ​​of a1 and a2 can be between 0.5 and 2, and a3 < a1*DCC0*f(opt^m)^a2.

[0112] Through the above process, the read reference defocus conversion coefficient DCC0 is adjusted according to the adjustment coefficient, so as to obtain the current defocus conversion coefficient DCC corresponding to the current optical parameters.

[0113] S506 , determining the displacement of the lens according to the current defocus conversion coefficient and the current phase difference.

[0114] S507: Focusing the camera lens based on the determined displacement.

[0115] The electronic device can use the product of the current defocus conversion coefficient and the current phase difference as the lens displacement. It controls the camera lens to move to the in-focus position according to the displacement, completing the focusing process and allowing the camera to capture a clear image.

[0116] In the above embodiment, the optical parameters of the camera are described using the aperture number as an example. In other embodiments, the optical parameters of the camera may include at least one or a combination of the following optical parameters: aperture number, focal length, optical zoom ratio, the inverse of the entrance pupil diameter, and the ratio of the focal length to the entrance pupil diameter. Since there is a conversion relationship between optical parameters such as the aperture number, focal length, optical zoom ratio, and the inverse of the entrance pupil diameter, the optical parameters of the camera can also be expressed as a linear combination of multiple parameters. For example, in one embodiment, the optical parameters of the camera may include a linear combination of the following optical parameters: aperture number, focal length, and the inverse of the entrance pupil diameter; the optical parameter optfactor of the camera may be expressed as: optfactor = b1*aperture number F_number+b2*focal length f+b3*1 / entrance pupil diameter d+b4. Wherein, b1, b2, and b3 are all set constants or may include variables. In typical operating scenarios, the relationship between b1, b2, and b3 satisfies max / min ≤ 2; max refers to the maximum value of b1, b2, and b3, and min refers to the minimum value of b1, b2, and b3. b4 can be a set constant or may include variables. In typical operating scenarios, the value range of b4 satisfies b4 <= b1 * aperture number F_number + b2 * focal length f + b3 * 1 / entrance pupil diameter d. In another embodiment, the optical parameters of the camera may include a linear combination of the following optical parameters: focal length, the inverse of the entrance pupil diameter, and the ratio of the focal length to the entrance pupil diameter; the optical parameter optfactor of the camera may be expressed as: optfactor = c1 * focal length f + c2 * 1 / entrance pupil diameter d + c3 * focal length f / entrance pupil diameter d + c4. Wherein, c1, c2, and c3 are all set constants or may include variables. In typical operating scenarios, the relationship between c1, c2, and c3 satisfies max / min ≤ 2; max refers to the maximum value among b1, b2, and b3, and min refers to the minimum value among b1, b2, and b3. c4 can be a set constant or may include variables. In typical operating scenarios, the value range of c4 satisfies c4 <= c1 * focal length f + c2 * 1 / entrance pupil diameter d + c3 * focal length f / entrance pupil diameter d. In another embodiment, the optical parameters of the camera may include a linear combination of the following optical parameters: aperture number, focal length, the inverse of the entrance pupil diameter, and the ratio of the focal length to the entrance pupil diameter; the optical parameter optfactor of the camera may be expressed as: optfactor = d1 * aperture number F_number + d2 * focal length f + d3 * 1 / entrance pupil diameter d + d4 * focal length f / entrance pupil diameter d + d5. Wherein, d1, d2, d3, and d4 are all set constants or may contain variables. In a typical working scenario, the relationship between d1, d2, d3, and d4 satisfies max / min ≤ 2. Max refers to the maximum value among d1, d2, d3, and d4, and min refers to the minimum value among d1, d2, d3, and d4.d5 can be a set constant or may contain variables. In a typical working scenario, the value range of d5 satisfies d5<=d1*aperture number F_number+d2*focal length f+d3*1 / entrance pupil diameter d+d4*focal length f / entrance pupil diameter d.

[0117] In the above embodiment, the camera can only calibrate the DCC corresponding to a single optical parameter or a small number of optical parameters, without having to perform a DCC calibration process for each optical parameter supported by the camera. When shooting an image through the camera, if the user adjusts the optical parameters of the camera, the electronic device can obtain the adjusted current optical parameters, derive the DCC corresponding to the current optical parameters based on the DCC corresponding to the calibrated optical parameters, and then determine the displacement of the lens under the current optical parameters, and focus the camera lens based on the displacement. This method can not only simplify the camera calibration process and save camera calibration time, but also only save the DCC corresponding to one optical parameter, or only save the DCC corresponding to a small number of optical parameters, in the electronic device, which can save the storage space of the electronic device; and this method can also support continuously adjustable optical parameters.

[0118] On the one hand, since the related art performs a DCC calibration process for each optical parameter supported by the camera, as the adjustable range of the camera's optical parameters () expands, the number of repeated executions of the DCC calibration process increases significantly. Assuming that the optical parameters of the camera include the optical zoom ratio and the aperture number, the adjustable number of the optical zoom ratio is a, and the adjustable number of the aperture number is b, then the number of repeated executions of the DCC calibration process is a*b times. For example, for a 30x zoom lens, the adjustable step size is 1, then the adjustable number of the optical zoom ratio is 30, and the adjustable aperture number corresponding to each optical zoom ratio is 2. Then, a DCC calibration process is performed once for each optical parameter of the camera, and a total of 60 DCC calibration processes need to be performed. Assuming that each DCC calibration process takes 5 seconds, the total calibration time is 5 minutes. The embodiment of the present application supports executing the DCC calibration process only once, so the calibration time can be shortened to 5 seconds, which can significantly save the camera calibration time.

[0119] On the other hand, assuming that the optical parameters of the camera include focal length, if the camera lens adopts a long focal length lens, the DCC calibration process of the related technology is adopted. When the DCC calibration process is executed for some of the focal lengths, the calibration object distance will increase accordingly. For example, when the DCC calibration process is executed for a long focal length, the calibration object distance may be greater than 10m, resulting in a larger calibration site, or the addition of additional optical distance-increasing equipment. However, by adopting the method provided in the embodiment of the present application, a suitable optical parameter can be selected to execute the DCC calibration process, and the suitable optical parameter can be selected based on the production calibration environment. For example, the DCC calibration process can be executed only at a short focal length, without the need to execute the DCC calibration process for a long focal length. For example, when the DCC calibration process is executed for a short focal length, the calibration object distance can be less than 1m, avoiding the extra space consumption or equipment cost overhead caused by DCC calibration, thereby reducing the problem of excessive spatial distance required for calibration in some long focal length zoom lens scenarios.

[0120] In other embodiments, the electronic device of the embodiment of the present application can pre-calibrate the DCC corresponding to a reference optical parameter, and then, based on the relationship between any optical parameter and the reference optical parameter, derive the DCC corresponding to more optical parameters for storage; or, the electronic device can pre-calibrate the DCC corresponding to multiple reference optical parameters, and then, based on the relationship between any optical parameter and any reference optical parameter, derive the DCC corresponding to more optical parameters for storage. The optical parameters of the camera may include at least one or a combination of the following optical parameters: aperture number, focal length, optical zoom ratio, inverse of entrance pupil diameter, ratio of focal length to entrance pupil diameter. The composition of the optical parameters of the camera can refer to the description above and will not be repeated here.

[0121] In one embodiment, the electronic device can perform a DCC calibration process when the camera adopts reference optical parameters. The process can be performed with reference to the process shown in Figure 2 and will not be described in detail here. After obtaining the reference defocus conversion coefficient corresponding to the reference optical parameter, the adjustment coefficient can be determined for each preset optical parameter according to the ratio of the optical parameter to the reference optical parameter, and the reference defocus conversion coefficient is adjusted based on the adjustment coefficient to obtain the target defocus conversion coefficient corresponding to the optical parameter. In this way, the target defocus conversion coefficient corresponding to multiple optical parameters of the camera can be obtained and saved. For example, the correspondence between multiple optical parameters and defocus conversion coefficients can be saved in the DCC lookup table. Among them, for any optical parameter, the process of determining the target defocus conversion coefficient corresponding to the optical parameter can be performed with reference to the specific implementation process of step S504 and step S505 in the above embodiment, and will not be described in detail here.

[0122] In another embodiment, the electronic device may divide the adjustable range of the optical parameter into multiple intervals, select a reference optical parameter in each interval, and obtain multiple reference optical parameters. The DCC calibration process is performed for each of the multiple reference optical parameters, and the DCC calibration process can be performed with reference to the process shown in Figure 2 to obtain the reference defocus conversion coefficients corresponding to the multiple reference optical parameters. After obtaining the reference defocus conversion coefficients corresponding to the multiple reference optical parameters, the following operations can be performed for each interval: for each optical parameter in the interval, an adjustment coefficient is determined according to the ratio of the optical parameter to the reference optical parameter in the interval, and based on the adjustment coefficient, the reference defocus conversion coefficient corresponding to the reference optical parameter in the interval is adjusted to obtain the target defocus conversion coefficient corresponding to the optical parameter. In this way, the target defocus conversion coefficients corresponding to the multiple optical parameters within the adjustable range of the optical parameter can be obtained and saved. Exemplarily, the correspondence between multiple optical parameters and defocus conversion coefficients can be saved in the DCC lookup table.

[0123] When a user turns on the camera function of an electronic device and uses the camera to capture an image, the user can adjust the camera's optical parameters at any time as needed. The camera can focus the camera lens in a timely manner based on the real-time changes in the optical parameters. This process may include the following steps as shown in Figure 8:

[0124] S801, obtaining the current optical parameters of the camera.

[0125] The optical parameters of the camera may include at least one or a combination of the following optical parameters: aperture number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, and ratio of focal length to entrance pupil diameter.

[0126] S802: Acquire an initial image captured by the camera under current optical parameters, and determine the current phase difference of the camera based on the initial image.

[0127] When the camera uses the current optical parameters, it captures an initial image and determines the camera's current phase difference based on the clarity of the initial image. The camera's current phase difference can reflect the distance between the camera lens and the focus position.

[0128] S803: Obtain a current defocus conversion coefficient corresponding to the pre-saved current optical parameters.

[0129] In one embodiment, a DCC lookup table is stored in the electronic device, and the DCC lookup table stores the correspondence between multiple optical parameters and defocus conversion coefficients. By querying the DCC lookup table, the electronic device can find the current optical parameter from multiple optical parameters and read the current defocus conversion coefficient corresponding to the current optical parameter from the DCC lookup table. The defocus conversion coefficients corresponding to a part of the optical parameters in the DCC lookup table are obtained according to the DCC calibration process shown in Figure 2. This part of the optical parameters can be called reference optical parameters, and the defocus conversion coefficients corresponding to the reference optical parameters can be called reference defocus conversion coefficients. The defocus conversion coefficients corresponding to another part of the optical parameters in the DCC lookup table can be obtained as follows: after obtaining the reference defocus conversion coefficients corresponding to the reference optical parameters, an adjustment coefficient can be determined for each preset optical parameter according to the ratio of the optical parameter to the reference optical parameter, and the reference defocus conversion coefficient can be adjusted based on the adjustment coefficient to obtain the target defocus conversion coefficient corresponding to the optical parameter. In this way, the target defocus conversion coefficients corresponding to multiple optical parameters of the camera can be obtained and saved.

[0130] S804: Determine the displacement of the lens according to the current defocus conversion coefficient and the current phase difference.

[0131] S805 , focusing the camera lens based on the determined displacement.

[0132] The electronic device can use the product of the current defocus conversion coefficient and the current phase difference as the lens displacement. It controls the camera lens to move to the in-focus position according to the displacement, completing the focusing process and allowing the camera to capture a clear image.

[0133] In the above embodiment, the camera can be calibrated for only a single optical parameter or the DCC corresponding to a small number of optical parameters. Then, by determining the adjustment coefficient, the defocus conversion coefficients corresponding to more optical parameters can be derived and stored. This method eliminates the need to perform a DCC calibration process for each optical parameter supported by the camera, simplifying the camera calibration process and saving camera calibration time.

[0134] Based on the same technical concepts as the aforementioned method embodiments, embodiments of the present application also provide a camera focusing device. This camera focusing device can be provided within the aforementioned electronic device. In some embodiments, as shown in FIG9 , the camera focusing device 900 can include a parameter acquisition unit 901 and a camera focusing unit 902. The camera focusing device 900 can be used to implement the functions of the aforementioned camera focusing method embodiments, thereby achieving the beneficial effects of the aforementioned method embodiments.

[0135] Among them, the parameter acquisition unit 901 can be used to obtain the current optical parameters of the camera; the camera focusing unit 902 can be used to focus the camera lens based on the current optical parameters of the camera; wherein, the displacement used to focus the camera lens is determined based on the current defocus conversion coefficient; the current defocus conversion coefficient is determined based on the adjustment coefficient and the reference defocus conversion coefficient; the adjustment coefficient is determined based on the current optical parameters and the reference optical parameters of the camera; the reference defocus conversion coefficient is calibrated when the camera adopts the reference optical parameters.

[0136] In an optional embodiment, the camera focusing unit 902 can be specifically used to: obtain the current phase difference of the camera; adjust the reference defocus conversion coefficient according to the adjustment coefficient to obtain the current defocus conversion coefficient corresponding to the current optical parameters; and determine the displacement according to the current defocus conversion coefficient and the current phase difference.

[0137] In another optional embodiment, the camera focusing unit 902 can be specifically used to: obtain the current phase difference of the camera; obtain the current defocus conversion coefficient corresponding to the pre-saved current optical parameters; the current defocus conversion coefficient is obtained by adjusting the reference defocus conversion coefficient based on the adjustment coefficient; and determine the displacement according to the current defocus conversion coefficient and the current phase difference.

[0138] In an optional embodiment, the camera focusing unit 902 may be specifically configured to: capture an initial image; and determine a current phase difference of the camera based on the initial image.

[0139] In an optional embodiment, the adjustment coefficient is determined based on a ratio of the current optical parameter to the reference optical parameter.

[0140] In an optional embodiment, the adjustment coefficient is determined based on the mth power of the ratio of the current optical parameter to the reference optical parameter.

[0141] In an optional embodiment, the optical parameters of the camera may include at least one or a combination of the following optical parameters: aperture number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, and ratio of focal length to entrance pupil diameter.

[0142] In an optional embodiment, the optical parameters of the camera may include a linear combination of the following optical parameters: aperture number, focal length, and the reciprocal of the entrance pupil diameter.

[0143] In another optional embodiment, the optical parameters of the camera may include a linear combination of the following optical parameters: focal length, the inverse of the entrance pupil diameter, and the ratio of the focal length to the entrance pupil diameter.

[0144] It should be noted that in other embodiments, the parameter acquisition unit 901 can be used to execute any step in the camera focus method executed by the electronic device, and the camera focus unit 902 can be used to execute any step in the camera focus method executed by the electronic device. The steps that the parameter acquisition unit 901 and the camera focus unit 902 are responsible for implementing can be specified as needed. By having the parameter acquisition unit 901 and the camera focus unit 902 respectively implement different steps in the camera focus method executed by the electronic device, the full functionality of the camera focus device is realized.

[0145] The functional modules in the embodiments of the present application may be integrated into a processor, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or software functional units.

[0146] Based on the same technical concept as the above-mentioned method embodiment, the present application also provides a camera calibration device in the embodiment. This camera calibration device can be provided in the above-mentioned electronic device. In some embodiments, as shown in Figure 10, the camera calibration device 1000 may include a camera calibration unit 1001 and a conversion unit 1002. The camera calibration device 1000 can be used to implement the functions of the above-mentioned camera calibration method embodiment, thereby achieving the beneficial effects of the above-mentioned method embodiment.

[0147] Among them, the camera calibration unit 1001 can be used to calibrate the reference defocus conversion coefficient of the camera when the camera adopts reference optical parameters; the conversion unit 1002 can be used to adjust the reference defocus conversion coefficient based on the adjustment coefficient to obtain the target defocus conversion coefficient corresponding to any optical parameter; the adjustment coefficient is determined based on any optical parameter and the reference optical parameter.

[0148] In an optional embodiment, the adjustment coefficient is determined based on a ratio of any optical parameter to a reference optical parameter.

[0149] In an optional embodiment, the adjustment coefficient is determined based on the mth power of a ratio of any optical parameter to a reference optical parameter.

[0150] In an optional embodiment, the optical parameters of the camera may include at least one or a combination of the following optical parameters: aperture number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, and ratio of focal length to entrance pupil diameter.

[0151] In an optional embodiment, the optical parameters of the camera may include a linear combination of the following optical parameters: aperture number, focal length, and the reciprocal of the entrance pupil diameter.

[0152] In another optional embodiment, the optical parameters of the camera may include a linear combination of the following optical parameters: focal length, the inverse of the entrance pupil diameter, and the ratio of the focal length to the entrance pupil diameter.

[0153] It should be noted that, in other embodiments, the camera calibration unit 1001 can be used to execute any step in the camera calibration method executed by the electronic device, and the conversion unit 1002 can be used to execute any step in the camera calibration method executed by the electronic device. The steps that the camera calibration unit 1001 and the conversion unit 1002 are responsible for implementing can be specified as needed. By having the camera calibration unit 1001 and the conversion unit 1002 respectively implement different steps in the camera calibration method executed by the electronic device, the full functionality of the camera calibration device is realized.

[0154] The functional modules in the embodiments of the present application may be integrated into a processor, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or software functional units.

[0155] Based on the same technical concept as the above-mentioned method embodiment, the present application also provides a chip in the embodiment, which can be a computing chip and can be applied to the above-mentioned electronic device. This chip can be used to implement the functions of the above-mentioned method embodiment, thereby achieving the beneficial effects of the above-mentioned method embodiment.

[0156] In some embodiments, the structure of the chip 1100 may be as shown in FIG11 , including a processor 1101 and a power supply circuit 1102 connected to the processor 1101. The processor 1101 and the power supply circuit 1102 may be interconnected via a bus. The processor 1101 may be a digital signal processor (DSP), an ASIC, a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component or other specific integrated circuit, etc. The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The power supply circuit 1102 is used to power the processor 1101 via the bus.

[0157] The processor 1101 can be connected to a memory provided outside the chip, or to a memory provided inside the chip, to run software programs and modules stored in the memory, thereby executing various functional applications and data processing of the chip 1100, such as the camera focusing method or camera calibration method provided in the embodiments of the present application.

[0158] In some embodiments, the processor 1101 may include one or more processing units. Different processing units may be independent devices or integrated into one or more processors. The processor 1101 may also include a controller that can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.

[0159] In some embodiments, if the chip executes a camera focusing method, the processor 1101 may perform the following operations: obtaining the current optical parameters of the camera; focusing the lens of the camera based on the current optical parameters of the camera; wherein the displacement used to focus the lens of the camera is determined based on the current defocus conversion coefficient; the current defocus conversion coefficient is determined based on the adjustment coefficient and the reference defocus conversion coefficient; the adjustment coefficient is determined based on the current optical parameters and the reference optical parameters of the camera; the reference defocus conversion coefficient is calibrated when the camera adopts the reference optical parameters.

[0160] In other embodiments, if the chip executes a camera calibration method, the processor 1101 may perform the following operations: calibrate the reference defocus conversion coefficient of the camera when the camera adopts reference optical parameters; adjust the reference defocus conversion coefficient based on the adjustment coefficient to obtain a target defocus conversion coefficient corresponding to any optical parameter; the adjustment coefficient is determined based on any optical parameter and the reference optical parameter.

[0161] Based on the same technical concept as the above embodiment, an electronic device is also provided in the embodiment of the present application. The electronic device can be an electronic camera using a variable optical parameter lens, or a smart phone, a wearable device, a tablet computer, a smart camera, etc. The electronic device can be used to implement the functions implemented in the above method embodiment, and thus the beneficial effects possessed by the above method embodiment can be achieved. The structure of the electronic device can be as shown in Figure 1. In some embodiments, the electronic device may include a processor and a memory connected to the processor. The processor and the memory can be interconnected via a bus, and the processor can be a general-purpose processor, such as a microprocessor, or other conventional processors. The bus can be a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc.

[0162] Among them, the memory can be used to store software programs and modules, and the processor executes various functional applications and data processing of the electronic device by running the software programs and modules stored in the memory, such as the camera focusing method or camera calibration method provided in the embodiments of the present application.

[0163] The memory may primarily include a program storage area and a data storage area. The program storage area may store at least one application program, for example, and the data storage area may store data used by the processor during operation. Furthermore, the memory may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0164] The processor in the electronic device is used to execute computer instructions or programs stored in the memory and perform the functions implemented by any of the above-mentioned method embodiments. In some embodiments, the processor may include one or more processing units, and different processing units may be independent devices or integrated into one or more processors. The processor may also include a controller, which can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.

[0165] The method steps in the embodiments of the present application can be implemented by hardware, or by a processor executing a computer program or instruction. The computer program or instruction can constitute a computer program product.

[0166] The present application also provides a computer program product comprising computer-executable instructions. In one embodiment, the computer-executable instructions are used to enable a computer to perform the functions of the above method embodiment.

[0167] Computer-executable instructions can be stored in a computer-readable storage medium. The present application also provides a computer-readable storage medium having executable instructions stored therein. In one embodiment, the computer-executable instructions are used to cause a computer to perform the functions of the above method embodiment.

[0168] The computer-readable storage medium provided in the embodiments of the present application may be a random access memory (RAM), a flash memory, a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a register, a hard disk, a mobile hard disk, a CD-ROM, or any other form of computer-readable storage medium known in the art.

[0169] Computer-executable instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium such as a floppy disk, hard disk, or magnetic tape; an optical medium such as a digital video disc (DVD); or a semiconductor medium such as a solid-state drive.

[0170] One or more of the above modules or units can be implemented in software, hardware, or a combination of the two. When any of the above modules or units is implemented in software, the software exists in the form of computer program instructions and is stored in a memory, and the processor can be used to execute the program instructions and implement the above method flow. The processor may include but is not limited to at least one of the following: a CPU, a microprocessor, a digital signal processor (DSP), a microcontroller unit (MCU), or an artificial intelligence processor, etc., and each storage device may include one or more cores for executing software instructions to perform calculations or processing. The processor may be built into an SoC, a DPU or an ASIC, or it may be an independent semiconductor chip. In addition to the core for executing software instructions for calculations or processing within the processor, it may further include necessary hardware accelerators, such as FPGAs, PLDs, or logic circuits for implementing dedicated logic operations.

[0171] When the above modules or units are implemented in hardware, the hardware can be any one or any combination of a CPU, a microprocessor, a DSP, an MCU, an artificial intelligence processor, an ASIC, a SoC, an FPGA, a PLD, a dedicated digital circuit, a hardware accelerator or a non-integrated discrete device, which can run the necessary software or not rely on the software to execute the above method flow.

[0172] The above description is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the scope of protection of the present application.

Claims

1. A camera focusing method, characterized in that: The method comprises: Get the current optical parameters of the camera; Based on the current optical parameters of the camera, the lens of the camera is focused; wherein the displacement used to focus the lens of the camera is determined based on the current defocus conversion coefficient; the current defocus conversion coefficient is determined based on the adjustment coefficient and the reference defocus conversion coefficient; the adjustment coefficient is determined based on the current optical parameters and the reference optical parameters of the camera; the reference defocus conversion coefficient is calibrated when the camera adopts the reference optical parameters.

2. The method according to claim 1, characterized in that The displacement is determined as follows: Obtaining the current phase difference of the camera; According to the adjustment coefficient, the reference defocus conversion coefficient is adjusted to obtain a current defocus conversion coefficient corresponding to the current optical parameter; The displacement is determined according to the current defocus conversion coefficient and the current phase difference.

3. The method according to claim 1, characterized in that The displacement is determined as follows: Obtaining the current phase difference of the camera; Acquire a current defocus conversion coefficient corresponding to the pre-saved current optical parameter; the current defocus conversion coefficient is obtained by adjusting the reference defocus conversion coefficient based on the adjustment coefficient; The displacement is determined according to the current defocus conversion coefficient and the current phase difference.

4. The method according to claim 2 or 3, characterized in that: The obtaining the current phase difference of the camera includes: Take the initial image; A current phase difference of the camera is determined based on the initial image.

5. The method according to any one of claims 1 to 4, characterized in that: The adjustment coefficient is determined based on a ratio of the current optical parameter to the reference optical parameter.

6. The method according to claim 5, characterized in that The adjustment coefficient is determined based on the mth power of the ratio of the current optical parameter to the reference optical parameter.

7. The method according to any one of claims 1 to 6, characterized in that: The current optical parameters include at least one or a combination of the following optical parameters: Aperture number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, ratio of focal length to entrance pupil diameter.

8. The method according to claim 7, characterized in that The current optical parameters include a linear combination of the following optical parameters: aperture number, focal length, and the reciprocal of entrance pupil diameter; or, the current optical parameters include a linear combination of the following optical parameters: focal length, the reciprocal of entrance pupil diameter, and the ratio of focal length to entrance pupil diameter.

9. A camera calibration method, characterized in that: The method comprises: When the camera adopts reference optical parameters, calibrating a reference defocus conversion coefficient of the camera; Based on the adjustment coefficient, the reference defocus conversion coefficient is adjusted to obtain a target defocus conversion coefficient corresponding to any optical parameter; the adjustment coefficient is determined based on any optical parameter and the reference optical parameter.

10. The method according to claim 9, characterized in that The adjustment coefficient is determined based on a ratio of any one of the optical parameters to the reference optical parameter.

11. The method according to claim 10, characterized in that The adjustment coefficient is determined based on the mth power of a ratio of any one of the optical parameters to the reference optical parameter.

12. The method according to any one of claims 9 to 11, characterized in that: The reference optical parameters include at least one or a combination of the following optical parameters: Aperture number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, ratio of focal length to entrance pupil diameter.

13. The method according to claim 12, characterized in that The reference optical parameters include a linear combination of the following optical parameters: aperture number, focal length, and the reciprocal of entrance pupil diameter; or, the current optical parameters include a linear combination of the following optical parameters: focal length, the reciprocal of entrance pupil diameter, and the ratio of focal length to entrance pupil diameter.

14. A camera focusing device, characterized in that: The device comprises: A parameter acquisition unit, used to acquire the current optical parameters of the camera; A camera focusing unit, used for focusing the lens of the camera based on the current optical parameters of the camera; wherein the displacement used for focusing the lens of the camera is determined based on a current defocus conversion coefficient; the current defocus conversion coefficient is determined based on an adjustment coefficient and a reference defocus conversion coefficient; the adjustment coefficient is determined based on the current optical parameters and the reference optical parameters of the camera; the reference defocus conversion coefficient is calibrated when the camera adopts the reference optical parameters.

15. The device according to claim 14, characterized in that The camera focusing unit is specifically used for: Obtaining the current phase difference of the camera; According to the adjustment coefficient, the reference defocus conversion coefficient is adjusted to obtain a current defocus conversion coefficient corresponding to the current optical parameter; The displacement is determined according to the current defocus conversion coefficient and the current phase difference.

16. The device according to claim 14, characterized in that The camera focusing unit is specifically used for: Obtaining the current phase difference of the camera; Acquire a current defocus conversion coefficient corresponding to the pre-saved current optical parameter; the current defocus conversion coefficient is obtained by adjusting the reference defocus conversion coefficient based on the adjustment coefficient; The displacement is determined according to the current defocus conversion coefficient and the current phase difference.

17. The device according to any one of claims 14 to 16, characterized in that The adjustment coefficient is determined based on a ratio of the current optical parameter to the reference optical parameter.

18. The device according to claim 17, characterized in that The adjustment coefficient is determined based on the mth power of the ratio of the current optical parameter to the reference optical parameter.

19. The device according to any one of claims 14 to 18, characterized in that The current optical parameters include at least one or a combination of the following optical parameters: Aperture number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, ratio of focal length to entrance pupil diameter.

20. A camera calibration device, characterized in that: The device comprises: A camera calibration unit, used for calibrating a reference defocus conversion coefficient of the camera when the camera adopts reference optical parameters; A conversion unit is used to adjust the reference defocus conversion coefficient based on an adjustment coefficient to obtain a target defocus conversion coefficient corresponding to any optical parameter; the adjustment coefficient is determined based on any optical parameter and the reference optical parameter.

21. The device according to claim 20, characterized in that The adjustment coefficient is determined based on a ratio of any one of the optical parameters to the reference optical parameter.

22. The device according to claim 21, characterized in that The adjustment coefficient is determined based on the mth power of a ratio of any one of the optical parameters to the reference optical parameter.

23. The device according to any one of claims 20 to 22, characterized in that The reference optical parameters include at least one or a combination of the following optical parameters: Aperture number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, ratio of focal length to entrance pupil diameter.

24. A chip, characterized in that: It comprises a processor and a power supply circuit; the power supply circuit is used to supply power to the processor, and the processor is used to execute a computer program to implement the method according to any one of claims 1 to 8, or to implement the method according to any one of claims 9 to 13.

25. An electronic device, characterized in that: It comprises a processor and a memory; the memory stores a computer program, and the processor is used to execute the computer program in the memory to implement the method according to any one of claims 1 to 8, or to implement the method according to any one of claims 9 to 13.

26. A computer-readable storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to make a computer execute the method according to any one of claims 1 to 8, or the method according to any one of claims 9 to 13.

27. A computer program product, characterized in that The method comprises computer executable instructions, wherein the computer executable instructions are used to make a computer execute the method according to any one of claims 1 to 8, or the method according to any one of claims 9 to 13.

Citation Information

Patent Citations

  • DCC acquisition method, focusing method and system, camera module and terminal

    CN111556247A

  • Out-of-focus conversion coefficient calibration method, PDAF method and camera module

    CN113014790A

  • Image registration method and device

    CN117114977A

  • Imaging device and lens device

    JP2018165826A

Cited By

  • Parameter calibration method and device of image acquisition equipment and computer equipment

    CN121437652A