Image processing method and related device
By reducing the credibility of weak texture sub-regions, the problem of inaccurate focus in electronic device shooting is solved, and the focus accuracy and user experience are improved.
Patent Information
- Application Number
- CN202410176103.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-07
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-02-07
AI Technical Summary
During the shooting process of electronic devices, there is an inaccurate focus problem caused by weak texture sub-areas, which affects the user experience.
By reducing the credibility of weak texture sub-regions to avoid them from being used as focus references, the focus accuracy is improved. The phase difference processing method is used to adjust the lens position to achieve accurate focus.
It improves the focusing accuracy of electronic devices, improves the user experience, and ensures the clarity of captured images.
Smart Images

Figure CN119277202B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to an image processing method and related devices. Background Art
[0002] In people's daily lives, it has become a common phenomenon to use the shooting functions of electronic devices such as mobile phones and smart watches to record life anytime and anywhere. The shooting function of electronic devices has added a lot of fun to people's lives.
[0003] However, at present, when people use the shooting function of electronic devices, a focus pulling phenomenon may occur, that is, the image or video taken may not be in focus, which seriously affects the user experience. Summary of the Invention
[0004] The embodiments of the present application provide an image processing method and related devices, which are beneficial for avoiding electronic devices from focusing through phase differences in weak texture sub-regions, improving the focusing accuracy of electronic devices, and helping users obtain in-focus images, thereby improving user experience.
[0005] In a first aspect, an embodiment of the present application proposes an image processing method, which is applied to an electronic device, the method comprising: acquiring a first image frame; when it is determined that a weak texture sub-region exists in the focus area of the first image frame, reducing the credibility of the weak texture sub-region; based on the phase difference of the focus area, driving a motor to adjust the position of the electronic device lens, the phase difference is obtained based on the target phase difference of each of some or all sub-regions in the focus area, the credibility values of the target phase differences of all or some of the sub-regions are greater than or equal to a preset threshold, and the some or all of the sub-regions do not include the weak texture sub-region.
[0006] It should be understood that the credibility of the weak texture sub-region refers to the credibility of the target phase difference in the weak texture sub-region. The in-focus region of the first image frame includes multiple sub-regions, and the phase difference of the in-focus region can be the smallest target phase difference among one or more target phase differences corresponding to one or more sub-regions whose target phase difference credibility value is greater than or equal to a preset threshold.
[0007] Optionally, the preset threshold can be 500 or any other value, the size of the focus area can be 0.4*0.4 or 0.3*0.3, the focus area can be the center area of the image, and the focus area can include 9 sub-areas, but this application is not limited to this.
[0008] In an embodiment of the present application, when it is determined that a weak texture sub-region exists in the focus area of the first image frame, the credibility of the weak texture sub-region is reduced. This is beneficial to avoid the electronic device focusing through the phase difference of the weak texture sub-region, which is beneficial to improving the focusing accuracy of the electronic device, and is beneficial for the user to obtain an in-focus image, thereby improving the user experience.
[0009] In combination with the first aspect, in certain implementations of the first aspect, the texture sub-region satisfies one or more of the following: the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold; or, the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region SAD is greater than a second threshold, and the weak texture sub-region includes multiple SAD values, and the multiple SAD values are obtained based on the left image in the weak texture sub-region and the right image in the weak texture sub-region.
[0010] Optionally, the first threshold may be 1 and the second threshold may be 1000, but this application does not limit this.
[0011] It should be understood that the weak texture sub-region does not have sufficient texture features to support the target phase difference and SAD calculation, and there may be a situation where the target phase difference value is too high and / or the minimum SAD value is too high. Therefore, in the embodiment of the present application, the sub-region whose absolute value of the target phase difference is greater than the first threshold, and / or the minimum value of the sum of the absolute values of the differences SAD is greater than the second threshold is determined to be a weak texture sub-region. In this way, the weak texture sub-region can be processed to reduce its credibility. Furthermore, after reducing the credibility of the weak texture sub-region, the possibility of the target phase difference of the weak texture sub-region being used as the phase difference used for focusing can be reduced, which is conducive to improving focusing accuracy and improving user experience.
[0012] In combination with the first aspect, in some implementations of the first aspect, the method further includes: selecting a first left image that matches a preset window size from the left image in the weak texture sub-area, and selecting a first right image that matches the preset window size from the right image in the weak texture sub-area, adding the absolute value of the difference between the grayscale values corresponding to each pixel in the first left image and the first right image to obtain a first SAD value, wherein the multiple SAD values of the weak texture sub-area include the first SAD value, the first left image and the first right image are respectively collected through the left pixel and the right pixel of the same pixel area of the electronic device, and the first phase difference between the first left image and the first right image is zero; offsetting the preset window by N pixels to the left from the position of the first right image to obtain a second right image, and adding the absolute value of the difference between the grayscale values corresponding to each pixel in the first left image and the second right image, A second SAD value is obtained, the multiple SAD values of the weak texture sub-region include the second SAD value, and the second phase difference between the first left image and the second right image is negative N; the preset window is offset M pixels to the right from the position of the first right image to obtain a third right image, and the absolute value of the difference between the grayscale values corresponding to each pixel in the first left image and the third right image is added to obtain a third SAD value, the multiple SAD values of the weak texture sub-region include the third SAD value, and the third phase difference between the first left image and the third right image is M; based on the first SAD value and the first phase difference corresponding to the first SAD value, the second SAD value and the second phase difference corresponding to the second SAD value, and the third SAD value and the third phase difference corresponding to the third SAD value, a SAD curve with phase difference as the independent variable and SAD value as the dependent variable is obtained.
[0013] Optionally, M and N can be any value greater than zero, which is not limited in this application.
[0014] In one possible implementation, before the left image in the weak texture sub-region and the right image in the weak texture sub-region are converted into the SAD curve, the left image array and the right image array can also be preprocessed. The preprocessing method can be mean-std normalization, but this application is not limited to this.
[0015] In combination with the first aspect, in certain implementations of the first aspect, the credibility of the weak texture sub-region is reduced, including: when the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold and the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD value) is greater than a second threshold, obtaining the credibility of the weak texture sub-region based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, a first value related to the left endpoint value of the SAD curve, a second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, a first coefficient, a second coefficient, and a third coefficient; wherein the first coefficient is a preset constant, the second coefficient is related to the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD value), and the third coefficient is related to the target phase difference of the weak texture sub-region.
[0016] In combination with the first aspect, in some implementations of the first aspect, the SAD value based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value related to the left endpoint value of the SAD curve, the second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, the second coefficient, and the third coefficient to obtain the credibility of the weak texture sub-region, including: based on the SAD value The minimum value c0, the SAD value a1 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value a2 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value c2 related to the left endpoint value of the SAD curve, the second value c1 related to the right endpoint value of the SAD curve, the area A of the weak texture sub-region, the first coefficient e1, the second coefficient e2, and the third coefficient e3. When a1 is greater than or equal to a2, the credibility Conf of the weak texture sub-region satisfies the following formula:
[0017]
[0018] When a1 is less than a2, the credibility Conf of the weak texture sub-region satisfies the following formula:
[0019]
[0020] Among them, the second coefficient e2 is the reciprocal of the minimum value of the sum of the absolute values of the differences SAD values corresponding to the weak texture sub-region, and the third coefficient e3 is the reciprocal of the integer obtained by rounding up the absolute value of the target phase difference of the weak texture sub-region.
[0021] It should be understood that the second coefficient and the third coefficient are both values greater than 0 and less than 1.
[0022] In an embodiment of the present application, when calculating the credibility of the target phase difference of the weak texture sub-region, the credibility value finally obtained by the weak texture sub-region can be reduced by multiplying the second coefficient and the third coefficient. In this way, when the sub-regions in the focus area are subsequently screened based on the sub-region credibility values, the probability of the weak texture sub-region being selected can be reduced, which is beneficial to avoiding the target phase difference of the weak texture sub-region as the phase difference used when the electronic device focuses, and is beneficial to improving the focusing accuracy and stability.
[0023] In combination with the first aspect, in certain implementations of the first aspect, the credibility of the weak texture sub-region is reduced, including: when the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold and the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD value) is less than or equal to a second threshold, obtaining the credibility of the weak texture sub-region based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, a first value related to the left endpoint value of the SAD curve, a second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, a first coefficient, and a third coefficient; wherein the first coefficient is a preset constant and the third coefficient is related to the target phase difference of the weak texture sub-region.
[0024] In combination with the first aspect, in some implementations of the first aspect, the credibility of the weak texture sub-region is obtained based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, a first value related to the left endpoint value of the SAD curve, a second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, and the third coefficient, including: based on the SAD value The minimum value c0 of the SAD value curve, the SAD value a1 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value a2 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value c2 related to the left endpoint value of the SAD curve, the second value c1 related to the right endpoint value of the SAD curve, the area A of the weak texture sub-region, the first coefficient e1, and the third coefficient e3. When a1 is greater than or equal to a2, the credibility Conf of the weak texture sub-region satisfies the following formula:
[0025]
[0026] When a1 is less than a2, the credibility Conf of the weak texture sub-region satisfies the following formula:
[0027]
[0028] The third coefficient e3 is the reciprocal of an integer obtained by rounding up the absolute value of the target phase difference of the weak texture sub-region.
[0029] In an embodiment of the present application, when the absolute value of the target phase difference of the weak texture sub-region is greater than the first threshold, and the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD) is less than or equal to the second threshold, when calculating the credibility of the target phase difference of the weak texture sub-region, the credibility value finally obtained by the weak texture sub-region can be reduced by multiplying it by the third coefficient without multiplying it by the second coefficient. This is beneficial to reducing the calculation complexity of the electronic device, and is also beneficial to reducing the probability of the weak texture sub-region being selected when subsequently screening each sub-region in the focus area based on the sub-region credibility value. It is beneficial to avoid the target phase difference of the weak texture sub-region being used as the phase difference used when the electronic device focuses, and is beneficial to improving the focusing accuracy and stability.
[0030] In combination with the first aspect, in certain implementations of the first aspect, the credibility of the weak texture sub-region is reduced, including: when the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold and the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD value) is greater than a second threshold, the credibility of the weak texture sub-region is obtained based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, a first value related to the left endpoint value of the SAD curve, a second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, a first coefficient, and a second coefficient; wherein the first coefficient is a preset constant, and the second coefficient is related to the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD value).
[0031] In combination with the first aspect, in some implementations of the first aspect, the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value related to the left endpoint value of the SAD curve, the second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, and the second coefficient are obtained to obtain the credibility of the weak texture sub-region, including: based on the SAD value The minimum value c0 of the SAD value curve, the SAD value a1 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value a2 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value c2 related to the left endpoint value of the SAD curve, the second value c1 related to the right endpoint value of the SAD curve, the area A of the weak texture sub-region, the first coefficient e1, and the second coefficient e2. When a1 is greater than or equal to a2, the credibility Conf of the weak texture sub-region satisfies the following formula:
[0032]
[0033] When a1 is less than a2, the credibility Conf of the weak texture sub-region satisfies the following formula:
[0034]
[0035] The second coefficient e2 is the reciprocal of the minimum value of the sum of absolute differences (SAD) corresponding to the weak texture sub-region.
[0036] In an embodiment of the present application, when the absolute value of the target phase difference of the weak texture sub-region is greater than the first threshold, and the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD) is greater than the second threshold, when calculating the credibility of the target phase difference of the weak texture sub-region, the credibility value finally obtained by the weak texture sub-region can be reduced by multiplying it by the second coefficient without multiplying it by the third coefficient. This is beneficial to reducing the calculation complexity of the electronic device, and is also beneficial to reducing the probability of the weak texture sub-region being selected when subsequently screening each sub-region in the focus area based on the sub-region credibility value. It is beneficial to avoid the target phase difference of the weak texture sub-region being used as the phase difference used when the electronic device focuses, and is beneficial to improving the focusing accuracy and stability.
[0037] In a second aspect, an embodiment of the present application provides an image processing device, which may be an electronic device, or a chip or chip system within an electronic device. The image processing device may include a processing unit. When the image processing device is an electronic device, the processing unit may be a processor. The image processing unit executes the instructions stored in the storage unit so that the electronic device implements an image processing method described in the first aspect or any possible implementation of the first aspect. When the image processing device is a chip or chip system within an electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit so that the electronic device implements an image processing method described in the first aspect or any possible implementation of the first aspect. The storage unit may be a storage unit within the chip (for example, a register, a cache, etc.), or a storage unit within the electronic device that is located outside the chip (for example, a read-only memory, a random access memory, etc.).
[0038] In a third aspect, an embodiment of the present application provides an electronic device comprising one or more processors and a memory, wherein the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code comprising computer instructions, and the one or more processors calling the computer instructions so that the electronic device executes the method described in the first aspect or any possible implementation of the first aspect.
[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes a computer program or instructions. When the computer program or instructions are run on a computer, the computer executes the method described in the first aspect or any possible implementation of the first aspect.
[0040] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes computer program code. When the computer program code runs on a computer, it enables the computer to execute the method described in the first aspect or any possible implementation of the first aspect.
[0041] In a sixth aspect, the present application provides a chip or chip system, comprising one or more processors and a communication interface, wherein the communication interface and the one or more processors are interconnected by a line, and the one or more processors are configured to run a computer program or instruction to perform the method described in the first aspect or any possible implementation of the first aspect. The communication interface in the chip may be an input / output interface, a pin, or a circuit.
[0042] In one possible implementation, the chip or chip system described above in this application further includes at least one memory, in which instructions are stored. The memory may be a storage unit within the chip, such as a register, a cache, etc., or a storage unit of the chip (e.g., a read-only memory, a random access memory, etc.).
[0043] It should be understood that the second to sixth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of an interface of an electronic device provided in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of a focus area provided in an embodiment of the present application;
[0046] Figure 3 A hardware structure block diagram of an electronic device provided in an embodiment of the present application;
[0047] Figure 4 A software structure block diagram of an electronic device provided in an embodiment of the present application;
[0048] Figure 5 A schematic flowchart of an image processing method provided in an embodiment of the present application;
[0049] Figure 6 A schematic diagram of pixel arrangement of an electronic device provided in an embodiment of the present application;
[0050] Figure 7 A schematic diagram of a SAD calculation process provided in an embodiment of the present application;
[0051] Figure 8A schematic diagram of a SAD curve provided in an embodiment of the present application;
[0052] Figure 9 A schematic flowchart of another image processing method provided in an embodiment of the present application;
[0053] Figure 10 A schematic diagram of a chip structure provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] To facilitate a clear description of the technical solutions of the embodiments of the present application, some of the terms and technologies involved in the embodiments of the present application are briefly introduced below:
[0055] 1. Other terms
[0056] In the embodiments of this application, terms such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. For example, the terms "first chip" and "second chip" are used solely to distinguish between different chips and do not define their order. Those skilled in the art will understand that terms such as "first" and "second" do not define the quantity or execution order, and do not necessarily define differences.
[0057] It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0058] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, c can be single or multiple.
[0059] 2. Electronic devices
[0060] The electronic device of the embodiment of the present application may include a handheld device with a shooting function, a vehicle-mounted device, etc. For example, some electronic devices include: mobile phones, tablet computers, PDAs, laptop computers, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving cars, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, in-vehicle devices, wearable devices, electronic devices in 5G networks or future evolved public land mobile communication networks (PLMNs), and the like. The electronic devices in the network (PLMN) are not limited to this in the embodiments of the present application.
[0061] As an example and not a limitation, in the embodiments of the present application, the electronic device may also be a wearable device. Wearable devices may also be referred to as wearable smart devices, which are a general term for wearable devices that are intelligently designed and developed using wearable technology for daily wear, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothes or accessories. Wearable devices are not only hardware devices, but also achieve powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include those that are fully functional, large in size, and can achieve complete or partial functions without relying on smartphones, such as smart watches or smart glasses, as well as those that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various smart bracelets and smart jewelry for vital sign monitoring.
[0062] In addition, in the embodiment of the present application, the electronic device can also be an electronic device in the Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network of human-machine interconnection and object-to-object interconnection.
[0063] The electronic device in the embodiments of the present application may also be referred to as: electronic device, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent or user device, etc.
[0064] In the embodiments of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and memory (also known as main memory). The operating system can be any one or more computer operating systems that implement business processing through processes, such as a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a Windows operating system. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.
[0065] In people's daily lives, it has become a common phenomenon to use the shooting functions of electronic devices such as mobile phones and smart watches to record life anytime and anywhere. The shooting function of electronic devices has added a lot of fun to people's lives.
[0066] For example, Figure 1 This is an applicable scenario of the embodiment of the present application. In some implementations, the user can enter the camera application on the electronic device by clicking on the camera application. Figure 1 In the illustrated interface 101, an electronic device captures an image through its camera. A target object can be displayed in the interface 101, and a user can obtain an image of the target object by clicking a photo control 102. It should be understood that when the electronic device captures the target object, the electronic device focuses based on the captured image frames so that the user can preview or obtain a clear image by clicking the photo control.
[0067] In some possible implementations, the electronic device performs focusing using a center focus method. Figure 2The focus area of the camera application is shown as an example. Figure 2 As shown, the central area 201 of the camera application preview frame can be the focus area during the camera application shooting process. The central area 201 can be divided into several sub-windows, such as Figure 2 In some implementations, the electronic device obtains the phase detection (PD) value of each sub-window and the confidence (Conf) value for judging whether the phase difference is credible, excludes the sub-windows with Conf values below a certain threshold, selects the sub-window with the smallest PD value from the remaining sub-windows, and focuses based on the PD value corresponding to the sub-window. However, in some weak-texture, low-contrast, or low-light scenes, the electronic device cannot capture images with sufficient texture features, but the weak-texture sub-window in the center area of the camera application may still show a high degree of credibility. If the sub-window is mistakenly used by the electronic device for focusing, it may cause focus pulling, making it difficult for users to obtain clear pictures, seriously affecting the user experience.
[0068] In view of this, the present application provides an image processing method and related devices, which, by reducing the credibility of weak texture sub-regions, is conducive to avoiding electronic devices from focusing through the phase difference of weak texture sub-regions, is conducive to improving the focusing accuracy of electronic devices, is conducive to users obtaining in-focus images, and enhances user experience.
[0069] In order to better understand the embodiments of the present application, the electronic devices involved in the embodiments of the present application are introduced below. Figure 3 This is a schematic diagram of the structure of the electronic device 300 provided in the embodiment of the present application. It should be understood that Figure 3 The structure shown is merely exemplary and does not constitute a specific limitation on the structure of the electronic device.
[0070] The electronic device 300 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0071] It should be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 300. In other embodiments of the present application, the electronic device 300 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0072] In the embodiment of the present application, the electronic device 300 can realize the shooting function through the camera 193 and display it through the display screen 194.
[0073] In some possible implementations, the camera 193 includes a lens, a motor, an image sensor, an image processor, and the like. Furthermore, the image sensor may also include structures such as a microlens array, a filter, a pixel array, and a photoelectric signal converter.
[0074] When a user takes a picture through the camera application, light is transmitted to the image sensor through the lens, and the light signal is converted into an electrical signal. The image sensor transmits the electrical signal to the image processor for processing, and the image processor converts the electrical signal into a digital image signal and transmits it to the display screen 194 for image display.
[0075] Optionally, the image sensor may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor, which is not specifically limited in this application.
[0076] Figure 4 This is a software structure block diagram of the electronic device 300 provided in an embodiment of the present application.
[0077] The software system of the electronic device 300 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 300. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system can be divided into five layers, from top to bottom, namely, application layer (applications), application framework layer (application framework), hardware abstraction layer (HAL), kernel layer (kernel) and hardware layer.
[0078] The application layer can include a series of application packages. The application layer runs applications by calling the application programming interface (API) provided by the application framework layer. In the embodiment of the present application, the application layer can include at least applications such as a camera and a gallery. The electronic device 300 can respond to user operations on the camera application to implement functions such as taking photos and recording videos. The pictures and videos taken by the user can be viewed in the gallery.
[0079] I understand. Figure 4 What is shown in the figure are some applications. In fact, the application layer can also include other applications, which is not limited in this application. For example, the application layer also includes information, alarm clock, weather, stopwatch, compass, timer, flashlight, calendar and other applications, which is not limited in this application.
[0080] The application framework layer provides an API and programming framework for applications in the application layer. The application framework layer includes some predefined functions. In embodiments of the present application, the application framework layer may include a camera access interface. The camera access interface can be used to provide an application programming interface and programming framework for camera applications.
[0081] The HAL layer may include at least a camera hardware abstraction layer (HAL) and a camera algorithm library. The HAL can provide virtual hardware for the camera device, while the algorithm library can include the code and data required to implement phase detection and reliability calculations, such as a focus algorithm module, provided by the embodiments of the present application.
[0082] In an embodiment of the present application, after the focusing algorithm module obtains the lens defocus amount corresponding to the motor (which can be understood as the distance that the objective lens assembly of the camera needs to move), the distance that the motor needs to move can be sent to the motor driver so that the motor driver pushes the motor to reach the quasi-focus position.
[0083] The kernel layer is the layer between hardware and software. In the embodiments of the present application, the kernel layer may include at least a camera device driver and a motor driver. The camera device driver is used to capture images with the sensor. The motor driver is used to drive the motor to move the camera lens assembly.
[0084] The hardware layer may include: sensors, such as image acquisition sensors, which can also be understood as cameras, image signal processors (ISPs), and motors such as voice coil motors (VCMs).
[0085] It should be understood that in some embodiments, layers that implement the same function may be referred to by other names, or a layer that can implement the functions of multiple layers may be considered as one layer, or a layer that can implement the functions of multiple layers may be divided into multiple layers. This embodiment of the present application does not limit this.
[0086] Next, combine Figure 4 The software architecture shown in Figure 5 The image processing method 500 provided by the embodiment of the present application is shown from the perspective of interaction between various modules. Figure 3 The software structure of the electronic device 300 shown in FIG. Figure 4 As shown, the specific forms and usage scenarios of the electronic devices shown in the embodiments shown in this application are only examples and should not constitute any limitation on the implementation of the method provided in this application.
[0087] It should be noted that the "focusing" involved in the subsequent description of the embodiments of the present application refers to adjusting the distance between the lens (convex lens or convex lens group) and the image sensor in the camera of the electronic device so that the image sensor continues to remain on the focal plane formed after the light reflected from the moving object is focused by the lens, which is conducive to making the image of the moving object seen by the user on the display screen of the electronic device a clear image.
[0088] It should also be understood that a possible scenario used in the embodiments of the present application is that when a user photographs a target object using an electronic device, the photographed target object and the electronic device are in a relatively stationary state, but the present application does not impose any limitations on the usage scenarios.
[0089] The method 500 includes the following steps:
[0090] In response to the user's operation of opening the camera application, the electronic device executes S501 and subsequent steps.
[0091] S501: A camera application transmits a start instruction to an image sensor, where the instruction is used to instruct the image sensor to capture an image.
[0092] In one possible implementation, the camera application calls a camera access interface of the application framework layer, and calls a camera device driver of the camera hardware abstraction layer at the kernel layer through the camera access interface to start the image sensor through the camera device driver.
[0093] Optionally, the user's operation of opening the camera application may be, for example, an operation of clicking the camera application icon, or an operation of waking up an intelligent voice assistant and opening the camera application using voice commands, which is not limited in this application.
[0094] It should be understood that the camera access interface can convert instructions from the application layer into instructions that can be recognized by the hardware abstraction layer. The camera application can send the camera start instruction to the camera device driver in the kernel layer by calling the camera hardware abstraction layer. The camera device driver can then drive the corresponding camera sensor to capture images.
[0095] S502: The image sensor captures an image and generates a RAW image.
[0096] It should be understood that the process of image sensor capturing an image can be understood as the process of exposing the pixel array of the image sensor. After the exposure of the pixel array of the image sensor is completed, the sensor generates a frame of image. The image captured by the sensor and not processed by the image signal processor can be called a RAW image.
[0097] S503: The sensor transmits the RAW image to the focus algorithm module.
[0098] S504. The focus algorithm module obtains a left image array and a right image array of each sub-window in the focus area based on the RAW image data, and preprocesses the left image array and the right image array to obtain a preprocessed left image array and a preprocessed right image array.
[0099] In some implementations, the pixel array of the image sensor of the electronic device includes phase detection pixels (PD pixels), Figure 6The arrangement of phase detection pixels is shown as an example. Figure 6 As shown, every two rows and four columns form a PD point, which includes 8 pixel blocks. For each pixel block, it can be divided into left pixels and right pixels, that is, the photosensitive area (i.e., photodiode) at the bottom of the same pixel is divided into two, and phase information capture can be completed within the same pixel. Optionally, the phase information acquisition method of this application can be called dual PD or 2PD, or Sparse PD, which is not limited in this application. For example Figure 6 The pixel block R0 shown in the figure can be divided into a left pixel R_L and a right pixel R_R. During the exposure process of the image sensor pixel array, the pixel block R0 can obtain a left pixel value R_L0 and a right pixel value R_R0. The same applies to other pixel blocks and will not be repeated here. In this way, a PD point can obtain a left pixel value Y_L and a right pixel value Y_R. Taking the left pixel value Y_L as an example, its calculation formula can be: Y_L = a*((R_L0+R_L1) / 2)+b*((Gr_L0+Gr_L1+Gb_L0+Gb_L1) / 4)+c*((B_L0+B_L1) / 2), where a, b, and c are fixed coefficients, and R_L0, R_L1, Gr_L0, Gr_L1, Gb_L0, Gb_L1, B_L0, and B_L1 are the left pixel values corresponding to the eight pixel blocks in the figure. It should be understood that Y_R can also be calculated using a similar formula, which will not be repeated here.
[0100] It should be understood that the RAW image data can include Y_L data and Y_R data corresponding to each PD point. For each target area (focus area or a subwindow in the focus area), the array composed of Y_L data can be called the left image array, and the array composed of Y_R data can be called the right image array.
[0101] In one possible implementation, the focus algorithm module may preprocess the left and right image arrays using mean-std normalization, but this application is not limited thereto. Preprocessing the left and right image arrays can remove noise from the arrays and improve the accuracy of the phase difference calculation results.
[0102] The pixel values described in the embodiments of the present application can be understood as grayscale values.
[0103] Optionally, when transmitting Y_L (Y_R), Y_L (Y_R) may include 10 bits, and the bit data transmission range is 0-1023. In one possible implementation, Y_L (Y_R) may have an offset value of 64, so its range may also be 64-1023, but this application does not make specific limitations on this.
[0104] S505 , the focus algorithm module processes the pre-processed left image array and the pre-processed right image array of each sub-window in the focus area based on the stereo matching (sum of absolute differences, SAD) algorithm to obtain a SAD curve corresponding to each sub-window.
[0105] For example, Figure 2 Taking the left and right image data corresponding to the sub-window 1 shown in FIG as an example, the method for obtaining the SAD curve corresponding to the sub-window 1 is described in detail.
[0106] It should be understood that the left image array and the right image array of the sub-window 1 can be intercepted from the entire frame RAW image. In some implementations, a portion of the right image array can be intercepted (search range). Figure 7 The left image array and the right image array of sub-window 1 are shown as an example. Figure 7 As shown, the left image array selected by window 701 and the right image array selected by window 702 are the left pixel value array and the right pixel value array corresponding to the same part of the PD points in sub-window 1. The sum of the absolute values after the corresponding subtraction of the data in window 701 and the data in window 702 is used as the SAD value 80 when the PD value is 0. Further, within the search range, window 702 is shifted left by one pixel to the position of window 703, and then the sum of the absolute values after the corresponding subtraction of the data in window 701 and the data in window 703 is used as the SAD value 100 when the PD value is -1. Similarly, by shifting window 702 left or right, the SAD value corresponding to each whole point in the PD value range [-6, 6] can be obtained. The SAD curve is drawn with the PD value as the horizontal coordinate and the SAD value as the vertical coordinate, as shown below. Figure 8 shown.
[0107] S506. The focusing algorithm module calculates the PD value of each sub-window based on the minimum value of the SAD curve in each sub-window, the PD value corresponding to the minimum value of the SAD curve, the SAD value corresponding to the PD value corresponding to the minimum value of the SAD curve minus 1, and the SAD value corresponding to the PD value corresponding to the minimum value of the SAD curve plus 1.
[0108] by Figure 8 Taking the SAD curve shown as an example, in a possible implementation, the PD value of sub-window 1 can be calculated according to the minimum value c0 of the SAD curve in sub-window 1, the PD value x corresponding to the minimum value of the SAD curve, the SAD value a1 corresponding to the PD value corresponding to the minimum value of the SAD curve minus 1, and the SAD value a2 corresponding to the PD value corresponding to the minimum value of the SAD curve plus 1, according to the following sub-pixel calculation formula (1): sub .
[0109]
[0110] S507. The focus algorithm module determines whether the absolute value of the sub-window PD value is greater than 1 and whether the minimum value in the SAD curve is greater than 1000. If the absolute value of the sub-window PD value is less than or equal to 1 and the minimum value in the SAD curve is less than or equal to 1000, execute S508; if the absolute value of the sub-window PD value is less than or equal to 1 and the minimum value in the SAD curve is greater than 1000, execute S509; if the absolute value of the sub-window PD value is greater than 1 and the minimum value in the SAD curve is less than or equal to 1000, execute S510; if the absolute value of the sub-window PD value is greater than 1 and the minimum value in the SAD curve is greater than 1000, execute S511.
[0111] S508. The focusing algorithm module calculates the Conf value of the PD value of each sub-window based on the minimum value of the SAD curve in each sub-window, the SAD value corresponding to the PD value corresponding to the minimum value of the SAD curve minus 1, the SAD value corresponding to the PD value corresponding to the minimum value of the SAD curve plus 1, the two endpoint values of the SAD curve, the area of each sub-window, and the first coefficient.
[0112] Still taking sub-window 1 as the corresponding Figure 8 Taking the SAD curve shown as an example, in one possible implementation, the PD Conf value of subwindow 1 can be calculated based on the minimum value c0 of the SAD curve in subwindow 1, the SAD value a1 corresponding to the PD value corresponding to the minimum value of the SAD curve minus 1, the SAD value a2 corresponding to the PD value corresponding to the minimum value of the SAD curve plus 1, the left endpoint value c2 and the right endpoint value c1 of the SAD curve, the area of subwindow 1, and a first coefficient. The first coefficient is a preset fixed coefficient.
[0113] When a1 is greater than or equal to a2, When a1 is less than a2,
[0114] S509. The focusing algorithm module calculates the Conf value of the PD value of each sub-window based on the minimum value of the SAD curve in each sub-window, the SAD value corresponding to the PD value corresponding to the minimum value of the SAD curve minus 1, the SAD value corresponding to the PD value corresponding to the minimum value of the SAD curve plus 1, the two endpoint values of the SAD curve, the area of each sub-window, and the first coefficient and the second coefficient.
[0115] In one possible implementation, in this case, the PD Conf value of subwindow 1 can be calculated based on the minimum value c0 of the SAD curve in subwindow 1, the SAD value a1 corresponding to the PD value corresponding to the minimum value of the SAD curve minus 1, the SAD value a2 corresponding to the PD value corresponding to the minimum value of the SAD curve plus 1, the left endpoint value c2 and the right endpoint value c1 of the SAD curve, the area of subwindow 1, and the first coefficient coefficient and the second coefficient min_coefficient. The Conf value of the PD value of each subwindow can be calculated. The first coefficient is a preset fixed coefficient, and the second coefficient min_coefficient is 1 / (c0 / 1000).
[0116] When a1 is greater than or equal to a2, When a1 is less than a2,
[0117] S510. The focusing algorithm module calculates the Conf value of the PD value of each sub-window based on the minimum value of the SAD curve in each sub-window, the SAD value corresponding to the PD value corresponding to the minimum value of the SAD curve minus 1, the SAD value corresponding to the PD value corresponding to the minimum value of the SAD curve plus 1, the two endpoint values of the SAD curve, the area of each sub-window, and the first coefficient and the third coefficient.
[0118] In one possible implementation, in this case, the PD Conf value of subwindow 1 can be calculated based on the minimum value c0 of the SAD curve in subwindow 1, the SAD value a1 corresponding to the PD value corresponding to the minimum value of the SAD curve minus 1, the SAD value a2 corresponding to the PD value corresponding to the minimum value of the SAD curve plus 1, the left endpoint value c2 and the right endpoint value c1 of the SAD curve, the area of subwindow 1, and the first coefficient coefficient and the third coefficient pd_value_coefficient. The Conf value of the PD value of each subwindow can be calculated. The first coefficient is a preset fixed coefficient, and the third coefficient pd_value_coefficient is the reciprocal of the absolute value of the PD value of subwindow 1 rounded up.
[0119] When a1 is greater than or equal to a2, When a1 is less than a2,
[0120] S511. The focusing algorithm module calculates the Conf value of the PD value of each sub-window based on the minimum value of the SAD curve in each sub-window, the SAD value corresponding to the PD value corresponding to the minimum value of the SAD curve minus 1, the SAD value corresponding to the PD value corresponding to the minimum value of the SAD curve plus 1, the two endpoint values of the SAD curve, the area of each sub-window, and the first coefficient, the second coefficient and the third coefficient.
[0121] In one possible implementation, in this case, the PD Conf value of subwindow 1 can be calculated based on the minimum value c0 of the SAD curve in subwindow 1, the SAD value a1 corresponding to the PD value corresponding to the minimum value of the SAD curve minus 1, the SAD value a2 corresponding to the PD value corresponding to the minimum value of the SAD curve plus 1, the left endpoint value c2 and the right endpoint value c1 of the SAD curve, the area of subwindow 1, and the first coefficient coefficient, the second coefficient min_coefficient, and the third coefficient pd_value_coefficient. The Conf value of the PD value of each subwindow is calculated. The first coefficient is a preset fixed coefficient, the second coefficient min_coefficient is 1 / (c0 / 1000), and the third coefficient pd_value_coefficient is the reciprocal of the absolute value of the PD value of subwindow 1 rounded up.
[0122] When a1 is greater than or equal to a2,
[0123]
[0124] When a1 is less than a2,
[0125]
[0126] S512 , the focusing algorithm module selects sub-windows whose Conf values of the PD values are greater than a preset threshold value from all sub-windows, and uses the minimum PD value in these sub-windows as the first PD value used when focusing the frame image captured by the image sensor.
[0127] Optionally, the preset threshold may be 500, but this application does not make any specific limitation to this.
[0128] It should be understood that the PD value used when focusing on a sub-window whose Conf value of the PD value in all sub-windows is greater than the minimum PD value in the preset threshold is the near view priority principle.
[0129] S513 : The focus algorithm module determines the lens defocus amount according to a relationship between the first PD value, the lens defocus amount, and a defocus conversion coefficient (DDC).
[0130] In a possible implementation, the lens defocus amount=phase difference*DDC, where DDC represents a coefficient of a linear relationship between a driving current of a motor controlling the lens and a moving position of the lens.
[0131] S514: The focus algorithm module transmits the lens defocus value to the motor driver. Correspondingly, the motor driver receives the lens defocus value.
[0132] S515: The motor drives the motor to transmit the lens defocus amount. Correspondingly, the motor receives the lens defocus amount.
[0133] S516: The motor moves the lens to a defocusing position to reach the lens in-focus position.
[0134] In some implementations, the lens defocus amount is indicated by a positive or negative sign in the moving direction, where a negative sign indicates that the lens needs to be closer to the target object, and a positive sign indicates that the lens needs to be farther away from the target object, but this application does not limit this.
[0135] In an embodiment of the present application, since the absolute value of the PD value of the weak texture sub-window is more likely to be greater than 1 and / or the minimum value in the SAD curve is greater than 1000, when calculating the Conf value of the PD value of each sub-window, the absolute value of the PD value of each sub-window and the minimum value in the SAD curve corresponding to each sub-window are judged, and when the absolute value of the PD value of the sub-window is greater than 1 and / or the minimum value in the SAD curve is greater than 1000, different coefficients are respectively corresponding, which is beneficial to reducing the Conf value of the weak texture sub-window, reducing the possibility of the PD value of the weak texture sub-window being the final PD value, avoiding the influence of the weak texture sub-window on the focus of the electronic device, and facilitating rapid focusing and improving user experience.
[0136] Figure 9 This is a schematic flow chart of an image processing method 900 provided in an embodiment of the present application. The method 900 can be executed by an electronic device, and its hardware structure can be as follows Figure 3 As shown, the software structure can be as follows Figure 4 As shown, but this application does not make specific limitations on this.
[0137] The method 900 includes the following steps:
[0138] S901, capturing a first image frame;
[0139] S902: When it is determined that a weak texture sub-region exists in the focus area of the first image frame, the credibility of the weak texture sub-region is reduced;
[0140] S903. Based on the phase difference of the focus area, drive the motor to adjust the position of the electronic device lens, where the phase difference is obtained based on the target phase difference of each of some or all sub-areas in the focus area, the credibility value of the target phase difference of each of all or some sub-areas is greater than or equal to a preset threshold, and some or all sub-areas do not include weak texture sub-areas.
[0141] It should be understood that the credibility of the weak texture sub-region refers to the credibility of the target phase difference in the weak texture sub-region. The in-focus region of the first image frame includes multiple sub-regions, and the phase difference of the in-focus region can be the smallest target phase difference among one or more target phase differences corresponding to one or more sub-regions whose target phase difference credibility value is greater than or equal to a preset threshold.
[0142] Optionally, the preset threshold can be 500 or any other value, the size of the focus area can be 0.4*0.4 or 0.3*0.3, the focus area can be the center area of the image, and the focus area can include 9 sub-areas, but this application is not limited to this.
[0143] In an embodiment of the present application, when it is determined that a weak texture sub-region exists in the focus area of the first image frame, the credibility of the weak texture sub-region is reduced. This is beneficial to avoid the electronic device focusing through the phase difference of the weak texture sub-region, which is beneficial to improving the focusing accuracy of the electronic device, and is beneficial for the user to obtain an in-focus image, thereby improving the user experience.
[0144] As an optional embodiment, the texture sub-region satisfies one or more of the following: the absolute value of the target phase difference of the weak texture sub-region is greater than the first threshold; or, the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region SAD is greater than the second threshold, and the weak texture sub-region includes multiple SAD values, and the multiple SAD values are obtained based on the left image in the weak texture sub-region and the right image in the weak texture sub-region.
[0145] Optionally, the first threshold may be 1 and the second threshold may be 1000, but this application does not limit this.
[0146] It should be understood that the weak texture sub-region does not have sufficient texture features to support the target phase difference and SAD calculation, and there may be a situation where the target phase difference value is too high and / or the minimum SAD value is too high. Therefore, in the embodiment of the present application, the sub-region whose absolute value of the target phase difference is greater than the first threshold, and / or the minimum value of the sum of the absolute values of the differences SAD is greater than the second threshold is determined to be a weak texture sub-region. In this way, the weak texture sub-region can be processed to reduce its credibility. Furthermore, after reducing the credibility of the weak texture sub-region, the possibility of the target phase difference of the weak texture sub-region being used as the phase difference used for focusing can be reduced, which is conducive to improving focusing accuracy and improving user experience.
[0147] As an optional embodiment, the method also includes: selecting a first left image that matches a preset window size from the left image in the weak texture sub-area, selecting a first right image that matches a preset window size from the right image in the weak texture sub-area, adding the absolute value of the difference between the grayscale values corresponding to each pixel in the first left image and the first right image to obtain a first SAD value, the multiple SAD values of the weak texture sub-area include the first SAD value, the first left image and the first right image are respectively collected by the left pixel and the right pixel of the same pixel area of the electronic device, and the first phase difference between the first left image and the first right image is zero; offsetting the preset window N pixels to the left from the position of the first right image to obtain a second right image, adding the absolute value of the difference between the grayscale values corresponding to each pixel in the first left image and the second right image to obtain a first SAD value. Two SAD values, the multiple SAD values of the weak texture sub-area include the second SAD value, and the second phase difference between the first left image and the second right image is negative N; the preset window is offset M pixels to the right from the position of the first right image to obtain the third right image, and the absolute value of the difference between the grayscale values corresponding to each pixel in the first left image and the third right image is added to obtain the third SAD value. The multiple SAD values of the weak texture sub-area include the third SAD value, and the third phase difference between the first left image and the third right image is M; based on the first SAD value and the first phase difference corresponding to the first SAD value, the second SAD value and the second phase difference corresponding to the second SAD value, and the third SAD value and the third phase difference corresponding to the third SAD value, a SAD curve with phase difference as the independent variable and SAD value as the dependent variable is obtained.
[0148] Optionally, M and N can be any value greater than zero, which is not limited in this application.
[0149] It should be understood that the preset window can be moved left or right multiple times from the position of the first right image, the SAD value of the right image and the first left image obtained after each movement is calculated, and the phase difference between the right image and the first left image is recorded as the horizontal and vertical coordinates of the SAD curve.
[0150] In one possible implementation, before the left image in the weak texture sub-region and the right image in the weak texture sub-region are converted into the SAD curve, the left image array and the right image array can also be preprocessed. The preprocessing method can be mean-std normalization, but this application is not limited to this.
[0151] The arrangement of the pixel array of the electronic device in the embodiment of the present application can be as follows: Figure 6 As shown in , the determination of the left image array and the right image array can refer to the description of S504 above, and the specific steps of obtaining the SAD curve can refer to the above description of Figure 7 The description is not repeated here.
[0152] As an optional embodiment, the credibility of the weak texture sub-region is reduced, including: when the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold and the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD value) is greater than a second threshold, the credibility of the weak texture sub-region is obtained based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, a first value related to the left endpoint value of the SAD curve, a second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, a first coefficient, a second coefficient, and a third coefficient; wherein the first coefficient is a preset constant, the second coefficient is related to the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD value), and the third coefficient is related to the target phase difference of the weak texture sub-region.
[0153] In a possible implementation, the credibility of the weak texture sub-region is obtained based on the minimum SAD value, the SAD value corresponding to the phase difference minus 1 corresponding to the minimum SAD value in the SAD value curve, the SAD value corresponding to the phase difference plus 1 corresponding to the minimum SAD value in the SAD curve, the first value related to the left endpoint value of the SAD curve, the second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, the second coefficient, and the third coefficient, including: based on the minimum SAD value c0, the SAD value a1 corresponding to the phase difference minus 1 corresponding to the minimum SAD value in the SAD value curve, the SAD value a2 corresponding to the phase difference plus 1 corresponding to the minimum SAD value in the SAD curve, the first value c2 related to the left endpoint value of the SAD curve, the second value c1 related to the right endpoint value of the SAD curve, the area A of the weak texture sub-region, the first coefficient e1, the second coefficient e2, and the third coefficient e3. When a1 is greater than or equal to a2, the credibility Conf of the weak texture sub-region satisfies the following formula:
[0154]
[0155] When a1 is less than a2, the credibility of the weak texture sub-region Conf satisfies the following formula:
[0156]
[0157] Among them, the second coefficient e2 is the reciprocal of the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region SAD value, and the third coefficient e3 is the reciprocal of the integer obtained by rounding up the absolute value of the target phase difference of the weak texture sub-region.
[0158] It should be understood that the weak texture sub-region can correspond to the sub-window 1 in the above embodiment, the area A of the weak texture sub-region can be the area area of the sub-window 1 described above, the first coefficient e1 can be the coefficient mentioned above, the second coefficient e2 can be the min_coefficient mentioned above, and the third coefficient e3 can be the pd_value_coefficient mentioned above.
[0159] It should also be understood that the second coefficient and the third coefficient are both values greater than 0 and less than 1.
[0160] In one possible implementation, c2 can be the left endpoint value in the SAD curve and the average of P SAD values close to the left endpoint value, c1 can be the right endpoint value in the SAD curve and the average of P SAD values close to the right endpoint value, P can be 2 or 3, but this application is not limited to this.
[0161] In an embodiment of the present application, when calculating the credibility of the target phase difference of the weak texture sub-region, the credibility value finally obtained by the weak texture sub-region can be reduced by multiplying the second coefficient and the third coefficient. In this way, when the sub-regions in the focus area are subsequently screened based on the sub-region credibility values, the probability of the weak texture sub-region being selected can be reduced, which is beneficial to avoiding the target phase difference of the weak texture sub-region as the phase difference used when the electronic device focuses, and is beneficial to improving the focusing accuracy and stability.
[0162] As an optional embodiment, the credibility of the weak texture sub-region is reduced, including: when the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold and the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD value) is less than or equal to a second threshold, the credibility of the weak texture sub-region is obtained based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, a first value related to the left endpoint value of the SAD curve, a second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, a first coefficient, and a third coefficient; wherein the first coefficient is a preset constant and the third coefficient is related to the target phase difference of the weak texture sub-region.
[0163] In a possible implementation, the credibility of the weak texture sub-region is obtained based on the minimum SAD value, the SAD value corresponding to the phase difference minus 1 corresponding to the minimum SAD value in the SAD value curve, the SAD value corresponding to the phase difference plus 1 corresponding to the minimum SAD value in the SAD curve, the first value related to the left endpoint value of the SAD curve, the second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, and the third coefficient, including: based on the minimum SAD value c0, the SAD value a1 corresponding to the phase difference minus 1 corresponding to the minimum SAD value in the SAD value curve, the SAD value a2 corresponding to the phase difference plus 1 corresponding to the minimum SAD value in the SAD curve, the first value c2 related to the left endpoint value of the SAD curve, the second value c1 related to the right endpoint value of the SAD curve, the area A of the weak texture sub-region, the first coefficient e1, and the third coefficient e3. When a1 is greater than or equal to a2, the credibility Conf of the weak texture sub-region satisfies the following formula:
[0164]
[0165] When a1 is less than a2, the credibility of the weak texture sub-region Conf satisfies the following formula:
[0166]
[0167] The third coefficient e3 is the reciprocal of an integer obtained by rounding up the absolute value of the target phase difference of the weak texture sub-region.
[0168] In an embodiment of the present application, when the absolute value of the target phase difference of the weak texture sub-region is greater than the first threshold, and the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD) is less than or equal to the second threshold, when calculating the credibility of the target phase difference of the weak texture sub-region, the credibility value finally obtained by the weak texture sub-region can be reduced by multiplying it by the third coefficient without multiplying it by the second coefficient. This is beneficial to reducing the calculation complexity of the electronic device, and is also beneficial to reducing the probability of the weak texture region being selected when subsequently screening each sub-region in the focus area based on the sub-region credibility value. It is beneficial to avoid the target phase difference of the weak texture sub-region being used as the phase difference used when the electronic device focuses, and is beneficial to improving the focusing accuracy and stability.
[0169] As an optional embodiment, the credibility of the weak texture sub-region is reduced, including: when the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold and the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD value) is greater than a second threshold, the credibility of the weak texture sub-region is obtained based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, a first value related to the left endpoint value of the SAD curve, a second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, a first coefficient, and a second coefficient; wherein the first coefficient is a preset constant, and the second coefficient is related to the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD value).
[0170] In a possible implementation, the credibility of the weak texture sub-region is obtained based on the minimum SAD value, the SAD value corresponding to the phase difference minus 1 corresponding to the minimum SAD value in the SAD value curve, the SAD value corresponding to the phase difference plus 1 corresponding to the minimum SAD value in the SAD curve, the first value related to the left endpoint value of the SAD curve, the second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, and the second coefficient, including: based on the minimum SAD value c0, the SAD value a1 corresponding to the phase difference minus 1 corresponding to the minimum SAD value in the SAD value curve, the SAD value a2 corresponding to the phase difference plus 1 corresponding to the minimum SAD value in the SAD curve, the first value c2 related to the left endpoint value of the SAD curve, the second value c1 related to the right endpoint value of the SAD curve, the area A of the weak texture sub-region, the first coefficient e1, and the second coefficient e2. When a1 is greater than or equal to a2, the credibility Conf of the weak texture sub-region satisfies the following formula:
[0171]
[0172] When a1 is less than a2, the credibility of the weak texture sub-region Conf satisfies the following formula:
[0173]
[0174] The second coefficient e2 is the reciprocal of the minimum value of the sum of absolute differences (SAD) corresponding to the weak texture sub-region.
[0175] In an embodiment of the present application, when the absolute value of the target phase difference of the weak texture sub-region is greater than the first threshold, and the minimum value of the sum of the absolute values of the differences corresponding to the weak texture sub-region (SAD) is greater than the second threshold, when calculating the credibility of the target phase difference of the weak texture sub-region, the credibility value finally obtained by the weak texture sub-region can be reduced by multiplying it by the second coefficient without multiplying it by the third coefficient. This is beneficial to reducing the calculation complexity of the electronic device, and is also beneficial to reducing the probability of the weak texture region being selected when subsequently screening each sub-region in the focus area based on the sub-region credibility value. It is beneficial to avoid the target phase difference of the weak texture sub-region being used as the phase difference used when the electronic device focuses, and is beneficial to improving the focusing accuracy and stability.
[0176] The image processing method of the embodiment of the present application has been described above. The device for performing the above method provided by the embodiment of the present application is described below. Those skilled in the art will understand that the method and device can be combined and referenced with each other, and the relevant device provided by the embodiment of the present application can perform the steps in the above list sorting method.
[0177] Figure 10 The schematic diagram of the structure of a chip provided by the embodiment is exemplarily shown. The chip 1000 includes one or more (including two) processors 1001, a communication line 1002, a communication interface 1003 and a memory 1004.
[0178] In some embodiments, the memory 1004 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.
[0179] The method described in the above embodiment of the present application can be applied to the processor 1001, or implemented by the processor 1001. The processor 1001 may be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor 1001 or an instruction in the form of software. The above-mentioned processor 1001 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 1001 can implement or execute the methods, steps and logic block diagrams related to each processing disclosed in the embodiment of the present application.
[0180] The steps of the method disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. Among them, the software module can be located in a storage medium mature in the art such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read only memory (EEPROM). The storage medium is located in the memory 1004, and the processor 1001 reads the information in the memory 1004 and completes the steps of the above method in combination with its hardware.
[0181] The processor 1001 , the memory 1004 , and the communication interface 1003 can communicate with each other via the communication line 1002 .
[0182] In the above embodiment, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory or downloaded and installed in the memory in the form of software.
[0183] In the embodiment of the present application, the chip 1000 may also be a chip system, such as a system on chip (SOC), which is not limited in the present application.
[0184] The image processing method provided in the embodiment of the present application can be applied to electronic devices with communication functions. The electronic devices include electronic devices. The specific device form of the electronic devices can refer to the above related descriptions and will not be repeated here.
[0185] An embodiment of the present application provides an electronic device, which includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory stores computer program code, and the computer program code includes computer instructions; the one or more processors call the computer instructions to enable the electronic device to execute the method in the above embodiment.
[0186] The present application provides a chip or chip system. The chip or chip system is applied to an electronic device and includes one or more processors configured to invoke computer instructions to cause the electronic device to execute the methods described in the above embodiments. The implementation principles and technical effects are similar to those of the above-described related embodiments and are not further elaborated here.
[0187] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method in the above embodiment. The method described in the above embodiment can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the function can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.
[0188] In one possible implementation, computer-readable media may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium designed to carry or store the desired program code in the form of instructions or data structures and accessible by a computer. Furthermore, any connection is appropriately referred to as a computer-readable medium. For example, if software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technologies such as infrared, radio and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave are included in the definition of medium. Disk and disc, as used herein, include optical discs, laser discs, optical discs, digital versatile discs (DVDs), floppy disks and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs reproduce data optically using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0189] An embodiment of the present application provides a computer program product, which includes computer program code. When the computer program code runs on an electronic device, the electronic device executes the method in the above embodiment.
[0190] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to produce a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0191] The above specific implementation methods further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of the present invention should be included in the scope of protection of the present invention.
Claims
1. An image processing method, characterized in that: Applied to electronic equipment, the method includes: Acquiring a first image frame; When it is determined that a weak texture sub-region exists in the focused area of the first image frame, if an absolute value of a target phase difference of the weak texture sub-region is greater than a first threshold, and a minimum value of a sum of absolute differences (SAD) corresponding to the weak texture sub-region is greater than a second threshold, reducing the credibility of the weak texture sub-region based on at least the first coefficient, the second coefficient, and the third coefficient of the weak texture sub-region; If the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold, and the minimum value of the SAD value corresponding to the weak texture sub-region is less than or equal to a second threshold, then reducing the credibility of the weak texture sub-region based on at least the first coefficient and the third coefficient of the weak texture sub-region; If the absolute value of the target phase difference of the weak texture sub-region is less than or equal to a first threshold, and the minimum value of the SAD value corresponding to the weak texture sub-region is greater than a second threshold, then reducing the credibility of the weak texture sub-region based on at least the first coefficient and the second coefficient of the weak texture sub-region; The first coefficient is a preset constant, the second coefficient is related to the minimum value of the SAD value, and the third coefficient is related to the target phase difference of the weak texture sub-region; Based on the phase difference of the focusing area, a driving motor adjusts the position of the electronic device lens, wherein the phase difference is obtained based on the target phase difference of each of some or all sub-areas in the focusing area, and the credibility values of the target phase differences of each of all or some of the sub-areas are greater than or equal to a preset threshold, and the some or all of the sub-areas do not include the weak texture sub-area.
2. The method according to claim 1, characterized in that The weak texture sub-region includes a plurality of SAD values, and the plurality of SAD values are obtained based on a left image in the weak texture sub-region and a right image in the weak texture sub-region.
3. The method according to claim 2, characterized in that The method further comprises: Selecting a first left image that matches a preset window size from the left image in the weak texture sub-region, and selecting a first right image that matches the preset window size from the right image in the weak texture sub-region, adding an absolute value of a difference between grayscale values corresponding to each pixel in the first left image and the first right image to obtain a first SAD value, wherein the multiple SAD values of the weak texture sub-region include the first SAD value, the first left image and the first right image are respectively acquired through a left pixel and a right pixel of the same pixel region of the electronic device, and a first phase difference between the first left image and the first right image is zero; Shifting the preset window N pixels to the left from the position of the first right image to obtain a second right image, adding the absolute value of the difference between the grayscale values corresponding to each pixel in the first left image and the second right image to obtain a second SAD value, wherein the multiple SAD values of the weak texture sub-region include the second SAD value, and the second phase difference between the first left image and the second right image is negative N; Shifting the preset window rightward by M pixels from the position of the first right image to obtain a third right image, adding the absolute value of the difference between the grayscale values corresponding to each pixel in the first left image and the third right image to obtain a third SAD value, wherein the multiple SAD values of the weak texture sub-region include the third SAD value, and a third phase difference between the first left image and the third right image is M; Based on the first SAD value and the first phase difference corresponding to the first SAD value, the second SAD value and the second phase difference corresponding to the second SAD value, the third SAD value and the third phase difference corresponding to the third SAD value, a SAD curve is obtained with phase difference as the independent variable and SAD value as the dependent variable.
4. The method according to claim 3, characterized in that If the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold, and the minimum value of the sum of absolute differences (SAD) corresponding to the weak texture sub-region is greater than a second threshold, reducing the credibility of the weak texture sub-region based on at least the first coefficient, the second coefficient, and the third coefficient of the weak texture sub-region, including: When the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold and the minimum value of the SAD value of the sum of the absolute values of the differences corresponding to the weak texture sub-region is greater than a second threshold, the credibility of the weak texture sub-region is obtained based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value related to the left endpoint value of the SAD curve, the second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, the second coefficient, and the third coefficient.
5. The method according to claim 4, characterized in that The obtaining of the credibility of the weak texture sub-region based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, a first value related to the left endpoint value of the SAD curve, a second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, the second coefficient, and the third coefficient includes: Based on the minimum value c0 of the SAD value, the SAD value a1 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value a2 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value c2 related to the left endpoint value of the SAD curve, the second value c1 related to the right endpoint value of the SAD curve, the area A of the weak texture sub-region, the first coefficient e1, the second coefficient e2, and the third coefficient e3, when a1 is greater than or equal to a2, the credibility Conf of the weak texture sub-region satisfies the following formula: ; When a1 is less than a2, the credibility Conf of the weak texture sub-region satisfies the following formula: ; Among them, the second coefficient e2 is the reciprocal of the minimum value of the sum of the absolute values of the differences SAD values corresponding to the weak texture sub-region, and the third coefficient e3 is the reciprocal of the integer obtained by rounding up the absolute value of the target phase difference of the weak texture sub-region.
6. The method according to claim 3, characterized in that If the absolute value of the target phase difference of the weak texture sub-region is less than or equal to a first threshold, and the minimum value of the sum of the absolute values of the differences (SAD) corresponding to the weak texture sub-region is greater than a second threshold, reducing the credibility of the weak texture sub-region based on at least the first coefficient and the second coefficient of the weak texture sub-region, including: When the absolute value of the target phase difference of the weak texture sub-region is greater than a first threshold and the minimum value of the SAD value of the sum of the absolute values of the differences corresponding to the weak texture sub-region is less than or equal to a second threshold, the credibility of the weak texture sub-region is obtained based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value related to the left endpoint value of the SAD curve, the second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, and the third coefficient.
7. The method according to claim 6, characterized in that The obtaining of the credibility of the weak texture sub-region based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, a first value related to the left endpoint value of the SAD curve, a second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, and the third coefficient includes: Based on the minimum value c0 of the SAD value, the SAD value a1 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value a2 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value c2 related to the left endpoint value of the SAD curve, the second value c1 related to the right endpoint value of the SAD curve, the area A of the weak texture sub-region, the first coefficient e1, and the third coefficient e3, when a1 is greater than or equal to a2, the credibility Conf of the weak texture sub-region satisfies the following formula: ; When a1 is less than a2, the credibility Conf of the weak texture sub-region satisfies the following formula: ; The third coefficient e3 is the reciprocal of an integer obtained by rounding up the absolute value of the target phase difference of the weak texture sub-region.
8. The method according to claim 3, characterized in that If the absolute value of the target phase difference of the weak texture sub-region is less than or equal to a first threshold, and the minimum value of the SAD value corresponding to the weak texture sub-region is greater than a second threshold, reducing the credibility of the weak texture sub-region based on at least the first coefficient and the second coefficient of the weak texture sub-region, including: When the absolute value of the target phase difference of the weak texture sub-region is less than or equal to a first threshold, and the minimum value of the SAD value of the sum of the absolute values of the differences corresponding to the weak texture sub-region is greater than a second threshold, the credibility of the weak texture sub-region is obtained based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value related to the left endpoint value of the SAD curve, the second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, and the second coefficient.
9. The method according to claim 8, characterized in that The obtaining of the credibility of the weak texture sub-region based on the minimum value of the SAD value, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, a first value related to the left endpoint value of the SAD curve, a second value related to the right endpoint value of the SAD curve, the area of the weak texture sub-region, the first coefficient, and the second coefficient includes: Based on the minimum value c0 of the SAD value, the SAD value a1 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD value curve minus 1, the SAD value a2 corresponding to the phase difference corresponding to the minimum value of the SAD value in the SAD curve plus 1, the first value c2 related to the left endpoint value of the SAD curve, the second value c1 related to the right endpoint value of the SAD curve, the area A of the weak texture sub-region, the first coefficient e1, and the second coefficient e2, when a1 is greater than or equal to a2, the credibility Conf of the weak texture sub-region satisfies the following formula: ; When a1 is less than a2, the credibility Conf of the weak texture sub-region satisfies the following formula: ; The second coefficient e2 is the reciprocal of the minimum value of the sum of absolute differences (SAD) corresponding to the weak texture sub-region.
10. An electronic device, characterized in that: The electronic device includes: one or more processors and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program code, where the computer program code includes computer instructions. The one or more processors call the computer instructions to enable the electronic device to execute the method according to any one of claims 1 to 9.
11. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the method as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 9.
13. A computer program product, characterized in that The computer program product comprises a computer program code, and when the computer program code is run on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Focusing method, terminal, electronic equipment and storage medium
CN117156273A
Focusing method, focusing device and storage medium
CN117177055A