CN107888819A - A kind of auto focusing method and device - Google Patents

A kind of auto focusing method and device Download PDF

Info

Publication number
CN107888819A
CN107888819A CN201610864820.4A CN201610864820A CN107888819A CN 107888819 A CN107888819 A CN 107888819A CN 201610864820 A CN201610864820 A CN 201610864820A CN 107888819 A CN107888819 A CN 107888819A
Authority
CN
China
Prior art keywords
focusing
focal position
section
subregion
estimate
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.)
Granted
Application number
CN201610864820.4A
Other languages
Chinese (zh)
Other versions
CN107888819B (en
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201610864820.4A priority Critical patent/CN107888819B/en
Priority to PCT/CN2017/098301 priority patent/WO2018059158A1/en
Publication of CN107888819A publication Critical patent/CN107888819A/en
Application granted granted Critical
Publication of CN107888819B publication Critical patent/CN107888819B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

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

Abstract

Auto focusing method provided by the invention, image to be captured is divided into M*N sub-regions, obtains M*N sub-regions in low frequency definition evaluation of estimate corresponding to present convergence location;Count low frequency focused curve in each focusing section and meet the quantity X of the subregion steeply risen, and meet the quantity Y of the subregion drastically declined;If some, which focuses on X in the I of section, is more than Y, continue to judge to focus on the magnitude relationship of X and Y in the I+1 of section;If the Y focused in the I+1 of section is more than X, it is determined that focal position i+1 is the clear focal position of low frequency.This method determines effective subregion according to the low frequency definition evaluation of estimate of each sub-regions of image to be captured, the focal position using the focal position of effective subregion as whole image.The spurious peaks in the focusing curve using whole image on curve are avoided to be disturbed to caused by focusing, so as to improve the degree of accuracy for the application scenarios figure below image focu that multiple peak values be present in focusing curve.

Description

A kind of auto focusing method and device
Technical field
The invention belongs to field of computer technology, more particularly to a kind of auto focusing method and device.
Background technology
Techniques of Automatic Focusing refers to that camera lens is focused to captured object automatically, so as to obtain most clearly image, It is widely used in video camera, digital camera, has in the mobile terminal of camera function.
Techniques of Automatic Focusing includes active focusing and passive type focuses on two kinds, wherein present document relates to be passive focusing side Formula, passive type focuses on gathers image by camera lens and imaging sensor, and computer analysis is carried out to each two field picture to determine quilt Take the photograph the distance of object.Camera is actually to move forward and backward camera lens against photographed scene to search for best focus position.
Passive type auto-focusing algorithm mainly finds focal position, focusing curve by analyzing focusing curve corresponding to image Relation between main reflection focal position and definition evaluation of estimate.Wherein, definition evaluation of estimate is image texture statistical information, Including horizontal direction texture statistics information h and vertical direction texture statistics information v, definition evaluation of estimate is united for horizontal direction texture Count information h and vertical direction texture statistics information v sums;Under normal circumstances, the numerical value of definition evaluation of estimate is higher shows image It is more clear.As shown in figure 1, the abscissa of focusing curve represents the position of focus motor, ordinate represents the clear of image entirety Evaluation of estimate is spent, curve A is the focusing curve of low frequency definition evaluation of estimate, and curve B is the focusing curve of high frequency definition evaluation of estimate. Focusing curve is analyzed, the position for finding focus motor corresponding to definition evaluation of estimate crest is defined as focal position.
But in spot light scene and/or more object distance scenes, multiple peak values occur in focusing curve, as shown in Fig. 2 For the focusing curve schematic diagram of the whole picture of spot light scene, curve A is the focusing curve of high frequency definition evaluation of estimate, curve B is the focusing curve of low frequency definition evaluation of estimate.Definition evaluation of estimate includes high frequency definition evaluation of estimate and low frequency definition is commented Value, wherein, high frequency definition evaluation of estimate is the HFS in image texture statistical information;Low frequency definition evaluation of estimate is figure As the low frequency part in texture statistics information.
When spot light object focus, the brightness of spot light is very high, therefore, corresponding definition during focus Peak value occurs in evaluation of estimate;But when spot light object focuses on unintelligible, the spot light brightness in image decrease but Area can become big, and now, peak value also occurs in definition evaluation of estimate, but peak value now is pseudo- peak value.It is more for this presence The scene of individual peak value, when focus motor is in the position of spurious peaks, image frame obscures, and focuses on inaccurate.
The content of the invention
In view of this, this application provides a kind of auto focusing method and device, to solve pseudo wave to be present in focusing curve The technical problem of inaccuracy is focused under the scene at peak.
First aspect, there is provided a kind of auto focusing method, image to be captured is divided into M*N sub-regions, wherein, M and N It is the integer more than 1, methods described includes:Focusing search range is obtained, and the focusing search range is divided at least Two focusing sections, wherein, it is from focal position i-1 to focal position i interval range, the focal position i to focus on section I Increase focal position corresponding to one first default step-length according to the first default adjustment direction for focal position i-1, and i is just whole Number;Then, low frequency definition evaluation of estimate of the M*N sub-regions at present convergence location i is obtained respectively;For focusing on section I, The every sub-regions for obtaining the image to be captured correspond to the slope of focusing curve, count in M*N sub-regions on focusing curve The first quantity X that slope is more than the subregion of the first preset value is risen, and focusing curve descending slope is more than described first and preset Second quantity Y of the subregion of value;Then, the magnitude relationship of focusing X and Y corresponding to the I of section is judged;If the focusing X corresponding to the I of section is more than Y, then the present convergence location i is increased into one described the according to the described first default adjustment direction One default step-length, reaches focal position i+1, and continues to compare the magnitude relationship for focusing on X and Y corresponding to the I+1 of section, the focusing Section I+1 is from focal position i to focal position i+1 interval range;If focusing Y corresponding to the I+1 of section is more than X, It is to make the low frequency part of the image to be captured clearly clear focal position of low frequency then to determine the focal position i+1.
The auto focusing method that first aspect provides, is divided into M*N sub-regions by image to be captured, then obtains each Subregion each focal position low frequency definition evaluation of estimate, then, according to the low frequency definition evaluation of estimate of each sub-regions It is effective subregion to find the subregion drastically declined after the focusing curve in two neighboring focusing section meets first to steeply rise, Focal position using the focal position of effective subregion as whole image.Pseudo wave when avoiding utilizing the focusing curve of whole image Peak disturbs to caused by focusing, so as to improve the accurate of the application scenarios figure below image focu that multiple peak values be present in focusing curve Degree.
In the first possible implementation of first aspect, methods described also includes:If the focusing section I+1 Corresponding X and Y are all higher than 0 and X and are more than Y, then continue to judge the magnitude relationship for focusing on X and Y corresponding to the I+2 of section, until finding Meet focusing sections of the Y more than X or the boundary bit of the focusing search range is adjusted to according to the described first default adjustment direction Put.
In second of possible implementation of first aspect, methods described also includes:If in the focused search In the range of be not present the focusing curve rate of rise be more than first preset value subregion, then statistics focus on section I internal memories It is more than the 3rd quantity x of the subregion of the second preset value in the focusing curve rate of rise, and focusing curve descending slope is more than 4th quantity y of the subregion of second preset value, wherein, second preset value is less than first preset value;Then, Judge the magnitude relationship of focusing x and y corresponding to the I of section;If focusing x corresponding to the I of section is more than y, continue to compare Compared with the magnitude relationship for focusing on x and y corresponding to the I+1 of section;If focusing y corresponding to the I+1 of section is more than x, it is determined that described Focal position i+1 is the clear focal position of the low frequency.
The auto focusing method that second of possible implementation of first aspect provides, searched when traveling through whole coarse adjustment focusing After rope scope, do not meet to steeply rise and drastically decline the subregion of condition, then according to satisfaction slowly rising and slowly decline Focusing section, determine coarse adjustment focal position.Avoid can not find and meet when steeply rising and drastically declining the subregion of condition, Clearly focal position can not be obtained, improves the degree of accuracy focused on automatically.
In the third possible implementation of first aspect, if being more than X in focusing Y corresponding to the I+1 of section, It is to make the low frequency part of the image to be captured clearly after the clear focal position of low frequency then to determine the focal position i+1, Methods described also includes:Obtain the high frequency of the whole image to be captured shot at the clear focal position i+1 of low frequency Definition evaluation of estimate;Focal position is increased described in one from the clear focal position of the low frequency according to the second default adjustment direction Second default step-length, obtains focal position i+x1, obtains the whole figure to be captured shot at the focal position i+x1 The high frequency definition evaluation of estimate of picture;The whole image to be captured is calculated in the section from focal position i+1 to focal position i+x1 Interior first slope;If the first slope is the rate of rise, and is more than first preset value, then continue the focusing Position i+x1 increases by one described second default step-length according to the described second default adjustment direction, obtains focal position i+x2, obtains Take the high frequency definition evaluation of estimate of the whole image to be captured shot at the focal position i+x2;Calculate entirely described treat Shooting image is in the second slope from focal position i+x1 to focal position i+x2 in section;If second slope is decline Slope, and it is more than first preset value, it is determined that the focal position i+x1 is the HFS for making the image to be captured The clearly clear focal position of high frequency.
The auto focusing method that the third implementation of first aspect provides, low frequency is determined by coarse adjustment focusing After clear focal position, recycle the high frequency focusing curve of whole image to be captured really to find and meanwhile meet to steeply rise with drastically The low frequency focused position of decline condition, and the low frequency focused position is defined as final focal position.High frequency focusing curve Slope is bigger, and the span in focal position direction of high frequency focusing curve is smaller, the high frequency found using high frequency focusing curve Focal position is more accurate, improves the accuracy focused on automatically.
It is described for focusing on section I in the 4th kind of possible implementation of first aspect, obtain each sub-district The slope of focusing curve corresponding to domain, including:For any one subregion in the image to be captured, the sub-district is calculated First between low frequency definition evaluation of estimate of the domain in focal position i and the low frequency definition evaluation of estimate in focal position i-1 is poor Value;If first difference is more than 0, the definition of first difference and the subregion in focal position i-1 is calculated The ratio of evaluation of estimate, obtain the rate of rise of the subregion in the focusing section I;If first difference is less than 0, The absolute value of first difference and the subregion are then calculated in the ratio of focal position i-1 definition evaluation of estimate, is obtained Descending slope of the subregion in the focusing section I.
Second aspect, there is provided a kind of autofocus, image to be captured is divided into M*N sub-regions, wherein, M and N It is the integer more than 1, described device includes:Focusing search range acquisition module, for obtaining focusing search range, and by institute State focusing search range and be divided at least two focusing sections, wherein, it is from focal position i-1 to focal position i to focus on section I Interval range, the focal position i is that focal position i-1 increases by one first default step-length according to the first default adjustment direction Corresponding focal position, and i is positive integer;First definition evaluation of estimate acquisition module, exists for obtaining M*N sub-regions respectively Present convergence location i low frequency definition evaluation of estimate;Slope acquisition module, for for focusing on section I, obtaining described to be captured Every sub-regions of image correspond to the slope of focusing curve;First statistical module, for for the focusing section I, counting M*N The focusing curve rate of rise is more than the first quantity X of the subregion of the first preset value in sub-regions, and focusing curve declines Slope is more than the second quantity Y of the subregion of first preset value;First judge module, for judging the focusing section I Corresponding X and Y magnitude relationship;If focusing X corresponding to the I of section is more than Y, by the present convergence location i according to Described first default adjustment direction increases by one described first default step-length, reaches focal position i+1, and continue to compare focal zone Between X and Y corresponding to I+1 magnitude relationship, the focusing section I+1 is section model from focal position i to focal position i+1 Enclose;First determining module, for when Y is more than X corresponding to the I+1 of section for the focusing, determining the focal position i+1 to make State the low frequency part of the image to be captured clearly clear focal position of low frequency.
The autofocus that second aspect provides, is divided into M*N sub-regions by image to be captured, then obtains each Subregion each focal position low frequency definition evaluation of estimate, then, according to the low frequency definition evaluation of estimate of each sub-regions It is effectively son to find the subregion for meeting drastically to decline after the focusing curve in two neighboring focusing section meets first to steeply rise Region, the focal position using the focal position of effective subregion as whole image.Avoid the focusing curve using whole image When curve on spurious peaks disturbed to caused by focusing, so as to improve the application scenarios figure below that multiple peak values be present in focusing curve The degree of accuracy of image focu.
In the first possible implementation of second aspect, first judge module is additionally operable to:When the focusing When X and Y corresponding to the I+1 of section is all higher than 0 and X and is more than Y, continue to judge the magnitude relationship for focusing on X and Y corresponding to the I+2 of section, Meet focusing sections of the Y more than X until finding or be adjusted to the focusing search range according to the described first default adjustment direction Boundary position.
In second of possible implementation of second aspect, described device also includes:Second statistical module, for working as When being more than the subregion of first preset value in the absence of the focusing curve rate of rise in the focusing search range, count poly- Threeth quantity x of the focusing curve rate of rise more than the subregion of the second preset value in burnt section I be present, and under focusing curve Drop angle rate is more than the 4th quantity y of the subregion of second preset value, wherein, it is pre- that second preset value is less than described first If value;Second judge module, for judging the magnitude relationship of focusing x and y corresponding to the I of section;If the focusing section I Corresponding x is more than y, then continues to compare the magnitude relationship for focusing on x and y corresponding to the I+1 of section;Second determining module, for working as State y corresponding to focusing on section I+1 and be more than x, it is determined that the focal position i+1 is the clear focal position of the low frequency.
The autofocus that second of possible implementation of second aspect provides, searched when traveling through whole coarse adjustment focusing After rope scope, do not meet to steeply rise the subregion with drastically decline condition, then utilize satisfaction slowly rising and slowly decline Focusing section, determine coarse adjustment focal position.Avoid can not find and meet when steeply rising and drastically declining the subregion of condition, Clearly focal position can not be obtained, improves the degree of accuracy focused on automatically.
In the third possible implementation of second aspect, described device also includes:Second definition evaluation of estimate obtains Modulus block, the high frequency for obtaining the whole image to be captured shot at the clear focal position i+1 of the low frequency are clear Spend evaluation of estimate;Focal position adjustment module, adjusted for focal position to be preset from the clear focal position of the low frequency according to second Perfect square obtains focal position i+x1 to one described second default step-length of increase;The second definition evaluation of estimate acquisition module, It is additionally operable to obtain the high frequency definition evaluation of estimate of the whole image to be captured shot at the focal position i+x1;Slope Computing module, for calculate the whole image to be captured from focal position i+1 to focal position i+x1 in section first Slope;The focal position adjusting module, for being the rate of rise when the first slope, and it is more than first preset value When, continue the focal position i+x1 increasing by one described second default step-length according to the described second default adjustment direction, obtain To focal position i+x2;The second definition evaluation of estimate acquisition module, it is additionally operable to obtain at the focal position i+x2 and shoots The whole image to be captured high frequency definition evaluation of estimate;The slope computing module, it is additionally operable to calculate entirely described treat Shooting image is in the second slope from focal position i+x1 to focal position i+x2 in section;3rd determining module, for working as It is descending slope to state the second slope, and when being more than first preset value, determines the focal position i+x1 to make described to wait to clap Take the photograph the HFS of the image clearly clear focal position of high frequency.
The autofocus that the third implementation of second aspect provides, low frequency is determined by coarse adjustment focusing After clear focal position, recycle the high frequency focusing curve of whole image to be captured really to find and meanwhile meet to steeply rise with drastically The low frequency focused position of decline condition, and the low frequency focused position is defined as final focal position.High frequency focusing curve Slope is bigger, and the span in focal position direction of high frequency focusing curve is smaller, the high frequency found using high frequency focusing curve Focal position is more accurate, improves the accuracy focused on automatically.
In the 4th kind of possible implementation of second aspect, the slope acquisition module includes:First calculates submodule Block, for for any one of subregion, calculating the subregion in focal position i definition evaluation of estimate with focusing on First difference of position i-1 definition evaluation of estimate;Second calculating sub module, for when first difference is more than 0, calculating First difference and the subregion obtain the subregion in institute in the ratio of focal position i-1 definition evaluation of estimate State the rate of rise focused in the I of section;3rd calculating sub module, for when first difference is less than 0, calculating described first The absolute value of difference and the subregion obtain the subregion in institute in the ratio of focal position i-1 definition evaluation of estimate State the descending slope focused in the I of section.
The third aspect, there is provided a kind of terminal device, including processor, memory and image acquiring device;Described image obtains Device is taken, for obtaining the image to be captured of current picture, image to be captured is divided into M*N sub-regions, wherein, M and N are equal For the integer more than 1;;The memory, instructed for storage program;The processor, for performing in the memory Programmed instruction, to realize acquisition focusing search range, and the focusing search range is divided at least one focusing section, its In, it is to be pressed from focal position i-1 to focal position i interval range, the focal position i for focal position i-1 to focus on section I Increase focal position corresponding to one first default step-length according to the first default adjustment direction, and i is positive integer;M*N is obtained respectively Low frequency definition evaluation of estimate of the sub-regions at present convergence location i;For focusing on section I, the image to be captured is obtained Every sub-regions correspond to the slope of focusing curve, counting the focusing curve rate of rise in M*N sub-regions, to be more than first default First quantity X of the subregion of value, and focusing curve descending slope are more than the second number of the subregion of first preset value Measure Y;Judge the magnitude relationship of focusing X and Y corresponding to the I of section;, will if focusing X corresponding to the I of section is more than Y The present convergence location i increases by one described first default step-length according to the described first default adjustment direction, reaches and focuses on position I+1 is put, and continues to compare the magnitude relationship for focusing on X and Y corresponding to the I+1 of section, the focusing section I+1 is from focal position i To focal position i+1 interval range;If focusing Y corresponding to the I+1 of section is more than X, it is determined that the focal position i+1 To make the low frequency part of the image to be captured clearly clear focal position of low frequency.
The terminal device that the third aspect provides, obtains image to be captured, and image to be captured is divided into M*N sub-district Domain, low frequency definition evaluation of estimate of each sub-regions in each focal position is then obtained, then, according to the low of each sub-regions Frequency definition evaluation of estimate finds the sub-district drastically declined after the focusing curve in two neighboring focusing section meets first to steeply rise Domain is effective subregion, the focal position using the focal position of effective subregion as whole image.Avoid utilizing whole image Focusing curve when curve on spurious peaks disturbed to caused by focusing, so as to improve focusing curve exist multiple peak values should The degree of accuracy focused on scene hypograph.
In the first possible implementation of the third aspect, the processor is additionally operable to:Obtain described clear in low frequency The high frequency definition evaluation of estimate of the whole image to be captured shot at clear focal position i+1;By focal position from described low The clear focal position of frequency increases by one described second default step-length according to the second default adjustment direction, obtains focal position i+x1, Obtain the high frequency definition evaluation of estimate of the whole image to be captured shot at the focal position i+x1;Calculate whole institute Image to be captured is stated in the first slope from focal position i+1 to focal position i+x1 in section;If the first slope is The rate of rise, and be more than first preset value, then continue the focal position i+x1 according to the described second default adjustment side To one described second default step-length of increase, focal position i+x2 is obtained, obtains the whole of the shooting focal position i+x2 at The high frequency definition evaluation of estimate of the image to be captured;The whole image to be captured is calculated from focal position i+x1 to focusing The second slope in the i+x2 sections of position;If second slope is descending slope, and is more than first preset value, then really The fixed focal position i+x1 is to make the HFS of the image to be captured clearly clear focal position of high frequency.
The terminal device that the first implementation of the third aspect provides, determines that low frequency is clear by coarse adjustment focusing After focal position, recycle the high frequency focusing curve of whole image to be captured really to find while meet to steeply rise and drastically decline The low frequency focused position of condition, and the low frequency focused position is defined as final focal position.The slope of high frequency focusing curve Bigger, the span in focal position direction of high frequency focusing curve is smaller, and the high frequency found using high frequency focusing curve is focused on Position is more accurate, improves the accuracy focused on automatically.
The auto focusing method that the application provides, during focus on automatically, image to be captured is divided into M*N Sub-regions, M*N sub-regions are obtained in low frequency definition evaluation of estimate corresponding to present convergence location, according to each sub-regions Low frequency focused curve is focusing on the slope on section corresponding to two two neighboring focal positions, count low in each focusing section Frequency focusing curve meets the quantity X for the subregion for steeply rising (rate of rise is more than the first preset value), and under meeting drastically The quantity Y of the subregion of (descending slope is more than first preset value) drops;If some, which focuses on X in the I of section, is more than Y, connect The magnitude relationship for judging to focus on X and Y in the I+1 of section;If the Y focused in the I+1 of section is more than X, it is determined that focal position i + 1 is the clear focal position of low frequency.This method is determined according to the low frequency definition evaluation of estimate of each sub-regions of image to be captured (subregion drastically declined after the focusing curve in two neighboring focusing section meets first to steeply rise is effective to effective subregion Subregion), the focal position using the focal position of effective subregion as whole image.The focusing of whole image can be avoided bent Spurious peaks are disturbed to caused by focusing in line, so as to improve the application scenarios figure below image focu that multiple peak values be present in focusing curve The degree of accuracy.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are the present invention Some embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can also basis These accompanying drawings obtain other accompanying drawings.
Fig. 1 is the image focusing curve schematic diagram that a kind of existing focus method obtains;
Fig. 2 is the image focusing curve schematic diagram that another existing focus method obtains;
Fig. 3 is the division schematic diagram of image region to be captured;
Fig. 4 is a kind of principle schematic of autofocus mechanism of the embodiment of the present invention;
Fig. 5 is a kind of focusing curve schematic diagram of spot light scene of the embodiment of the present invention;
Fig. 6 is a kind of focusing curve schematic diagram of more object distance scenes of the embodiment of the present invention;
Fig. 7 is a kind of block diagram of autofocus of the embodiment of the present invention;
Fig. 8 is the block diagram of another kind autofocus of the embodiment of the present invention;
Fig. 9 is the block diagram of another autofocus of the embodiment of the present invention.
Embodiment
Auto focusing method provided in an embodiment of the present invention, mainly by the way that image to be captured is divided into M*N sub-regions (as shown in Figure 3), during focus motor regulation, a focal position and definition evaluation of estimate are formed for every sub-regions Focusing curve, share the focusing curve of M*N sub-regions and the focusing curve of an overall picture.Then, each height is analyzed The focusing curve in region, determine that the slope of curve meets the effective subregion for steeply rising and drastically declining, by effective subregion Focal position of the focal position as whole image, so as to avoid the focusing curve spurious peaks of whole image to caused by focusing Interference.
Below in conjunction with the accompanying drawing in the embodiment of the present invention, technical solution of the present invention is discussed in detail.Obviously, described reality It is part of the embodiment of the present invention to apply example, rather than whole embodiments.Based on the embodiment in the present invention, the common skill in this area The every other embodiment that art personnel are obtained under the premise of creative work is not made, belong to the model that the present invention protects Enclose.
Fig. 4 is referred to, is a kind of principle schematic of autofocus mechanism of the embodiment of the present invention.
As shown in figure 4, the autofocus mechanism includes:Camera lens 110, imaging sensor 120, image signal processing unit 130th, central processing unit 140 and focus motor 150.
Camera lens 110 is mainly used in being imaged;Imaging sensor 120 is used to optical signalling be converted to image simulation electric signal; Image signal processing unit (Image Signal Processing, be abbreviated as ISP) is mainly used to the imaging sensor to front end The unit of the signal transacting of defeated 120 output, is handled picture signal by a series of Digital Image Processing algorithms, is obtained clear Clear degree evaluation of estimate;Central processing unit (Central Processing Unit, be abbreviated as CPU) is run according to definition evaluation of estimate The focus motor 150 of focusing algorithm control camera lens moves, so that lens imaging is clear, auto focusing method provided by the invention should For in CPU.
Auto focusing method provided by the invention is applied in central processing unit 140.
The image that imaging sensor 120 exports exports the focus statistics information per sub-regions after ISP is handled, and gathers Burnt statistical information is the result counted to image texture information.Focus statistics information includes high frequency statistics information and low frequency is united Information is counted, wherein, high frequency statistics information is the HFS of image texture statistical information;Low frequency statistical information is image texture system Count the low frequency part of information.
For example, horizontal direction low frequency statistical information h1, horizontal direction high frequency statistics information h2, vertical direction low frequency statistics letter Cease v1, vertical direction high frequency statistics information v2;, the low frequency definition evaluation of estimate per sub-regions is h1+v1, and corresponding high frequency is clear Clear degree evaluation of estimate is h2+v2.Alternatively, a weighted value w can be set per sub-regionsi, then low frequency definition evaluation of estimate be wi* (h1+v1), high frequency definition evaluation of estimate wi*(h2+v2)。
Automatic focusing is discussed in detail for spot light scene and more object distance scenes respectively below in conjunction with Fig. 5 and Fig. 6, In actual automatic focusing, spot light scene and more object distance scenes are not differentiated between, because the auto focusing method phase of two scenes Together.But the focusing curve cluster of spot light scene and more object distance scenes differs, therefore, the present invention will be directed to two different fields Scape illustrates respectively.
Fig. 5 is referred to, shows a kind of focusing curve schematic diagram of spot light scene of the embodiment of the present invention.
Generally light be present in subject picture, the scene of reflective object calls spot light scene, in Fig. 5, curve A For focusing curve corresponding to whole image;Curve B is the focusing curve in spot light region, focusing curve corresponding to spot light region Multiple peak values be present.Curve C and D represent the focusing curve of non-dots source region.
The auto focusing method that the present embodiment provides, is determined first with the low frequency definition evaluation of estimate of each sub-regions Coarse adjustment focal position, then, the high frequency definition evaluation of estimate of each sub-regions is recycled to determine target sharpness evaluation of estimate.
Certainly, in other embodiments of the invention, can be determined merely with the low frequency definition evaluation of estimate of subregion Clear focal position.In other words, following coarse tuning process only is included in such a embodiment, not comprising fine-tuning process.
First, coarse tuning process
(1) coarse adjustment initializes
Coarse adjustment initialization procedure is mainly used in determining the parameter used in coarse tuning process, including coarse adjustment initial position, coarse adjustment Inceptive direction, coarse adjustment focusing search range and coarse adjustment steps etc.;
Coarse adjustment initial position, directly it can be obtained according to the motor drive module of focus motor.
Coarse adjustment inceptive direction, it can be determined according to initial position, the initial position of focus motor is remote object distance position, then adjusts Perfect square is to being then nearly object distance direction.For example, in focusing curve figure shown in Fig. 1, abscissa left end is the Far directions of focus motor The right-hand member of (remote object distance direction) abscissa is the Near directions (nearly object distance direction) of focus motor, it is assumed that the initial bit of focus motor The left end point of nearly abscissa is rested against, then adjustment direction is Near directions;
Coarse adjustment focusing search range (that is, focusing search range), it is that the infinity object distance of the current zoom position of camera lens is corresponding Focus motor position and minimum object distance corresponding to position range between focus motor position;
Coarse adjustment steps (that is, the first default step-length), can be determined according to coarse adjustment focusing search range.
It is assumed that the coarse adjustment initial position of focus motor is P0, coarse adjustment adjustment direction is Near directions, coarse adjustment focused search model It is P0~P5 to enclose, and coarse adjustment steps are step1.Image to be captured is divided into M*N sub-regions.
(2) coarse adjustment specific steps
(1) P0~P1 sections:
1. acquisition focus motor is located at P0 positions, the low frequency definition evaluation of estimate of every sub-regions of image to be captured; Low frequency definition evaluation of estimate of every sub-regions in P0 positions is designated as maximum low frequency definition evaluation of estimate corresponding to the subregion.
Low frequency definition when 2. focus motor from P0 position adjustments to P1 positions, obtains P1 positions per sub-regions is evaluated Value.
3. for any one subregion, it is oblique in P0~P1 sections to calculate low frequency focused curve corresponding to the subregion Rate, if the low frequency definition evaluation of estimate of P1 positions is more than the low frequency definition evaluation of estimate of P0 positions, by the subregion most Big low frequency definition evaluation of estimate is updated to the low frequency definition evaluation of estimate of P1 positions.
In the embodiment of the present invention, low frequency focused slope of a curve includes the rate of rise and descending slope, for any one Subregion, should if the low frequency definition evaluation of estimate of P1 position correspondences is more than the low frequency definition evaluation of estimate of P0 position correspondences Slope of the low frequency focused curve in P0~P1 sections is the rate of rise;If the low frequency definition evaluation of estimate of P1 position correspondences is less than The low frequency definition evaluation of estimate of P0 position correspondences, then it is descending slope for the slope of the low frequency focused curve in P0~P1 sections.
The rate of rise or descending slope are further calculated according to formula 1:
In formula 1, FVP0Low frequency definition evaluation of estimate corresponding to pending subregion when being in P0 positions for focus motor; FVP1Low frequency definition evaluation of estimate corresponding to pending subregion when being in P1 positions for focus motor;K is that pending subregion exists Slope is risen or fallen in P0~P1 sections.
4. counting in P0~P1 sections, low frequency focused rate of rise is more than the first preset value in M*N sub-regions Subregion quantity X, and descending slope are more than the subregion quantity Y of the first preset value.
It should be noted that for same image, if the statistical of image is different, the slope being calculated may Differ, therefore, the first preset value is determined according to the empirical value of a large amount of contextual datas obtained under used statistical.
5. judge the size of X and Y corresponding to P0~P1 sections.
In other words, the step judges whether the low frequency focused curve of M*N sub-regions meets drastically in P0~P1 sections Rise or drastically decline, and count the quantity X for meeting and steeply rising, and meet the quantity Y drastically declined.
As shown in figure 5, P0~P1 sections, the low frequency focused curve of each sub-regions is gradually increasing, but is not met drastically Rising condition, i.e. P0~P1 sections, X=0;Y=0;
(2) P1~P2 sections:Repeat the above steps 1.~5., X and Y quantity corresponding to statistics P1~P2 sections;Such as Fig. 5 Shown, the low frequency focused curve of each sub-regions does not meet the condition for steeply rising or drastically declining, i.e. P1~P2 sections, X still =0, Y=0.For any one subregion, if the low frequency that the low frequency definition evaluation of estimate of P2 positions is more than P1 positions is clear Evaluation of estimate is spent, then the maximum low frequency definition evaluation of estimate of the subregion is updated to the low frequency definition evaluation of estimate of P2 positions.
P2~P3 sections:Repeat the above steps 1.~5., X and Y quantity corresponding to statistics P2~P3 sections;Such as Fig. 5 institutes Show, the low frequency focused curve of part subregion (non-spot light subregion) meets the condition of steeply rising, and counts qualified Quantity X > 0, spot light region do not meet the condition of steeply rising, and non-dots source region meets the condition of steeply rising, therefore, X number Amount is the quantity of non-spot light subregion;This section does not meet the subregion drastically declined, Y=0.
For any one subregion, if the low frequency definition evaluation of estimate of P3 positions is more than the low frequency definition of P2 positions Evaluation of estimate, then the maximum low frequency definition evaluation of estimate of the subregion is updated to the low frequency definition evaluation of estimate of P3 positions.
(3) P3~P4 sections:Repeat the above steps 1.~5., X and Y quantity corresponding to statistics P3~P4 sections;Such as Fig. 5 Shown, the low frequency focused curve of non-dots source region meets the quantity Y > 0 of the condition drastically declined, and spot light region is not met Drastically decline condition, non-spot light, which meets, drastically declines condition, and therefore, Y quantity is non-spot light subregion in whole image Quantity;This section does not meet the subregion steeply risen, X=0.
Focusing curve is generally all symmetrical curve, therefore, it is generally the case that the Y value in P3~P4 sections is equal to P2~P3 areas Between X values.
So far, determine that low frequency focused curve meets in P2~P3 sections to steeply rise, meanwhile, meet urgency in P3~P4 sections The subregion that play declines is effective subregion.And determine that maximum low frequency definition is evaluated in the low frequency focused curve of effective subregion Focal position corresponding to value is coarse adjustment focal position, and in the present embodiment, coarse adjustment focal position is that (that is, low frequency clearly gathers for P4 positions Burnt position).
In another application scenarios of the present invention, if after traveling through whole coarse adjustment focusing search range, do not meet urgency Play rises and drastically declines the subregion of condition, then (meets the slope for slowly rising and slowly declining according to the second preset value Value), find low frequency focused curve according to above-mentioned coarse tuning process and meet slowly rising and the focusing section slowly declined, then, really Focal position corresponding to the maximum low frequency definition evaluation of estimate in the fixed focusing section is coarse adjustment focal position.Wherein, second is default Value is less than the first preset value, moreover, the set-up mode of the second preset value is identical with the set-up mode of the first preset value.
2nd, fine-tuning process
(1) fine tuning initialization procedure
Fine-tuning process and coarse tuning process are a difference in that:Fine-tuning process uses high frequency definition evaluation of estimate, coarse tuning process Use low frequency definition evaluation of estimate.
It is identical with coarse adjustment initialization procedure, fine tuning initialization procedure it needs to be determined that fine tuning initial position, fine tuning inceptive direction, Fine tuning scope and fine tuning step-length.
Fine tuning initial position, the coarse adjustment focal position (that is, the clear focal position of low frequency) that coarse tuning process determines are used as fine tuning Initial position;
Fine tuning inceptive direction, it is the opposite direction of coarse adjustment inceptive direction, in the present embodiment, fine tuning inceptive direction is Far directions;
Fine tuning focusing search range, it is the +/- coarse adjustment steps of fine tuning initial position;
Fine tuning step-length (step2), determined according to fine tuning focusing search range, and fine tuning step-length is less than coarse adjustment steps.
(2) fine tuning specific steps
It is similar with coarse tuning process, the difference is that fine-tuning process refers to high frequency definition evaluation of estimate.
1. acquisition focus motor is located at fine tuning initial position P4, the high frequency definition evaluation of image whole image to be captured Value;
2. adjust a fine tuning step-length (step2) according to fine tuning direction, i.e. focus motor is adjusted to P4-step2, is obtained The high frequency definition evaluation of estimate of whole image during P4-step2 positions;
3. calculate slope of the high frequency focusing curve in P4~(P3-step2) section corresponding to whole image.
4. judge whole image in P4~(P4-step2) section slope whether meet the condition of steeply rising or drastically under Drop condition.
If steeply risen 5. the high frequency focusing curve in P4~(P4-step2) section meets, continue to judge (P4- Step2)~(P4-2*step2) whether the slope of the high frequency focusing curve of whole image meets and drastically declines condition in section;
6. the slope of the high frequency focusing curve of whole image meets in (if P4-step2)~(P4-2*step2) sections Drastically decline condition, it is determined that (P4-step) is final target focal position.
The auto focusing method that the present embodiment provides, during focus on automatically, image to be captured is divided into M*N sub-regions, and obtain the low frequency focused curve of M*N sub-regions.For each focusing section, statistics satisfaction steeply rises Low frequency focused curved line number X and meet the low frequency focused curved line number Y that drastically declines, then, compare X and Y size, and press Focal position is found according to the big focusing curve of quantity.The spurious peaks in the focusing curve using whole image on curve are avoided to poly- Interference caused by Jiao, so as to improve the degree of accuracy for the application scenarios figure below image focu that multiple peak values be present in focusing curve.
Fig. 6 is referred to, shows a kind of automatic focusing curve schematic diagram of more object distance scenes of the present invention, more object distance scenes are Refer to and multiple objects in picture shot be present, and multiple objects are from difference, the i.e. focal position of multiple objects with a distance from camera lens not Together.Whole picture is divided into M*N sub-regions, obtains definition evaluation of estimate corresponding to per sub-regions.
It is identical with the automatic focusing of spot light scene, in some embodiments of the invention, it is possible to use only per height The low frequency definition evaluation of estimate in region determines final target focal position;Or in other embodiments, including coarse adjustment and Two processes of fine tuning, coarse tuning process can determine coarse adjustment focal position using low frequency definition evaluation of estimate;Then, fine tuning is carried out Process, according to high frequency definition evaluation of estimate it is determined that coarse adjustment focal position on the basis of find final target focal position. The embodiment for not only including coarse tuning process but also comprising fine-tuning process is illustrated below:
Coarse adjustment initialization is carried out first, and coarse adjustment initialization is identical with the embodiment of spot light scene, and here is omitted.So Afterwards, coarse adjustment is carried out according to low frequency definition evaluation of estimate, fine tuning is finally carried out according to high frequency definition evaluation of estimate.
As shown in fig. 6, curve A is focusing curve corresponding to whole image;Curve B is that the object nearer apart from camera lens is (near Object) focusing curve;Curve C is the focusing curve of the object (far object) apart from camera lens farther out.
(1) coarse tuning process
P0-P1 sections, count whether the often low frequency focused slope of curve of sub-regions meets to steeply rise condition quantity X and expire Foot drastically declines the quantity Y of condition;As shown in fig. 6, remote object distance focusing curve (curve C) meets to steeply rise condition, and record X Numerical value;In the absence of the focusing curve drastically declined, i.e. Y=0;
P1-P2 sections, as shown in fig. 6, nearly object distance focusing curve (curve B) meets to steeply rise condition, i.e. X > 0;Remote thing Meet the condition that drastically declines, i.e. Y > 0 away from focusing curve.I.e. not only there is the focusing curve steeply risen but also existed drastically in the section The focusing curve of decline, then judge X and Y magnitude relationship,
If X is more than Y, show that subregion quantity shared by far object is more than the quantity of subregion shared by nearly object, i.e., it is remote Object is more than the area of nearly object in the area of whole picture, accordingly, it is determined that primary objects of the far object as the picture, i.e. Coarse adjustment focal position is determined according to far object, is really that P2 positions are coarse adjustment focal position in the present embodiment;
If X is less than Y, show that subregion quantity shared by nearly object is more than subregion quantity shared by far object, i.e., near thing Body is more than the area of far object in the area of whole picture.Accordingly, it is determined that nearly primary objects of the object as the picture, i.e. root Coarse adjustment focal position is determined according to nearly object., it is necessary to continue to move to the position of focus motor to find nearly object in the present embodiment Focal position, until finding the critical localisation for not only meeting to steeply rise but also meeting drastically to decline, as coarse adjustment focal position (i.e., P4 positions in the present embodiment).
In other embodiments of the invention, if after traveling through whole coarse adjustment range, do not meet to steeply rise and drastically The subregion of decline condition, then according to the second preset value (meeting the slope value for slowly rising and slowly declining), according to above-mentioned thick Tune process finds the region that focusing curve meets slowly to rise and slowly decline, then, it is determined that the maximum low frequency in the region is clear Focal position corresponding to spending evaluation of estimate is coarse adjustment focal position.Wherein, the second preset value is less than the first preset value.
(2) fine-tuning process:
The fine-tuning process of more object distance scenes is identical with the fine-tuning process of spot light scene, using coarse adjustment focal position as at the beginning of fine tuning Beginning position, fine tuning inceptive direction be coarse adjustment inceptive direction opposite direction, i.e. Near directions.It is poly- according to the adjustment of fine tuning inceptive direction Burnt motor, until being found on the high frequency focusing curve in whole image while meeting to steeply rise and drastically decline the focusing in region Position, as final focal position.
The auto focusing method that the present embodiment provides, when the low frequency focused curve of more sub-regions in same focusing section In simultaneously in the presence of the curve that steeply rises condition and drastically decline is met, then further compare the curve that steeply rises and drastically under The magnitude relationship of the curved line number of drop, and find focal position according to the big focusing curve of quantity.Avoid utilizing whole image Spurious peaks in focusing curve on curve are disturbed to caused by focusing, so as to improve the application that multiple peak values be present in focusing curve The degree of accuracy of scene figure below image focu.
For foregoing each method embodiment, in order to be briefly described, therefore it is all expressed as to a series of combination of actions, but It is that those skilled in the art should know, the present invention is not limited by described sequence of movement, because according to the present invention, certain A little steps can use other orders or carry out simultaneously.Secondly, those skilled in the art should also know, be retouched in specification The embodiment stated belongs to preferred embodiment, necessary to involved action and the module not necessarily present invention.
Corresponding to above-mentioned auto focusing method embodiment, present invention also offers autofocus embodiment.
Fig. 7 is referred to, shows a kind of block diagram of autofocus of the embodiment of the present invention, the device is applied to Fig. 4 institutes In the central processing unit 140 shown, during using autofocus mechanism shooting image shown in Fig. 4, image to be captured is divided into M*N Sub-regions, wherein, M and N are the integer more than 1.
As shown in fig. 7, the device includes:Focusing search range acquisition module 110, the first definition evaluation of estimate acquisition module 120th, slope acquisition module 130, the first statistical module 140, the first judge module 150 and the first determining module 160.
Focusing search range acquisition module 110, for obtaining focusing search range;
Focusing search range is focus motor position and minimum thing corresponding to the infinity object distance of the current zoom position of camera lens Away from the position range between corresponding focus motor position.Focusing search range is divided at least two according to the first default step-length Section is focused on, it is from focal position i-1 to focal position i interval range, the focal position i that any one, which focuses on section I, Increase focal position corresponding to one first default step-length according to the first default adjustment direction for focal position i-1, and i is just whole Number.
First definition evaluation of estimate acquisition module 120, for obtaining M*N sub-regions respectively present convergence location i's Low frequency definition evaluation of estimate.
Present convergence location i can be obtained directly according to the motor drive module of focus motor.
Slope acquisition module 130, for for focusing on section I, the every sub-regions for obtaining the image to be captured to be corresponding The slope of focusing curve.
In a kind of possible implementation of the present invention, slope acquisition module includes:First calculating sub module, second calculate Submodule and the 3rd calculating sub module;
First calculating sub module, for any one subregion for the image to be captured, calculate the son First difference of definition evaluation of estimate of the region in focal position i and the definition evaluation of estimate in focal position i-1;
Second calculating sub module, position is being focused on subregion for when the first difference is more than 0, calculating the first difference The ratio of i-1 definition evaluation of estimate is put, obtains the rate of rise of the subregion in the focusing section I;
3rd calculating sub module, for when the first difference is less than 0, calculating the absolute value and subregion of the first difference In the ratio of focal position i-1 definition evaluation of estimate, obtain the subregion and focusing on the descending slope in the I of section.
First statistical module 140, for for focusing on section I, it is big to count the focusing curve rate of rise in M*N sub-regions It is more than the subregion of the first preset value in the first quantity X of the subregion of the first preset value, and focusing curve descending slope Second quantity Y;
First judge module 150, for judging the magnitude relationship of X and Y corresponding to focusing section I;If focus on I pairs of section The X answered is more than Y, then present convergence location i is increased into one first default step-length according to the first default adjustment direction, reach focusing Position i+1, and continue to compare the magnitude relationship for focusing on X and Y corresponding to the I+1 of section.
In the alternatively possible implementation of the present invention, the first judge module 150 is additionally operable to:When I+1 pairs of section of focusing When the X and Y answered is all higher than 0 and X and is more than Y, continue to judge the magnitude relationship for focusing on X and Y corresponding to the I+2 of section, it is full until finding Focusing sections of the sufficient Y more than X or the boundary position that the focusing search range is adjusted to according to the first default adjustment direction.
First determining module 160, for when Y corresponding to focusing section I+1 is more than X, determining focal position i+1 to make to treat The low frequency part of the shooting image clearly clear focal position of low frequency.
The autofocus that the present embodiment provides, during focus on automatically, image to be captured is divided into M*N sub-regions, M*N sub-regions are obtained in low frequency definition evaluation of estimate corresponding to present convergence location.According to figure to be captured The low frequency definition evaluation of estimate of each sub-regions of picture determines effective subregion (focusing curve in two neighboring focusing section The subregion for meeting drastically to decline after first steeply rising is effective subregion), using the focal position of effective subregion as whole The focal position of image, the spurious peaks in the focusing curve using whole image on curve are avoided to be disturbed to caused by focusing, from And improve the degree of accuracy that application scenarios figure below image focu of multiple peak values in focusing curve be present.
In another application scenarios of the present invention, if after traveling through whole coarse adjustment focusing search range, do not meet drastically Rise and drastically decline the subregion of condition.Then judge whether the subregion for slowly rising with slowly declining condition.
Fig. 8 is referred to, shows the block diagram of another kind autofocus of the embodiment of the present invention, the device is on Fig. 7 bases On also include:Second statistical module 210, the second judge module 220 and the second determining module 230.
Second statistical module 210, for when being more than institute in the absence of the focusing curve rate of rise in the focusing search range When stating the subregion of the first preset value, count and the focusing curve rate of rise be present more than the second preset value in focusing section I 3rd quantity x of subregion, and focusing curve descending slope are more than the 4th quantity y of the subregion of second preset value, Wherein, the second preset value is less than the first preset value.
Second judge module 220, for judging the magnitude relationship of x and y corresponding to focusing section I;If focus on I pairs of section The x answered is more than y, then continues to compare the magnitude relationship for focusing on x and y corresponding to the I+1 of section;
Second determining module 230, for being more than x as y corresponding to focusing section I+1, it is determined that focal position i+1 is described The clear focal position of low frequency.
The autofocus that the present embodiment provides, after whole coarse adjustment focusing search range is traveled through, does not meet drastically Rise and drastically decline the subregion of condition, then judge whether the subregion for slowly rising and slowly declining, if there is Meet the focusing section for slowly rising and slowly declining, after whole coarse adjustment focusing search range is traveled through, do not meet on drastically The subregion of condition is risen and drastically declined, then according to the focusing section for meeting slowly to rise and slowly decline, determines that coarse adjustment gathers Burnt position.Avoid can not find and meet when steeply rising and drastically declining the subregion of condition, clearly focal position can not be obtained Phenomenon occur, so as to improve the degree of accuracy focused on automatically.
In the alternatively possible implementation of the present invention, it is low to carry out coarse adjustment focusing acquisition using low frequency definition evaluation of estimate After the clear focal position of frequency, continue with high frequency definition evaluation of estimate and carry out fine tuning focusing, finally obtained with fine tuning focusing The clear focal position of high frequency as final focal position.
Fig. 9 is referred to, shows the block diagram of another autofocus of the embodiment of the present invention, base of the device in Fig. 7 Also include on plinth:Second definition evaluation of estimate acquisition module 310, focal position adjustment module 320, the and of slope computing module 330 3rd determining module 340.
Second definition evaluation of estimate acquisition module 310, for obtaining what is shot at the clear focal position i+1 of the low frequency The high frequency definition evaluation of estimate of the whole image to be captured.
Focal position adjustment module 320, for focal position to be preset into adjustment according to second from the clear focal position of low frequency Direction increases by one second default step-length, obtains focal position i+x1.
Second definition evaluation of estimate acquisition module 310, it is additionally operable to obtain the whole of shooting at focal position i+x1 and waits to clap Take the photograph the high frequency definition evaluation of estimate of image.
Slope computing module 330, for calculating whole image to be captured in the area from focal position i+1 to focal position i+x1 Interior first slope.
Focal position adjusting module 320, for being the rate of rise when first slope, and when being more than the first preset value, continue Focal position i+x1 is increased into one second default step-length according to the second default adjustment direction, obtains focal position i+x2.
Second definition evaluation of estimate acquisition module 310, it is additionally operable to obtain the whole to be captured of focal position i+x2 place shooting The high frequency definition evaluation of estimate of image.
The slope computing module 330, it is additionally operable to calculate whole image to be captured from focal position i+x1 to focusing position Put the second slope in i+x2 sections.
3rd determining module 340, for when the second slope be descending slope, and is more than the first preset value, it is determined that focusing Position i+x1 is to make the HFS of the image to be captured clearly clear focal position of high frequency.
The autofocus that the present embodiment provides, low frequency is determined in focusing search range by coarse adjustment focusing After clear focal position, recycle the high frequency focusing curve of whole image to be captured really to find and meanwhile meet to steeply rise with drastically The low frequency focused position of decline condition, and the low frequency focused position is defined as final focal position.High frequency focusing curve Slope is bigger, and the span in focal position direction of high frequency focusing curve is smaller, therefore, is found using high frequency focusing curve High frequency focal position is more accurate, improves the accuracy focused on automatically.
It should be noted that each embodiment in this specification is described by the way of progressive, each embodiment weight Point explanation is all difference with other embodiment, between each embodiment identical similar part mutually referring to. For device class embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is joined See the part explanation of embodiment of the method.
Described above is only the preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improvements and modifications also should It is considered as protection scope of the present invention.

Claims (10)

  1. A kind of 1. auto focusing method, it is characterised in that image to be captured is divided into M*N sub-regions, wherein, M and N are Integer more than 1, methods described include:
    Focusing search range is obtained, and the focusing search range is divided at least two focusing sections, wherein, focus on section I is default according to first for focal position i-1 to focal position i interval range, the focal position i from focal position i-1 Adjustment direction increases focal position corresponding to one first default step-length, and i is positive integer;
    Low frequency definition evaluation of estimate of the M*N sub-regions at present convergence location i is obtained respectively;
    For focusing on section I, the every sub-regions for obtaining the image to be captured correspond to the slope of focusing curve, statistics M*N The focusing curve rate of rise is more than the first quantity X of the subregion of the first preset value, and drop angle under focusing curve in subregion Rate is more than the second quantity Y of the subregion of first preset value;
    Judge the magnitude relationship of focusing X and Y corresponding to the I of section;
    If focusing X corresponding to the I of section is more than Y, by the present convergence location i according to the described first default adjustment side To one described first default step-length of increase, reach focal position i+1, and continue to compare and focus on X and Y corresponding to the I+1 of section Magnitude relationship, the focusing section I+1 are from focal position i to focal position i+1 interval range;
    If focusing Y corresponding to the I+1 of section is more than X, it is determined that the focal position i+1 is to make the image to be captured The low frequency part clearly clear focal position of low frequency.
  2. 2. according to the method for claim 1, it is characterised in that methods described also includes:
    If focusing X and Y corresponding to the I+1 of section is all higher than 0 and X and is more than Y, continue to judge to focus on corresponding to the I+2 of section X and Y magnitude relationship, meet focusing sections of the Y more than X until finding or be adjusted to institute according to the described first default adjustment direction State the boundary position of focusing search range.
  3. 3. method according to claim 1 or 2, it is characterised in that methods described also includes:
    If the subregion that the focusing curve rate of rise is more than first preset value is not present in the focusing search range, Then there is threeth quantity x of the focusing curve rate of rise more than the subregion of the second preset value in statistics in focusing section I, and Focusing curve descending slope is more than the 4th quantity y of the subregion of second preset value, wherein, second preset value is less than First preset value;
    Judge the magnitude relationship of focusing x and y corresponding to the I of section;
    If focusing x corresponding to the I of section is more than y, continue to compare the magnitude relationship for focusing on x and y corresponding to the I+1 of section;
    If focusing y corresponding to the I+1 of section is more than x, it is determined that the focal position i+1 is that the low frequency clearly focuses on position Put.
  4. 4. method according to claim 1 or 2, it is characterised in that if be more than in focusing Y corresponding to the I+1 of section X, it is determined that the focal position i+1 be make the low frequency part of the image to be captured clearly the clear focal position of low frequency it Afterwards, methods described also includes:
    Obtain the high frequency definition evaluation of the whole image to be captured shot at the clear focal position i+1 of low frequency Value;
    Focal position is increased into one described second according to the second default adjustment direction from the clear focal position of the low frequency to preset Step-length, focal position i+x1 is obtained, obtain the high frequency of the whole image to be captured shot at the focal position i+x1 Definition evaluation of estimate;
    The whole image to be captured is calculated in the first slope from focal position i+1 to focal position i+x1 in section;
    If the first slope is the rate of rise, and is more than first preset value, then continue the focal position i+x1 Increase by one described second default step-length according to the described second default adjustment direction, obtain focal position i+x2, obtain described poly- The high frequency definition evaluation of estimate of the whole image to be captured shot at burnt position i+x2;
    The whole image to be captured is calculated in the second slope from focal position i+x1 to focal position i+x2 in section;
    If second slope is descending slope, and is more than first preset value, it is determined that the focal position i+x1 is Make the HFS of the image to be captured clearly clear focal position of high frequency.
  5. 5. according to the method for claim 1, it is characterised in that it is described for focusing on section I, obtain each subregion The slope of corresponding focusing curve, including:
    For any one subregion in the image to be captured, the low frequency for calculating the subregion in focal position i is clear Spend evaluation of estimate and the first difference between focal position i-1 low frequency definition evaluation of estimate;
    If first difference is more than 0, the definition of first difference and the subregion in focal position i-1 is calculated The ratio of evaluation of estimate, obtain the rate of rise of the subregion in the focusing section I;
    If first difference is less than 0, the absolute value of first difference is calculated with the subregion in focal position i-1 Definition evaluation of estimate ratio, obtain descending slope of the subregion in the focusing section I.
  6. A kind of 6. autofocus, it is characterised in that image to be captured is divided into M*N sub-regions, wherein, M and N are Integer more than 1, described device include:
    Focusing search range acquisition module, it is divided at least for obtaining focusing search range, and by the focusing search range Two focusing sections, wherein, it is from focal position i-1 to focal position i interval range, the focal position i to focus on section I Increase focal position corresponding to one first default step-length according to the first default adjustment direction for focal position i-1, and i is just whole Number;
    First definition evaluation of estimate acquisition module, it is clear for obtaining low frequency of the M*N sub-regions in present convergence location i respectively Spend evaluation of estimate;
    Slope acquisition module, for for focusing on section I, the every sub-regions for obtaining the image to be captured to correspond to focusing curve Slope;
    First statistical module, for for the focusing section I, counting the focusing curve rate of rise in M*N sub-regions and being more than First quantity X of the subregion of the first preset value, and focusing curve descending slope are more than the subregion of first preset value The second quantity Y;
    First judge module, for judging the magnitude relationship of focusing X and Y corresponding to the I of section;If the focusing section I Corresponding X is more than Y, then by the present convergence location i according to the described first default adjustment direction increase by one it is described first pre- If step-length, reach focal position i+1, and continue to compare the magnitude relationship for focusing on X and Y corresponding to the I+1 of section, the focusing section I+1 is from focal position i to focal position i+1 interval range;
    First determining module, for when Y is more than X corresponding to the I+1 of section for the focusing, determining that the focal position i+1 is to make The low frequency part of the image to be captured clearly clear focal position of low frequency.
  7. 7. device according to claim 6, it is characterised in that first judge module is additionally operable to:
    When focusing X and Y corresponding to the I+1 of section, which is all higher than 0 and X, is more than Y, continue to judge to focus on X corresponding to the I+2 of section With Y magnitude relationship, meet focusing sections of the Y more than X until finding or be adjusted to institute according to the described first default adjustment direction State the boundary position of focusing search range.
  8. 8. the device according to claim 6 or 7, it is characterised in that described device also includes:
    Second statistical module, for pre- more than described first when the focusing curve rate of rise is not present in the focusing search range If during the subregion of value, count and the focusing curve rate of rise be present more than the subregion of the second preset value in focusing section I 3rd quantity x, and focusing curve descending slope are more than the 4th quantity y of the subregion of second preset value, wherein, it is described Second preset value is less than first preset value;
    Second judge module, for judging the magnitude relationship of focusing x and y corresponding to the I of section;If the focusing section I Corresponding x is more than y, then continues to compare the magnitude relationship for focusing on x and y corresponding to the I+1 of section;
    Second determining module, for being more than x as focusing y corresponding to the I+1 of section, it is determined that the focal position i+1 is institute State the clear focal position of low frequency.
  9. 9. the device according to claim 6 or 7, it is characterised in that described device also includes:
    Second definition evaluation of estimate acquisition module, for obtaining the whole institute shot at the clear focal position i+1 of the low frequency State the high frequency definition evaluation of estimate of image to be captured;
    Focal position adjustment module, for focal position to be preset into adjustment direction according to second from the clear focal position of the low frequency The default step-length of increase by one described second, obtains focal position i+x1;
    The second definition evaluation of estimate acquisition module, be additionally operable to obtain the focal position i+x1 at shoot it is whole described in The high frequency definition evaluation of estimate of image to be captured;
    Slope computing module, for calculating the whole image to be captured in the section from focal position i+1 to focal position i+x1 Interior first slope;
    The focal position adjusting module, for being the rate of rise when the first slope, and when being more than first preset value, Continue the focal position i+x1 increasing by one described second default step-length according to the described second default adjustment direction, gathered Burnt position i+x2;
    The second definition evaluation of estimate acquisition module, is additionally operable to obtain that shot at the focal position i+x2 whole is described treats The high frequency definition evaluation of estimate of shooting image;
    The slope computing module, it is additionally operable to calculate the whole image to be captured from focal position i+x1 to focal position i+ The second slope in x2 sections;
    3rd determining module, for being descending slope when second slope, and when being more than first preset value, it is determined that described Focal position i+x1 is to make the HFS of the image to be captured clearly clear focal position of high frequency.
  10. 10. device according to claim 6, it is characterised in that the slope acquisition module includes:
    First calculating sub module, for for any one of subregion, calculating the subregion in the clear of focal position i Spend the first difference of evaluation of estimate and the definition evaluation of estimate in focal position i-1;
    Second calculating sub module, for when first difference is more than 0, calculating first difference with the subregion poly- The ratio of burnt position i-1 definition evaluation of estimate, obtain the rate of rise of the subregion in the focusing section I;
    3rd calculating sub module, for when first difference is less than 0, calculating the absolute value of first difference and the son Region obtains lower drop angle of the subregion in the focusing section I in the ratio of focal position i-1 definition evaluation of estimate Rate.
CN201610864820.4A 2016-09-29 2016-09-29 Automatic focusing method and device Active CN107888819B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610864820.4A CN107888819B (en) 2016-09-29 2016-09-29 Automatic focusing method and device
PCT/CN2017/098301 WO2018059158A1 (en) 2016-09-29 2017-08-21 Auto-focusing method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610864820.4A CN107888819B (en) 2016-09-29 2016-09-29 Automatic focusing method and device

Publications (2)

Publication Number Publication Date
CN107888819A true CN107888819A (en) 2018-04-06
CN107888819B CN107888819B (en) 2020-07-07

Family

ID=61763109

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610864820.4A Active CN107888819B (en) 2016-09-29 2016-09-29 Automatic focusing method and device

Country Status (2)

Country Link
CN (1) CN107888819B (en)
WO (1) WO2018059158A1 (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109218718A (en) * 2018-10-31 2019-01-15 广州立景创新科技有限公司 Auto-focusing adjustment method, device, equipment and storage medium
CN112672039A (en) * 2020-12-07 2021-04-16 北京集光通达科技股份有限公司 Multi-zone-based active focusing conversion method and equipment
CN113747041A (en) * 2020-05-29 2021-12-03 杭州海康威视数字技术股份有限公司 Camera focusing method and focusing method based on recurrent neural network
CN113776788A (en) * 2021-11-05 2021-12-10 武汉普赛斯电子技术有限公司 Parameter testing method and device for laser
CN113905181A (en) * 2021-11-16 2022-01-07 福州鑫图光电有限公司 Automatic focusing method and terminal
CN114022484A (en) * 2022-01-10 2022-02-08 深圳金三立视频科技股份有限公司 Image definition value calculation method and terminal for point light source scene
CN114697531A (en) * 2020-12-30 2022-07-01 深圳中科飞测科技股份有限公司 Focusing method and system, equipment and storage medium
CN114697524A (en) * 2020-12-30 2022-07-01 浙江宇视科技有限公司 Automatic focusing method, device, electronic apparatus and medium
CN115242965A (en) * 2022-05-06 2022-10-25 福建星网智慧软件有限公司 Automatic focusing method, device, equipment and medium for variable step length of camera
CN116866715A (en) * 2023-07-24 2023-10-10 微创优通医疗科技(上海)有限公司 Automatic focusing method of endoscope, electronic device and readable storage medium
CN117097984A (en) * 2023-09-26 2023-11-21 武汉华工激光工程有限责任公司 Camera automatic focusing method and system based on calibration and compound search

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113382155B (en) * 2020-03-10 2023-02-28 浙江宇视科技有限公司 Automatic focusing method, device, equipment and storage medium
CN112525909A (en) * 2020-12-03 2021-03-19 湖南伊鸿健康科技有限公司 Automatic focusing method of electron microscope
CN114119555B (en) * 2021-11-29 2024-05-17 哈尔滨工业大学 Large-caliber element edge detection method based on object distance focusing method
CN114401363B (en) * 2021-12-31 2024-02-27 山东信通电子股份有限公司 Control method and equipment for transmission line monitoring equipment
CN114245023B (en) * 2022-02-24 2022-06-03 浙江华创视讯科技有限公司 Focusing processing method and device, camera device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080151097A1 (en) * 2006-12-22 2008-06-26 Industrial Technology Research Institute Autofocus searching method
CN101713903A (en) * 2005-11-28 2010-05-26 佳能株式会社 Optical apparatus
CN102200674A (en) * 2010-03-23 2011-09-28 三星电子株式会社 Imaging apparatus performing auto focusing function with plurality of band pass filters and auto focusing method applied to the same
CN105472250A (en) * 2015-12-23 2016-04-06 浙江宇视科技有限公司 Automatic focusing method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101950116B (en) * 2010-09-14 2012-08-08 浙江工业大学 Video automatic focusing method applied to multi-main-body scene
CN105785561B (en) * 2014-12-22 2018-04-03 杭州舜立光电科技有限公司 A kind of digital microscope and its focus method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101713903A (en) * 2005-11-28 2010-05-26 佳能株式会社 Optical apparatus
US20080151097A1 (en) * 2006-12-22 2008-06-26 Industrial Technology Research Institute Autofocus searching method
CN102200674A (en) * 2010-03-23 2011-09-28 三星电子株式会社 Imaging apparatus performing auto focusing function with plurality of band pass filters and auto focusing method applied to the same
CN105472250A (en) * 2015-12-23 2016-04-06 浙江宇视科技有限公司 Automatic focusing method and device

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109218718B (en) * 2018-10-31 2020-09-08 广州立景创新科技有限公司 Automatic focusing debugging method, device, equipment and storage medium
CN109218718A (en) * 2018-10-31 2019-01-15 广州立景创新科技有限公司 Auto-focusing adjustment method, device, equipment and storage medium
CN113747041A (en) * 2020-05-29 2021-12-03 杭州海康威视数字技术股份有限公司 Camera focusing method and focusing method based on recurrent neural network
CN113747041B (en) * 2020-05-29 2023-06-06 杭州海康威视数字技术股份有限公司 Camera focusing method and focusing method based on cyclic neural network
CN112672039B (en) * 2020-12-07 2022-06-28 北京集光通达科技股份有限公司 Multi-zone active transformation focusing method and equipment
CN112672039A (en) * 2020-12-07 2021-04-16 北京集光通达科技股份有限公司 Multi-zone-based active focusing conversion method and equipment
CN114697524B (en) * 2020-12-30 2023-05-02 浙江宇视科技有限公司 Automatic focusing method, device, electronic equipment and medium
CN114697531A (en) * 2020-12-30 2022-07-01 深圳中科飞测科技股份有限公司 Focusing method and system, equipment and storage medium
CN114697524A (en) * 2020-12-30 2022-07-01 浙江宇视科技有限公司 Automatic focusing method, device, electronic apparatus and medium
CN113776788A (en) * 2021-11-05 2021-12-10 武汉普赛斯电子技术有限公司 Parameter testing method and device for laser
CN113905181A (en) * 2021-11-16 2022-01-07 福州鑫图光电有限公司 Automatic focusing method and terminal
CN114022484B (en) * 2022-01-10 2022-04-29 深圳金三立视频科技股份有限公司 Image definition value calculation method and terminal for point light source scene
CN114022484A (en) * 2022-01-10 2022-02-08 深圳金三立视频科技股份有限公司 Image definition value calculation method and terminal for point light source scene
CN115242965A (en) * 2022-05-06 2022-10-25 福建星网智慧软件有限公司 Automatic focusing method, device, equipment and medium for variable step length of camera
CN115242965B (en) * 2022-05-06 2024-05-31 福建星网智慧软件有限公司 Variable-step-length automatic focusing method, device, equipment and medium for camera
CN116866715A (en) * 2023-07-24 2023-10-10 微创优通医疗科技(上海)有限公司 Automatic focusing method of endoscope, electronic device and readable storage medium
CN116866715B (en) * 2023-07-24 2024-04-26 微创优通医疗科技(上海)有限公司 Automatic focusing method of endoscope, electronic device and readable storage medium
CN117097984A (en) * 2023-09-26 2023-11-21 武汉华工激光工程有限责任公司 Camera automatic focusing method and system based on calibration and compound search
CN117097984B (en) * 2023-09-26 2023-12-26 武汉华工激光工程有限责任公司 Camera automatic focusing method and system based on calibration and compound search

Also Published As

Publication number Publication date
WO2018059158A1 (en) 2018-04-05
CN107888819B (en) 2020-07-07

Similar Documents

Publication Publication Date Title
CN107888819A (en) A kind of auto focusing method and device
KR102032882B1 (en) Autofocus method, device and electronic apparatus
CN108496350B (en) Focusing processing method and device
CN108076278B (en) Automatic focusing method and device and electronic equipment
TWI515470B (en) Auto-focus system for multiple lens and method thereof
US9992478B2 (en) Image processing apparatus, image pickup apparatus, image processing method, and non-transitory computer-readable storage medium for synthesizing images
TWI511081B (en) Image capturing device and method for calibrating image deformation thereof
TWI471677B (en) Auto focus method and auto focus apparatus
CN108881729A (en) A kind of Atomatic focusing method of endoscope
JP6537083B2 (en) Method and imager for automatic focusing
CN105430279A (en) Quick and automatic focusing method and device for camera
US9619886B2 (en) Image processing apparatus, imaging apparatus, image processing method and program
TW201312249A (en) Image processing system and automatic focusing method
CN105391945A (en) Automatic focusing control method and device of camera
US20150201182A1 (en) Auto focus method and auto focus apparatus
US8433187B2 (en) Distance estimation systems and method based on a two-state auto-focus lens
CN105554387A (en) Zoom tracking curve correction method and device
CN105430277A (en) Automatic focusing control method and device
RU2389050C1 (en) Automatic focusing method
TWI515471B (en) Auto-focus system for multiple lens and method thereof
JP6136019B2 (en) Moving image photographing apparatus and focusing method of moving image photographing apparatus
US10999491B2 (en) Control apparatus, image capturing apparatus, control method, and storage medium
JPH05300421A (en) Automatic focusing device
CN105959577A (en) Camera focusing method and apparatus
CN110839126A (en) Zoom tracking method and device and zoom camera

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
GR01 Patent grant
GR01 Patent grant