CN110324536A - A kind of image change automatic sensing focusing method for micro- camera - Google Patents

A kind of image change automatic sensing focusing method for micro- camera Download PDF

Info

Publication number
CN110324536A
CN110324536A CN201910764039.3A CN201910764039A CN110324536A CN 110324536 A CN110324536 A CN 110324536A CN 201910764039 A CN201910764039 A CN 201910764039A CN 110324536 A CN110324536 A CN 110324536A
Authority
CN
China
Prior art keywords
value
scene
image
object selection
focusing
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
CN201910764039.3A
Other languages
Chinese (zh)
Other versions
CN110324536B (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.)
Hangzhou Touptek Photoelectric Technology Co Ltd
Original Assignee
Hangzhou Touptek Photoelectric 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 Hangzhou Touptek Photoelectric Technology Co Ltd filed Critical Hangzhou Touptek Photoelectric Technology Co Ltd
Priority to CN201910764039.3A priority Critical patent/CN110324536B/en
Publication of CN110324536A publication Critical patent/CN110324536A/en
Application granted granted Critical
Publication of CN110324536B publication Critical patent/CN110324536B/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
    • H04N23/673Focus control based on electronic image sensor signals based on contrast or high frequency components of image signals, e.g. hill climbing method

Landscapes

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

Abstract

The invention discloses a kind of image change automatic sensing focusing methods for micro- camera, comprising the following steps: defines several scenes state according to the variable condition of brightness of image and object selection value;Monitor the brightness of image of current scene and the real-time change situation of object selection value, scene state locating for current scene is determined according to the real-time change situation of brightness of image and object selection value, focusing monitoring strategies corresponding with the scene state are used according to scene state, the focusing monitoring strategies include: to restore to stablize to brightness of image and/or object selection value, into single focus process;Single focus process is executed based on search by hill climbing method, determines best focus position.The image change automatic sensing focusing method can use automatically different focusing strategies according to different focus scene, to promote focusing accuracy.

Description

A kind of image change automatic sensing focusing method for micro- camera
Technical field
The invention belongs to micro- camera Autofocus Technology fields, and in particular to a kind of image change for micro- camera Automatic sensing focusing method.
Background technique
Autofocus Technology is by modern microelectronic technology, digital image processing techniques and mechanical control method, with number The clarity of word method evaluation goal scene replaces manual focusing with automatic focusing, finally makes one kind of system blur-free imaging Technology.Autofocus Technology is widely used in the fields such as machine vision, military affairs, safety monitoring, smart phone, and gradually sends out Transform into Yi Menji it is light, mechanical, electrical, calculate in one complex technology.
The Atomatic focusing method of early stage has telemetry and focusing test method.Wherein, telemetry includes ultrasonic distance measurement method, infrared survey Away from method, laser ranging method and triangle telemetry etc..Focusing test method mainly includes contrast detection method, phase difference detection method etc..Contrast inspection Survey method and phase-detection method Autofocus Technology are usually used in slr camera, and other methods are then since system realizes complicated and accuracy It is not high, it is not necessarily suitable industrial circle.
Most widely used currently based on the Atomatic focusing method of Digital Image Processing, it includes Depth from defocus and to depth of focus Degree method two major classes.Depth from defocus is a kind of method of the acquirement depth information to complete auto-focusing, institute from out-of-focus image Need image and calculation amount small, focusing speed is fast, but since Depth from defocus requires to establish the approximate imaging system estimated in advance Mathematical model, therefore precision of focusing is not high enough.Focusing depth method needs a series of image at different focus positions, using one kind Suitable focusing evaluation function describes the clarity of image, corresponds to best focus position at evaluation function maximum value.
Focus search algorithm is one of the key technology of focusing depth method auto-focusing, and common algorithm has the method for exhaustion, climbs Mountain method, Fibonacci method, functional approaching.Search by hill climbing method is because effect is good and simple and easy is widely used.Search by hill climbing method Principle it is as follows: searched for since any, search often take a step forward, system can all acquire the image of corresponding position and calculate its figure As evaluation function value.If object selection value starts to reduce, changes direction of search reduction step-length and continue searching, search repeatedly Rope, until step-length is reduced to predetermined minimum, focusing terminates.Search by hill climbing method has some limitations: noise jamming causes There is local peaking in evaluation function curve, causes accidentally to focus.
Application publication number is that the patent application of CN 107509023A discloses a kind of auto-focusing searching algorithm, will be climbed the mountain Search method and functional approaching combine, and the search by hill climbing method in the algorithm uses the two-part algorithm of coarse-fine combination: rough When focusing, big step pitch considers the rapidity of algorithm, and gray variance function is selected quickly to approach focusing position;When fine focusing When, half step distance considers that the sensitivity of algorithm uses Laplacian function exact focus position.It is reduced by comparing 3 width pictures Focusing and fits best focusing position at section in minizone using functional approaching.The auto-focusing searching algorithm root Change the direction of search and adjustment step-size in search according to object selection value size, to shorten the auto-focusing time.
Above-mentioned is all single focusing method, and defect is after scene changes, and needs manual operation ability Realize focusing.
Summary of the invention
In view of above-mentioned problem, the present invention provides a kind of image change automatic sensing focusings for micro- camera Method, the image change automatic sensing focusing method are based on search by hill climbing method, increase to focusing scene monitoring function, Neng Gougen Different focusing strategies is used, automatically according to different focus scene to promote focusing accuracy.
The technical solution of the present invention is as follows:
A kind of image change automatic sensing focusing method for micro- camera, comprising the following steps:
Several scenes state is defined according to the variable condition of brightness of image and object selection value;
The brightness of image of current scene and the real-time change situation of object selection value are monitored, according to brightness of image and figure As the real-time change situation of evaluation function value determines scene state locating for current scene, used according to scene state and the scene The corresponding focusing monitoring strategies of state, the focusing monitoring strategies include: to restore to brightness of image and/or object selection value Stablize, into single focus process;
Single focus process is executed based on search by hill climbing method, determines best focus position.
This is for realizing single pair based on search by hill climbing method in the image change automatic sensing focusing method of micro- camera Burnt process carries out the monitoring of brightness of image and object selection value to scene image, according to image after single focusing The situation of change of brightness and object selection value, determines which kind of scene state the scene image of monitoring is in, according to different Scene state uses corresponding focusing monitoring strategies, when monitoring scene tend towards stability after automatic starting focusing again, improve pair Pyrogene exactness.
In the present invention, according to the situation of change of brightness of image and object selection value, 4 kinds of scene states are defined.Tool Body, the scene state includes:
Scene state I: brightness of image and object selection value remain unchanged in single focus process, show current scene It does not change;
Scene state II: brightness of image changes in single focus process, shows that current scene changes;
Scene state III: object selection value maximum value, and object selection value are searched in single focus process It changes, shows that current scene changes;
Scene state IV: after the completion of single focusing, object selection value changes, and shows that current scene becomes Change.
Above-mentioned 4 kinds of scene states are to summarize to obtain by many experiments, when scene is in scene state II, scene state When III and scene state IV, show that scene changes, needs to re-start focus process.
In the present invention, brightness of image is changed into the judgment criteria as scene state II, specifically, will focus last time terminates When brightness of image and current focus process in the changing value of the difference of brightness of image that calculates as brightness of image;
During scene monitoring, when the changing value of brightness of image is greater than threshold value ThrDifZL2, then it is assumed that brightness of image hair It is raw to change;The changing value of brightness of image is less than or equal to threshold value ThrDifZL2, then it is assumed that brightness of image remains unchanged.
On the basis of defining scene state, it can be based on the scene state type in practical applications, according to field The brightness of image of scape and the real-time change situation of object selection value carry out preliminary classification, specifically, the basis to scene The real-time change situation of brightness of image and object selection value determines that scene state locating for current scene includes:
Brightness of image changes, then current scene is marked to be in scene state II;
On the basis of searching object selection value maximum value, when the changing value of object selection value maximum value is big When threshold value ThrDifFV1, label current scene is in scene state III;
Brightness of image remains unchanged, and does not search object selection value maximum value or object selection value maximum value When changing value is less than or equal to threshold value ThrDifFV1, label current scene is in scene state I;
On the basis of searching object selection value maximum value, when the changing value of object selection value is greater than threshold value When ThrDifFV2, label current scene is in scene state IV;
The object selection value that will be searched in object selection value at the end of current focusing and current focus process Changing value of the difference of maximum value as object selection value maximum value.
After single is focused, determine to whether there is scene changes in single focus process, specifically, logical movement images are commented The changing value and threshold value ThrDifFV1 of valence functional value maximum value are realized, when the changing value of object selection value maximum value is greater than When threshold value ThrDifFV1, it is believed that scene is changed in focus process, exits current focusing.
After single focusing is exited, it is also necessary to which whether monitoring scene changes, and equally passes through brightness of image and picture appraisal The situation of change of functional value reacts scene situation of change.When the changing value of brightness of image is greater than threshold value ThrDifZL2 and image When the changing value of evaluation function value is greater than threshold value ThrDifFV2, it is believed that scene is changed.Since brightness of image and image are commented One statistical information of valence functional value certainly exists fluctuation, therefore the threshold value being arranged has to be larger than the maximum value of fluctuation.
Following situations occurs in order to prevent: such as under low-illumination scene, statistical information fluctuation is relatively large, it may appear that scene Do not become, but Rule of judgment meets, error starting of focusing.Therefore increase additional restrictive condition in the present invention: must be twice in succession All it is judged as that scene changes, just thinks that scene is veritably to be changed, i.e., judges current scene for scene continuous 2 times When state I I, scene state III or scene state IV, just determine current scene be really scene state II, scene state III or Scene state IV.
Scene state classification is to realize that the stability fundamental of focusing monitoring can be according to specific after determining scene state Scene state monitors the variation of corresponding brightness of image or object selection value, determines the opportunity of restarting focusing, in this way Focusing time can either be shortened, be also able to ascend focusing accuracy.
Change when monitoring scene, i.e., judgement scene state be scene state II, scene state III and scene shape When state IV, restart single focusing again after needing to wait scene stillness, otherwise can frequently restart focusing, it is of the invention according to figure Image brightness and the variation degree of object selection value determine whether scene is static.
In the present invention, when scene state is scene state II, the focusing monitoring strategies of use include:
During scene monitoring, when the brightness of image difference of adjacent two moment scene is less than threshold value ThrDifZL3, table The brightness of image of light field scape is restored to stablize, and restarting enters single focus process.
When scene state is scene state II, show that the brightness of image of scene is changed, such as sample moves The brightness of image of scene is caused to change, at this point, the focusing monitoring strategies used are the amplitudes of variation of detection image brightness, When brightness of image amplitude of variation very little shows that brightness of image tends towards stability, at this time automatically when being less than given threshold ThrDifZL3 Restarting focusing, avoids and manually restarts focusing, shortens focusing time, restarts again when brightness of image tends towards stability Focusing, also can guarantee the accuracy of focusing.
In the present invention, when scene state is scene state III, the focusing monitoring strategies of use include:
During scene monitoring, when the object selection value difference value of adjacent two moment scene is less than threshold value When ThrDifFV3, show that the object selection value of scene is restored to stablize, restarting enters single focus process.
In the present invention, when scene state is scene state IV, the focusing monitoring strategies of use include:
During scene monitoring, when the object selection value difference value of adjacent two moment scene is less than threshold value ThrDifFV3, i.e. the object selection value of scene restore after stablizing, and continue the variation for judging object selection value, when working as When changing value at the end of the preceding more last focusing of object selection value is greater than threshold value ThrDifFV2, restarting enters single Secondary focus process;
When scene state is scene state III and scene state IV, show that the object selection value of scene is changed Become.At this point, the focusing monitoring strategies used are the amplitudes of variation of detection image evaluation function value, for scene state III, only The amplitude of variation for sampling the object selection value at adjacent two moment is judged, when amplitude of variation very little, is less than given threshold When ThrDifFV3, show object selection value regional stability, focusing of resetting automatically at this time;For scene state IV, by After the definition of scene state IV is single focusing, object selection value changes, therefore, at adjacent two moment The amplitude of variation of object selection value is less than on the basis of given threshold ThrDifFV3, it is also necessary to judge object selection It is worth the changing value situation of maximum value, the changing value of object selection value maximum value is when being greater than threshold value ThrDifFV2, automatic weight New starting focusing, avoids and manually restarts focusing, shortening focusing time, restarts again pair when brightness of image tends towards stability Coke also can guarantee the accuracy of focusing.
When scene state is scene state I, continue the brightness of image and object selection value that monitor current scene Real-time change situation.
Preferably, threshold value ThrDifZL2 value is 150~200, and the value of threshold value ThrDifZL3 is 100~120, into one Step ground, threshold value ThrDifZL2 value are 200, and the value of threshold value ThrDifZL3 is 100.
Preferably, the object selection that threshold value ThrDifFV1, the selection of threshold value ThrDifFV2 and previous moment obtain The size of value has relationship, and general rule is, the object selection value that the size of threshold value ThrDifFV2 is obtained with previous moment Increase and increases.
In the present invention, in order to improve focusing efficiency, executed in single focus process based on search by hill climbing method, using change The way of search search of step-length indicates the object selection value maximum value of best focus position, detailed process are as follows:
Scene is divided into defocus region and focal zone according to object selection value size, in defocus region, using compared with Big step-size in search;In focal zone, the smaller step-size in search of use.
In the present invention, in order to improve focusing accuracy, executed in single focus process based on search by hill climbing method, it is also right The direction of search is modified, detailed process are as follows:
The average value of adjacent four steps object selection value is calculated twice in succession, if preceding four steps object selection value is flat Mean value be greater than rear four steps object selection value average value, indicate to defocus direction search for, then change the direction of search after It is continuous to find the object selection value maximum value for indicating best focus position.
In the present invention, object selection value, detailed process are calculated using high fdrequency component are as follows:
It is filtered using FIR filter V1, FIR of the iir filter H1 of horizontal direction, iir filter H2 and vertical direction Device V2 is filtered scene image, exports high fdrequency component;
Judged again by threshold value after taking absolute value to the high fdrequency component of output, statistics is more than that the high frequency of threshold gate limit value is logical Amount, obtains the statistical value of high fdrequency component;
Assuming that the statistical value of the high fdrequency component of region n corresponding four filters output is respectively H1_n, H2_n, V1_n, V2_n, then the two of region n group object selection value FV1_n and FV2_n is respectively as follows:
FV1_n=α × H1_n+ (1- α) × V1_n
FV2_n=β × H2_n+ (1- β) × V2_n
Wherein, wherein α, β are respectively weight coefficient.
The invention has the benefit that
Present invention energy automatic sensing direction of search in focus search, and be rapidly returned to after Search Error direction, subtract Small focusing time;
The present invention can be adaptive change step-length, select long step-length in defocus regional movement, focal zone selects when moving With small step-length, focusing speed is accelerated, small step length is taken to scan for can be improved focusing precision in focal zone;By right The expansion of object selection realizes the function that focusing can be also completed in the case where low image quality;
Present invention also adds focusing monitoring functions, pass through the monitoring to brightness of image and picture appraisal parameter value, energy Enough variations for more accurately judging scene, realize automatic focusing function;After focusing is exited, scene changes are monitored twice It is judged as that scene is really changed, avoids the influence that weak vibrations generate algorithm, realizes more stable scene prison Control function;After being judged as that scene changes, continue monitoring scene variation, until being judged as that scene stillness just restarts focusing, It avoids because being constantly in the state frequently focused during scene changes, improves the stability and accuracy of focusing.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to do simply to introduce, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art, can be with root under the premise of not making the creative labor Other accompanying drawings are obtained according to these attached drawings.
Fig. 1 is the flow chart for the single focusing that embodiment provides;
Fig. 2 is to judge different scenes state flow chart according to single focusing result;
Fig. 3 is that rear scene condition monitoring flow chart is exited in single focusing;
Fig. 4 is the calculating logic block diagram of object selection value.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention more comprehensible, with reference to the accompanying drawings and embodiments to this Invention is described in further detail.It should be appreciated that the specific embodiments described herein are only used to explain the present invention, And the scope of protection of the present invention is not limited.
Embodiment proposes a kind of image change automatic sensing focusing method for micro- camera, passes through monitoring strategies of focusing Monitoring image variation, restarts single focus process, and the function of auto-focusing is realized in the case where image change.
The image change automatic sensing focusing method for being used for micro- camera can be in the microfacies for being equipped with stepper motor It is realized in machine.Wherein motor whole process has 854 steps, and stepper motor can move on to specified according to image change automatic sensing focusing method Position captures different location image and finds optimum focusing position according to the criterion in image change automatic sensing focusing method It sets, that is, finds object selection value maximum value.
This is used for the specific implementation flow of the image change automatic sensing focusing method of micro- camera are as follows: starting is based on first The single of search by hill climbing method is focused, and after motor is successfully found best focus position, judges scene state, monitors plan into focusing Slightly, the variation of monitoring image brightness and object selection value after monitoring that image changes, is stablized to image change, Focus function is restarted again.
In the present embodiment, parameter 2 is referred to as using brightness of image as referred to as parameter 1, object selection value.Such as Fig. 1 It is shown, single focus process is executed based on search by hill climbing method, determines the process of best focus position are as follows:
S101 determines initial search direction.
7 are set by motor search first step step-length, two images is captured respectively, calculates 2 value of parameter of two images simultaneously Compare, initial search direction is set to the direction of the increase of parameter 2.
S102, motor variable step-size search.
It in order to improve focusing efficiency, is scanned for according to variable step-size search mode, specific search process are as follows:
Firstly, dividing defocus region and focal zone according to parameter 2;In the biggish step-size in search of defocus regional choice, So that motor is left defocus region within a short period of time, into focal zone, shortens in the unnecessary search in defocus region Between;Lesser step-size in search is then selected in focal zone, motor is made more accurately to search for best focal point;Meanwhile considering focusing The step-size in search of situation of the initial position of search near best focal point, focal zone can be segmented further, work as focusing The initial position of search first uses small step length searching, after continuously searching for 10 times, if not finding optimum focusing also in focal zone Point, then increase step-size in search.
In the present embodiment, the step-size in search of next step is determined according to 2 threshold value ThrFV of parameter and 2 current value of parameter:
Wherein, stepn+1For motor movement step next time, FVnFor the object selection value of n-th, i.e. parameter 2, ThrFV is 2 threshold value of parameter, which is defocus region and focal zone by motor movement region division, and parameter 2 is greater than the threshold value The region of ThrFV is focal zone, is otherwise defocus region.It is measured according to experiment, threshold value ThrFV=30.
In search process, the parameter 2 of continuous four width image is calculated, is denoted as FV respectively1、FV2、FV3、FV4, work as FV1<FV2> FV3>FV4And FV2When > ThrMaxFV, then judgement has found best focus position, FV2Corresponding picture position is exactly optimum focusing Position returns to best focus position.Threshold value ThrMaxFV, should be according to real image evaluation function for judging best focus position Value setting, the range that this threshold value can be chosen are to be less than optimum focusing peak value greater than local peaking, measure by experiment, ThrMaxFV=400.
S103, judges whether preceding 15 step searches best focus position, if preceding 15 step searches best focus position, returns Best focus position executes S104 if preceding 15 step does not search best focus position;
S104 is recorded and is judged that preceding 15 step captures the maximum value of the parameter 2 of image and whether is greater than given threshold ThrStartFV expands 2 value of parameter of subsequent searches areas captured image if the maximum value of parameter 2 is less than ThrStartFV 10 times big, then motor variable step continues searching, that is, jumps and execute S102;It, will if the maximum value of parameter 2 is greater than ThrStartFV The parameter 2 of subsequent searches areas captured image remains unchanged, then motor variable step continues searching, that is, jumps and execute S102.
Threshold value ThrStartFV is used to the size of substantially forecast image search global parameters 2, may be configured as and threshold value ThrMaxFV is equal.The case where best peak value evaluation function of image is too small when occurring, and is less than threshold value ThrMaxFV, can not lead at this time The criterion identification best focus position of S102 is crossed, therefore just needs to identify such case by given threshold ThrStartFV, To expand parameter 2, then carry out the judgement of S102.
S105 determines that this time focusing result is defocus if never searching best focus position, and focusing terminates, And exit this focus process.
In order to improve focusing accuracy, also motor movement direction, that is, direction of search is modified in search process, is made Motor to defocus range searching when turn to immediately, the specific method is as follows:
The average value of adjacent four steps parameter 2 is calculated twice in succession, if the average value of preceding four steps parameter 2 is greater than rear four steps parameter 2 average value indicates to search for toward defocus direction, then changes the direction of search and continually look for best focus position.
Experiment can voluntarily select to feel using ROI (Region of Interest, area-of-interest) focusing window The region of interest carries out auto-focusing.It divides the image into that 7*7 block equal area is for selection, can be realized the sample uneven to height Product are focused, and the interference that different object distances generate focusing is avoided, and realize exact focus.
In the present embodiment, using high fdrequency component calculating parameter 2.As shown in figure 4, wherein TH1, TH2, TH3, TH4 are respectively The threshold value of setting.First then original image is taken absolute value the output of filter by obtaining high fdrequency component after filter Judged again by threshold value thresholding afterwards, the participation more than threshold value counts, the statistical value of final output image high fdrequency component, using four Road high-pass filter, respectively the iir filter H1, iir filter H2 of horizontal direction and the FIR filter V1 of vertical direction, FIR filter V2.Assuming that the statistical value of region n corresponding four filters output is respectively H1_n, H2_n, V1_n, V2_n, then Two groups of evaluation function values FV1_n and FV2_n in the region can be calculated by following formula:
FV1_n=α × H1_n+ (1- α) × V1_n
FV2_n=β × H2_n+ (1- β) × V2_n
Wherein, α takes 0.45, β to take 0.85.
After single focusing, scene state is judged, into focusing monitoring strategies, monitoring image brightness and picture appraisal The variation of functional value after monitoring that image changes, is stablized, then restart focus function to image change.
In the present embodiment, scene state is divided into 4 kinds, is respectively as follows: scene state I: brightness of image in single focus process It is remained unchanged with object selection value, shows that current scene does not change;Scene state II: image in single focus process Brightness changes, and shows that current scene changes;Scene state III: picture appraisal letter is searched in single focus process Numerical value maximum value, and object selection value changes, and shows that current scene changes;Scene state IV: single focusing After the completion, object selection value changes, and shows that current scene changes.When monitoring that scene is in scene state When II, scene state III and scene state IV, show that scene changes, needs to be restarted automatically focus function.
Flow chart according to Fig.2, after single focusing, according to the variation of parameter 1 and parameter 2, by scene State preliminary classification, motor, which often makes a move, records the variation of parameter 1, judges whether the variation of parameter 1 is greater than given threshold, if Greater than threshold value, this shows that scene changes in focus process, then scene state preliminary classification is scene state II.Scene state The purpose of II setting is to judge whether sample moves during the focusing process, if sample is mobile, the variation of parameter 1 is greater than threshold Value ThrDifZL1, by experiment, threshold value is set as ThrDifZL1=2000.
After having monitored parameter 1 and having realized to the classification of scene state II, after waiting scene brightness to stablize, then to parameter 2 into Row monitoring, when not finding best focus position, preliminary judgement scene state is scene state I.
If finding best focus position in focus process, according to the present invention in improved search by hill climbing method, figure is being found As that can return at the peak value after evaluation function peak of curve, in the case where scene does not change, the figure at peak point is returned to As the maximum value recorded in evaluation function value and focus process is approximately equal, if two values have big difference, illustrate focus process Middle scene changes, and current location is not real focal position.Therefore, last focusing terminates 2 value of parameter returned The difference of 2 maximum value FV2 of parameter should be less than certain threshold value ThrDifFV1 in FV1 and focus process, if being more than threshold value, it may be assumed that
|FV1-FV2|>ThrDifFV1
Then marking scene state is scene state III, and otherwise marking scene state is scene state I.
It is tested according to experiment, is provided that threshold value ThrDifFV1 according to FV1 size
Flow chart according to Fig.3, after single is focused, enters different focus monitoring plan according to different scene states Slightly.If scene state is tentatively denoted as scene state I, continue monitoring parameters 1 and parameter 2, is calculated every time 0.2s primary The value FV2 of the value ZL2 of current scene parameter 1, parameter 2, respectively with last focusing at the end of the value ZL1 of parameter 1, parameter 2 Maximum value FV1 compares, when variation is more than certain threshold value, then it is assumed that scene is changed.The variation of parameter 1 is more than threshold value ThrDifZL2, note scene state are scene state II;The variation of parameter 2 is more than threshold value ThrDifFV2, and note scene state is scene State I V.It is shown below:
|ZL1-ZL2|>ThrDifZL2
|FV1-FV2|>ThrDifFV2
Parameter 1 and parameter 2 are a statistical informations, certainly exist fluctuation, therefore the threshold value being arranged has to be larger than fluctuation Maximum value.It is tested according to experiment, threshold value ThrDifZL2=200, ThrDifFV2 setting are as follows:
If scene state is denoted as scene state II, after waiting scene brightness to stablize, then single focus function is restarted.It is i.e. every A moment (such as the value ZL of a current scene parameter 1 is calculated every time 0.2s)T, and the ZL with last momentT-tCompare, When variation is less than threshold value, it may be assumed that
|ZLT-ZLT-t|<ThrDifZL3
It is static then to think that scene tends towards stability, restarting focusing.It is tested according to experiment, 1 change threshold of parameter ThrDifZL3=100.
If scene state is denoted as scene state III, after waiting scene evaluation function value to stablize, then single focusing function is restarted Energy.I.e. each moment (such as calculates the value FV of a current scene parameter 2 every time t=0.2s)T, and with last moment The value FV of parameter 2T-tCompare, when variation is less than threshold value, it may be assumed that
|FVT-FVT-t|<ThrDifFV3
It is static then to think that scene tends towards stability, restarting focusing.It is tested according to experiment, 2 change threshold of parameter ThrDifFV3=20.
If scene state is denoted as scene state IV, scene evaluation function value is waited to stablize, i.e. the variation of parameter 2 is less than certain Threshold value ThrDifFV3, in order to prevent some weak vibrations cause focusing frequently restart, judge the parameter 2 of present image again The relatively last focusing of value at the end of parameter 2 value variation, if still meeting scene changes condition, (variation is less than threshold Value ThrDifFV2), then it is assumed that the scene is changed really, otherwise restarting focusing is considered as scene and does not become, is i.e. scene State is 1, and goes successively to focusing monitoring.
In above-mentioned image change automatic sensing focusing method, the energy automatic sensing direction of search in focus search, and searching for It is rapidly returned to after wrong way, reduces focusing time;Step-length can also adaptively be changed, selected in defocus regional movement Long step-length, focal zone select small step-length when moving, accelerate focusing speed, and small step length is taken to scan in focal zone It can be improved focusing precision;By the expansion to object selection, realizing can also complete to focus in the case where low image quality Function,
Meanwhile increasing focusing monitoring method by the monitoring to image parameter 1 and parameter 2, it can more accurately Judge the variation of scene, realizes automatic focusing function;After focusing is exited, scene changes are monitored twice and are just judged as that scene is true Positive having occurred changes, and avoids the influence that weak vibrations generate algorithm, realizes more stable scene monitoring function;It is judged as After scene changes, continue monitoring scene variation, until being judged as that scene stillness just restarts focusing, avoids because of scene It is constantly in the state frequently focused in change procedure, improves the stability and accuracy of focusing.
Technical solution of the present invention and beneficial effect is described in detail in above-described specific embodiment, Ying Li Solution is not intended to restrict the invention the foregoing is merely presently most preferred embodiment of the invention, all in principle model of the invention Interior done any modification, supplementary, and equivalent replacement etc. are enclosed, should all be included in the protection scope of the present invention.

Claims (10)

1. a kind of image change automatic sensing focusing method for micro- camera, comprising the following steps:
Several scenes state is defined according to the variable condition of brightness of image and object selection value;
The brightness of image of current scene and the real-time change situation of object selection value are monitored, is commented according to brightness of image and image The real-time change situation of valence functional value determines scene state locating for current scene, is used and the scene state according to scene state Corresponding focusing monitoring strategies, the focusing monitoring strategies include: to restore steady to brightness of image and/or object selection value It is fixed, into single focus process;
Single focus process is executed based on search by hill climbing method, determines best focus position.
2. being used for the image change automatic sensing focusing method of micro- camera as described in claim 1, which is characterized in that described Scene state includes:
Scene state I: brightness of image and object selection value remain unchanged in single focus process, show that current scene is not sent out Changing;
Scene state II: brightness of image changes in single focus process, shows that current scene changes;
Scene state III: object selection value maximum value is searched in single focus process, and object selection value occurs Change, shows that current scene changes;
Scene state IV: after the completion of single focusing, object selection value changes, and shows that current scene changes.
3. being used for the image change automatic sensing focusing method of micro- camera as claimed in claim 2, which is characterized in that will be upper Changing value of the difference of the brightness of image calculated in brightness of image and current focus process at the end of secondary focusing as brightness of image;
During scene monitoring, when the changing value of brightness of image is greater than threshold value ThrDifZL2, then it is assumed that brightness of image changes Become;The changing value of brightness of image is less than or equal to threshold value ThrDifZL2, then it is assumed that brightness of image remains unchanged.
4. being used for the image change automatic sensing focusing method of micro- camera as claimed in claim 2, which is characterized in that described Determine that scene state locating for current scene includes: according to the real-time change situation of brightness of image and object selection value
Brightness of image changes, then current scene is marked to be in scene state II;
On the basis of searching object selection value maximum value, when the changing value of object selection value maximum value is greater than threshold When value ThrDifFV1, label current scene is in scene state III;
Brightness of image remains unchanged, and does not search the variation of object selection value maximum value or object selection value maximum value When value is less than or equal to threshold value ThrDifFV1, label current scene is in scene state I;
On the basis of searching object selection value maximum value, when the changing value of object selection value is greater than threshold value When ThrDifFV2, label current scene is in scene state IV;
The object selection value searched in object selection value at the end of current focusing and current focus process is maximum Changing value of the difference of value as object selection value maximum value.
5. being used for the image change automatic sensing focusing method of micro- camera as claimed in claim 2, which is characterized in that on the spot When scape state is scene state II, the focusing monitoring strategies of use include:
During scene monitoring, when the brightness of image difference of adjacent two moment scene is less than threshold value ThrDifZL3, show field The brightness of image of scape is restored to stablize, and restarting enters single focus process.
6. being used for the image change automatic sensing focusing method of micro- camera as claimed in claim 2, which is characterized in that on the spot When scape state is scene state III, the focusing monitoring strategies of use include:
During scene monitoring, when the object selection value difference value of adjacent two moment scene is less than threshold value ThrDifFV3, Show that the object selection value of scene is restored to stablize, restarting enters single focus process.
7. being used for the image change automatic sensing focusing method of micro- camera as claimed in claim 2, which is characterized in that on the spot When scape state is scene state IV, the focusing monitoring strategies of use include:
During scene monitoring, when adjacent two moment scene object selection value difference value be less than threshold value ThrDifFV3, i.e., The object selection value of scene is restored after stablizing, and the variation for judging object selection value is continued, when present image evaluates letter When changing value at the end of the more last focusing of numerical value is greater than threshold value ThrDifFV2, restarting enters single focus process;
When scene state be scene state I when, continue monitor current scene brightness of image and object selection value it is real-time Situation of change.
8. being used for the image change automatic sensing focusing method of micro- camera as described in claim 1, which is characterized in that in base It is executed in single focus process in search by hill climbing method, the figure of best focus position is indicated using the way of search search of variable step As evaluation function value maximum value, detailed process are as follows:
Scene is divided into defocus region and focal zone according to object selection value size, in defocus region, using relatively wantonly searching for Suo Buchang;In focal zone, the smaller step-size in search of use.
9. being used for the image change automatic sensing focusing method of micro- camera as described in claim 1, which is characterized in that in base It executes in single focus process, also the direction of search is modified, detailed process in search by hill climbing method are as follows:
The average value of adjacent four steps object selection value is calculated twice in succession, if the average value of preceding four steps object selection value Greater than the average value of rear four steps object selection value, indicates to search for defocus direction, then change the direction of search and continue to seek Look for the object selection value maximum value for indicating best focus position.
10. being used for the image change automatic sensing focusing method of micro- camera as described in claim 1, which is characterized in that benefit Object selection value, detailed process are calculated with high fdrequency component are as follows:
Using the FIR filter V1 of the iir filter H1 of horizontal direction, iir filter H2 and vertical direction, FIR filter V2 Scene image is filtered, high fdrequency component is exported;
Being judged again by threshold value after taking absolute value to the high fdrequency component of output, statistics is more than the high frequency flux of threshold gate limit value, Obtain the statistical value of high fdrequency component;
Assuming that the statistical value of the high fdrequency component of region n corresponding four filters output is respectively H1_n, H2_n, V1_n, V2_n, Then two groups of object selection values FV1_n and FV2_n of region n are respectively as follows:
FV1_n=α × H1_n+ (1- α) × V1_n
FV2_n=β × H2_n+ (1- β) × V2_n
Wherein, wherein α, β are respectively weight coefficient.
CN201910764039.3A 2019-08-19 2019-08-19 Image change automatic sensing focusing method for microscope camera Active CN110324536B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910764039.3A CN110324536B (en) 2019-08-19 2019-08-19 Image change automatic sensing focusing method for microscope camera

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910764039.3A CN110324536B (en) 2019-08-19 2019-08-19 Image change automatic sensing focusing method for microscope camera

Publications (2)

Publication Number Publication Date
CN110324536A true CN110324536A (en) 2019-10-11
CN110324536B CN110324536B (en) 2021-09-07

Family

ID=68126270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910764039.3A Active CN110324536B (en) 2019-08-19 2019-08-19 Image change automatic sensing focusing method for microscope camera

Country Status (1)

Country Link
CN (1) CN110324536B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111432129A (en) * 2020-04-14 2020-07-17 广东欧谱曼迪科技有限公司 Automatic focusing hill climbing search algorithm based on threshold value method and local maximum value
CN111654637A (en) * 2020-07-14 2020-09-11 RealMe重庆移动通信有限公司 Focusing method, focusing device and terminal equipment
CN112969027A (en) * 2021-04-02 2021-06-15 浙江大华技术股份有限公司 Focusing method and device of electric lens, storage medium and electronic equipment
CN113766213A (en) * 2021-09-02 2021-12-07 信利光电股份有限公司 Method for improving AF burning parameter detection efficiency of camera module

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101494737A (en) * 2009-03-09 2009-07-29 杭州海康威视数字技术股份有限公司 Integrated camera device and self-adapting automatic focus method
CN102053339A (en) * 2010-11-23 2011-05-11 天津市亚安科技电子有限公司 Automatic focusing method
CN105391945A (en) * 2015-12-23 2016-03-09 北京奇虎科技有限公司 Automatic focusing control method and device of camera
CN105611158A (en) * 2015-12-23 2016-05-25 北京奇虎科技有限公司 Automatic focus following method and device and user equipment
CN106131406A (en) * 2016-07-05 2016-11-16 上海理工大学 A kind of method of self adaptation focusing
US10250794B2 (en) * 2017-01-04 2019-04-02 Motorola Mobility Llc Capturing an image using multi-camera automatic focus

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101494737A (en) * 2009-03-09 2009-07-29 杭州海康威视数字技术股份有限公司 Integrated camera device and self-adapting automatic focus method
CN102053339A (en) * 2010-11-23 2011-05-11 天津市亚安科技电子有限公司 Automatic focusing method
CN105391945A (en) * 2015-12-23 2016-03-09 北京奇虎科技有限公司 Automatic focusing control method and device of camera
CN105611158A (en) * 2015-12-23 2016-05-25 北京奇虎科技有限公司 Automatic focus following method and device and user equipment
CN106131406A (en) * 2016-07-05 2016-11-16 上海理工大学 A kind of method of self adaptation focusing
US10250794B2 (en) * 2017-01-04 2019-04-02 Motorola Mobility Llc Capturing an image using multi-camera automatic focus

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111432129A (en) * 2020-04-14 2020-07-17 广东欧谱曼迪科技有限公司 Automatic focusing hill climbing search algorithm based on threshold value method and local maximum value
CN111654637A (en) * 2020-07-14 2020-09-11 RealMe重庆移动通信有限公司 Focusing method, focusing device and terminal equipment
CN111654637B (en) * 2020-07-14 2021-10-22 RealMe重庆移动通信有限公司 Focusing method, focusing device and terminal equipment
CN112969027A (en) * 2021-04-02 2021-06-15 浙江大华技术股份有限公司 Focusing method and device of electric lens, storage medium and electronic equipment
CN112969027B (en) * 2021-04-02 2022-08-16 浙江大华技术股份有限公司 Focusing method and device of electric lens, storage medium and electronic equipment
CN113766213A (en) * 2021-09-02 2021-12-07 信利光电股份有限公司 Method for improving AF burning parameter detection efficiency of camera module

Also Published As

Publication number Publication date
CN110324536B (en) 2021-09-07

Similar Documents

Publication Publication Date Title
CN110324536A (en) A kind of image change automatic sensing focusing method for micro- camera
CN105578048B (en) A kind of quick focusing method and device, mobile terminal
CN109696788A (en) A kind of fast automatic focusing method based on display panel
US7777801B2 (en) Method for evaluating effective sampling steps of auto focus
CN105652429B (en) A kind of microscopic cell glass slide scanning auto focusing method based on machine learning
CN107888819B (en) Automatic focusing method and device
CN105430279B (en) Camera fast automatic focusing method and device
CN104853087B (en) A kind of identification of spot light scene and focus method
CN110381261B (en) Focusing method, focusing device, computer-readable storage medium and electronic equipment
US7389042B2 (en) Auto focus method for digital camera
CN103929588A (en) Rapid and automatic focusing method and system for camera zoom
CN113109936B (en) Microscope automatic focusing method and device based on image definition evaluation
CN106341596B (en) A kind of focus method and device
CN106534676A (en) Automatic focus adjustment method for zoom camera systems
CN112203012B (en) Image definition calculation method, automatic focusing method and system
CN105049723B (en) Atomatic focusing method based on defocusing amount difference qualitative analysis
CN105430277B (en) Autofocus control method and device
CN101950116B (en) Video automatic focusing method applied to multi-main-body scene
CN111770271B (en) Automatic focusing method based on image processing
CN109361849B (en) Automatic focusing method
CN110824689A (en) Full-automatic microscopic image depth of field expanding system and method thereof
CN103354599A (en) Automatic focusing method applied to moving light source scene and automatic focusing apparatus
CN108769533A (en) A kind of auto-focusing algorithm
CN111105346A (en) Full-scanning microscopic image splicing method based on peak value search and gray template registration
CN117579814B (en) Quick lens detection method based on focusing detection

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