Camera focusing method and camera calibration method
By calibrating the reference defocus conversion coefficient in the electronic camera and adjusting it using the adjustment coefficient, the problem in the prior art that the DCC calibration process is required for each optical parameter is solved, and the effect of simplifying the calibration process, saving time and supporting continuously adjustable optical parameters is achieved.
Patent Information
- Application Number
- CN202311693296.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-08
- Publication Date
- 2025-06-10
AI Technical Summary
When using optical parameter variable lenses, existing electronic cameras need to perform defocus conversion coefficient (DCC) calibration process for each optical parameter, resulting in cumbersome, time-consuming and inability to support continuously adjustable optical parameters.
By calibrating the reference defocus conversion coefficient when the camera adopts reference optical parameters, and adjusting the reference defocus conversion coefficient according to the current optical parameters using the adjustment coefficient, the current defocus conversion coefficient corresponding to the current optical parameters is determined, thereby realizing automatic focus on the camera lens.
Simplifies the camera's DCC calibration process, saves calibration time, and supports the camera to have continuously adjustable optical parameters.
Smart Images

Figure CN120128796A_ABST
Abstract
Description
Technical Field
[0001] 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
[0002] With the development of electronic cameras, users have a growing 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 photographed by the electronic camera clearer, the target object can be used as a focus point, and automatic focusing is performed based on the focus point.
[0003] Phase detection auto focus (PDAF) is an auto focus technology. When an electronic camera uses PDAF technology for auto focus, it needs to use a defocus conversion coefficient (DCC). Therefore, the electronic camera needs to calibrate the DCC in advance.
[0004] If the lens used in the electronic camera is a zoom lens or other lens with variable optical parameters, the lens has different DCC under different optical parameters, so the electronic camera needs to perform a DCC calibration process for each optical parameter to obtain the DCC corresponding to different optical parameters. Repeating the DCC calibration process for the electronic camera many times is not only cumbersome and time-consuming, but also cannot support continuously adjustable optical parameters. Summary of the invention
[0005] 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.
[0006] In the first aspect, a camera focusing method is provided. The execution subject of the method may be an electronic device or a chip, a chip system or a 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 is an example of an electronic device executing the method. 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. Among them, 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.
[0007] 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 current optical parameters that change in real time 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 that the present application can calibrate the reference defocus conversion coefficient only when the camera adopts the reference optical parameters, without executing a DCC calibration process for each optical parameter of the camera. This can not only simplify the process of DCC calibration of the camera and save the time of DCC calibration of the camera, but also support the camera with continuously adjustable optical parameters.
[0008] 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.
[0009] In the above implementation method, the electronic device can calibrate the reference defocus conversion coefficient when the camera adopts 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 the storage space of the electronic device.
[0010] In another optional implementation, the electronic device can determine the displacement in the following manner: obtaining the current phase difference of the camera; obtaining the current defocus conversion coefficient corresponding to the current optical parameters stored in advance; and determining the displacement used to focus the camera lens according to 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.
[0011] In the above implementation, the electronic device can calibrate the reference defocus conversion coefficient when the camera adopts 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 execute a DCC calibration process for each optical parameter of the camera, which can not only simplify the process of DCC calibration of the camera, but also save the time of DCC calibration of the camera.
[0012] 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.
[0013] 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.
[0014] 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.
[0015] 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.
[0016] The value of m can be adjusted according to different 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.
[0017] 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.
[0018] 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.
[0019] 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 inverse of the entrance pupil diameter.
[0020] 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.
[0021] In the second aspect, a camera calibration method is provided, and 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 not limited to an electronic camera, a smart phone, a wearable device, etc., and 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, calibrate the reference defocus conversion coefficient of the camera; based on the adjustment coefficient, adjust 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 any of the optical parameters and the reference optical parameters.
[0022] 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.
[0023] In an optional implementation manner, the adjustment coefficient is determined based on the mth power of the ratio of any optical parameter to the reference optical parameter.
[0024] 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.
[0025] 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 inverse of the entrance pupil diameter.
[0026] 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.
[0027] In a third aspect, a camera focusing device is provided, which includes corresponding functional modules, which are respectively 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 by executing the corresponding software implementation 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 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.
[0028] 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 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 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 optical parameter and the reference optical parameter.
[0029] In a fifth aspect, a chip is provided, which can be applied to the above electronic device. The chip may include a processor and a power supply circuit, the power supply circuit is used to power the processor, and the processor is used to execute a computer program to implement any method recorded in the first aspect or any method recorded in the second aspect.
[0030] In a 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.
[0031] 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 above, or any one of the methods recorded in the second aspect.
[0032] 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 above, or any one of the methods recorded in the second aspect.
[0033] 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
[0034] Figure 1 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0035] Figure 2A schematic diagram of the flow of the DCC calibration process provided in the embodiment of the present application;
[0036] Figure 3 It is a schematic diagram of the camera's focus state and out-of-focus state;
[0037] Figure 4 It is a schematic diagram of the phase difference corresponding to the imaging when the camera lens is in different positions;
[0038] Figure 5 A schematic diagram of a camera focusing method according to an embodiment of the present application;
[0039] Figure 6 This is a schematic diagram of the camera imaging principle;
[0040] Figure 7 This is a schematic diagram of the principle of forming phase difference during camera imaging;
[0041] Figure 8 A schematic diagram of a flow chart of another camera focusing method provided in an embodiment of the present application;
[0042] Fig. 9 A structural block diagram of a camera focusing device provided in an embodiment of the present application;
[0043] Fig.10 A structural block diagram of a camera calibration device provided in an embodiment of the present application;
[0044] Fig.11 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. The terms used in the implementation mode of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0046] Before introducing the specific solutions provided by the embodiments of the present application, some 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.
[0047] (1) Circle of confusion: When an object point is imaged, in the focused state, the imaging light beam of the object point converges to a point, and the image is clear. In the defocused state, the imaging light beam of the object point cannot converge to a point, but forms a diffuse circular projection on the imaging plane, which is visually a virtual shadow. This circular projection can be called the circle of confusion.
[0048] (2) Phase difference (PD): In the defocused state, when an object is imaged on the imaging plane of the camera, there is an offset between the pixel imaging positions of the left half of the imaging plane and the pixel imaging positions of the right half of the imaging plane. The offset is called the phase difference. When using PDAF technology for autofocus, the amount of displacement that the camera lens needs to move can be determined based on the product of the phase difference and the defocus conversion coefficient.
[0049] In the embodiments of the present application, "multiple" refers to two or more than two. 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 there is no restriction on which ones are included. For example, including at least one of A, B and C, then A, B, C, A and B, A and C, B and C, or A and B and C may be included. "And / or" describes the association relationship of associated objects, indicating that three relationships may 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 previously associated objects are in an "or" relationship.
[0050] Unless otherwise specified, the ordinal numbers such as "first" and "second" mentioned 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 the multiple objects.
[0051] 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 videos. Exemplarily, the electronic device including the camera function can be a smart camera, a smart phone, a wearable device (such as a smart watch, etc.), a tablet computer, a personal computer (PC, personal computer), a personal digital assistant (personal digital assistant, PDA), a vehicle terminal, a drone, an aerial camera, a computer, etc.
[0052] Figure 1 FIG. 1 shows an optional hardware structure diagram of an electronic device 100 to which the embodiment of the present application is applicable. Figure 1As shown, 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 .
[0053] 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 processor (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), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0054] 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.
[0055] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory, or a memory. The memory may store instructions or data that the processor 110 has just used or is cyclically using. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory, thereby avoiding repeated access and reducing the waiting time of the processor 110.
[0056] In some embodiments, the processor 110 may include one or more interfaces. The interface 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, etc.
[0057] The USB interface is an interface that complies with USB standard specifications, and specifically may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface may be used to connect a charger to charge the electronic device 100, may be used to transmit data between the electronic device 100 and a peripheral device, may be used to connect headphones, and play audio through the headphones, etc.
[0058] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic 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 in the above embodiments, or a combination of multiple interface connection methods.
[0059] The memory 120 of the electronic device 100 may be arranged inside the electronic device 100 for storing computer executable program codes, wherein the executable program codes include 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 may store an operating system, an application program required for at least one function (such as a camera application), etc. The data storage area may store data created during the use of the electronic device 100 (such as images taken by a camera, etc.), 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 (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 arranged 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.
[0060] In some embodiments, the memory 120 of the electronic device 100 may also be replaced by an external memory or an external memory card. Exemplarily, 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 via the external memory interface to implement a data storage function, such as files such as images or videos taken by a camera can 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.
[0061] The electronic device 100 can realize the shooting function through an image signal processing unit (ISP), a camera 130, a DSP, etc. The camera 130 can be understood as a camera, and the camera 130 can include a lens and a photosensitive element. The lens can include one or more lenses, for example, the lens can be a lens group composed of multiple lenses.
[0062] The ISP is used to process the data fed back by the camera 130. For example, when taking a photo, the shutter is opened, and the light is transmitted to the photosensitive element of the camera 130 through the lens of the camera 130. The light signal is converted into an electrical signal, and the photosensitive element transmits the acquired electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 130.
[0063] 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 a photosensitive element converting a light signal into an electrical signal can be called photosensitization. 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 RGB, YUV or other format.
[0064] In some embodiments, the processor 110 may trigger the camera 130 according to the program or instruction in the memory 120, collect at least one image through the camera 130, and perform corresponding processing on the at least one image according to the program or instruction, such as image enhancement processing, image post-processing, etc. After processing, the processed image may be displayed by the display screen 150. In some embodiments, the camera 130 of the electronic device 100 may include 1 or N cameras, where N is a positive integer greater than 1. For example, the electronic device 100 may include at least one front camera and at least one rear camera. For another example, the electronic device 100 may also include a side camera.
[0065] In some embodiments, the camera 130 may use a lens with variable optical parameters, and the optical parameters of the camera may also be referred to as the optical parameters of the camera lens. The optical parameters of the camera may include, but are not limited to, focal length, optical zoom ratio, aperture number, the inverse of the entrance pupil diameter, the ratio of focal length to entrance pupil diameter, etc. Among them, the focal length may also be referred to as focal length, which is a measurement method for measuring the convergence or divergence of light, and refers to the distance from the center point of the lens of the lens to the focus of light convergence when parallel light rays are incident. Generally, a camera with a short focal length has better light-gathering ability than a camera with a long focal length. The optical zoom ratio refers to the magnification of the lens, and the optical zoom ratio 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 incident light beam, which is related to the amount of light entering the lens, and can be understood as the diameter of the current light-transmitting part of the lens. The aperture number is the ratio of the focal length to the entrance pupil diameter, which is proportional to the amount of light entering the lens. The larger the aperture number, the more light entering. For example, the camera 130 may use a zoom lens with a variable focal length.
[0066] 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.
[0067] 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 used 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 a wired charger through a USB interface. In some wireless charging embodiments, the charging management module may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module is charging the battery, it may also power the electronic device through the power management module.
[0068] The power management module is used to connect the battery, the charging management module and the processor 110. The power management module receives input from the battery and / or the charging management module to power the processor 110, the memory 120, the display screen 150 and the camera 130. The power management module can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module can also be set in the processor 110. In other embodiments, the power management module and the charging management module can also be set in the same device.
[0069] The electronic device 100 implements the display function through a graphics processing unit (GPU), a display screen 150, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 150 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0070] The display screen 150 is used to display images, videos, etc. The display screen 150 includes a display panel, and the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or 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.
[0071] The electronic device 100 may further include a key 160, for example, a power key, a camera confirmation key, a volume key, a parameter adjustment key, etc. The key may be a mechanical key or a touch key. The electronic device 100 may receive a key input and generate a key signal input related to the user settings and function control of the electronic device 100.
[0072] It is to be understood that the structure illustrated in the embodiment 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 in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0073] Exemplarily, the electronic device 100 may also 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 an analog audio signal output, and is also used to convert analog audio input into a digital audio signal. The audio module can also be used to encode and decode audio signals. In some embodiments, the audio module can be arranged in the processor 110, or some functional modules of the audio module can be arranged in the processor 110. The speaker is also called a "speaker" and is used to convert an audio electrical signal into a sound signal. The microphone is also called a "microphone" and a "microphone" and is used to convert a sound signal into an electrical signal. The headphone jack is used to connect a wired headset. The headphone jack can be a USB interface, or it can be a 3.5mm open mobile electronic device platform (open mobile terminal platform, OMTP) standard interface, or a cellular telecommunications industry association of the USA (cellular telecommunications industry association of the USA, CTIA) standard interface.
[0074] 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 optical parameters of the camera 130 can be adjusted 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 automatic focus. The process of automatic focus needs to convert the detected PD into the displacement amount that the lens needs to move. This conversion process requires the use of DCC, so the DCC needs to be calibrated in advance.
[0075] If the lens used in the electronic device is a lens with variable optical parameters, the lens has different DCC under different optical parameters, so the electronic device needs to perform a DCC calibration process for each optical parameter to obtain the DCC corresponding to the different optical parameters. The electronic device repeatedly performs the DCC calibration process, which is not only cumbersome and time-consuming, but also cannot support continuously adjustable optical parameters.
[0076] 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 including a camera, or can be executed by a chip or chip system located in the electronic camera or electronic device.
[0077] The camera focusing method provided in the embodiment of the present application may include the following steps: obtaining the current optical parameters of the camera, and focusing 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, and 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.
[0078] 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 current optical parameters that change in real time and the reference optical parameters, and the calibrated reference defocus conversion coefficient. Then, the displacement used to focus the camera lens can be determined based on the current defocus conversion coefficient. 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 can not only simplify the camera calibration process and save camera calibration time, but also support continuously adjustable optical parameters.
[0079] The camera focusing method provided by the present application is introduced below through specific embodiments.
[0080] In some embodiments, the electronic device of the embodiment 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 a 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 the optical parameter, in one embodiment, the electronic device can perform the DCC calibration process when the camera adopts the reference aperture number F0_number, and the process may include Figure 2 The following steps are shown:
[0081] S201, move the camera lens to position L1.
[0082] The electronic device fixes the aperture number of the camera at the reference aperture number F0_number, and moves the position of the lens to position L1 via the focus motor while keeping the position of the reference object to be photographed and the position of the imaging plane of the camera's photosensitive component unchanged.
[0083] S202: Acquire a phase difference corresponding to the current position based on the captured image.
[0084] like Figure 3As shown, when an object is imaged, in the focused state, the object is clearly imaged on the imaging plane of the camera, and the pixel imaging position a1 of the left half of the imaging plane is consistent with the pixel imaging position a2 of the right half. At this time, the phase difference PD=a1-a2=0. Therefore, the position of the camera lens in the focused state can be called the focused position of the lens. In the out-of-focus state, the imaging picture of the object on the imaging plane of the camera is diffuse, and there is an offset between the pixel imaging position b1 of the left half of the imaging plane and the pixel imaging position b2 of the right half. The offset is PD, and at this time 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 of the left half of the imaging plane and the pixel imaging position of 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 of the left half of the imaging plane and the pixel imaging position of the right half also changes accordingly, that is, the clarity of the object imaging picture can reflect the magnitude of the phase difference.
[0085] 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 according to the clarity of the image.
[0086] S203, determine whether the acquired phase difference reaches a set number; if yes, execute step S205; if not, execute step S204.
[0087] S204, change the position of the lens; return to step S202.
[0088] like Figure 4 As shown, after obtaining the phase difference PD1 corresponding to position L1, the position of the lens can be changed, and the lens can be moved to position L2. When the lens of the camera is at position L2, an image of the reference object is captured by the camera. According to the clarity of the image, the phase difference PD2 corresponding to position L2 can be determined. Then the lens can be moved to position L3, and so on, until a set number of phase differences are obtained. Exemplarily, 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 position L2, position L3 to position Ln in sequence, and the phase differences PD1 to PDn corresponding to the n positions are obtained respectively.
[0089] 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.
[0090] Assuming that the set number is n, in one embodiment, according to the phase differences PD1~PDn corresponding to the n positions of the lens, a curve of the corresponding relationship between the phase difference and the lens position can be fitted, and according to the curve, the reference DCC corresponding to the reference aperture number F0_number can be determined. In another embodiment, according to the phase differences PD1~PDn corresponding to the n positions of the lens, the corresponding focus position when the phase difference is 0 can be predicted. Then, for each of the n positions, the distance between the position and the focus position is determined, that is, the displacement Lens shift of the lens from the position to the focus position. Since the displacement Lens shift of the lens adjusted to the focus position satisfies the following relationship: Lens shift=DCC*PD. Therefore, the distance between the position and the focus position can be divided by the phase difference corresponding to the position, and the quotient obtained can be used as a DCC, that is, DCC=Lens shift / PD. For n positions, n DCCs can be obtained, and the average value of the n DCCs is used as the reference defocus conversion coefficient DCC0 corresponding to the reference aperture number F0_number.
[0091] 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.
[0092] In an optional embodiment, since DCC is related to the optical parameters of the camera, for example, DCC can be determined by the focal length, entrance pupil diameter, aperture number, etc. of the camera lens. Different optical parameters correspond to different DCCs. The electronic device can Figure 2 The camera calibration method shown calibrates reference defocus conversion coefficients corresponding to multiple reference optical parameters respectively.
[0093] When a user turns on the camera function of an electronic device and uses the camera to capture images, the user can adjust the optical parameters of the camera at any time as needed, and the camera can focus the camera lens in time according to the real-time changing optical parameters. This process may include Figure 5 The following steps are shown:
[0094] S501, obtaining current optical parameters of the camera.
[0095] 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, 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.
[0096] S502, acquiring an initial image captured by the camera under current optical parameters, and determining a current phase difference of the camera based on the initial image.
[0097] When the camera uses the current optical parameters, the camera captures an initial image and determines the current phase difference of the camera based on the clarity of the initial image. For example, when the camera uses the current aperture number F_number, the current phase difference PD of the camera can be determined based on the initial image captured by the camera. The current phase difference of the camera can reflect the distance between the camera lens and the focus position.
[0098] S503, obtaining a reference defocus conversion coefficient corresponding to a pre-stored reference optical parameter.
[0099] 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 reference optical parameter; 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 with 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.
[0100] 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-saved reference aperture number F0_number.
[0101] S504: Determine an adjustment coefficient according to the current optical parameters and the reference optical parameters.
[0102] S505: Adjust the reference defocus conversion coefficient according to the adjustment coefficient to obtain a current defocus conversion coefficient corresponding to the current optical parameter.
[0103] 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, a0 is a set constant.
[0104] In an optional embodiment, according to the relationship between the optical parameters of the camera, it can be determined that the value of m can be 2. The principle is as follows: Take the optical parameters of the camera including the aperture number as an example for explanation, such as Figure 6 As shown, lens 602 can be understood as the lens of the camera, arrow 601 on the left side of lens 602 is the object to be photographed by the camera, and arrow 603 on the right side of lens 602 is the image of the object on the imaging plane of the camera, that is, the left side of lens 602 is the object side, and the right side is the image side. It has been explained above that when the lens of the camera is in a defocused state, there is a confusion circle in the physical imaging picture. Since the object distance is usually much larger than the image distance in the actual use scenario of the camera, the object distance can be approximately unchanged when the lens of the camera moves. Therefore, from the geometric relationship of the optical path, it can be obtained that the ratio between the Lens shift of the camera lens to the focus position and the size of the confusion circle can be described as: Lens shift / confusion circle=focal length / 0.5 entrance pupil diameter=2*F_number; wherein F_number is the aperture number, and F_number=focal length / entrance pupil diameter. It can be obtained that the Lens shift of the camera lens to the focus position=focal length / 0.5 entrance pupil diameter*confusion circle=2*F_number*confusion circle. The above-mentioned lens shift, which is the distance the lens needs to move to reach the focusing position, can be understood as the displacement that the lens needs to move when focusing.
[0105] like Figure 7 As shown in the figure, the energy of the diffuse circle generated by the lens optical path is a distribution with high energy in the center and gradually decreasing energy on both sides, and the center of the diffuse circle is the energy peak. The position of the diffuse circle can represent the position of the object imaging screen. The surface of the photosensitive element includes multiple microlenses. After the light passes through the microlenses on the surface of the photosensitive element, the left half of the pixels are superimposed with a high left and low right responsivity distribution, and the right half of the pixels are superimposed with a high right and low left responsivity distribution; in other words, Figure 7At the position indicated by the arrow in the figure, the sensitivity of the microlens in the left half gradually decreases from left to right, and the sensitivity of the microlens in the right half gradually increases from left to right. It can be seen that the slope of the sensitivity of the left and right halves of the photosensitive element is the same in magnitude and opposite in sign. The slope of the sensitivity can reflect the trend of sensitivity change. The size of the slope of the sensitivity is related to the focal length and the entrance pupil diameter, which is the ratio of the entrance pupil diameter to the focal length. It can be expressed as follows: the slope of the sensitivity is inversely proportional to the aperture number F_number, and the slope = a / F_number. Among them, a is a constant, and a is related to the optical properties of the microlens in the photosensitive element. Due to the different trends in the sensitivity change of the left and right halves of the photosensitive element, the positions of the energy peaks of the two circles of confusion obtained in the left half and the right half 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. From this we can conclude that the circle of confusion = PD*F_number / a.
[0106] Since the displacement of the lens required to be moved is Lens shift = focal length / 0.5 entrance pupil diameter*circle of confusion = 2*F_number*circle of confusion, the relationship between the displacement of the lens required to be moved and the phase difference PD can be expressed as:
[0107] Lens shift = 2 / a*focal length 2 / entrance pupil diameter 2 *PD=2 / a*F_number 2 *PD.
[0108] 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 second power (square) of the ratio of the current optical parameter to the reference optical parameter, and the adjustment coefficient can be expressed as f(opt^2). The current optical parameter DCC can be expressed as DCC=DCC0*f(opt^2).
[0109] 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 within a range of plus or minus 1.5 times, that is, the value of m may be between 1.3 and 3.
[0110] In one embodiment, the formula for determining the current optical parameter DCC may add other parameter items. For example, the formula for determining the current optical parameter DCC may be transformed into: DCC = a1*DCC0*f(opt^m)^a2+a3. Wherein, a1, a2, a3 are constants or contain other variable factors. The following relationship is satisfied between a1, a2, and a3: the values of a1 and a2 may be between 0.5 and 2, and a3 < a1*DCC0*f(opt^m)^a2.
[0111] 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.
[0112] S506, determining the displacement of the lens according to the current defocus conversion coefficient and the current phase difference.
[0113] S507, focusing the camera lens based on the determined displacement.
[0114] The electronic device can use the product of the current defocus conversion coefficient and the current phase difference as the displacement of the lens, and control the camera lens to move to the focus position according to the displacement to complete the focusing process, so that the camera can capture a clear image.
[0115] In the above embodiment, the optical parameters of the camera are described by taking 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 may also be expressed as a linear combination of multiple parameters. Exemplarily, 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. Among them, b1, b2, b3 are all set constants or may include variables. In a typical working scenario, the relationship between b1, b2, b3 satisfies max / min≤2; max refers to the maximum value of b1, b2, b3, and min refers to the minimum value of b1, b2, b3. b4 can be a set constant or may include variables. In a typical working scenario, 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 can be expressed as: optfactor=c1*focal length f+c2*1 / entrance pupil diameter d+c3*focal length f / entrance pupil diameter d+c4. Among them, c1, c2, c3 are all set constants or may include variables. In a typical working scenario, the relationship between c1, c2, c3 satisfies max / min≤2; max refers to the maximum value among b1, b2, b3, and min refers to the minimum value among b1, b2, b3. c4 can be a set constant or may include variables. In a typical working scenario, 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 can 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. Among them, 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 of d1, d2, d3, and d4, and min refers to the minimum value of d1, d2, d3, and d4.d5 may be a set constant or may include 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.
[0116] In the above embodiment, the camera can only calibrate the DCC corresponding to a single optical parameter or a small number of optical parameters, and there is no need 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, and 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 the method can also support continuously adjustable optical parameters.
[0117] On the one hand, since the DCC calibration process is performed once for each optical parameter supported by the camera in the related art, as the adjustable range of the optical parameters of the camera () is expanded, 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. Calculated based on 5s for each DCC calibration process, the total calibration duration is 5min. The embodiment of the present application supports executing the DCC calibration process only once, so the calibration duration can be shortened to 5s, which can greatly save the camera calibration time.
[0118] On the other hand, assuming that the optical parameters of the camera include focal length, if the camera lens adopts a telephoto lens, the DCC calibration process of the related technology is adopted, and 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 resulting in 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. Exemplarily, the DCC calibration process can be executed only at a short focal length, without executing 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 additional space consumption or equipment cost overhead caused by DCC calibration, thereby reducing the problem of excessive space distance required for calibration in some long focal length zoom lens scenarios.
[0119] In other embodiments, the electronic device of the embodiment of the present application may pre-calibrate a DCC corresponding to a reference optical parameter, and then derive more DCCs corresponding to optical parameters based on the relationship between any optical parameter and the reference optical parameter for storage; or, the electronic device may pre-calibrate DCCs corresponding to multiple reference optical parameters, and then derive more DCCs corresponding to optical parameters based on the relationship between any optical parameter and any reference optical parameter for storage. Among them, 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.
[0120] In one embodiment, the electronic device can perform a DCC calibration process when the camera uses reference optical parameters. Figure 2 The process shown is executed and will not be repeated 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. Exemplarily, 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, which will not be repeated here.
[0121] 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. The DCC calibration process can refer to Figure 2 The process shown is executed to obtain reference defocus conversion coefficients corresponding to multiple reference optical parameters. After obtaining the reference defocus conversion coefficients corresponding to 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 multiple optical parameters within the adjustable range of the optical parameters can be obtained and saved. Exemplarily, the correspondence between multiple optical parameters and defocus conversion coefficients can be saved in the DCC lookup table.
[0122] When a user turns on the camera function of an electronic device and uses the camera to capture images, the user can adjust the optical parameters of the camera at any time as needed, and the camera can focus the camera lens in time according to the real-time changing optical parameters. This process may include Figure 8 The following steps are shown:
[0123] S801, obtaining current optical parameters of the camera.
[0124] 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.
[0125] S802, acquiring an initial image captured by the camera under current optical parameters, and determining a current phase difference of the camera based on the initial image.
[0126] When the camera adopts the current optical parameters, the camera captures an initial image and determines the current phase difference of the camera according to the clarity of the initial image. The current phase difference of the camera can reflect the distance between the camera lens and the focus position.
[0127] S803, obtaining a current defocus conversion coefficient corresponding to the pre-saved current optical parameter.
[0128] 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 the multiple optical parameters, and read the current defocus conversion coefficient corresponding to the current optical parameter from the DCC lookup table. The defocus conversion coefficient corresponding to a part of the optical parameters in the DCC lookup table is calculated according to Figure 2 The optical parameters obtained by the DCC calibration process shown in the figure 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 in the following manner: 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 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 coefficients corresponding to multiple optical parameters of the camera can be obtained and saved.
[0129] S804, determining the displacement of the lens according to the current defocus conversion coefficient and the current phase difference.
[0130] S805, focusing the camera lens based on the determined displacement.
[0131] The electronic device can use the product of the current defocus conversion coefficient and the current phase difference as the displacement of the lens, and control the camera lens to move to the focus position according to the displacement to complete the focusing process, so that the camera can capture a clear image.
[0132] In the above embodiment, the camera can only calibrate the DCC corresponding to a single optical parameter or a small number of optical parameters, and then derive the defocus conversion coefficients corresponding to more optical parameters by determining the adjustment coefficients for storage. This method does not need to perform a DCC calibration process for each optical parameter supported by the camera, which can simplify the camera calibration process and save camera calibration time.
[0133] Based on the same technical concept as the above method embodiment, the present application embodiment also provides a camera focusing device. The camera focusing device can be set in the above electronic device. In some embodiments, Fig. 9 As shown, the camera focusing device 900 may include a parameter acquisition unit 901 and a camera focusing unit 902. The camera focusing device 900 may be used to implement the functions in the above camera focusing method embodiment, and thus may achieve the beneficial effects possessed by the above method embodiment.
[0134] Among them, the parameter acquisition unit 901 can be used to obtain the current optical parameters of the camera; the camera focus 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.
[0135] 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; determine the displacement according to the current defocus conversion coefficient and the current phase difference.
[0136] 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; determine the displacement according to the current defocus conversion coefficient and the current phase difference.
[0137] 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.
[0138] In an optional embodiment, the adjustment coefficient is determined based on a ratio of a current optical parameter to a reference optical parameter.
[0139] 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.
[0140] 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.
[0141] 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 inverse of the entrance pupil diameter.
[0142] 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.
[0143] 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, and 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 to realize all the functions of the camera focus device.
[0144] Each functional module in the embodiment of the present application can be integrated into one processor, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional units.
[0145] Based on the same technical concept as the above method embodiment, the present application embodiment also provides a camera calibration device. The camera calibration device can be set in the above electronic device. In some embodiments, Fig.10 As shown, the camera calibration device 1000 may include a camera calibration unit 1001 and a conversion unit 1002. The camera calibration device 1000 may be used to implement the functions in the above camera calibration method embodiment, and thus may achieve the beneficial effects of the above method embodiment.
[0146] 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.
[0147] In an optional embodiment, the adjustment coefficient is determined based on a ratio of any optical parameter to a reference optical parameter.
[0148] 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.
[0149] 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.
[0150] 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 inverse of the entrance pupil diameter.
[0151] 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.
[0152] 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, and the camera calibration unit 1001 and the conversion unit 1002 respectively implement different steps in the camera calibration method executed by the electronic device to realize all the functions of the camera calibration device.
[0153] Each functional module in the embodiment of the present application can be integrated into one processor, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional units.
[0154] Based on the same technical concept as the above method embodiment, a chip is also provided in the embodiment of the present application, which may be a computing chip and may be applied to the above electronic device. The chip may be used to implement the functions of the above method embodiment, and thus may achieve the beneficial effects of the above method embodiment.
[0155] In some embodiments, the structure of the chip 1100 can be as follows: Fig.11 As shown, it includes a processor 1101 and a power supply circuit 1102 connected to the processor 1101. The processor 1101 and the power supply circuit 1102 can be connected to each other through a bus. The processor 1101 can be a digital signal processor (digital signal processor, DSP), ASIC, field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components or other specific integrated circuits. The bus can be a peripheral component interconnect (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extendedindustry standard architecture, EISA) bus, etc. The bus can 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 through the bus.
[0156] Processor 1101 can be connected to a memory disposed outside the chip, or to a memory disposed inside the chip, to run software programs and modules stored in the memory, thereby executing various functional applications and data processing of chip 1100, such as the camera focusing method or camera calibration method provided in an embodiment of the present application.
[0157] In some embodiments, the processor 1101 may include one or more processing units, and different processing units may be independent devices or integrated into one or more processors. The processor 1101 may also include a controller, which may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0158] 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.
[0159] In other embodiments, if the chip executes a camera calibration method, the processor 1101 may perform the following operations: calibrate a reference defocus conversion coefficient of the camera when the camera adopts reference optical parameters; 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.
[0160] 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 lens with variable optical parameters, 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 by the above method embodiment, and thus can achieve the beneficial effects of the above method embodiment. The structure of the electronic device can be as follows: Figure 1 As shown. In some embodiments, the electronic device may include a processor and a memory connected to the processor. The processor and the memory may be connected to each other via a bus, and the processor may be a general-purpose processor, such as a microprocessor, or other conventional processors. The bus may be a PCI bus or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0161] 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.
[0162] The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store at least one application program, etc.; the data storage area may be used to store data used during the operation of the processor, etc. In addition, the memory 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, or other volatile solid-state storage devices.
[0163] The processor in the electronic device is used to run the computer instructions or programs stored in the memory and perform the functions implemented by any of the above method embodiments. In some embodiments, the processor may include one or more processing units, and different processing units may be independent devices or integrated in one or more processors. The processor may also include a controller, which may generate an operation control signal based on the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
[0164] The method steps in the embodiments of the present application may be implemented by hardware, or by a processor executing a computer program or instruction. The computer program or instruction may constitute a computer program product.
[0165] The present application also provides a computer program product, which includes computer executable instructions. In one embodiment, the computer executable instructions are used to enable a computer to execute the functions of the above method embodiment.
[0166] The computer executable instructions may be stored in a computer readable storage medium. The present application also provides a computer readable storage medium, wherein the computer readable storage medium stores the executable instructions. In one embodiment, the computer executable instructions are used to enable a computer to execute the functions in the above method embodiment.
[0167] 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.
[0168] Computer executable instructions may be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium. For example, the computer program or instructions may be transferred from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The computer readable storage medium may 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 may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disc (DVD); it may also be a semiconductor medium, such as a solid state drive.
[0169] One or more of the above modules or units can be implemented by 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 (digital signal processor, DSP), a microcontroller (microcontroller unit, MCU), or an artificial intelligence processor and other types of storage devices for running software, each storage device may include one or more cores for executing software instructions for calculation or processing. The processor may be built into a SoC, a DPU or an ASIC, or it may be an independent semiconductor chip. In addition to the core used to execute software instructions for calculation or processing in the processor, it may further include necessary hardware accelerators, such as FPGA, PLD or logic circuits for implementing dedicated logic operations.
[0170] 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.
[0171] The above is only a specific implementation of the present application, but the protection scope 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 protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A camera focusing method, characterized in that, the method includes: 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 amount used for focusing the lens of the camera 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; 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 uses the reference optical parameters.
2. The method according to claim 1, characterized in that, the displacement amount is determined by the following method: 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; determining the displacement amount according to the current defocus conversion coefficient and the current phase difference.
3. The method according to claim 1, characterized in that, the displacement amount is determined by the following method: obtaining the current phase difference of the camera; obtaining the current defocus conversion coefficient corresponding to the current optical parameters pre-stored; the current defocus conversion coefficient is obtained by adjusting the reference defocus conversion coefficient according to the adjustment coefficient; determining the displacement amount 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 of the current phase difference of the camera includes: shooting an initial image; determining the current phase difference of the camera 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 the ratio of the current optical parameters to the reference optical parameters.
6. The method according to claim 5, characterized in that, the adjustment coefficient is determined based on the m-th power of the ratio of the current optical parameters to the reference optical parameters.
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, reciprocal of entrance pupil diameter; or, the current optical parameters include a linear combination of the following optical parameters: focal length, reciprocal of entrance pupil diameter, ratio of focal length to entrance pupil diameter.
9. A camera calibration method, characterized in that, the method includes: calibrating the reference defocus conversion coefficient of the camera when the camera uses the reference optical parameters; adjusting the reference defocus conversion coefficient based on an adjustment coefficient to obtain the target defocus conversion coefficient corresponding to any optical parameter; the adjustment coefficient is determined based on the any optical parameter and the reference optical parameters.
10. The method according to claim 9, characterized in that, The adjustment coefficient is determined based on the ratio of any one of the optical parameters to the reference optical parameter.
11. The method according to claim 10, wherein, the adjustment coefficient is determined based on the m-th power of the 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, wherein, the reference optical parameter includes at least one or a combination of the following optical parameters: f-number, focal length, optical zoom ratio, reciprocal of the entrance pupil diameter, ratio of the focal length to the entrance pupil diameter.
13. The method according to claim 12, wherein, the reference optical parameter includes a linear combination of the following optical parameters: f-number, focal length, reciprocal of the entrance pupil diameter; or, the current optical parameter includes a linear combination of the following optical parameters: focal length, reciprocal of the entrance pupil diameter, ratio of the focal length to the entrance pupil diameter.
14. A camera focusing device, wherein, the device includes: a parameter acquisition unit configured to acquire the current optical parameter of the camera; a camera focusing unit configured to focus the lens of the camera based on the current optical parameter of the camera; wherein, the displacement amount 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 parameter and the reference optical parameter of the camera; the reference defocus conversion coefficient is calibrated when the camera uses the reference optical parameter.
15. The device according to claim 14, wherein, the camera focusing unit is specifically configured to: acquire 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 parameter; determine the displacement amount according to the current defocus conversion coefficient and the current phase difference.
16. The device according to claim 14, wherein, the camera focusing unit is specifically configured to: acquire the current phase difference of the camera; acquire the current defocus conversion coefficient corresponding to the current optical parameter pre-stored; the current defocus conversion coefficient is obtained by adjusting the reference defocus conversion coefficient according to the adjustment coefficient; determine the displacement amount according to the current defocus conversion coefficient and the current phase difference.
17. The device according to any one of claims 14 to 16, wherein, the adjustment coefficient is determined based on the ratio of the current optical parameter to the reference optical parameter.
18. The device according to claim 17, wherein, the adjustment coefficient is determined based on the m-th 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, wherein, the current optical parameter includes at least one or a combination of the following optical parameters: f-number, focal length, optical zoom ratio, reciprocal of the entrance pupil diameter, ratio of the focal length to the entrance pupil diameter.
20. A camera calibration device, wherein, The device includes: a camera calibration unit configured to calibrate a reference defocus conversion coefficient of the camera when the camera adopts reference optical parameters; a conversion unit configured 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 the any optical parameter and the reference optical parameter.
21. The device according to claim 20, wherein, the adjustment coefficient is determined based on a ratio of the any optical parameter to the reference optical parameter.
22. The device according to claim 21, wherein, the adjustment coefficient is determined based on an m-th power of a ratio of the any optical parameter to the reference optical parameter.
23. The device according to any one of claims 20 to 22, wherein, the reference optical parameter includes at least one or a combination of the following optical parameters: f-number, focal length, optical zoom ratio, reciprocal of entrance pupil diameter, ratio of focal length to entrance pupil diameter.
24. A chip, wherein, it includes a processor and a power supply circuit; the power supply circuit is configured to supply power to the processor, and the processor is configured 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, wherein, it includes a processor and a memory; a computer program is stored in the memory, and the processor is configured 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, wherein, it stores computer-executable instructions, and the computer-executable instructions are configured to cause a computer to 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, wherein, it includes computer-executable instructions, and the computer-executable instructions are configured to cause a computer to 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
Cited By
Parameter calibration method and device of image acquisition equipment and computer equipment
CN121437652A