CN117082343A - Automatic focusing method, system and device for target object - Google Patents

Automatic focusing method, system and device for target object Download PDF

Info

Publication number
CN117082343A
CN117082343A CN202310991048.2A CN202310991048A CN117082343A CN 117082343 A CN117082343 A CN 117082343A CN 202310991048 A CN202310991048 A CN 202310991048A CN 117082343 A CN117082343 A CN 117082343A
Authority
CN
China
Prior art keywords
block
focal length
blocks
definition
target object
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310991048.2A
Other languages
Chinese (zh)
Inventor
沈佩雯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Huagan Technology Co ltd
Original Assignee
Zhejiang Huagan Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Huagan Technology Co ltd filed Critical Zhejiang Huagan Technology Co ltd
Priority to CN202310991048.2A priority Critical patent/CN117082343A/en
Publication of CN117082343A publication Critical patent/CN117082343A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • H04N23/675Focus control based on electronic image sensor signals comprising setting of focusing regions

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)
  • Automatic Focus Adjustment (AREA)

Abstract

The application discloses an automatic focusing method, an automatic focusing system and an automatic focusing device for a target object, which are used for adaptively distributing weights to each block in an image picture according to an interested region selected by a user, and then realizing the best focusing clear effect on the image picture according to the weights and the definition of each block. The application provides an automatic focusing method for a target object, which comprises the following steps: determining an interested region according to a block covered by a target object selected by a user in an image picture; focusing the region of interest, and recording a first focal length used when the region of interest is the clearest; focusing each block by taking the first focal length as a central focal length, and recording a second focal length used when each block is the clearest; determining weight values corresponding to all the blocks according to the first focal length and the second focal length; and determining the overall highest definition of the image picture according to the weight value and definition corresponding to each block, and focusing according to the overall highest definition.

Description

Automatic focusing method, system and device for target object
Technical Field
The present application relates to the field of imaging technologies, and in particular, to an auto-focusing method, system, and apparatus for a target object.
Background
Currently, there are many electronic devices or systems with camera shooting and photographing functions, such as a video monitoring and imaging system, a handheld camera, a mobile phone capable of shooting video, and the like, and all such devices can acquire images in real time and display the images on a display device. When shooting an image or video, the image needs to be focused clearly, and two focusing modes exist at present: one is auto-focusing and the other is manual focusing.
In the existing automatic focusing technology, a target image is divided into a plurality of blocks, half-width coefficients in the horizontal direction and the vertical direction are calculated according to the normalized size of a region of interest, then the weight value of each block is calculated according to the normalized center coordinates and the half-width coefficients by utilizing a two-dimensional discrete Gaussian function, finally the normalized overall definition of the target image is calculated according to the weight value and the definition of each block, and focusing is performed according to the normalized overall definition of the target image. According to the method, the region of interest is simply given with higher weight, and the weight distribution is not carried out on each block of the target image in a self-adaptive manner aiming at different scenes, so that the clear optimal focal length of the image picture cannot be effectively determined, and the method cannot be suitable for application scenes with larger foreground and background differences.
Disclosure of Invention
The embodiment of the application provides an automatic focusing method, an automatic focusing system and an automatic focusing device for a target object, which are used for adaptively distributing weights to each block in an image picture according to a region of interest selected by a user, and then realizing the best focusing clear effect on the image picture according to the weights and the definition of each block.
The embodiment of the application provides an automatic focusing method for a target object, which comprises the following steps:
determining an interested region according to a block covered by a target object selected by a user in an image picture presented by a camera lens; wherein the image picture is divided into N blocks, and N is a positive integer;
focusing the region of interest, and recording a first focal length used by the lens when the overall definition of the region of interest is highest;
focusing on the first focal length as a central focal length for each block in the image picture, and recording a second focal length corresponding to the lens when the image definition corresponding to each block is highest;
determining weight values corresponding to the N blocks according to the first focal length and the N second focal lengths; when the second focal length corresponding to the block is closer to the first focal length, the weight value corresponding to the block is larger;
and determining the overall highest definition of the image picture according to the weight values and the definition corresponding to the N blocks, and focusing according to the overall highest definition of the image picture.
According to the method, a region of interest is determined according to a block covered by a target object selected by a user in an image picture presented by a camera lens; wherein the image picture is divided into N blocks, and N is a positive integer; focusing the region of interest, and recording a first focal length used by the lens when the overall definition of the region of interest is highest; focusing on the first focal length as a central focal length for each block in the image picture, and recording a second focal length corresponding to the lens when the image definition corresponding to each block is highest; determining weight values corresponding to the N blocks according to the first focal length and the N second focal lengths; when the second focal length corresponding to the block is closer to the first focal length, the weight value corresponding to the block is larger; and determining the overall highest definition of the image picture according to the weight values and the definition corresponding to the N blocks, and focusing according to the overall highest definition of the image picture, so that the weight is adaptively distributed to each block in the image picture according to the region of interest selected by a user, and then the best focusing definition effect on the image picture is realized according to the weight and the definition of each block.
In some embodiments, the weight values corresponding to the N blocks are preset between a first preset value and a second preset value; and the difference value obtained by subtracting the first preset value from the second preset value is larger than a preset threshold value.
In some embodiments, the N blocks are arranged in rows and columns; according to the first focal length and the N second focal lengths, determining the weight values corresponding to the N blocks specifically includes:
comparing N differences between the second focal lengths and the first focal lengths, and marking the second focal length with the largest difference as F 1
Calculating weight values corresponding to the N blocks according to the following formula;
wherein i and j respectively represent the number of the row number and the column number of the block, and are integers greater than or equal to 0; a represents the first preset value; b represents the second preset value; f (F) i,j Representing a second focal length corresponding to the ith row and jth column blocks; f (F) 0 Representing the first focal length; g i,j Corresponding weight values of the ith row and the jth column blocks; wherein F is 1 ≠F 0
According to the method, the weight value corresponding to each block is determined according to the first focal length and the second focal length corresponding to each block, and further different weight distribution modes of each block are realized according to different scenes.
In some embodiments, the method further comprises:
if F 1 =F 0 Then the camera lens uses F 0 Focusing is performed.
In some embodiments, the determining the overall highest definition of the image frame according to the weight values and the definitions corresponding to the N blocks includes:
for each block, weighting calculation is carried out on the definition of the block according to the weight value corresponding to the block;
and comparing the definition after the weighted calculation of the N blocks, and selecting the maximum definition after the weighted calculation as the overall highest definition of the image picture.
By the method, the focal length used for obtaining the best definition target image is determined according to the weight value and definition corresponding to each block.
In some embodiments, determining the region of interest specifically includes:
transmitting an image picture presented by the lens to a user terminal for a user to select a target object on the user terminal according to the image picture;
acquiring a target object selected by a user on the user terminal, and determining a block covered by the target object in an image picture presented by the lens according to the target object; and determining each block covered by the target object as a region of interest if the proportion of covering the block is greater than 50%.
By the method, the region of interest is determined according to the target object selected by the user.
In some embodiments, the specific number of N blocks is determined according to the resolution of the image frame; wherein the number of blocks N is proportional to the resolution.
By the method, the number of blocks divided by the image picture is determined according to the resolution of the image picture.
Another embodiment of the present application provides an autofocus system for a target object, comprising a determination module, a focus module, and a calculation module, wherein
The determining module is used for determining an interested region according to a block covered by a target object selected by a user in an image picture presented by the camera lens; wherein the image picture is divided into N blocks, and N is a positive integer;
the focusing module is used for focusing the region of interest, and recording a first focal length used by the lens when the overall definition of the region of interest is highest; focusing on the first focal length as a central focal length for each block in the image picture, and recording a second focal length corresponding to the lens when the image definition corresponding to each block is highest; focusing according to the highest definition of the whole image frame determined by the computing module;
the computing module is used for determining weight values corresponding to the N blocks according to the first focal length and the N second focal lengths; when the second focal length corresponding to the block is closer to the first focal length, the weight value corresponding to the block is larger; and determining the overall highest definition of the image picture according to the weight values and the definition corresponding to the N blocks.
Another embodiment of the present application provides an autofocus apparatus for a target object, which includes a memory for storing program instructions and a processor for calling the program instructions stored in the memory, and executing any one of the methods described above according to the obtained program.
Furthermore, according to an embodiment, for example, a computer program product for a computer is provided, comprising software code portions for performing the steps of the method defined above, when said product is run on a computer. The computer program product may include a computer-readable medium having software code portions stored thereon. Furthermore, the computer program product may be directly loaded into the internal memory of the computer and/or transmitted via the network by at least one of an upload procedure, a download procedure and a push procedure.
Another embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for causing the computer to perform any of the methods described above.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is an overall flow diagram of an auto-focusing method for a target object according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an image frame divided into a plurality of blocks according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a block in which a region of interest is located according to an embodiment of the present application;
fig. 4 is a schematic distribution diagram of weight values corresponding to each block in an image frame according to an embodiment of the present application;
FIG. 5 is a schematic diagram of an autofocus system for a target object according to an embodiment of the present application;
fig. 6 shows an autofocus method (F) for a target object according to an embodiment of the present application 1 ≠F 0 ) Is a specific flow diagram of (1);
fig. 7 shows an autofocus method (F) for a target object according to an embodiment of the present application 1 =F 0 ) Is a specific flow diagram of (1);
fig. 8 is a schematic structural diagram of an autofocus device for a target object according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The embodiment of the application provides an automatic focusing method, an automatic focusing system and an automatic focusing device for a target object, which are used for adaptively distributing weights to each block in an image picture according to a region of interest selected by a user, and then realizing the best focusing clear effect on the image picture according to the weights and the definition of each block.
The method and the device are based on the same application, and because the principles of solving the problems by the method and the device are similar, the implementation of the device and the method can be referred to each other, and the repetition is not repeated.
The terms first, second and the like in the description and in the claims of embodiments of the application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The following examples and embodiments are to be construed as illustrative only. Although the specification may refer to "an", "one", or "some" example or embodiment(s) at several points, this does not mean that each such reference is related to the same example or embodiment, nor that the feature is applicable to only a single example or embodiment. Individual features of different embodiments may also be combined to provide further embodiments. Furthermore, terms such as "comprising" and "including" should be understood not to limit the described embodiments to consist of only those features already mentioned; such examples and embodiments may also include features, structures, units, modules, etc. that are not specifically mentioned.
Various embodiments of the application are described in detail below with reference to the drawings attached to the specification. It should be noted that, the display sequence of the embodiments of the present application only represents the sequence of the embodiments, and does not represent the advantages or disadvantages of the technical solutions provided by the embodiments.
It should be noted that, according to the technical scheme provided by the embodiment of the application, the image frame presented by the camera lens is divided into N blocks with the same size, the first focal length corresponding to the lens is recorded when the block where the region of interest is located selected by the user is focused and clear, then focusing is performed by taking the first focal length as the central focal length, the second focal length corresponding to the lens is recorded when each block is focused and clear, the highest definition of the image frame is determined by utilizing the first focal length and the N second focal lengths, and the lens focuses according to the highest definition, which is described but not limited thereto.
Referring to fig. 1, an autofocus control method according to an embodiment of the present application may be executed by a camera or an imaging system having an autofocus function, and includes the following specific steps:
step S101, determining an interested region according to a block covered by a target object selected by a user in an image picture presented by a camera lens; wherein the image picture is divided into N blocks, and N is a positive integer;
in this step, for example, the image frame currently presented by the lens is sent to the user terminal through the management system of the camera, the user selects the target object from the image frame through the user interface of the user terminal, and the user terminal submits the target object selected by the user to the management system. The management system divides the image frame into N blocks, for example, as shown in fig. 2, and the N blocks are arranged in rows and columns; determining a block covered by the target object in the image picture according to the target object selected by the user; for each block covered by the target object, when the proportion of covering the block reaches more than 50%, the block is determined as the region of interest, for example, as shown in fig. 3, the black marked position is the block where one oblique object is located, namely, the region of interest.
The target object selected by the user may be a specific object included in the shooting scene presented by the lens, or may be an area selected by the user from the image frame.
The specific value of N is determined according to the resolution of the image frame. The value of N is proportional to the resolution of the image picture, and the larger the resolution of the image picture is, the larger the value of N is, otherwise, the smaller the resolution of the image picture is, and the smaller the value of N is. If the value of N is too small, the subsequent focusing effect is poor; if the value of N is too large, the subsequent calculation efficiency is low, so that the value of N is adapted to the resolution of the image frame, for example, as shown in fig. 2, the image frame presented by the lens is divided into 80 (8×10) blocks.
It should be noted that, the image frame may be uniformly divided into N blocks, or may be divided into N blocks with different sizes, where the shapes of the blocks may be rectangular, circular, diamond, etc., so as to reduce the calculation amount and reduce the complexity of calculation.
Step S102, focusing the region of interest, and recording a first focal length used by the lens when the overall definition of the region of interest is highest;
in this step, the overall sharpness of the region of interest is evaluated by the management system using, for example, a variance function. The variance is a measurement method for examining the degree of dispersion between a group of discrete data and the mean value of the data, and the larger the variance is, the larger the deviation between the group of data is, the larger the data in the group is, the smaller the data in the group is, and the distribution is unbalanced; the smaller the variance, the smaller the deviation between the data of this group, the data distribution in the group is balanced, and the sizes are similar. Compared with the image with focus blur, the image with focus sharpness has larger gray scale difference between image pixels, namely larger variance, so that the sharpness of the image can be measured by calculating the variance of the gray scale data of the image, and the larger the variance is, the better the sharpness of the image is.
It should be noted that, in this step, whether the overall sharpness of the region of interest reaches the highest or not is evaluated, and other existing image sharpness evaluation methods may be adopted, which is not limited in any way.
Step S103, focusing by taking the first focal length as a central focal length for each block in the image picture, and recording a second focal length corresponding to the lens when the image definition corresponding to each block is highest;
in this step, the first focal length, e.g. F, used by the lens is based on the region of interest having the highest overall sharpness 0 Setting a precise focusing range, e.g. [ F ] 0 -f,F 0 +f]Wherein the value of f can be selected to be a suitable value according to the lenses of different cameras. In [ F ] 0 -f,F 0 +f]In the range, N blocks are automatically focused one by one, and when the image corresponding to each block reaches the highest definition, a second focal length such as F corresponding to the camera lens is recorded i,j
Step S104, determining weight values corresponding to the N blocks according to the first focal length and the N second focal lengths; when the second focal length corresponding to the block is closer to the first focal length, the weight value corresponding to the block is larger;
n blocks of the image picture are arranged according to rows (such as X rows and Y columns), and weight values g of the N blocks are preset i,j (i and j represent the number of columns and rows, respectively, where the block is located, i ε [0, X-1 ]],j∈[0,Y-1]) In [ a, b ]]In the range, the difference obtained by subtracting a from b is larger than a preset threshold value, such as 8, and in practical application, for example, a takes the value of 1 and b takes the value of 10. To achieve finer focusing, the difference between a, b may be suitably enlarged. a. b can be a positive integer or a decimal, and in order to reduce the complexity of calculation, a and b in the embodiment of the application are positive integers.
According to the first focal length F 0 N second focal lengths F i,j Calculate |F i,j -F 0 The second focal length with the largest calculated result is recorded as F 1 (F 1 ≠F 0 If F 1 And F is equal to 0 The images corresponding to the N blocks reach the clearest at the same focal distance, namely, the focal distance corresponding to the lens is F when the overall definition of the whole image frame is determined to be the highest 0 Then the camera lens directly uses F 0 Focusing) using a, b, F 0 、F i,j And F 1 Calculating the weight value g corresponding to the N blocks according to the following formula i,j
Substituting a=1 and b=10 into the first equation to obtain the second equation:
for example, as shown in fig. 4, a weight value corresponding to each block in the image frame is calculated by a formula two, and the region of interest corresponds to a target objectBut the focal length of the lens used correspondingly when each block of the object reaches the highest definition is not necessarily the same, but F 0 It is necessary that the focal length of the lens is used when the most of the blocks where the target object is located are clear.
Through step S104, the weight value corresponding to each block is adaptively calculated according to different scenes.
Step 105, determining the overall highest definition of the image frame according to the weight values and the definition corresponding to the N blocks, and focusing according to the overall highest definition of the image frame.
In the step, for each block in an image picture, weighting calculation is carried out on the definition of the block according to the weight value corresponding to the block, and the definition after the weighting calculation of each block is obtained; comparing the sizes of the definition after the weighted calculation of each block, and selecting the maximum definition after the weighted calculation as the integral highest definition of the image picture; and then focusing is performed according to the overall highest definition of the image frame.
In some embodiments, the weight values corresponding to the N blocks are preset (e.g. g i,j ) Between a first preset value (e.g. a) and a second preset value (e.g. b); and the difference of the second preset value minus the first preset value is greater than a preset threshold (e.g., 8).
In some embodiments, the N blocks are arranged in rows and columns (e.g., X columns, Y columns as described above); according to the first focal length and the N second focal lengths, determining the weight values corresponding to the N blocks specifically includes:
comparing N differences between the second focal lengths and the first focal lengths, and marking the second focal length with the largest difference as F 1
Calculating weight values corresponding to the N blocks according to the following formula;
wherein i and jThe serial numbers of the row number and the column number of the block are respectively shown as integers which are more than or equal to 0; a represents the first preset value; b represents the second preset value; f (F) i,j Representing a second focal length corresponding to the ith row and jth column blocks; f (F) 0 Representing the first focal length; g i,j Corresponding weight values of the ith row and the jth column blocks; wherein F is 1 ≠F 0
In some embodiments, the method further comprises:
if F 1 =F 0 Then the camera lens uses F 0 Focusing is performed.
In some embodiments, the determining the overall highest definition of the image frame according to the weight values and the definitions corresponding to the N blocks includes:
for each block, weighting calculation is carried out on the definition of the block according to the weight value corresponding to the block;
and comparing the definition after the weighted calculation of the N blocks, and selecting the maximum definition after the weighted calculation as the overall highest definition of the image picture.
To achieve focusing according to a user-selected region of interest, in some embodiments, determining the region of interest specifically includes:
transmitting the image frame presented by the lens to a user terminal for a user to select a target object (such as the above-mentioned one oblique object or a part of the image frame selected by the user) according to the image frame on the user terminal;
acquiring a target object selected by a user on the user terminal, and determining a block covered by the target object in an image picture presented by the lens according to the target object; and determining each block covered by the target object as a region of interest if the proportion of covering the block is greater than 50%.
In some embodiments, the specific number of N blocks is determined according to the resolution of the image frame; wherein the number of blocks N is proportional to the resolution.
Referring to fig. 5, an autofocus system for a target object according to an embodiment of the present application includes a determining module 100, a focusing module 200, and a calculating module 300, where
A determining module 100, configured to determine a region of interest according to a region covered by a target object selected by a user in an image frame presented by a camera lens; wherein the image picture is divided into N blocks, and N is a positive integer;
the focusing module 200 is configured to focus the region of interest, and record a first focal length used by the lens when the overall sharpness of the region of interest is highest; focusing on the first focal length as a central focal length for each block in the image picture, and recording a second focal length corresponding to the lens when the image definition corresponding to each block is highest; focusing according to the overall highest definition of the image frame determined by the calculation module 300;
the calculating module 300 is configured to determine weight values corresponding to the N blocks according to the first focal length and the N second focal lengths; when the second focal length corresponding to the block is closer to the first focal length, the weight value corresponding to the block is larger; and determining the overall highest definition of the image picture according to the weight values and the definition corresponding to the N blocks.
Examples of several specific process flows are given below.
Embodiment one:
referring to fig. 6, an auto-focusing method for a target object according to an embodiment of the present application is performed by, for example, an imaging system, and includes the following specific steps:
the image picture is uniformly divided into 80 blocks with the same size in 8 rows and 10 columns in advance, and weight values corresponding to the 80 blocks are preset to be in [1,10 ].
Step S601, an image picture currently presented by a lens is sent to a user terminal, and the user selects a target object from the image picture through the user terminal;
step S602, obtaining a target object selected by a user terminal, and determining an interested region according to a block covered by the target object in an image picture;
step S603, focusing the region of interest, and recording the first focal length F used by the lens when the whole region of interest is clearest 0
Step S604, F 0 Setting a focusing range for the central focal length, focusing each block in the image picture in the focusing range, and recording the second focal length F used by the lens when the image corresponding to each block is the clearest i,j And the highest definition for each block;
step S605, calculating the difference between each second focal length and the first focal length, determining the second focal length with the largest difference, and marking the second focal length as F 1 ,F 1 ≠F 0
Step S606, utilizing the first focal length, the 80 second focal lengths and F 1 Calculating a weight value corresponding to each block through the formula II;
step S607, for each block, performing a weighted calculation on the highest definition of the block according to the weight value corresponding to the block, for example, as shown in fig. 4;
step S608, comparing the definition after the weighted calculation of the 80 blocks, and determining the maximum definition after the weighted calculation;
in step S609, the maximum definition obtained by the weighting calculation is taken as the overall highest definition of the image frame, and the lens focuses according to the overall highest definition.
Embodiment two:
referring to fig. 7, an auto-focusing method for a target object according to an embodiment of the present application is performed by, for example, an imaging system, and includes the following specific steps:
the image picture is uniformly divided into N blocks with the same size in X rows and Y columns in advance, and weight values corresponding to all the preset blocks are all in [1,10 ].
Step S701, an image picture currently presented by a lens is sent to a user terminal, and is used for a user to select an area from the image picture through the user terminal;
step S702, acquiring a selected area of a user terminal, and determining an interested area according to a block covered by the area in an image picture;
step 703, focusing the region of interest, and recording a first focal length used by the lens when the whole region of interest is the clearest;
step S704, setting a focusing range by taking the first focal length as a central focal length, focusing each block in an image picture in the focusing range, and recording a second focal length corresponding to the lens when the image corresponding to each block is the clearest;
step S705, calculating the difference value between each second focal length and the first focal length, and determining that the second focal length with the largest difference value is the same as the first focal length;
step S706, the lens focuses according to the first focal length.
The following describes a device or apparatus provided by an embodiment of the present application, where explanation or illustration of the same or corresponding technical features as those described in the above method is omitted.
Referring to fig. 8, an autofocus apparatus for a target object according to an embodiment of the present application includes:
processor 800, for reading the program in memory 820, performs the following processes:
determining an interested region according to a block covered by a target object selected by a user in an image picture presented by a camera lens; wherein the image picture is divided into N blocks, and N is a positive integer;
focusing the region of interest, and recording a first focal length used by the lens when the overall definition of the region of interest is highest;
focusing on the first focal length as a central focal length for each block in the image picture, and recording a second focal length corresponding to the lens when the image definition corresponding to each block is highest;
determining weight values corresponding to the N blocks according to the first focal length and the N second focal lengths; when the second focal length corresponding to the block is closer to the first focal length, the weight value corresponding to the block is larger;
and determining the overall highest definition of the image picture according to the weight values and the definition corresponding to the N blocks, and focusing according to the overall highest definition of the image picture.
In some embodiments, the weight values corresponding to the N blocks are preset between a first preset value and a second preset value; and the difference value obtained by subtracting the first preset value from the second preset value is larger than a preset threshold value.
In some embodiments, the N blocks are arranged in rows and columns; according to the first focal length and the N second focal lengths, determining the weight values corresponding to the N blocks specifically includes:
comparing N differences between the second focal lengths and the first focal lengths, and marking the second focal length with the largest difference as F 1
Calculating weight values corresponding to the N blocks according to the following formula;
wherein i and j respectively represent the number of the row number and the column number of the block, and are integers greater than or equal to 0; a represents the first preset value; b represents the second preset value; f (F) i,j Representing a second focal length corresponding to the ith row and jth column blocks; f (F) 0 Representing the first focal length; g i,j Corresponding weight values of the ith row and the jth column blocks; wherein F is 1 ≠F 0
In some embodiments, the processor 800 is further configured to read a program in the memory 820, and execute:
if F 1 =F 0 Then the camera lens uses F 0 Focusing is performed.
In some embodiments, the determining the overall highest definition of the image frame according to the weight values and the definitions corresponding to the N blocks includes:
for each block, weighting calculation is carried out on the definition of the block according to the weight value corresponding to the block;
and comparing the definition after the weighted calculation of the N blocks, and selecting the maximum definition after the weighted calculation as the overall highest definition of the image picture.
In some embodiments, determining the region of interest specifically includes:
transmitting an image picture presented by the lens to a user terminal for a user to select a target object on the user terminal according to the image picture;
acquiring a target object selected by a user on the user terminal, and determining a block covered by the target object in an image picture presented by the lens according to the target object; and determining each block covered by the target object as a region of interest if the proportion of covering the block is greater than 50%.
In some embodiments, the specific number of N blocks is determined according to the resolution of the image frame; wherein the number of blocks N is proportional to the resolution.
In some embodiments, the autofocus device for a target object according to the present application further includes a transceiver 810 for receiving data transmitted by a user terminal and transmitting data to the user terminal under the control of the processor 800.
Wherein in fig. 8, a bus architecture may comprise any number of interconnected buses and bridges, and in particular, one or more processors represented by processor 800 and various circuits of memory represented by memory 820, linked together. The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, power management circuits, etc., which are well known in the art and, therefore, will not be described further herein. The bus interface provides an interface. Transceiver 810 may be a plurality of elements, i.e., including a transmitter and a receiver, providing a means for communicating with various other apparatus over a transmission medium.
In some embodiments, the autofocus apparatus for a target object provided by embodiments of the present application further includes a user interface 830, where the user interface 830 may be an interface capable of interfacing with an inscribed desired device, including but not limited to a keypad, display, speaker, microphone, joystick, etc.
The processor 800 is responsible for managing the bus architecture and general processing, and the memory 820 may store data used by the processor 800 in performing operations.
In some embodiments, the processor 800 may be a CPU (Central processing Unit), ASIC (Application Specific Integrated Circuit ), FPGA (Field-Programmable Gate Array, field programmable Gate array), or CPLD (Complex Programmable Logic Device ).
Embodiments of the present application provide a computing device, which may be specifically a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (Personal Digital Assistant, PDA), and the like. The computing device may include a central processing unit (Center Processing Unit, CPU), memory, input/output devices, etc., the input devices may include a keyboard, mouse, touch screen, etc., and the output devices may include a display device, such as a liquid crystal display (Liquid Crystal Display, LCD), cathode Ray Tube (CRT), etc.
The memory may include Read Only Memory (ROM) and Random Access Memory (RAM) and provides the processor with program instructions and data stored in the memory. In the embodiment of the present application, the memory may be used to store a program of any of the methods provided in the embodiment of the present application.
The processor is configured to execute any of the methods provided by the embodiments of the present application according to the obtained program instructions by calling the program instructions stored in the memory.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the method of any of the above embodiments. The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
An embodiment of the present application provides a computer readable storage medium storing computer program instructions for use in an apparatus provided in the embodiment of the present application, where the computer program instructions include a program for executing any one of the methods provided in the embodiment of the present application. The computer readable storage medium may be a non-transitory computer readable medium.
The computer-readable storage medium can be any available medium or data storage device that can be accessed by a computer, including, but not limited to, magnetic storage (e.g., floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc.), optical storage (e.g., CD, DVD, BD, HVD, etc.), and semiconductor storage (e.g., ROM, EPROM, EEPROM, nonvolatile storage (NAND FLASH), solid State Disk (SSD)), etc.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (10)

1. An autofocus method for a target object, the method comprising:
determining an interested region according to a block covered by a target object selected by a user in an image picture presented by a camera lens; wherein the image picture is divided into N blocks, and N is a positive integer;
focusing the region of interest, and recording a first focal length used by the lens when the overall definition of the region of interest is highest;
focusing on the first focal length as a central focal length for each block in the image picture, and recording a second focal length corresponding to the lens when the image definition corresponding to each block is highest;
determining weight values corresponding to the N blocks according to the first focal length and the N second focal lengths; when the second focal length corresponding to the block is closer to the first focal length, the weight value corresponding to the block is larger;
and determining the overall highest definition of the image picture according to the weight values and the definition corresponding to the N blocks, and focusing according to the overall highest definition of the image picture.
2. The method of claim 1, wherein the weight values corresponding to the N blocks are preset to be between a first preset value and a second preset value; and the difference value obtained by subtracting the first preset value from the second preset value is larger than a preset threshold value.
3. The method of claim 2, wherein the N blocks are arranged in rows and columns; according to the first focal length and the N second focal lengths, determining the weight values corresponding to the N blocks specifically includes:
comparing N differences between the second focal lengths and the first focal lengths, and marking the second focal length with the largest difference as F 1
Calculating weight values corresponding to the N blocks according to the following formula;
wherein i and j respectively represent the number of the row number and the column number of the block, and are integers greater than or equal to 0; a represents the first preset value; b represents the second preset value; f (F) i,j Representing a second focal length corresponding to the ith row and jth column blocks; f (F) 0 Representing the first focal length; g i,j Corresponding weight values of the ith row and the jth column blocks; wherein F is 1 ≠F 0
4. A method according to claim 3, characterized in that the method further comprises:
if F 1 =F 0 Then the camera lens uses F 0 Focusing is performed.
5. The method of claim 1, wherein determining the overall highest definition of the image frame according to the weight values and the resolutions corresponding to the N blocks comprises:
for each block, weighting calculation is carried out on the definition of the block according to the weight value corresponding to the block;
and comparing the definition after the weighted calculation of the N blocks, and selecting the maximum definition after the weighted calculation as the overall highest definition of the image picture.
6. The method according to claim 1, wherein determining the region of interest comprises:
transmitting an image picture presented by the lens to a user terminal for a user to select a target object on the user terminal according to the image picture;
acquiring a target object selected by a user on the user terminal, and determining a block covered by the target object in an image picture presented by the lens according to the target object; and determining each block covered by the target object as a region of interest if the proportion of covering the block is greater than 50%.
7. The method of claim 1, wherein the specific number of N blocks is determined based on a resolution of the image frame; wherein the number of blocks N is proportional to the resolution.
8. An autofocus system for a target object comprising a determination module, a focus module, and a calculation module, wherein
The determining module is used for determining an interested region according to a block covered by a target object selected by a user in an image picture presented by the camera lens; wherein the image picture is divided into N blocks, and N is a positive integer;
the focusing module is used for focusing the region of interest, and recording a first focal length used by the lens when the overall definition of the region of interest is highest; focusing on the first focal length as a central focal length for each block in the image picture, and recording a second focal length corresponding to the lens when the image definition corresponding to each block is highest; focusing according to the highest definition of the whole image frame determined by the computing module;
the computing module is used for determining weight values corresponding to the N blocks according to the first focal length and the N second focal lengths; when the second focal length corresponding to the block is closer to the first focal length, the weight value corresponding to the block is larger; and determining the overall highest definition of the image picture according to the weight values and the definition corresponding to the N blocks.
9. An autofocus device for a target object, comprising:
a memory for storing program instructions;
a processor for invoking program instructions stored in said memory to perform the method of any of claims 1-7 in accordance with the obtained program.
10. A computer program product for a computer, characterized in that it comprises software code portions for performing the method according to any of claims 1 to 7 when the product is run on the computer.
CN202310991048.2A 2023-08-08 2023-08-08 Automatic focusing method, system and device for target object Pending CN117082343A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310991048.2A CN117082343A (en) 2023-08-08 2023-08-08 Automatic focusing method, system and device for target object

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310991048.2A CN117082343A (en) 2023-08-08 2023-08-08 Automatic focusing method, system and device for target object

Publications (1)

Publication Number Publication Date
CN117082343A true CN117082343A (en) 2023-11-17

Family

ID=88707252

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310991048.2A Pending CN117082343A (en) 2023-08-08 2023-08-08 Automatic focusing method, system and device for target object

Country Status (1)

Country Link
CN (1) CN117082343A (en)

Similar Documents

Publication Publication Date Title
CN110660066B (en) Training method of network, image processing method, network, terminal equipment and medium
US9558543B2 (en) Image fusion method and image processing apparatus
CN109889724B (en) Image blurring method and device, electronic equipment and readable storage medium
US9332195B2 (en) Image processing apparatus, imaging apparatus, and image processing method
CN109040596B (en) Method for adjusting camera, mobile terminal and storage medium
US20220343520A1 (en) Image Processing Method and Image Processing Apparatus, and Electronic Device Using Same
CN110855957B (en) Image processing method and device, storage medium and electronic equipment
CN114390201A (en) Focusing method and device thereof
CN111080571A (en) Camera shielding state detection method and device, terminal and storage medium
CN110689565B (en) Depth map determination method and device and electronic equipment
CN114494442A (en) Image processing method, device and equipment
CN111385461A (en) Panoramic shooting method and device, camera and mobile terminal
CN110392211B (en) Image processing method and device, electronic equipment and computer readable storage medium
JP5900017B2 (en) Depth estimation apparatus, reconstructed image generation apparatus, depth estimation method, reconstructed image generation method, and program
CN113628259A (en) Image registration processing method and device
CN115170383A (en) Image blurring method and device, storage medium and terminal equipment
US10122939B2 (en) Image processing device for processing image data and map data with regard to depth distribution of a subject, image processing system, imaging apparatus, image processing method, and recording medium
CN109788199B (en) Focusing method suitable for terminal with double cameras
CN117082343A (en) Automatic focusing method, system and device for target object
CN111724300A (en) Single picture background blurring method, device and equipment
US11743573B2 (en) Imaging apparatus for adjusting photographing conditions according to photographed images and method for controlling imaging apparatus
CN115514895B (en) Image anti-shake method, apparatus, electronic device, and computer-readable storage medium
CN109089049A (en) A kind of extreme dynamic range image generating method, computer installation and storage medium
CN111800626B (en) Photographing consistency evaluation method and device, mobile terminal and storage medium
CN117726666B (en) Cross-camera monocular picture measurement depth estimation method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination