Focusing method and device

By analyzing the trend chart of motor position and sharpness evaluation value, a preliminary selection area was selected and automatically focused, which solved the problem of operational complexity caused by users manually selecting areas of interest and achieved the automatic focusing effect of drone camera equipment.

CN121728347APending Publication Date: 2026-03-24ZHEJIANG HUAFEI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In existing technologies, users manually select areas of interest for focusing, which leads to complex operations. This is especially true in drone camera scenarios where the scene changes greatly, making it difficult to automatically focus on the target object. Furthermore, when there is a rich background, problems such as out-of-focus or non-target objects being in focus can easily occur.

Method used

By acquiring trend charts of target images, the relationship between motor position and sharpness evaluation values ​​is analyzed to select multiple initial regions. These regions are then used for automatic focusing, and the target region is determined and focused by using peak count and slope for region filtering.

Benefits of technology

It achieves automatic focusing, reducing the complexity of manual operation for users and improving the accuracy and efficiency of focusing, especially in complex scenes where it can automatically identify and focus on the area of ​​interest.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121728347A_ABST
    Figure CN121728347A_ABST
Patent Text Reader

Abstract

The invention discloses a focusing method and device, and the method comprises the steps: obtaining a trend chart of a target image, and enabling the trend chart to comprise a plurality of regions which are used for representing the relation between a motor position and a definition evaluation value; performing region screening on the trend chart according to peak values included in each region to obtain a plurality of primary selection regions; and focusing the target area of the target image through the plurality of primary selection areas. Through the method and the device, the technical problem of complicated operation caused by the fact that a user manually selects the region of interest for focusing in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing, and more specifically, to a focusing method and apparatus. Background Technology

[0002] With the development of camera technology, focusing technology has been continuously iterating and upgrading. Various methods to improve focusing accuracy have emerged, but currently, there is no method in the industry that allows specifying foreground and background focus. In such cases, it may be difficult for users to automatically focus the camera on the part of their interest.

[0003] Especially in drone-borne camera scenarios, where the scene changes frequently, users often need to manually select the area of ​​interest after each scene change to ensure the target object is in focus, which is relatively cumbersome. Moreover, in scenes with a rich background, if the selection size is not appropriate, the final target object may be out of focus while non-target objects are in focus.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This application provides a focusing method and apparatus to at least solve the technical problem in the related art where the operation is complicated due to the user manually selecting the region of interest for focusing.

[0006] According to one aspect of the embodiments of this application, a focusing method is provided, comprising: acquiring a trend map of a target image, wherein the trend map includes a plurality of regions for representing the relationship between motor position and sharpness evaluation value; filtering the trend map according to the peak values ​​contained in each of the regions to obtain a plurality of preliminary selected regions; and focusing a target region of the target image through the plurality of preliminary selected regions.

[0007] In one exemplary embodiment, filtering the trend graph based on the peaks contained in each of the regions includes: filtering the trend graph based on the number of peaks in the regions; or, filtering the trend graph based on the number of peaks in the regions and the slope of the peaks.

[0008] In one exemplary embodiment, filtering the trend graph based on the number of peaks in the region includes: determining regions containing a number of peaks less than or equal to a first preset value as the initial selection regions.

[0009] In an exemplary embodiment, region filtering based on the trend graph according to the number of peaks and the slope of the peaks includes: determining a target feature value for each region based on the number of peaks and the slope of each peak; and determining regions whose target feature values ​​are greater than or equal to a second preset value as the initial selected regions.

[0010] In one exemplary embodiment, determining a target feature value for each region based on the number of peaks in the region and the slope of each peak includes: determining a first feature value for the region based on the number of peaks in the region; determining a second feature value for the region based on the slope of the peaks in the region; and determining a target feature value for the region by weighting the first feature value and the second feature value.

[0011] In one exemplary embodiment, determining a second characteristic value of a region based on the slope of a peak value in the region includes: if the region includes multiple peak values, determining a target peak value among the multiple peak values; and determining the slope of the target peak value as the second characteristic value of the region.

[0012] In one exemplary embodiment, the fewer the number of peaks in the region and the greater the slope of the peaks, the larger the target feature value of the region.

[0013] In an exemplary embodiment, before focusing on the target region of the target image through multiple preliminary selection regions, the method further includes: determining the motor position corresponding to the peak value of each of the preliminary selection regions; classifying the preliminary selection regions according to the motor position corresponding to the peak value to obtain multiple types of regions; and determining the region among the multiple types of regions that conforms to the target configuration information as the target region.

[0014] According to another aspect of the embodiments of this application, a focusing apparatus is also provided, comprising: an acquisition module for acquiring a trend map of a target image, wherein the trend map includes a plurality of regions for representing the relationship between motor position and sharpness evaluation value; a filtering module for filtering the trend map according to the peak values ​​contained in each of the regions to obtain a plurality of preliminary selection regions; and a focusing module for focusing a target region of the target image through the plurality of preliminary selection regions.

[0015] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed by a processor.

[0016] According to another aspect of the embodiments of this application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the steps in any of the method embodiments described above.

[0017] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to perform the steps of any of the above method embodiments through the computer program.

[0018] This application achieves automatic focusing by acquiring a trend map of the target image, which includes multiple regions representing the relationship between motor position and sharpness evaluation values; filtering the trend map based on the peak values ​​contained in each region to obtain multiple preliminary regions; and focusing on the target region of the target image using these preliminary regions. Therefore, it solves the technical problem of complex operation caused by users manually selecting regions of interest for focusing in related technologies, achieving the technical effect of automatic focusing. Attached Figure Description

[0019] Figure 1 This is a schematic diagram illustrating an application scenario of a focusing method according to an embodiment of this application;

[0020] Figure 2 This is a flowchart illustrating an optional focusing method according to an embodiment of this application;

[0021] Figure 3 These are schematic diagrams of the original scene images according to embodiments of this application;

[0022] Figure 4 This is a schematic diagram of the FV curve according to an embodiment of this application;

[0023] Figure 5 This is a schematic diagram showing the position of a portion of the lighthouse in the original scene image according to an embodiment of this application;

[0024] Figure 6 This is a schematic diagram of a partial Fv curve of a lighthouse according to an embodiment of this application;

[0025] Figure 7 This is a schematic diagram showing the position of a portion of the wire in the original scene image according to an embodiment of this application;

[0026] Figure 8 This is a schematic diagram of a partial Fv curve of a wire according to an embodiment of this application;

[0027] Figure 9This is a schematic diagram of the slope of the peak value according to an embodiment of this application;

[0028] Figure 10 A schematic diagram of an optional configuration interface according to an embodiment of this application;

[0029] Figure 11 This is a schematic diagram of an optional configuration process according to an embodiment of this application;

[0030] Figure 12 This is an overall flowchart based on an embodiment of this application;

[0031] Figure 13 This is a structural block diagram of an optional focusing device according to an embodiment of this application;

[0032] Figure 14 This is a computer system architecture block diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0033] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0034] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0035] According to one aspect of the embodiments of this application, a focusing method is provided. Optionally, in this embodiment, the above-described focusing method may be applied to, but is not limited to, [examples of applications such as...]. Figure 1The hardware environment shown includes terminal device 102 and server 104. Server 104 can be connected to terminal device 102 via a network and can be used to provide services (e.g., application services, etc.) to terminal device 102 or clients installed on terminal device 102. A database can be set up on server 104 or independently of server 104 to provide data storage services for server 104.

[0036] The aforementioned network may include, but is not limited to, at least one of the following: wired network and wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network (WAN), metropolitan area network (MAN), and local area network (LAN). The aforementioned wireless network may include, but is not limited to, at least one of the following: Wireless Fidelity (WIFI) and Bluetooth. Terminal device 102 may be, but is not limited to, a personal computer (PC), mobile phone, tablet computer, etc. Server 104 may be, but is not limited to, a cloud server, server cluster, or other server types.

[0037] The focusing method of this application embodiment can be executed by server 104, terminal device 102, or jointly by server 104 and terminal device 102. The focusing method of this application embodiment can also be executed by a client installed on the terminal device 102.

[0038] Taking the focusing method in this embodiment as an example, which is executed by terminal device 102, Figure 2 This is a flowchart illustrating an optional focusing method according to an embodiment of this application, such as... Figure 2 As shown, the process of this method may include the following steps:

[0039] Step S202: Obtain a trend graph of the target image, wherein the trend graph includes multiple regions for representing the relationship between the motor position and the sharpness evaluation value;

[0040] like Figure 3 The image shown is the target image, which is the original scene image. The foreground is a street lamp, and the background is a power line. Figure 4 This is a schematic diagram of the global sharpness evaluation value (Focus Value, or FV) curve of the target image. The horizontal axis represents the position of the Focus motor, and the vertical axis represents the global Fv. Since the lighthouse scene has rich overall details, the global Fv has only one single peak. The global Fv curve is obtained by summing the Fv values ​​of the same Focus motor position in each region.

[0041] Figure 5 This is a partial view of the lighthouse's location within the original scene image. Figure 6This is a partial Fv curve graph of the lighthouse. Each box contains an Fv curve representing a region where the motor position and sharpness rating (FV) are related. The horizontal axis of the Fv curve in each region represents the motor position (e.g., the position of the Focus motor), and the vertical axis represents the sharpness rating (FV). Red dots in each region represent the global Fv peak, yellow dots represent the Fv peak of a single region, and the letter N indicates that the deviation between the global Fv peak and the Fv peak of a single region is within three Focus motor steps. Figure 7 This is a schematic diagram showing the location of a portion of the power line in the original scene image. Figure 8 This is a partial Fv curve graph of the wires. Each box contains an Fv curve representing a region where the motor position and sharpness rating (FV) are related. The horizontal axis of the Fv curve in each region represents the motor position (e.g., the position of the Focus motor), and the vertical axis represents the sharpness rating (FV). Red dots in each region represent the global Fv peak, yellow dots represent the Fv peak of a single region, and the letter Y indicates that the deviation between the global Fv peak and the Fv peak of a single region is outside eight Focus motor steps.

[0042] Step S204: Filter the trend map based on the peak values ​​contained in each region to obtain multiple initially selected regions;

[0043] In one exemplary embodiment, filtering the trend graph based on the peaks contained in each of the regions includes: filtering the trend graph based on the number of peaks in the regions; or, filtering the trend graph based on the number of peaks in the regions and the slope of the peaks.

[0044] The process of filtering the trend chart based on the number of peaks in the region includes: identifying regions containing a number of peaks less than or equal to a first preset value as the initial selection regions.

[0045] The first preset value mentioned above can be set according to the actual situation, for example: 1, 2, 3.

[0046] Taking 2 as an example, in Figure 6 and Figure 8 In the FV curve shown, the regions with a number of peaks less than or equal to 2 are identified as the initial selected regions.

[0047] Optionally, a region can be scored based on the number of peaks it contains, with regions containing fewer peaks receiving higher scores. For example, a region with only one peak receives a score of 100, a region with two peaks receives a score of 60 (60 can be set as the passing grade), and a region with more than two peaks receives a score of 0. Further preliminary regions can be selected based on these scores; for example, regions with a score greater than or equal to 60 can be selected as the preliminary regions.

[0048] In another alternative embodiment, region filtering is performed on the trend graph based on the number of peaks in the region and the slope of the peaks, including:

[0049] The target feature value of each region is determined based on the number of peaks in the region and the slope of each peak; the region whose target feature value is greater than or equal to a second preset value is determined as the initial selected region.

[0050] The method of determining the target feature value of each region based on the number of peaks in the region and the slope of each peak includes: determining a first feature value of the region based on the number of peaks in the region; determining a second feature value of the region based on the slope of the peaks in the region; and determining the target feature value of the region by weighting the first feature value and the second feature value.

[0051] The smaller the number of peaks in a region and the greater the slope of the peaks, the larger the target feature value of that region.

[0052] Each region must have at least one peak. For example, if a region has only one peak, the first characteristic value is 100; if the region has two peaks, the first characteristic value is 60; and if the region has more than two peaks, the first characteristic value is 0. The magnitude of the first characteristic value can be determined according to the actual situation, based on the above method of dividing the number of peaks.

[0053] The second eigenvalue is determined based on the slope of the peak. For example, if the slope near the peak is 10% or more, the second eigenvalue is 100; if the slope near the peak is 5% or more, the second eigenvalue is 60; and if the slope near the peak is less than 5%, the second eigenvalue is 0. Figure 9 For example, taking the right side of the FV curve as the starting point and the line connecting it to the peak value of the region as the slope, Figure 9 The slope of the left-hand plot is significantly smaller than that of the right-hand plot, which to some extent indicates that the Fv trend on the left side is chaotic, and the second characteristic value of the left-hand plot is smaller.

[0054] By combining the first and second eigenvalues ​​to determine the target eigenvalue, the weighted sum of the first and second eigenvalues ​​can be used to determine the target eigenvalue. The weights of the first and second eigenvalues ​​can be selected according to the actual situation.

[0055] The region whose target feature value is greater than or equal to the second preset value is determined as the above-mentioned preliminary region. The selection of the second preset value can be determined according to the actual situation, such as 50, 60, etc.

[0056] In an optional embodiment, determining a second characteristic value of the region based on the slope of the peak value of the region includes: if the region includes multiple peak values, determining a target peak value among the multiple peak values; and determining the slope of the target peak value as the second characteristic value of the region.

[0057] The target peak value can be the largest among multiple peak values ​​(the highest value in the region). The second characteristic value of the region is determined based on the slope of the highest peak value.

[0058] Step S206: Focus the target region of the target image through multiple pre-selected regions.

[0059] In an exemplary embodiment, the target region described above can be determined in the following manner:

[0060] Determine the motor position corresponding to the peak value in each of the initial selection regions; classify the initial selection regions according to the motor position corresponding to the peak value to obtain multiple types of regions; determine the regions in the multiple types of regions that meet the target configuration information as the target regions.

[0061] If the initial selection area contains multiple peaks, the initial selection area can be classified according to the location of the point corresponding to the largest peak.

[0062] like Figure 10 As shown, users can enable foreground and background focus in the configuration interface, selecting either foreground or background focus. The target configuration information mentioned above includes, but is not limited to, the foreground or background selected by the user. For example... Figure 11 The configuration interface shown sends the target configuration information to the focusing module. The focusing module determines the target area based on the user's selection of near or far view and focuses on the target area.

[0063] like Figure 12 The diagram shown is a schematic of the overall process, which mainly includes the following steps:

[0064] The first step is to obtain the focusing process parameters, including the positions of the zoom motor and the focus motor, and the FV evaluation value of the corresponding points;

[0065] The second step is to use bubble sort to sort the process quantities by the number of motor steps in Focus and generate a trend chart.

[0066] The third step is to perform preliminary screening of each region in the trend chart to obtain the initial selected regions.

[0067] The initial selection method includes, in the above embodiments, filtering the trend map based on the peak values ​​contained in each region, including: filtering the trend map based on the number of peak values ​​in each region; or, filtering the trend map based on the number of peak values ​​in each region and the slope of the peak values.

[0068] The fourth step is to classify the initial selection area based on the motor position corresponding to the peak value in the initial selection area. For example, the distance difference between two unit steps of the Focus motor is used as the aggregation radius to finally obtain the distance characteristics of the scene, which represent the near and far distances.

[0069] The fifth step is to obtain the user's target configuration information and then focus on the target area based on that information.

[0070] This application, through feature analysis of the focusing trend curve, filters out regions that can be used to determine object distance characteristics, thus achieving reliable analysis of object distance characteristics in a scene. By clustering object distances, it achieves a more realistic classification of near and far object distances.

[0071] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0072] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / random access memory (RAM), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0073] According to another aspect of the embodiments of this application, a focusing device is also provided, which can be used to implement the focusing method provided in the above embodiments, and will not be repeated hereafter. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0074] Figure 13 This is a structural block diagram of an optional focusing device according to an embodiment of this application, such as... Figure 13 As shown, the focusing device includes:

[0075] The acquisition module 1302 is used to acquire a trend graph of the target image, wherein the trend graph includes multiple regions for representing the relationship between the motor position and the sharpness evaluation value;

[0076] The filtering module 1304 is used to filter the trend map based on the peak values ​​contained in each region to obtain multiple initially selected regions.

[0077] The focusing module 1306 is used to focus on the target region of the target image through multiple pre-selected regions.

[0078] In an exemplary embodiment, the above-described apparatus is further configured to filter the trend graph based on the number of peaks in the region; or, to filter the trend graph based on the number of peaks in the region and the slope of the peaks.

[0079] In one exemplary embodiment, the above-described apparatus is further configured to determine the region containing a number of peaks less than or equal to a first preset value as the initial selected region.

[0080] In an exemplary embodiment, the above-described apparatus is further configured to determine a target feature value for each of the regions based on the number of peaks in the region and the slope of each of the peaks; and to determine the region whose target feature value is greater than or equal to a second preset value as the initial selected region.

[0081] In an exemplary embodiment, the above-described apparatus is further configured to determine a first feature value of the region based on the number of peaks in the region; determine a second feature value of the region based on the slope of the peaks in the region; and determine a target feature value of the region by weighting the first feature value and the second feature value.

[0082] In an exemplary embodiment, the above-described apparatus is further configured to, when the region includes a plurality of peaks, determine a target peak among the plurality of peaks; and determine the slope of the target peak as the second characteristic value of the region.

[0083] In one exemplary embodiment, the fewer the number of peaks in the region and the greater the slope of the peaks, the larger the target feature value of the region.

[0084] In an exemplary embodiment, the apparatus is further configured to: determine the motor position corresponding to the peak value of each of the preliminary selection regions before focusing on the target region of the target image through the plurality of preliminary selection regions; classify the preliminary selection regions according to the motor position corresponding to the peak value to obtain a plurality of types of regions; and determine the region in the plurality of types that conforms to the target configuration information as the target region.

[0085] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0086] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein the program executes the steps in any of the above method embodiments when it is run.

[0087] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, ROMs, RAMs, portable hard drives, magnetic disks, or optical disks.

[0088] According to another aspect of the embodiments of this application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor is configured to perform the steps of any of the method embodiments described above via the computer program. In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0089] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0090] According to another aspect of the embodiments of this application, a computer program product is also provided, comprising a computer program / instructions containing program code for performing the methods shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via communication section 1409, and / or installed from removable medium 1411. When the computer program is executed by central processing unit 1401, it performs various functions provided in the embodiments of this application. The sequence numbers of the embodiments of this application above are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0091] Figure 14 A schematic block diagram of a computer system architecture for implementing embodiments of the present application is shown. Figure 14 As shown, the computer system 1400 includes a Central Processing Unit (CPU) 1401, which can perform various appropriate actions and processes based on programs stored in ROM 1402 or programs loaded into RAM 1403 from storage section 1408. Random access memory 1403 also stores various programs and data required for system operation. The CPU 1401, ROM 1402, and RAM 1403 are interconnected via bus 1404. Input / output (I / O) interface 1405 is also connected to bus 1404.

[0092] The following components are connected to I / O interface 1405: an input section 1406 including a keyboard, mouse, etc.; an output section 1407 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1408 including a hard disk, etc.; and a communication section 1409 including a network interface card (NIC), modem, etc. The communication section 1409 performs communication processing via a network such as the Internet. A drive 1410 is also connected to I / O interface 1405 as needed. Removable media 1411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1410 as needed so that computer programs read from them can be installed into storage section 1408 as needed.

[0093] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1409, and / or installed from removable medium 1411. When the computer program is executed by central processing unit 1401, it performs various functions defined in the system of this application.

[0094] It should be noted that, Figure 14 The computer system 1400 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0095] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0096] The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A focusing method, characterized in that, include: Obtain a trend graph of the target image, wherein the trend graph includes multiple regions for representing the relationship between motor position and sharpness evaluation value; The trend chart is filtered based on the peak values ​​contained in each region to obtain multiple preliminary regions; The target region of the target image is focused by using multiple initial selection regions.

2. The method according to claim 1, characterized in that, The trend chart is filtered based on the peak values ​​contained in each region, including: The trend chart is filtered by region based on the number of peak values ​​in the region; or... The trend chart is used to filter regions based on the number of peaks in the region and the slope of the peaks.

3. The method according to claim 2, characterized in that, The trend chart is filtered based on the number of peak values ​​in the region, including: The region containing a number of peaks less than or equal to a first preset value is determined as the initial selection region.

4. The method according to claim 2, characterized in that, The trend chart is used to filter regions based on the number of peaks and the slope of those peaks, including: The target feature value of each region is determined based on the number of peaks in the region and the slope of each peak. The region whose target feature value is greater than or equal to the second preset value is determined as the initial selection region.

5. The method according to claim 4, characterized in that, Determining the target feature value of each region based on the number of peaks in the region and the slope of each peak includes: The first characteristic value of the region is determined based on the number of peaks in the region; The second characteristic value of the region is determined based on the slope of the peak value of the region; The weighted sum of the first feature value and the second feature value is determined as the target feature value of the region.

6. The method according to claim 5, characterized in that, Determining the second characteristic value of the region based on the slope of the peak value of the region includes: In the case where the region includes multiple peaks, a target peak is determined among the multiple peaks; The slope of the target peak value is determined as the second characteristic value of the region.

7. The method according to any one of claims 4 to 6, characterized in that, The fewer the number of peaks in the region, and the greater the slope of the peaks, the larger the target feature value of the region.

8. The method according to claim 1, characterized in that, Before focusing on the target region of the target image through multiple pre-selected regions, the method further includes: Determine the motor position corresponding to the peak value in each of the initially selected regions; The initially selected regions are classified according to the motor positions corresponding to the peak values, resulting in multiple types of regions; The regions that match the target configuration information among multiple types of regions are identified as the target regions.

9. A focusing device, characterized in that, include: An acquisition module is used to acquire a trend graph of the target image, wherein the trend graph includes multiple regions for representing the relationship between the motor position and the sharpness evaluation value; The filtering module is used to filter the trend map based on the peak values ​​contained in each region to obtain multiple initially selected regions. The focusing module is used to focus on the target region of the target image through multiple pre-selected regions.

10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 8.

12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.