Focusing method and device, electronic equipment and medium
By adjusting the position of the focus area, the virtual focus problem when the focus object is located at the edge of the focus area is solved, and the clarity of imaging and user experience are improved.
Patent Information
- Application Number
- CN202311622310.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-30
- Publication Date
- 2025-05-30
AI Technical Summary
When the focus object is located at the edge of the focus area, it may cause deviations in the confidence calculation of the focus area, resulting in a false focus phenomenon, resulting in unclear imaging.
By determining the focus area composed of sub-regions of multiple arrays, and adjusting the position of the focus area when the focus body is located at the edge of the focus area, ensuring sufficient details of the focus body in the focus area.
It improves the phase position reliability of the focus area and the sub-region, increases the focus rate when there is less detail in the focus area, obtains a clear focus image, and improves the user's shooting experience.
Smart Images

Figure CN120075611A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of camera autofocus, and particularly to a focusing method, apparatus, electronic device, and medium. Background Art
[0002] Autofocus is an important method in camera algorithms, and customers hope to obtain clear focused images of the scenes to be photographed.
[0003] When the focusing object is located at the edge of the focusing area, only a small part of the details of the focusing object exists in the focusing area, which may cause deviation in the confidence calculation of the focusing area, and further result in defocus phenomenon, causing unclear imaging. Summary of the Invention
[0004] To overcome the problems in the related art, the present disclosure provides a focusing method, apparatus, electronic device, and medium.
[0005] According to the first aspect of the embodiments of the present disclosure, a focusing method is provided, including:
[0006] Determine a focusing area, where the focusing area includes a plurality of sub-areas arranged in an array;
[0007] In response to the focusing subject being located at the edge of the focusing area, adjust the position of the focusing area, where the position of the focusing subject in the focusing area is determined based on the position of the sub-area displaying the focusing subject in the focusing area;
[0008] Perform focusing based on the adjusted focusing area.
[0009] In some embodiments, the adjusting the position of the focusing area includes:
[0010] Determine a sub-area of the image in the focusing area that displays the focusing subject as a target area;
[0011] Based on the image in the target area and the image in the reference area, determine the feature change parameter between the target area and each reference area, where the reference area is the sub-area adjacent to the target area in the focusing area, and the feature change parameter is used to characterize the change degree between the image in the target area and the image in the reference area;
[0012] Adjust the position of the focusing area based on the relationship between the feature change parameter and the preset parameter.
[0013] In some embodiments, the multiple sub-areas included in the focusing area are arranged in a multi-row and multi-column array, and each target area has at least two reference areas;
[0014] Adjusting the position of the focusing area based on the relationship between the feature change parameter and the preset parameter includes:
[0015] Determine the feature change parameters that meet the first preset condition among at least two of the feature change parameters as the first feature parameters, where the first preset condition is related to the numerical magnitude of the feature change parameter;
[0016] Use the first feature parameters whose relationship with the preset parameter meets the second preset condition among the first feature parameters as the target feature parameters;
[0017] Adjust the position of the focusing area based on the number of the target feature parameters.
[0018] In some embodiments, the adjusting the position of the focusing area based on the number of the target feature parameters includes:
[0019] When the number of the target feature parameters is one, the focusing area moves a preset distance along the direction from the reference area to the target area.
[0020] In some embodiments, the adjusting the position of the focusing area based on the number of the target feature parameters includes:
[0021] When the number of the target feature parameters is two, determine a calculation model based on the two target feature parameters;
[0022] Based on the two target feature parameters and the calculation model, determine a moving angle, where the moving angle is the included angle of the moving direction relative to the reference position;
[0023] Move the focusing area a preset distance along the moving direction.
[0024] In some embodiments, the determining the feature change parameters that meet the first preset condition among at least two of the feature change parameters as the first feature parameters includes:
[0025] Arrange at least two of the feature change parameters in descending order of numerical value;
[0026] Select the feature change parameters ranked first and second as the first feature parameters.
[0027] In some embodiments, the focusing method further includes:
[0028] If the relationship between each of the first feature parameters and the preset parameter does not meet the second preset condition, use the current focusing area for focusing.
[0029] In some embodiments, determining the feature change parameter between the target region and each of the reference regions based on the images in the target region and the images in the reference regions includes:
[0030] Determining the confidence level of each of the reference regions based on the images in the target region and the images in the reference regions;
[0031] If the confidence level of any one of the reference regions is less than or equal to a preset confidence level, determining the feature change parameter between the target region and each of the reference regions.
[0032] In some embodiments, the focusing method further includes:
[0033] If the confidence level of each of the reference regions is greater than the preset confidence level, performing focusing using the current focusing region.
[0034] In some embodiments, determining the feature change parameter between the target region and each of the reference regions includes:
[0035] Calculating the image feature values of the target region and the reference regions respectively;
[0036] Calculating the gradient value of the target region relative to the reference region as the feature change parameter, or the gradient value of the reference region relative to the target region as the feature change parameter.
[0037] In some embodiments, the focusing method further includes:
[0038] Determining the central sub-region of the focusing region, where the central sub-region is the sub-region where the geometric center of the focusing region is located, or the central sub-region is the sub-region with the geometric center of the focusing region as a vertex;
[0039] When the focusing subject is located in other sub-regions of the focusing region except the central sub-region, determining that the focusing subject is located at the edge of the focusing region.
[0040] In some embodiments, the focusing method further includes:
[0041] When there is an overlapping region between the focusing subject and the central sub-region, performing focusing using the current focusing region.
[0042] In some embodiments, the focusing method further includes:
[0043] If the confidence level of the focusing region is greater than or equal to the preset confidence level, determining the position of the focusing subject in the focusing region;
[0044] If the confidence level of the focus area is less than the preset confidence level, the current focus area is used for focusing.
[0045] According to a second aspect of the embodiments of the present disclosure, a focusing device is provided, including:
[0046] A determination module, configured to determine a focus area, where the focus area includes a plurality of sub-areas arranged in an array;
[0047] An adjustment module, configured to adjust the position of the focus area in response to the focus subject being located at the edge of the focus area, where the position of the focus subject in the focus area is determined based on the position of the sub-area displaying the focus subject in the focus area;
[0048] A focusing module, configured to perform focusing based on the adjusted focus area.
[0049] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, including:
[0050] A processor;
[0051] A memory for storing instructions executable by the processor;
[0052] Wherein, the processor is configured to execute the focusing method as described in the first aspect of the present disclosure.
[0053] According to a fourth aspect of the embodiments of the present disclosure, a non-transitory computer-readable storage medium is provided. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the focusing method as described in the first aspect of the present disclosure.
[0054] Adopting the above method of the present disclosure has the following beneficial effects: The focusing method in the present disclosure can determine a focus area composed of a plurality of sub-areas arranged in an array, and judge the position of the focus subject in the image in the focus area. When the focus subject in the image is located at the edge of the focus area, the position of the focus area is adjusted, and then focusing is performed based on the adjusted focus area, so as to increase the details of the focus subject in the focus area, improve the confidence level of the phase of the focus area and the sub-areas in the focus area, enhance the focusing success rate when there are only fewer details in the focus area, obtain a clearly focused image, and improve the user's shooting experience.
[0055] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. Description of the Drawings
[0056] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure and used together with the specification to explain the principles of the present disclosure.
[0057] Figure 1 It is a flowchart of a focusing method shown according to an exemplary embodiment.
[0058] Figure 2 It is a schematic diagram of a focusing area shown according to an exemplary embodiment.
[0059] Figure 3 It is a schematic diagram of a focusing area shown according to an exemplary embodiment.
[0060] Figure 4 It is a schematic diagram of a focusing area shown according to an exemplary embodiment.
[0061] Figure 5 It is a schematic diagram of a target area shown according to an exemplary embodiment.
[0062] Figure 6 It is a schematic diagram of a target area shown according to an exemplary embodiment.
[0063] Figure 7 It is a schematic diagram of a focusing scene shown according to an exemplary embodiment.
[0064] Figure 8 It is a schematic diagram of a coordinate system shown according to an exemplary embodiment.
[0065] Figure 9 It is a schematic diagram before and after the adjustment of the focusing area of a scene shown according to an exemplary embodiment.
[0066] Figure 10 It is a schematic diagram before and after the adjustment of the focusing area of a scene shown according to an exemplary embodiment.
[0067] Figure 11 It is a flowchart of a focusing method shown according to an exemplary embodiment.
[0068] Figure 12 It is a schematic diagram of a focusing area shown according to an exemplary embodiment.
[0069] Figure 13 It is a flowchart of a focusing method shown according to an exemplary embodiment.
[0070] Figure 14 It is a schematic diagram of the position of a focusing subject and a focusing area shown according to an exemplary embodiment.
[0071] Figure 15 It is a flowchart of a focusing method shown according to an exemplary embodiment.
[0072] Figure 16 It is a block diagram of a focusing device shown according to an exemplary embodiment.
[0073] Figure 17 It is a block diagram of an electronic device shown according to an exemplary embodiment. Detailed implementation manners
[0074] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present disclosure. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0075] Auto focus is an important part of the camera algorithm. Common camera focusing algorithms include PDAF (Phase Detection Auto Focus), CAF (Continous Auto Focus), and TOF (Time of Flight). Among them, since TOF relies on a laser sensor, it cannot be used for focusing on many devices and in some telephoto and environmental scenarios.
[0076] During the focusing process using the AF (Auto Focus) algorithm, PDAF is usually given priority. When PDAF is unavailable, CAF is then used for focusing. Currently, the focusing algorithm preferentially adopts central multi-window focusing, that is, the central window is divided into multiple small windows, the phase features of each small window are statistically analyzed, and then the phase features of the small windows are used for focusing.
[0077] When the confidence of the phase of the window is reliable, it is considered that the phase is in focus, and the phase of this window will be used to participate in the focusing. However, there are special scenarios where it is not possible to well characterize the focus accuracy of the phase through the confidence of the phase, such as the point light source scenario, the scenario with less detail, and the moiré pattern scenario, etc. For example, when the object is at the edge of the focusing frame and only a small part of the details exist within the focusing window, the phase estimation may be deviated, resulting in a defocus situation.
[0078] To solve the above problems, the present disclosure provides a focusing method. The focusing method in the present disclosure can determine a focusing area composed of sub-areas arranged in an array, and determine the position of the focusing subject in the image within the focusing area. When the focusing subject in the image is located at the edge of the focusing area, the position of the focusing area is adjusted, and then focusing is performed based on the adjusted focusing area. The focusing method in the present disclosure can increase the details of the focusing subject at the edge of the focusing area in the focusing area, improve the accuracy of the phase in the focusing area and the sub-areas within the focusing area, increase the focusing rate when there are fewer details in the focusing area, and obtain a clearly focused image.
[0079] An exemplary embodiment of the present disclosure provides a focusing method, which is applied to an electronic device including a camera device. The electronic device can specifically be a smart device such as a mobile phone, a tablet computer, a notebook, a smart robot, a smart wearable device, etc. In addition, various hardware resources are provided on the electronic device, as well as an energy storage device for supplying electrical energy for the operation of various hardware resources.
[0080] As Figure 1 shown, the focusing method shown in the present disclosure includes:
[0081] S101. Determine the focusing area.
[0082] S102. In response to the focusing subject being located at the edge of the focusing area, adjust the position of the focusing area.
[0083] S103. Perform focusing based on the adjusted focusing area.
[0084] In one example, the processes in steps S101 - S103 in the embodiment of the present disclosure can be displayed on the display interface of the electronic device to show the adjustment process to the user, so that the user can intuitively see the adjustment process of the position of the focusing area, and help the user know whether the moving process of the focusing area is the moving method they want to focus on. In addition, showing the adjustment process of the position of the focusing area to the user can also increase the human-computer interaction effect during the user's shooting process and improve the user's interaction experience. At the same time, the multiple sub-areas that make up the focusing area involved in steps S101 - S103 can be displayed on the display interface of the electronic device. For example, the focusing area can be displayed on the display interface, and at the same time, multiple sub-areas can be displayed within the focusing area.
[0085] Of course, it can be understood that in some special cases, the processes in steps S101 - S103 in the embodiment of the present disclosure can also perform relevant calculations in the background. Only after determining the adjusted focusing area, the adjusted focusing area will be displayed on the display interface, which is convenient for the user to use, saves the user's waiting time, and improves the user experience.
[0086] In one example, a control can also be displayed on the display interface of the electronic device. In response to a first operation by the user on the control, the focusing method shown in steps S101 - S103 is then performed. The first operation can be a click operation, a swipe operation, a voice input operation, etc. performed by the user. For example, after the user launches the camera application and clicks a preset button on the display interface of the camera application, it means that the user has performed the first operation. The electronic device responds to the first operation and executes the focusing method shown in steps S101 - S103. If the user does not perform the first operation, the focusing method shown in steps S101 - S103 may not be used for focusing, but other preset focusing methods can be used for focusing.
[0087] In step S101, generally, the center region of interest is preferably selected for focusing, that is, a certain proportion of the center region is demarcated in the center of the picture for focusing. At this time, the center region for focusing in the center of the picture can be determined as the focusing region. Among them, the focusing region can be an arbitrarily selected region in the center region, and does not necessarily need to be a specific region in the center region. For example, Figure 2 As shown in a schematic diagram of a focusing region, the square in the figure represents the focusing region.
[0088] In order to be able to focus more precisely on small objects, the focusing region can be divided into multiple sub - regions. Referring to Figure 3 As shown, the focusing region can include multiple sub - regions arranged in an array. The focusing region can include 3 * 3 sub - regions. Of course, other division methods can also be used. For example, the focusing region can include 1 * 3 sub - regions, 4 * 4 sub - regions, etc.
[0089] In one example, in order to facilitate the distinction of each sub - region in the focusing region and clarify which sub - region among the multiple sub - regions is the target region, the multiple sub - regions in the focusing region can be numbered. Taking the focusing region shown in Figure 3 as an example, the 3 * 3 sub - regions in Figure 3 are numbered to obtain the numbered focusing region as shown in Figure 4 . As shown in Figure 4 , Figure 4 the focusing region includes 9 sub - regions. Among them, the sub - region numbered 4 is the central sub - region in the focusing region. Referring to Figure 5 as shown, the sub - region numbered 4 is the central sub - region. If the focusing subject is a pen, the pen is exactly located in the sub - region numbered 4, that is, the focusing subject is in the central sub - region. At this time, the focus point is in the central sub - region, and there is no need to adjust the position of the focusing region anymore to obtain an image with the best focusing effect.
[0090] In addition, it should be noted that the numbering method of the sub-regions is not fixed. When the numbering order of the sub-regions changes, although the position of the central sub-region does not change, the corresponding number of the central sub-region will change. In one example, the numbering can be done row by row, with the first row numbered 0 - 2, the second row numbered 3 - 5, and the third row numbered 6 - 8; in another example, the numbering can also be done column by column, with the first column numbered 0 - 2, the second column numbered 3 - 5, and the third column numbered 6 - 8.
[0091] Of course, it can be understood that the above numbering of the sub-regions is for the purpose of explaining the focusing method in the present disclosure. During the application of the focusing method, these numbers will not be displayed on the display interface. At the same time, these numbers may not actually exist in the background, but are represented in other forms, such as by the coordinate positions of pixel points, etc.
[0092] In step S102, the focusing subject can be an object such as a person, an item, or a landscape being focused on during the focusing process.
[0093] In addition, it should be noted that the position of the focusing subject in the focusing area can be determined based on the position of the sub-region displaying the focusing subject in the focusing area, that is, the position of the focusing subject in the focusing area can be determined by the position of the sub-region displaying the focusing subject in the focusing area. For example, if the focusing subject is displayed in sub-region q and sub-region q is located in the edge area of the focusing area, it can be determined that the focusing subject is located in the edge area of the focusing area. Another example is that if sub-region q is located in the central sub-region of the focusing area, it can be determined that the focusing subject is located in the central sub-region of the focusing area.
[0094] In one example, the edge area of the focusing area can be determined based on the central sub-region in the focusing area. The edge area can be any sub-region except the central sub-region. Referring to Figure 4 as shown, the sub-region numbered 4 is the central sub-region, then all other sub-regions except the sub-region numbered 4 (i.e., the sub-regions numbered 0 - 3, 5 - 8) can be determined as the edge area of the focusing area. When the focusing subject is not located in the central sub-region, if the focusing subject is located in any one or any combination of the sub-regions numbered 0 - 3, 5 - 8, it is considered that the focusing subject is located in the edge area of the focusing area.
[0095] In another example, the edge area of the focusing area can also be set in advance. For example, Figure 4Sub-regions numbered 0, 1, 2, 3, 5, 6, 7, and 8 are determined as the edge regions of the focus area. When the focus subject is displayed in any one or any combination of the sub-regions numbered 0, 1, 2, 3, 5, 6, 7, and 8, it can be determined that the focus subject is located in the edge region of the focus area. For greater accuracy, while setting the edge region of the focus area, the non-edge region of the focus area can also be set. For example, Figure 4 Sub-regions numbered 1, 4, and 7 in Figure 4 are determined as the non-edge regions of the focus area. When the focus subject is located in both the edge region and the non-edge region, or when the focus subject is only located in the non-edge region, in both of these two cases, it is determined that the focus subject is not located in the edge region of the focus area. For example, when the focus subject is displayed in the sub-region numbered 4, since the sub-region numbered 4 is located in the center of the focus area and not in the edge region of the focus area, based on the position of the sub-region numbered 4, it is determined that the focus subject is displayed at the center position of the focus area. Another example is when the focus subject is displayed in the sub-regions numbered 4 and 7. Because the sub-regions where the focus subject is displayed include not only the sub-region numbered 7 at the edge but also the sub-region numbered 4 at the center position of the focus area, therefore, based on the positions of the sub-regions of the focus subject, it can be determined that the focus subject is not located in the edge region of the focus area.
[0096] In one example, the position of the focus area can be adjusted from the vertical and horizontal positions. For example, the position of the focus area can be adjusted upward; or, the position of the focus area can be adjusted to the left.
[0097] In another example, a specific adjustment angle can be calculated and the position of the focus area can be adjusted according to the adjustment angle. For example, if the calculated adjustment angle of the focus area in a certain situation is 60° (relative to a certain reference object), the position of the focus area can be adjusted in the direction of 60° relative to a certain reference object.
[0098] In another example, the above two examples adjust the position of the focus area from the aspect of direction. To make the position of the adjusted focus area more precise, the magnitude of the adjustment distance can also be restricted from the aspect of distance. For example, the position of the focus area is adjusted to the left by a magnitude of x, where x can be any positive number; or, the position of the focus area is adjusted in the direction of 60° relative to a certain reference object by a magnitude of y, where y can be any positive number.
[0099] In step S103, after adjusting the position of the focus area, most of the focus subjects should be included in the focus area at this time, that is, the focus subject is no longer located in the edge area of the focus area. Therefore, by using the adjusted focus area for focusing and photographing the focus subject, a clearly focused image can be obtained.
[0100] The focusing method in the present disclosure can increase the details of the focus subject at the edge of the focus area in the focus area, improve the accuracy of the phase in the focus area and the sub-areas in the focus area, increase the focusing rate when there are few details in the focus area, and obtain a clearly focused image.
[0101] According to an exemplary embodiment, the focusing method in this embodiment includes:
[0102] S201. Determine the focus area.
[0103] S202. In response to the focus subject being located at the edge of the focus area, determine a sub-area of the image showing the focus subject in the focus area as the target area.
[0104] S203. Based on the image in the target area and the image in the reference area, determine the feature change parameter between the target area and each reference area.
[0105] S204. Adjust the position of the focus area based on the relationship between the feature change parameter and the preset parameter.
[0106] S205. Focus based on the adjusted focus area.
[0107] Among them, steps S201 and S205 are the same as steps S101 and S103 in the above embodiment, and will not be elaborated here.
[0108] In step S202, a sub-area of the image showing the focus subject in the focus area can be understood as: a sub-area of the image including the focus subject in the focus area, or a sub-area of the focus area having an overlapping area with the focus subject. For the convenience of understanding, in the following steps, a sub-area of the focus area having an overlapping area with the focus subject is uniformly used as the definition of the target area.
[0109] Since the focus subject may have overlapping areas with multiple sub-areas in the focus area, there may be multiple situations for determining the target area.
[0110] In one example, when the focus subject has an overlapping area with only one sub-area, this sub-area can be determined as the target area. As Figure 5 shown, there is only one sub-area numbered 4 that has an overlapping area with the focus subject. At this time, the target area is the sub-area numbered 4.
[0111] In another example, when there is an overlapping area between the focused subject and multiple sub-regions, the sub-region closest to the foreground among the multiple sub-regions can be determined as the target region. Here, the foreground refers to the part closer to the camera in the picture, and it can be anything, such as grass, trees, buildings, people, animals, etc. As Figure 6 shown, there are image features in the sub-regions numbered 0-2, but the detailed features in the sub-region numbered 0 are the image features closest to the foreground. Therefore, the sub-region numbered 0 can be determined as the target region. Here, it should be noted that when determining which sub-region among the respective sub-regions has the image features closest to the foreground, it can be determined based on the depth-of-field information during the camera shooting process, which will not be elaborated here.
[0112] In another example, the sub-region with the highest confidence in the phase of the multiple sub-regions can also be determined as the target region. Among them, the confidence in the phase is calculated based on the image features. The confidence in the phase is affected by the gradient value or the curvature value of the image. When there are more image features in a certain sub-region, the confidence in the phase of this sub-region is higher. For the calculation of the confidence in the phase of the sub-region, it can be: after the image features appear in the focused area, the chip in the electronic device will automatically calculate the gradient value and the curvature value of each sub-region with image features by using a preset algorithm, determine the confidence in the phase of each sub-region, and store it in a preset location in the electronic device, such as the memory of the electronic device. Among them, the chip for calculating the confidence in the phase can be a common chip on the market. In practical applications, when the user wants to obtain the confidence in the phase of a certain sub-region, it can be directly called from the memory in the electronic device. As Figure 6 shown, the chip of the electronic device calculates that the confidence in the phase of the sub-region numbered 0 is m, the confidence in the phase of the sub-region numbered 1 is n, and the confidence in the phase of the sub-region numbered 2 is p, where m > p > n. It can be seen from this that the confidence in the phase of the sub-region numbered 0 is the highest, which also means that the image features in the sub-region numbered 0 are the most. At this time, according to the method for determining the target region given in this example, the sub-region numbered 0 can be determined as the target region.
[0113] In another example, when there is an overlapping area between the focused subject and multiple sub-regions, any sub-region among the multiple sub-regions can also be selected and determined as the target region. As Figure 6As shown, the sub-regions that overlap with the focused subject are the sub-region numbered 0, the sub-region numbered 1, and the sub-region numbered 2 respectively. Therefore, any one of the sub-regions numbered 0, the sub-region numbered 1, and the sub-region numbered 2 can be selected as the target region. For example, the sub-region numbered 2 can be determined as the target region.
[0114] In step S203, the reference region can be a sub-region adjacent to the target region in the focused region. As Figure 6 shown, assuming the target region is the sub-region numbered 1, the reference regions are the sub-regions adjacent to the sub-region numbered 1, that is, the sub-region numbered 0, the sub-region numbered 2, and the sub-region numbered 4.
[0115] Among them, the feature change parameter is used to characterize the degree of change between the image in the target region and the image in the reference region. For example, the feature change parameter can be the ratio difference between the ratio of the image feature value in the target region to the total image feature value and the ratio of the image feature value in the reference region to the total image feature value; or for another example, the feature change parameter can be the gradient ratio, gradient difference, etc. between the gradient value of the image in the target region and the gradient value of the image in the reference region. Here, it should be noted that referring to the calculation method of the confidence level of the phase of the sub-region in the focused region in the above step S202, it can be known that the confidence level of the phase of the sub-region is affected by the gradient value and the curvature value, and during the calculation of the confidence level of the phase of the sub-region, the electronic device will also calculate the gradient value and the curvature value of the sub-region. Therefore, if the feature change parameter is determined indirectly or directly through the gradient value, and the target region is determined based on the confidence level of the phase of the sub-region in the focused region in the above step S202, the gradient value of the target region and the gradient value of the reference region can be directly called from the electronic device to reduce the redundancy of the electronic device caused by recalculating the gradient value. If the target region is not determined based on the confidence level of the phase of the sub-region in the focused region in the above step S202, the gradient value of each sub-region needs to be calculated separately.
[0116] Taking the gradient ratio as the feature change parameter, the following two scenarios are specifically described:
[0117] Scenario 1:
[0118] Assume Figure 7If the target region in it is the sub-region numbered 6, then the reference regions are the sub-regions adjacent to the sub-region numbered 6, that is, the sub-region numbered 3 and the sub-region numbered 7. By calling the gradient values of each existing sub-region in the electronic device or calculating the gradient values of each sub-region, the gradient values of the above three sub-regions are determined. The gradient value of the target region is 120, the gradient value of the reference region numbered 3 is 5, and the gradient value of the reference region numbered 7 is 6. Therefore, there are two feature change parameters. Among them, the first feature change parameter is the ratio of the gradient value of 120 to the gradient value of 5, that is, the value of the first feature change parameter is 24; the second feature change parameter is the ratio of the gradient value of 120 to the gradient value of 6, that is, the value of the second feature change parameter is 20. Therefore, in Scenario 1, the feature change parameters between the target region and each reference region are 24 and 20 respectively.
[0119] Scenario 2:
[0120] Suppose Figure 6 If the target region in it is the sub-region numbered 1, then the reference regions are the sub-regions adjacent to the sub-region numbered 1, that is, the reference regions are the sub-region numbered 0, the sub-region numbered 2, and the sub-region numbered 4. Similarly to Scenario 1, by obtaining the gradient values of the above four sub-regions, the feature change parameters can be determined. The specific calculation process will not be elaborated in this scenario. The gradient values of the target region, the reference region numbered 0, the reference region numbered 2, and the reference region numbered 4 can be obtained as 132, 135, 78, and 6 respectively. Then the feature change parameters between the target region and the above three reference regions are 0.98, 1.69, and 22 respectively.
[0121] It should be noted that the above Scenario 1 and Scenario 2 only take the gradient ratio as an example of the feature change parameter to illustrate how to calculate the feature change parameter. In this embodiment, the specific determination method of the feature change parameter is not limited. For example, the gradient difference in Scenario 1 and Scenario 2 can also be calculated and used as the feature change parameter.
[0122] In step S204, in one example, the preset parameter can be a value of the same nature as the feature change parameter. The relationship between the feature change parameter and the preset parameter can be the magnitude relationship between the feature change parameter and the preset parameter. For example, the feature change parameter is greater than the preset parameter, the feature change parameter is less than the preset parameter, or the feature change parameter is equal to the preset parameter, etc. Taking the gradient ratio as the feature change parameter as an example, the preset parameter can be a threshold of a gradient ratio, and the relationship between the preset parameter and the feature change parameter is that the gradient ratio corresponding to the feature change parameter is greater than the threshold of the gradient ratio.
[0123] In another example, the preset parameter can also be a certain conditional parameter set in advance. The relationship between the feature change parameter and the preset parameter can be whether the feature change parameter meets the conditional parameter. For example, the feature change parameter meets the conditional parameter, or the feature change parameter does not meet the conditional parameter.
[0124] In one example, adjusting the position of the focus area can be to adjust the position of the focus area in terms of angle. For example, move the position of the focus area in the 63-degree direction. It should be noted that although this situation only adjusts the position of the focus area in terms of angle, the local configuration of the electronic device will set the distance of each adjustment. For example, the distance of each adjustment is the size of half a sub-region. To obtain a better adjustment effect, assume that the effect of the first adjustment of the position of the focus area is not good (for example, the focused subject after adjustment is still located in the edge area of the focus area), then the focusing method shown in steps 201-S205 can be looped until the desired focusing effect is obtained.
[0125] In another example, it can also be to adjust the position of the focus area in terms of both angle and distance. For example, move the position of the focus area in the 12-degree direction by the size of 0.75 sub-regions. It should be noted that the distance can be the most appropriate moving distance calculated separately by the electronic device. For example, moving the focus area by the size of two sub-regions can make the image features in the target area the most, then the distance at this time can be the size of two sub-regions; the distance can also be the moving distance set in the local configuration of the electronic device as in the above example, which will not be elaborated in this example.
[0126] To make the focusing effect more perfect, this embodiment preferably adjusts the position of the focus area in terms of both angle and distance.
[0127] The focusing method provided in this embodiment can increase the details of the focused subject in the edge area in the focus area by adjusting the position of the focus area and performing focusing based on the adjusted focus area, making the image features of the focused subject in the focus area more abundant, thereby improving the focusing accuracy of the focus area and obtaining a clearer focused image to enhance the user's shooting experience.
[0128] According to an exemplary embodiment, the focusing method in this embodiment includes:
[0129] S301. Determine the focus area.
[0130] S302. In response to the focused subject being located at the edge of the focus area, determine a sub-region of the image showing the focused subject in the focus area as the target area.
[0131] S303. Determine the feature change parameters between the target region and each reference region based on the images in the target region and the images in the reference regions.
[0132] S304. Determine the feature change parameters that meet the first preset condition among at least two feature change parameters as the first feature parameters.
[0133] S305. Take the first feature parameters whose relationship with the preset parameters meets the second preset condition among the first feature parameters as the target feature parameters.
[0134] S306. Adjust the position of the focus region based on the number of target feature parameters.
[0135] S307. Perform focusing based on the adjusted focus region.
[0136] Among them, steps S301 - S303, S307 are the same as steps S201 - S203, S205 in the above embodiments, and will not be elaborated here.
[0137] In one example, the multiple sub - regions included in the focus region in this embodiment are arranged in a multi - row and multi - column array. For example, the multiple sub - regions included in the focus region are arranged in a 3×3 array, or the multiple sub - regions included in the focus region are arranged in a 2×3 array. Additionally, it should be noted that each target region has at least two reference regions, that is to say, each target region has at least two reference regions adjacent to the target region. Therefore, the array setting where some target regions have only one reference region is not applicable to this embodiment. For example, the multiple sub - regions included in the focus region are arranged in a 1×2 array, or the multiple sub - regions included in the focus region are arranged in a 2×1 array.
[0138] In step S304, since each target region has at least two reference regions. For example, in the above scenario one, the target region has two reference regions, and in the above scenario two, the target region has three reference regions. Therefore, the number of feature change parameters is definitely greater than or equal to two.
[0139] Among them, the first preset condition is related to the numerical size of the feature change parameter and can represent the screening and filtering of the feature change parameter.
[0140] In one example, if the first preset condition can be the feature change parameters ranked in the top two in descending order, then it is necessary to sort at least two feature change parameters in descending order and determine the feature change parameters ranked in the top two in the sorting. At this time, the feature change parameters ranked in the top two in the sorting are the first feature parameters. For example, in the above scenario two of step S203, the feature change parameters ranked in the top two in descending order are 22 and 1.69. Therefore, the first feature parameters corresponding to scenario two are 22 and 1.69.
[0141] In another example, if the first preset condition can be the feature change parameter with the largest value, it is necessary to find out the feature change parameter with the largest value among at least two feature change parameters. At this time, the feature change parameter with the largest value is the first feature parameter. Similarly, the first feature parameter corresponding to Scenario 2 is 22.
[0142] The above two examples are only two possible cases of the first preset condition. In practical applications, the first preset condition can also be the feature change parameter with the smallest value, the feature change parameters ranked in the first two positions in ascending order, and so on.
[0143] In step S305, in one example, the second preset condition can represent the relationship between the first feature parameter and the preset parameter. For example, the second preset condition can be that the first feature parameter is greater than the preset parameter; for another example, the second preset condition can be that the first feature parameter is less than the preset parameter; for another example, the second preset condition can be that the ratio of the first feature parameter to the preset parameter is greater than a certain value, etc. After determining the second preset condition, the first feature parameters that meet the second preset condition among all the first feature parameters can be screened out according to the second preset condition, and this first feature parameter is used as the target feature parameter.
[0144] Specifically, assume that the second preset condition is that the first feature parameter is greater than the preset parameter. If there are a first feature parameter X, a first feature parameter Y, and a preset parameter Z, where X > Z and Y < Z, then the first feature parameter that meets the second preset condition among the first feature parameter X and the first feature parameter Y is the first feature parameter X. Therefore, the first feature parameter X is the finally determined target feature parameter. Taking Scenario 2 above as an example, assume that the preset parameter is 5 and the first feature parameters are 22 and 1.69 respectively. By comparing the first feature parameters with the preset parameter, the target feature parameter of Scenario 2 can be obtained as 22.
[0145] In another example, assume that the second preset condition is that the first feature parameter is greater than the preset parameter. If there are a first feature parameter X, a first feature parameter Y, and a preset parameter Z, where X > Z and Y > Z, then the first feature parameters that meet the second preset condition among the first feature parameter X and the first feature parameter Y are the first feature parameter X and the first feature parameter Y. At this time, both the first feature parameter X and the first feature parameter Y are the finally determined target feature parameters. Taking Scenario 1 in step S203 above as an example, assume that the preset parameter is 5 and the first feature parameters are 24 and 20 respectively. By comparing the first feature parameters with the preset parameter, the target feature parameters of Scenario 1 can be obtained as 24 and 20.
[0146] In step S306, as can be seen from the above step S305, the number of target feature parameters is not fixed, but is determined according to the relationship between the first feature parameter and the preset parameter in practice.
[0147] In one example, an adjustment method for the position of the focus area can be generated according to the number of target feature parameters. For example, when the number of target feature parameters is 1, adjustment method A is generated; for another example, when the number of target feature parameters is 2, adjustment method B is generated.
[0148] Specifically, when the number of target feature parameters is one, such as the target feature parameter corresponding to scenario two is only one, only this one target feature parameter can be considered, and the position of the focus area can be adjusted according to this one target feature parameter.
[0149] The way to adjust the position of the focus area can be:
[0150] In one example, a reference area corresponding to the target feature parameter can be obtained, and the focus area can be adjusted based on the relationship between the reference area and the target area.
[0151] In another example, a calculation model can be established in advance, where the calculation model can be used to represent the corresponding relationship between the target feature parameter and the adjustment method. After obtaining the target feature parameter, the target feature parameter can be substituted into the calculation model to determine the adjustment method, and finally the position of the focus area can be adjusted based on the adjustment method.
[0152] Specifically, when the number of target feature parameters is two, such as the target feature parameters in scenario one above are two, it is necessary to consider adjusting the position of the focus area from two aspects of the target feature parameters. Similar to the way to adjust the position of the focus area when the number of target feature parameters is one, when the number of target feature parameters is two, the way to adjust the position of the focus area can be:
[0153] In one example, reference areas corresponding to the two target feature parameters can be obtained, and the focus area can be adjusted based on the relationship between the two reference areas and the target area. For example, if one of the two reference areas is above or below the target area, and the other is on the left or right side of the target area, the position of the focus area can be moved along the axis of symmetry of the two reference areas.
[0154] In another example, a calculation model can be established in advance, where the calculation model can be used to represent the corresponding relationship between the target feature parameter and the adjustment method. After obtaining the two target feature parameters, the two target feature parameters can be substituted into the calculation model to determine the adjustment method, and finally the position of the focus area can be adjusted based on the adjustment method.
[0155] In this embodiment, by determining the target feature parameter and adjusting the position of the focus area according to the number of target feature parameters, the adjustment methods corresponding to different numbers of target feature parameters can be determined, so that different adjustment methods can be implemented in different situations, thereby achieving the adjustment of the position of the focus area faster and better.
[0156] According to an exemplary embodiment, the focusing method in this embodiment includes:
[0157] S401. Determine the focus area.
[0158] S402. In response to the focus subject being located at the edge of the focus area, determine a sub-region of the image showing the focus subject in the focus area as the target area.
[0159] S403. Based on the image in the target area and the image in the reference area, determine the feature change parameter between the target area and each reference area.
[0160] S404. Determine the feature change parameter that satisfies the first preset condition among at least two feature change parameters as the first feature parameter.
[0161] S405. Use the first feature parameter whose relationship with the preset parameter satisfies the second preset condition among the first feature parameters as the target feature parameter.
[0162] S406. When the number of target feature parameters is one, move the focus area a preset distance in the direction from the reference area to the target area.
[0163] S407. Perform focusing based on the adjusted focus area.
[0164] Among them, steps S401 - S405, S407 are the same as steps S301 - S305, S307 in the above embodiment, and will not be elaborated here.
[0165] In step S406, since the target feature parameter is obtained by screening or other operations on the feature change parameter, the target feature parameter has the same / similar parameter characteristics as the feature change parameter. That is to say, the target feature parameter is the same as the feature change parameter and can also be used to characterize the change degree between the image in the target area and the image in the reference area. When there is only one target feature parameter, it means that at this time, only the change degree between the image in the target area and the image in a certain reference area is relatively large. Simply put, the image features in a certain reference area are less. Therefore, the adjustment method can be summarized as moving the focus area in the direction from the reference area to the target area, so that the image features in the reference area will increase appropriately, thereby making the focus clearer.
[0166] The following uses a specific embodiment to illustrate step S406:
[0167] Referring to the above step S305, the target feature parameter in scenario two is obtained as 22. And referring to the above step S203, it is known that the target feature parameter 22 corresponds to the target feature parameter between the sub-region numbered 1 (target region) and the sub-region numbered 4 (reference region). Therefore, the method for adjusting the focus area in scenario two is: adjust the focus area in the direction from the sub-region numbered 4 to the sub-region numbered 1, and move a preset distance. The preset distance can be selected and set according to the actual situation. For example, it can be half of the size of the focus area or half of the size of the sub-region.
[0168] In this embodiment, when the number of target feature parameters is one, the adjustment method of the focus area is given, that is, moving the focus area a preset distance along the direction from the reference region to the target region. In subsequent application processes, if it is found that the number of target feature parameters is one, the adjustment method provided in this embodiment can be directly substituted, making the focusing method more simple and convenient.
[0169] According to an exemplary embodiment, the focusing method in this embodiment includes:
[0170] S501. Determine the focus area.
[0171] S502. In response to the focusing subject being located at the edge of the focus area, determine a sub-region of the image showing the focusing subject in the focus area as the target region.
[0172] S503. Based on the image in the target region and the image in the reference region, determine the feature change parameter between the target region and each reference region.
[0173] S504. Determine the feature change parameter that satisfies the first preset condition among at least two feature change parameters as the first feature parameter.
[0174] S505. Use the first feature parameter whose relationship with the preset parameter satisfies the second preset condition among the first feature parameters as the target feature parameter.
[0175] S506. When the number of target feature parameters is two, determine a calculation model based on the two target feature parameters.
[0176] S507. Based on the two target feature parameters and the calculation model, determine the moving angle.
[0177] S508. Move the focus area a preset distance along the moving direction.
[0178] S509. Perform focusing based on the adjusted focus area.
[0179] Among them, steps S501 - S505, S509 are the same as steps S301 - S305, S307 in the above - mentioned embodiment, and will not be elaborated here.
[0180] In step S506, the calculation model is used to represent the corresponding relationship between the movement angle and two target feature parameters. For example, by performing a preset operation on the two target feature parameters, the movement angle can be obtained, and the corresponding relationship between the movement angle and the two target feature parameters is the calculation model. Among them, the calculation model can be a formula operation or a matrix operation, etc.
[0181] In one example, the target area and two reference areas can be determined based on two target feature parameters, and the calculation model can be determined according to the target area and the reference areas.
[0182] The following gives a specific process for determining the calculation model according to the target area and the reference areas:
[0183] In one example, as Figure 8 shown, taking the vertex corresponding to the lower - right corner of the sub - area numbered 4 as the origin, the focus area can be divided into four quadrants through coordinate axes. Among them, the first quadrant is the upper - right part in the coordinate system, where both the x - coordinate and the y - coordinate are positive; the second quadrant is the upper - left part in the plane rectangular coordinate system, where the x - coordinate is negative and the y - coordinate is positive; the third quadrant is the lower - left part in the plane rectangular coordinate system, where both the x - coordinate and the y - coordinate are negative; the fourth quadrant is the lower - right part in the plane rectangular coordinate system, where the x - coordinate is positive and the y - coordinate is negative. In addition, it should be noted that the present disclosure does not limit the specific position of the origin of this coordinate system. For example, the origin can be the vertex corresponding to the lower - left corner of the focus area, or the vertex corresponding to the lower - left corner of the target area, etc.
[0184] As Figure 8 shown, the characteristic change parameters between the sub - area numbered 2 and the sub - area numbered 5, the characteristic change parameters between the sub - area numbered 1 and the sub - area numbered 4, and the characteristic change parameters between the sub - area numbered 0 and the sub - area numbered 3 represent the positive direction of the Y - axis; the characteristic change parameters between the sub - area numbered 0 and the sub - area numbered 1, the characteristic change parameters between the sub - area numbered 3 and the sub - area numbered 4, and the characteristic change parameters between the sub - area numbered 6 and the sub - area numbered 7 represent the negative direction of the X - axis.
[0185] After the coordinate system is established, the calculation model can be established respectively according to the quadrants where the target area and the reference areas are located. For example:
[0186] When the target area and the reference area are located in the first quadrant, the calculation model is established according to the following formula:
[0187]
[0188] Among them, θ represents the moving angle, RatioGrad(+Y) represents the target feature parameter in the positive direction of the Y-axis, and Sum(RatioGrad_ij) represents the sum of the target feature parameters.
[0189] When the target area and the reference area are in the second quadrant, a calculation model is established according to the following formula:
[0190]
[0191] Among them, RatioGrad(-X) represents the target feature parameter in the negative direction of the X-axis.
[0192] When the target area and the reference area are in the third quadrant, a calculation model is established according to the following formula:
[0193]
[0194] Among them, RatioGrad(-Y) represents the target feature parameter in the negative direction of the Y-axis.
[0195] When the target area and the reference area are in the fourth quadrant, a calculation model is established according to the following formula:
[0196]
[0197] Among them, RatioGrad(+X) represents the target feature parameter in the positive direction of the X-axis.
[0198] It should be noted that establishing a coordinate system and establishing calculation models respectively according to the quadrants where the target area and the reference area are located are only one implementation manner of the calculation model provided in this embodiment. The specific type, specific value, etc. of the calculation model can be selected and set according to actual needs.
[0199] In step S507, the moving angle is the included angle of the moving direction relative to the reference position, where the reference position can be a fixed reference position such as the positive half-axis of the X-axis or the positive half-axis of the Y-axis.
[0200] In one example, assume that the positive half-axis of the X-axis is the reference position, and the target feature parameters of Scenario 1 are 24 and 20. It is known that the target feature parameter 24 is the target feature parameter between the sub-region numbered 6 (target region) and the sub-region numbered 3 (reference region), and the target feature parameter 20 is the target feature parameter between the sub-region numbered 6 (target region) and the sub-region numbered 7 (reference region). At this time, if a coordinate system is established with the vertex corresponding to the upper right corner of the sub-region numbered 4 as the origin, then the sub-region numbered 6 (target region), the sub-region numbered 3 (reference region), and the sub-region numbered 7 (reference region) are all located in the third quadrant, and the target feature parameter 24 represents the negative Y-axis direction, and the target feature parameter 20 represents the negative X-axis direction. Substituting the two target feature parameters into the above calculation model for the third quadrant, the following formula is obtained:
[0201]
[0202] Therefore, the angle between the moving direction of the focus area and the positive half-axis of the X-axis is 229°, that is, the moving angle is 229°.
[0203] In addition, the calculation model provided in this embodiment based on the target region and the reference region is also applicable to the case where the number of target feature parameters is one. Since the adjustment method when the number of target feature parameters is one is relatively simple, that is, directly adjust the focus area along the direction from the reference region to the target region. Therefore, the calculation model provided in this embodiment can be used as an alternative method. Similar to the adjustment method when the number of target feature parameters is two, only by substituting the target feature parameter into the corresponding calculation model, the moving angle of the focus area when the number of target feature parameters is one can be obtained. For example, taking Scenario 2 as an example, assume that the positive half-axis of the X-axis is the reference position, and a coordinate system is established with the vertex corresponding to the upper left corner of the sub-region numbered 4 as the origin. It can be seen that the sub-region numbered 1 (target region) and the sub-region numbered 4 (reference region) are located in the first quadrant, and the target feature parameter 22 represents the positive Y-axis direction. Substituting this one target feature parameter into the above calculation model for the first quadrant, the following formula is obtained:
[0204]
[0205] That is, the angle between the moving direction of the focus area and the positive half-axis of the X-axis, that is, the moving angle, is 90°.
[0206] In step S508, the moving direction is determined according to the moving angle. For example, if the moving angle is 229°, the moving direction is the direction of 229° relative to the positive half-axis of the X-axis; for another example, if the moving angle is 90°, the moving direction is the direction of 90° relative to the positive half-axis of the X-axis. In one example, the preset distance can be selected and set according to the actual situation, such as half of the size of the focusing area or half of the size of the moving sub-area.
[0207] In this embodiment, the focusing area can be adjusted according to the angle calculated by the calculation model. For the sake of more convenient understanding, this embodiment gives two schematic diagrams of the focusing area before and after adjustment:
[0208] As Figure 9 shown in the schematic diagram of the focusing area before and after adjustment in Scenario 1, where 91 represents the focusing area before adjustment and 92 represents the focusing area after adjustment, Figure 9 which can clearly show the changes in the focusing area before and after adjustment.
[0209] As Figure 10 shown in the schematic diagram of the focusing area before and after adjustment in Scenario 2, which clearly shows the changes in the focusing area before and after adjustment. Among them, 1001 represents the focusing area before adjustment and 1002 represents the focusing area after adjustment. It can be seen that the image features in the adjusted focusing area have increased significantly.
[0210] In this embodiment, by determining the calculation model and determining the moving angle based on two target feature parameters and the calculation model, it is possible to determine how large the angle to be moved according to the actual situation of the focusing area, so that one focusing area corresponds to one moving angle, making the adjustment method more in line with practical applications and solving the problem of inapplicability caused by a unified moving angle.
[0211] According to an exemplary embodiment, the focusing method in this embodiment includes:
[0212] S601. Determine the focusing area.
[0213] S602. In response to the focusing subject being located at the edge of the focusing area, determine a sub-area of the image showing the focusing subject in the focusing area as the target area.
[0214] S603. Based on the image in the target area and the image in the reference area, determine the feature change parameter between the target area and each reference area.
[0215] S604. Arrange at least two feature change parameters in descending order of numerical value.
[0216] S605. Select the feature change parameters ranked first and second as the first feature parameters.
[0217] S606. Take the first feature parameters in the first feature parameters whose relationship with the preset parameters meets the second preset condition as the target feature parameters.
[0218] S607. Adjust the position of the focus area based on the number of target feature parameters.
[0219] S608. Perform focusing based on the adjusted focus area.
[0220] Among them, steps S601 - S604, S607 - S608 are the same as steps S301 - S304, S306 - S307 in the above embodiments, and will not be elaborated here.
[0221] In step S605, the present disclosure gives examples in the order from large to small. In practical applications, it can also be arranged in the order from small to large, or any sorting method can be used to sort the feature change parameters.
[0222] In step S606, select the first and second feature change parameters in the arrangement as the first feature parameters, which is equivalent to taking the largest and the second largest feature change parameters among at least two feature change parameters as the first feature parameters.
[0223] When the sorting method in the present disclosure changes, the selected feature change parameters should also change accordingly. For example, if the sorting method is changed to the order from small to large, then the last and the second - last feature change parameters in the arrangement are correspondingly selected as the first feature parameters.
[0224] In this embodiment, selecting the first and second feature change parameters in the arrangement can select the largest and the second largest feature change parameters that characterize the degree of change between the image in the target area and the image in the reference area among multiple feature change parameters, and taking this feature change parameter as the first feature parameter can facilitate subsequent adjustment of the position in the focus area to maximize the image features in the reference area.
[0225] According to an exemplary embodiment, the focusing method in this embodiment includes:
[0226] S701. Determine the focus area.
[0227] S702. In response to the focusing subject being located at the edge of the focus area, determine a sub - area of the image showing the focusing subject in the focus area as the target area.
[0228] S703. Based on the image in the target area and the image in the reference area, determine the feature change parameters between the target area and each reference area.
[0229] S704. Determine the feature change parameter that satisfies the first preset condition among at least two feature change parameters as the first feature parameter.
[0230] S705. Use the first feature parameter whose relationship with the preset parameter satisfies the second preset condition among the first feature parameters as the target feature parameter.
[0231] S706. Adjust the position of the focus area based on the number of target feature parameters.
[0232] S707. Perform focusing based on the adjusted focus area.
[0233] S708. If the relationship between each first feature parameter and the preset parameter does not satisfy the second preset condition, use the current focus area for focusing.
[0234] Among them, steps S701 - S707 are the same as steps S301 - S307 in the above - mentioned embodiment, and will not be elaborated here.
[0235] Among them, steps S705 and S708 are in an alternative relationship, that is, the relationship between the first feature parameter and the preset parameter either satisfies the second preset condition or does not satisfy the second preset condition. Only when the relationship between the first feature parameter and the preset parameter satisfies the second preset condition, steps S706 and S707 will be performed.
[0236] In step S708, when the relationship between each first feature parameter and the preset parameter does not satisfy the second preset condition, it indicates that the image features in the target area and the reference area are quite similar. Therefore, there is no need to further adjust the position of the focus area, and a good - focused imaging can be obtained by using the current focus area for focusing.
[0237] In this embodiment, if it is found that there is no first feature parameter whose relationship with the preset parameter satisfies the second preset condition, it means that there are enough image features in the target area and the focus area, and the current focus area can be used for focusing without adjusting the position of the focus area, thus simplifying the focusing process.
[0238] According to an exemplary embodiment, the focusing method in this embodiment includes:
[0239] S801. Determine the focus area.
[0240] S802. In response to the focusing subject being located at the edge of the focus area, determine a sub - area of the image showing the focusing subject in the focus area as the target area.
[0241] S803. Determine the confidence level of each reference region based on the images in the target region and the images in the reference regions.
[0242] S804. If the confidence level of any one of the reference regions is less than or equal to the preset confidence level, determine the feature change parameters between the target region and each reference region.
[0243] S805. Adjust the position of the focus region based on the relationship between the feature change parameters and the preset parameters.
[0244] S806. Perform focusing based on the adjusted focus region.
[0245] S807. If the confidence level of each reference region is greater than the preset confidence level, perform focusing using the current focus region.
[0246] Among them, steps S801 - S802, S805 - S806 are the same as steps S201 - S202, S204 - S205 in the above - mentioned embodiment, and will not be elaborated here.
[0247] Among them, steps S804 and S807 are in an alternative relationship, that is, the confidence level of the reference region is either greater than the preset confidence level or less than or equal to the preset confidence level. Only when the confidence level of any one of the reference regions is less than or equal to the preset confidence level, steps S805 and S806 will be performed.
[0248] In step S803, the confidence level refers to the confidence level of the phase. The confidence level of the phase is calculated based on the image features and is affected by the gradient value or the curvature value of the image. When there are more image features in the reference region, the confidence level of the phase of the reference region is greater and the phase is more accurate. Referring to the description of the confidence level in step S101 above, where the sub - region with the highest confidence level of the phases of multiple sub - regions is determined as the target region, when the user needs to obtain the confidence level of the phase of the reference region, the pre - calculated confidence level of the reference region can be directly called from the electronic device.
[0249] In step S804, if the confidence level of any one of the reference regions is less than or equal to the preset confidence level, it indicates that the phase of the reference region is not credible, that is, the phase of this reference region is inaccurate. Therefore, it is necessary to adjust the focus region and determine the feature change parameters between the target region and each reference region.
[0250] In step S807, if the confidence level of each reference region is greater than the preset confidence level, it indicates that the phase of each reference region is credible, and there is no need to adjust the focus region. Perform focusing using the current focus region. Then a clearly focused image can be obtained.
[0251] In this embodiment, by determining the confidence level of each reference region, a focusing method corresponding to the case where the confidence level of any one reference region is less than or equal to a preset confidence level, or the confidence levels of each reference region are all greater than the preset confidence level is given. Setting two focusing methods enables the electronic device to select different focusing methods according to the specific situation of the reference region, thereby making the focusing method more adaptable to the specific scenario.
[0252] According to an exemplary embodiment, this embodiment provides a focusing method. The focusing method in this embodiment is a specific limitation of step S804 in the foregoing content. Step S804 includes the following steps:
[0253] S8041. Calculate the image feature values of the target region and the reference region respectively.
[0254] S8042. Calculate the gradient value of the target region relative to the reference region as the feature change parameter, or calculate the gradient value of the reference region relative to the target region as the feature change parameter.
[0255] In step S8041, the image feature value can be calculated according to the content of the image. For example, it can be obtained how much the image in the sub-region accounts for the total area of the sub-region by calculating the ratio of the image in the sub-region to the area of the sub-region, so as to obtain the amount of the image content and deduce the image feature value.
[0256] In step S8042, in the related art, when calculating the confidence level of the phase through the image feature value, generally the gradient value and the curvature value of the focusing region and each sub-region are calculated. Therefore, the gradient values of the target region and the reference region can both directly call the gradient values pre-calculated in the electronic device.
[0257] In one example, the gradient value of the target region relative to the reference region can be used as the feature change parameter. For example, the gradient ratio of the target region to the reference region, that is, the gradient ratio of the two, can be used as the feature change parameter.
[0258] In another example, the gradient value of the reference region relative to the target region can also be used as the feature change parameter. For example, the gradient ratio of the reference region to the target region, that is, the gradient ratio of the two, can be used as the feature change parameter.
[0259] According to an exemplary embodiment, as Figure 11 shown, the focusing method in this embodiment includes:
[0260] S901. Determine the focusing region.
[0261] S902. Determine the central sub-region of the focusing region.
[0262] S903. When the focus subject is located in other sub-regions of the focus area except the central sub-region, it is determined that the focus subject is located at the edge of the focus area.
[0263] S904. In response to the focus subject being located at the edge of the focus area, a sub-region of the image in the focus area where the focus subject is displayed is determined as the target area.
[0264] S905. Based on the image in the target area and the image in the reference area, the feature change parameter between the target area and each reference area is determined.
[0265] S906. Based on the relationship between the feature change parameter and the preset parameter, the position of the focus area is adjusted.
[0266] S907. Focusing is performed based on the adjusted focus area.
[0267] Among them, steps S901, S904 - S907 are the same as steps S201, S202 - S205 in the above embodiments, and will not be elaborated here.
[0268] In step S902, in one example, when the focus area includes an odd number of sub-regions, such as 3*3, 5*5, 7*7 sub-regions, the central sub-region of the focus area can be the sub-region where the geometric center of the focus area is located. For example, for the focus area composed of 3*3 sub-regions shown as follows, the central sub-region of this focus area is the central area among the multiple sub-regions, that is, the sub-region numbered 4. In addition, the central sub-region of the focus area can also be a custom sub-region. For example, in a certain specific scenario, the focus subject cannot enter the rightmost column of the focus area composed of 3*3 sub-regions. At this time, the sub-region corresponding to the second row of the first column in the focus area composed of 3*3 sub-regions can be used as the central sub-region. Figure 4 As shown, for the focus area composed of 3*3 sub-regions, the central sub-region of this focus area is the central area among the multiple sub-regions, that is, the sub-region numbered 4. In addition, the central sub-region of the focus area can also be a custom sub-region. For example, in a certain specific scenario, the focus subject cannot enter the rightmost column of the focus area composed of 3*3 sub-regions. At this time, the sub-region corresponding to the second row of the first column in the focus area composed of 3*3 sub-regions can be used as the central sub-region.
[0269] In another example, when the focus area includes an even number of sub-regions, such as 4*4, 6*6, 8*8 sub-regions, the central sub-region of the focus area can be the sub-region with the geometric center of the focus area as the vertex. For example, as shown in the schematic diagram of the 4*4 focus area, the central sub-region is the area composed of the thickened lines. It should be noted that in the process of determining the central sub-region of the focus area composed of even * even sub-regions, the center point of the focus area can be determined first. For example, the center point of the focus area in the figure (the black dot in the figure). After that, based on the determined center point, the number of sub-regions required to form the central sub-region is determined. In addition, the central sub-region of the focus area can also be a custom sub-region. For example, when the even number forming the focus area is very large, a part of the sub-regions can be selected by oneself to form the central sub-region. Figure 12 As shown in the schematic diagram of the 4*4 focus area, the central sub-region is the area composed of the thickened lines. It should be noted that in the process of determining the central sub-region of the focus area composed of even * even sub-regions, the center point of the focus area can be determined first. For example, the center point of the focus area in the figure (the black dot in the figure). After that, based on the determined center point, the number of sub-regions required to form the central sub-region is determined. In addition, the central sub-region of the focus area can also be a custom sub-region. For example, when the even number forming the focus area is very large, a part of the sub-regions can be selected by oneself to form the central sub-region. Figure 12 For example, the center point of the focus area in the figure (the black dot in the figure). After that, based on the determined center point, the number of sub-regions required to form the central sub-region is determined. In addition, the central sub-region of the focus area can also be a custom sub-region. For example, when the even number forming the focus area is very large, a part of the sub-regions can be selected by oneself to form the central sub-region.
[0270] In step S903, in one example, if the focus subject is not located in the central sub-region of the focus area, but in other sub-regions of the focus area except the central sub-region, it is determined that the focus subject is located in the edge region of the focus area. As Figure 6 shown, Figure 6 the central sub-region in Figure 6 is the sub-region numbered 4, and the building (focus subject) in
[0271] is not located in the sub-region numbered 4. Therefore, the building (focus subject) is located in the edge region of the focus area.
[0272] This embodiment provides a method for determining the central sub-region of the focus area. By determining the central sub-region of the focus area, it can be simply determined whether the focus subject is located in the edge region, so as to adjust the position of the focus area or directly use the current focus area for focusing. Figure 13 According to an exemplary embodiment, as
[0273] shown, the focusing method in this embodiment includes:
[0274] S1001. Determine the focus area.
[0275] S1002. Determine the central sub-region of the focus area.
[0276] Among them, steps S1001 - S1002 are the same as steps S901 - S902 in the above embodiment and will not be elaborated here.
[0277] In step S1003, there are two cases where there is an overlapping area between the focus subject and the central sub-region:
[0278] In one example, a part of the focus subject is located in the central sub-region of the focus area, and a part is located in sub-regions outside the central sub-region of the focus area. As Figure 14 shown, a part of the building is located in the central sub-region numbered 4, and the other part is located in sub-regions outside the central sub-region.
[0279] In another example, the focus subject is entirely located in the central sub-region of the focus area. As Figure 5 shown, the top of the pencil (focus subject) is completely located in the sub-region numbered 4.
[0280] However, regardless of which case the overlapping area between the focus subject and the central sub-region is, as long as the focus subject is included in the central sub-region, it is considered that the focus subject is not located in the edge region, and the phase of the focus region is accurate. At this time, the current focus region can still be used for focusing.
[0281] According to an exemplary embodiment, as Figure 15 shown, the focusing method in this embodiment includes:
[0282] S1101. Determine the focus region.
[0283] S1102. Judge the relationship between the confidence level of the focus region and the preset confidence level.
[0284] S1103. If the confidence level of the focus region is greater than or equal to the preset confidence level, confirm the position of the focus subject in the focus region.
[0285] S1104. Determine the central sub-region of the focus region.
[0286] S1105. When the focus subject is located in other sub-regions of the focus region except the central sub-region, determine that the focus subject is located at the edge of the focus region.
[0287] S1106. In response to the focus subject being located at the edge of the focus region, determine a sub-region of the image showing the focus subject in the focus region as the target region.
[0288] S1107. Based on the image in the target region and the image in the reference region, determine the feature change parameter between the target region and each reference region.
[0289] S1108. Based on the relationship between the feature change parameter and the preset parameter, adjust the position of the focus region.
[0290] S1109. Focus based on the adjusted focus region.
[0291] S1110. If the confidence level of the focus region is less than the preset confidence level, use the current focus region for focusing.
[0292] Among them, steps S1101, S1104 - S1109 are the same as steps S901, S902 - S907 in the above embodiment, and will not be elaborated here.
[0293] Among them, steps S1103 and S1110 are in an alternative relationship, that is, the confidence level of the focus region is either greater than or equal to the preset confidence level or less than the preset confidence level. And only when the confidence level of the focus region is greater than or equal to the preset confidence level, steps S1104 - S1109 will be performed.
[0294] In step S1102, it is necessary to determine the relationship between the confidence level of the focus area and the preset confidence level. When the confidence level of the focus area is greater than or equal to the preset confidence level, jump to step S1103; when the confidence level of the focus area is less than the preset confidence level, jump to step S1110.
[0295] In step S1103, the confidence level of the focus area is the confidence level of the phase of the focus area, and this confidence level can be directly called from the electronic device.
[0296] In step S1110, if the confidence level of the focus area is less than the preset confidence level, it indicates that there may be no focus subject in the focus area. Since the focus subject cannot be determined, the focus area cannot be adjusted. Therefore, the current focus area is still used for focusing.
[0297] In this embodiment, by determining the magnitude relationship between the confidence level of the focus area and the preset confidence level, it is judged whether the focus area needs to be adjusted. When the confidence level of the focus area is less than the preset confidence level, the position of the focus area does not need to be adjusted, which simplifies the focusing process and avoids unnecessary adjustment processes.
[0298] An exemplary embodiment of the present disclosure provides a focusing device, as Figure 16 shown, a block diagram of a focusing device shown in the present disclosure.
[0299] The block diagram includes a determination module 1601, an adjustment module 1602, and a focusing module 1603. The determination module 1601 is used to determine the focus area, where the focus area includes a plurality of sub-areas arranged in an array. The adjustment module 1602 is used to adjust the position of the focus area in response to the focus subject being located at the edge of the focus area, where the position of the focus subject in the focus area is determined based on the position of the sub-area displaying the focus subject in the focus area. The focusing module 1603 is used to perform focusing based on the adjusted focus area.
[0300] In an exemplary embodiment of the present disclosure, the adjustment module 1602 is specifically used for:
[0301] Determine a sub-area of the image displaying the focus subject in the focus area as the target area;
[0302] Based on the image in the target area and the image in the reference area, determine the feature change parameter between the target area and each reference area, where the reference area is a sub-area adjacent to the target area in the focus area, and the feature change parameter is used to characterize the change degree between the image in the target area and the image in the reference area;
[0303] Based on the relationship between the feature change parameter and the preset parameter, adjust the position of the focus area.
[0304] In an exemplary embodiment of the present disclosure, a plurality of sub-regions included in the focus region are arranged in a multi-row and multi-column array, and each target region has at least two reference regions;
[0305] The adjustment module 1602 is specifically configured to:
[0306] Determine a feature change parameter that satisfies a first preset condition among at least two feature change parameters as a first feature parameter, where the first preset condition is related to the numerical magnitude of the feature change parameter;
[0307] Use a first feature parameter whose relationship with a preset parameter among the first feature parameters satisfies a second preset condition as a target feature parameter;
[0308] Adjust the position of the focus region based on the number of target feature parameters.
[0309] In an exemplary embodiment of the present disclosure, the adjustment module 1602 is specifically configured to:
[0310] When the number of target feature parameters is one, move the focus region a preset distance along the direction from the reference region to the target region.
[0311] In an exemplary embodiment of the present disclosure, the adjustment module 1602 is specifically configured to:
[0312] When the number of target feature parameters is two, determine a calculation model based on the two target feature parameters;
[0313] Based on the two target feature parameters and the calculation model, determine a moving angle, where the moving angle is the included angle of the moving direction relative to the reference position;
[0314] Move the focus region a preset distance along the moving direction.
[0315] In an exemplary embodiment of the present disclosure, the adjustment module 1602 is specifically configured to:
[0316] Arrange at least two feature change parameters in descending order of numerical value;
[0317] Select the feature change parameters ranked first and second as the first feature parameters.
[0318] In an exemplary embodiment of the present disclosure, the focusing device further includes: a second focusing module;
[0319] The second focusing module is configured to perform focusing using the current focus region if the relationship between each first feature parameter and the preset parameter does not satisfy the second preset condition.
[0320] In an exemplary embodiment of the present disclosure, the adjustment module 1602 is specifically configured to:
[0321] Based on the images in the target region and the images in the reference regions, determine the confidence level of each reference region;
[0322] If the confidence level of any one of the reference regions is less than or equal to a preset confidence level, determine the feature change parameter between the target region and each reference region.
[0323] In an exemplary embodiment of the present disclosure, the focusing device further includes: a third focusing module;
[0324] The third focusing module is configured to, if the confidence level of each reference region is greater than the preset confidence level, perform focusing using the current focusing region.
[0325] In an exemplary embodiment of the present disclosure, the adjustment module 1602 is specifically configured to:
[0326] Calculate the image feature values of the target region and the reference regions respectively;
[0327] Calculate the gradient value of the target region relative to the reference region as the feature change parameter, or calculate the gradient value of the reference region relative to the target region as the feature change parameter.
[0328] In an exemplary embodiment of the present disclosure, the focusing device further includes: a fifth determination module and a sixth determination module;
[0329] The fifth determination module is configured to determine the central sub-region of the focusing region, where the central sub-region is the sub-region where the geometric center of the focusing region is located, or the central sub-region is the sub-region with the geometric center of the focusing region as a vertex;
[0330] The sixth determination module is configured to determine that the focusing subject is located at the edge of the focusing region when the focusing subject is located in other sub-regions of the focusing region except the central sub-region.
[0331] In an exemplary embodiment of the present disclosure, the focusing device further includes: a fourth focusing module;
[0332] The fourth focusing module is configured to, when there is an overlapping region between the focusing subject and the central sub-region, perform focusing using the current focusing region.
[0333] In an exemplary embodiment of the present disclosure, the focusing device further includes: a first processing module;
[0334] The first processing module is configured to:
[0335] If the confidence level of the focusing region is greater than or equal to the preset confidence level, determine the position of the focusing subject in the focusing region;
[0336] If the confidence level of the focusing region is less than the preset confidence level, perform focusing using the current focusing region.
[0337] Regarding the device in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and will not be elaborated here.
[0338] Figure 17 FIG. is a block diagram of an electronic device 1700 shown according to an exemplary embodiment. For example, the electronic device 1700 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0339] Referring to Figure 17 , the electronic device 1700 may include one or more of the following components: a processing component 1702, a memory 1704, a power supply component 1706, a multimedia component 1708, an audio component 1710, an input / output (I / O) interface 1712, a sensor component 1714, and a communication component 1716.
[0340] The processing component 1702 generally controls the overall operation of the electronic device 1700, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. The processing component 1702 may include one or more processors 1720 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 1702 may include one or more modules to facilitate the interaction between the processing component 1702 and other components. For example, the processing component 1702 may include a multimedia module to facilitate the interaction between the multimedia component 1708 and the processing component 1702.
[0341] The memory 1704 is configured to store various types of data to support the operation of the electronic device 1700. Examples of such data include instructions for any application or method operating on the electronic device 1700, contact data, phone book data, messages, pictures, videos, etc. The memory 1704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.
[0342] The power supply component 1706 provides power to various components of the electronic device 1700. The power supply component 1706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 1700.
[0343] The multimedia component 1708 includes a screen that provides an output interface between the electronic device 1700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can sense not only the boundaries of the touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operations. In some embodiments, the multimedia component 1708 includes a front camera and / or a rear camera. When the electronic device 1700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
[0344] The audio component 1710 is configured to output and / or input audio signals. For example, the audio component 1710 includes a microphone (MIC) that is configured to receive external audio signals when the electronic device 1700 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 1704 or transmitted via the communication component 1716. In some embodiments, the audio component 1710 further includes a speaker for outputting audio signals.
[0345] The I / O interface 1712 provides an interface between the processing component 1702 and a peripheral interface module, which can be a keyboard, a click wheel, buttons, etc. These buttons can include but are not limited to: a home button, a volume button, a power button, and a lock button.
[0346] The sensor assembly 1714 includes one or more sensors for providing an assessment of various aspects of the state of the electronic device 1700. For example, the sensor assembly 1714 can detect the on / off state of the electronic device 1700, the relative positioning of components, such as the display and keypad of the electronic device 1700. The sensor assembly 1714 can also detect a change in the position of the electronic device 1700 or a component of the electronic device 1700, the presence or absence of user contact with the electronic device 1700, the orientation or acceleration / deceleration of the electronic device 1700, and a change in the temperature of the electronic device 1700. The sensor assembly 1714 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 1714 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1714 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0347] The communication component 1716 is configured to facilitate communication between the electronic device 1700 and other devices in a wired or wireless manner. The electronic device 1700 can access a wireless network based on communication standards, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1716 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0348] In an exemplary embodiment, the electronic device 1700 can be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above-described methods.
[0349] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 1704 including instructions, is provided. The above instructions can be executed by the processor 1720 of the electronic device 1700 to complete the above-described methods. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0350] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the focusing method provided by the exemplary embodiments of the present disclosure.
[0351] Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common general knowledge or conventional technical means in the technical field not disclosed by the present disclosure. The specification and embodiments are only to be regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.
[0352] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.
Claims
1. A focusing method, characterized in that, it includes: Determine a focusing area, wherein the focusing area includes a plurality of sub-areas arranged in an array; In response to the focusing subject being located at the edge of the focusing area, adjust the position of the focusing area, wherein the position of the focusing subject in the focusing area is determined based on the position of the sub-area displaying the focusing subject in the focusing area; Perform focusing based on the adjusted focusing area.
2. The focusing method according to claim 1, characterized in that, The adjustment of the position of the focusing area includes: Determine a sub-area of the image in the focusing area that displays the focusing subject as the target area; Based on the image in the target area and the image in the reference area, determine the feature change parameter between the target area and each reference area, wherein the reference area is the sub-area adjacent to the target area in the focusing area, and the feature change parameter is used to characterize the change degree between the image in the target area and the image in the reference area; Adjust the position of the focusing area based on the relationship between the feature change parameter and the preset parameter.
3. The focusing method according to claim 2, characterized in that, The multiple sub-areas included in the focusing area are arranged in a multi-row and multi-column array, and each target area has at least two reference areas; The adjustment of the position of the focusing area based on the relationship between the feature change parameter and the preset parameter includes: Determine the feature change parameter that satisfies the first preset condition among at least two feature change parameters as the first feature parameter, and the first preset condition is related to the numerical value of the feature change parameter; Use the first feature parameter whose relationship with the preset parameter satisfies the second preset condition among the first feature parameters as the target feature parameter; Adjust the position of the focusing area based on the number of the target feature parameters.
4. The focusing method according to claim 3, characterized in that, The adjustment of the position of the focusing area based on the number of the target feature parameters includes: When the number of the target feature parameters is one, the focusing area moves a preset distance in the direction from the reference area to the target area.
5. The focusing method according to claim 3, characterized in that, The adjustment of the position of the focusing area based on the number of the target feature parameters includes: When the number of the target feature parameters is two, determine a calculation model based on the two target feature parameters; Based on the two target feature parameters and the calculation model, determine the moving angle, wherein the moving angle is the included angle of the moving direction relative to the reference position; Move the focusing area a preset distance along the moving direction.
6. The focusing method according to claim 3, characterized in that, The determination of the feature change parameter that satisfies the first preset condition among at least two feature change parameters as the first feature parameter includes: Arrange at least two feature change parameters in descending order of numerical value; Select the feature change parameters arranged in the first and second positions as the first feature parameters.
7. The focusing method according to claim 3, wherein, the focusing method further includes: If the relationship between each of the first feature parameters and the preset parameter does not satisfy the second preset condition, perform focusing using the current focusing area.
8. The focusing method according to claim 2, wherein, the determining the feature change parameters between the target area and each of the reference areas based on the images in the target area and the images in the reference areas includes: Determine the confidence level of each of the reference areas based on the images in the target area and the images in the reference area; If the confidence level of any one of the reference areas is less than or equal to the preset confidence level, determine the feature change parameters between the target area and each of the reference areas.
9. The focusing method according to claim 8, wherein, the focusing method further includes: If the confidence level of each of the reference areas is greater than the preset confidence level, perform focusing using the current focusing area.
10. The focusing method according to claim 8, wherein, the determining the feature change parameters between the target area and each of the reference areas includes: Calculate the image feature values of the target area and the reference area respectively; Calculate the gradient value of the target area relative to the reference area as the feature change parameter, or the gradient value of the reference area relative to the target area as the feature change parameter.
11. The focusing method according to claim 2, wherein, the focusing method further includes: Determine the central sub-area of the focusing area, wherein the central sub-area is the sub-area where the geometric center of the focusing area is located, or the central sub-area is the sub-area with the geometric center of the focusing area as the vertex; When the focusing subject is in other sub-areas of the focusing area except the central sub-area, determine that the focusing subject is at the edge of the focusing area.
12. The focusing method according to claim 11, wherein, the focusing method further includes: When there is an overlapping area between the focusing subject and the central sub-area, perform focusing using the current focusing area.
13. The focusing method according to claim 11, wherein, the focusing method further includes: If the confidence level of the focusing area is greater than or equal to the preset confidence level, determine the position of the focusing subject in the focusing area; If the confidence level of the focusing area is less than the preset confidence level, perform focusing using the current focusing area.
14. A focusing device, wherein, comprises: A determination module for determining a focusing area, wherein the focusing area includes a plurality of sub-areas arranged in an array; An adjustment module, configured to adjust the position of the focusing area in response to the focusing subject being located at the edge of the focusing area, wherein the position of the focusing subject in the focusing area is determined based on the position of the sub-area displaying the focusing subject in the focusing area; A focusing module, configured to perform focusing based on the adjusted focusing area.
15. An electronic device, characterized in that it comprises: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the focusing method according to any one of claims 1-13.
16. A non-transitory computer-readable storage medium, characterized in that when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the focusing method according to any one of claims 1-13.