Disclosure of Invention
The invention provides an automatic focusing method and device, which solve the problem of poor imaging quality caused by the fact that the speed, step length and the like of a motor cannot be accurately focused in the prior art.
In order to solve the problems, the invention adopts the following technical scheme:
a method of auto-focusing, comprising:
acquiring a fuzzy diameter value of an image sensor of a terminal, an aperture value of a lens and a motion parameter of a motor;
calculating the object distance range of each step of the motor according to the fuzzy diameter value, the aperture value of the lens and the motion parameter of the motor;
eliminating the steps of which the object distance range is within the object distance range of other steps in the steps;
acquiring gray contrast values of corresponding positions of all steps left after elimination;
and determining a stepping position from the steps left after the elimination according to the gray contrast value to be used as a focusing focus.
Further, determining a step position from the remaining steps as a focus of focusing according to the gray contrast value comprises: selecting a composition that satisfies the following formula:
when n is
2>When i is, A
n=X
iAnd the step left after the elimination is used as a first focusing step; the motor is controlled to move to push a focusing window to focus on the positions corresponding to the first focusing step from near to far, and when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the first focusing step, any position corresponding to two steps with larger gray contrast values in the positions corresponding to the three continuous steps is selected as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; x
iFor the rest of the step, A
nFor the first focus step, i and n are positive integers.
Further, when the inflection point appears in the gray contrast value at the position corresponding to three consecutive steps in the first focus step, the method further includes: selecting a composition that satisfies the following formula:
when 3N is less than or equal to N
AWhen, B
n=X
1And the step left after the elimination is used as a second focusing step; the motor is controlled to move to push the focusing window to focus on the position corresponding to the second focusing step from far to near, and when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the second focusing step, any position corresponding to the two steps with the larger gray contrast values in the positions corresponding to the three continuous steps is selected as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; n is a radical of
ANumber of the farthest step determined in the first focusing step, B
nFor a second focus step.
Further, when the gray contrast values at the positions corresponding to three consecutive steps in the second focus step have inflection points, the method further includes: selecting to satisfy:
is left after eliminationThe lower step is used as a third focusing step; the motor moves to push a focusing window to focus the third focusing step from near to far, and when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the third focusing step, the position corresponding to the step with the largest gray contrast value in the positions corresponding to the three continuous steps is selected as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; c
nFor the third focusing step, N
BThe number of the determined closest step of the second focus steps.
Further, the gray contrast value of one position where the gray contrast values of the positions corresponding to the three consecutive steps in the first focus step appear an inflection point is determined as a first threshold, the gray contrast value of one position where the gray contrast values of the positions corresponding to the three consecutive steps in the second focus step appear an inflection point is determined as a second threshold, the gray contrast value of the focus is greater than the second threshold, and the second threshold is greater than the first threshold; acquiring a gray contrast value of a current focusing window, and if the current gray contrast value is larger than a second threshold value and smaller than the gray contrast value of a focus, executing a step of selecting a third focusing step; if the current gray contrast value is larger than the first threshold value and smaller than the second threshold value, executing a step of selecting a second focus step; the step of selecting the first focus step is performed if the current grey contrast value is smaller than a first threshold value.
Further, the speed of the motor motion is controlled according to the distance between two adjacent focal points.
An autofocus device comprising:
the parameter acquisition module is used for acquiring a fuzzy diameter value of an image sensor in the terminal, an aperture value of a lens and a motion parameter of a motor;
the object distance range calculation module is used for calculating the object distance range of each step of the motor according to the fuzzy diameter value, the aperture value of the lens and the motion parameter of the motor;
the stepping eliminating module is used for eliminating steps of which the object distance range is within the object distance range of other steps in the stepping process;
the gray contrast acquisition module is used for acquiring the gray contrast value of the corresponding position of each step left after the elimination;
and the focus determining module is used for determining a stepping position from the remaining steps after the elimination according to the gray contrast value to be used as a focusing focus.
Further, the focus determination module includes: a first focus step selection submodule for selecting a focus step that satisfies the following formula:
when n is
2>When i is, A
n=X
iAnd the step left after the elimination is used as a first focusing step; the first focus determining submodule is used for pushing a focusing window to focus on the position corresponding to the first focusing step from near to far by controlling the motor to move, and when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the first focusing step, any position corresponding to two steps with larger gray contrast values in the positions corresponding to the three continuous steps is selected as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; x
iFor the rest of the step, A
nFor the first focus step, i and n are positive integers.
Further, the focus determination module further comprises: the second focusing step selection submodule is used for selecting the gray contrast values at the positions corresponding to three continuous steps in the first focusing step to meet the following formula after inflection points appear in the gray contrast values:
when 3N is less than or equal to N
AWhen, B
n=X
1And the step left after the elimination is used as a second focusing step; a second focus determining submodule for controlling the motor to move to drive the focusing window to focus on the position corresponding to the second focus step from far to near, when the focusing window is focused onWhen inflection points appear in the gray contrast values of the positions corresponding to the continuous three steps in the second focusing step, selecting any position corresponding to two steps with larger gray contrast values in the positions corresponding to the continuous three steps as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; n is a radical of
ANumber of the farthest step determined in the first focusing step, B
nFor a second focus step.
Further, the focus determination module further comprises: a third focusing step selection submodule, configured to select a gray contrast value at a position corresponding to three consecutive steps in the second focusing step, which satisfies:
the step left after the elimination is used as a third focusing step; the third focus determining submodule is used for pushing a focusing window to focus on the third focusing step from near to far through the movement of a motor, and when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the third focusing step, the position corresponding to the step with the largest gray contrast value in the positions corresponding to the three continuous steps is selected as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; c
nFor the third focusing step, N
BThe number of the determined closest step of the second focus steps.
Further, still include: a threshold determination module, configured to determine, as a first threshold, a grayscale contrast value of one of the positions where the grayscale contrast values of the positions corresponding to three consecutive steps in the first focus step have inflection points, and determine, as a second threshold, a grayscale contrast value of one of the positions where the grayscale contrast values of the positions corresponding to three consecutive steps in the second focus step have inflection points, where the grayscale contrast value of the focus is greater than the second threshold, and the second threshold is greater than the first threshold; the processing module is used for acquiring the gray contrast value of the current focusing window, and if the current gray contrast value is larger than a second threshold value and smaller than the gray contrast value of the focus, a trigger starting instruction is sent to the third focusing step selection submodule; if the current gray scale contrast value is larger than a first threshold value and smaller than a second threshold value, sending a trigger starting instruction to the second focus stepping selection submodule; and if the current gray contrast value is smaller than a first threshold value, sending a trigger starting instruction to the first focusing stepping selection submodule.
The invention has the beneficial effects that:
the invention provides an automatic focusing method and device, which are characterized in that the object distance range of each step of a motor is calculated by acquiring the fuzzy diameter value of an image sensor of a terminal, the aperture value of a lens and the motion parameter of the motor, the steps of the object distance range in the object distance range of other steps are eliminated, and the gray contrast value of the corresponding position of each step left after elimination is acquired; and determining a stepping position from the steps left after the elimination according to the gray contrast value to be used as a focusing focus. This scheme is through rejecting in the step-by-step of other step-by-step object distance within ranges for can not coincide between the step-by-step object distance scope that newly obtains, reduced the number of times that the motor removed, and the removal step length of motor has also changed, thereby realized quick auto focus, can not influence its imaging quality yet, promoted user experience.
Detailed Description
The present invention will be described in further detail with reference to the following detailed description and accompanying drawings.
The first embodiment is as follows:
fig. 3 is a flowchart of an auto-focusing method according to an embodiment of the present invention, please refer to fig. 3,
s301: acquiring a fuzzy diameter value of an image sensor of a terminal, an aperture value of a lens and a motion parameter of a motor;
the terminal of the invention comprises: mobile phones, tablets, palm top computers, cameras, video cameras, etc.; the motion parameters of the motor include: the motor stroke and the oscillation frequency and the oscillation time when the motor drives the lens to move; in the embodiment, a fuzzy diameter value of the image sensor, an aperture value of the lens, a motor stroke and an oscillation frequency and an oscillation time when the motor drives the lens to move are obtained by reading parameters written in a terminal memory; the oscillation frequency and the oscillation time of the motor during movement can also be obtained by measuring through a special measuring instrument;
s302: calculating the object distance range of each step of the motor according to the fuzzy diameter value, the aperture value of the lens and the motion parameter of the motor;
it should be noted that, in the image sensor of the terminal, the length and speed of each step of the motor are set according to the blur diameter value, the aperture value of the lens and the motion parameters of the motor; the relationship between motor stroke and length of step is:
wherein S is the motor stroke and u is the length of the step; different motors are matched with different lenses, and the motor oscillation frequency and the motor oscillation time are different; the relationship between the movement speed of the motor and the oscillation time is v
i=f'.F(t
f),v
iAs the speed of movement, t
fF 'is oscillation time, and f' is oscillation frequency; for each step of the motor, the range of object distances corresponding to each step comprises: near object distance Limit (Near Focus Limit):
and Far Focus Limit (Far Focus Limit):
wherein H is the hyperfocal distance,
a is a lens aperture value, and d is an image sensor fuzzy diameter; calculating the corresponding u after each step of the motor
NAnd u
F;
S303: eliminating the steps of which the object distance range is within the object distance range of other steps in the steps;
specifically, the object distance ranges of adjacent steps can be obtained by pairwise comparison: comparing u in adjacent stepsNAnd uFThe step which can cover other focusing object distance is selected, namely, the step of which the object distance range is in other object distance ranges is removed, so that the distance of the adjacent step is not the same in the rest steps, the moving distance of each step of the motor is not the same, but the step can cover the object distance range which can be covered by the step, and in the step, the redundant steps are removed; for example, in this embodiment, assuming that the new moving step of the motor is Xi, where Xi is the step left after the elimination, and i is a positive integer, that is, the motor will move according to the position corresponding to the new step Xi, the number of steps moved to complete the formation of the whole motor will be reduced;
s304: acquiring gray contrast values of corresponding positions of all steps left after elimination;
when the motor moves one step each time, a corresponding gray contrast value exists in the position corresponding to the step; obtaining the gray contrast value of each step corresponding position, generally moving to the step corresponding position by controlling a motor, and focusing the position to obtain the gray contrast value of a pixel point in the focusing window;
s305: determining a stepping position from the steps left after the elimination according to the gray contrast value to be used as a focusing focus;
in this embodiment, the motor is controlled to focus the corresponding position of each step left after the elimination, so as to obtain the gray contrast value corresponding to each step, and the position of the step corresponding to the value with the largest gray contrast is selected as the focus of focusing, or the position of the step corresponding to the gray contrast value belonging to the range satisfying the high-definition imaging is selected as the focus of focusing. In the embodiment, the repeated steps in the object distance range with other steps are eliminated, so that the moving times of the motor are reduced, the imaging quality is not reduced, the possibility of quick focusing can be achieved, and the use experience of a user is improved.
Preferably, the step S305 of determining a position of one step from the remaining steps as a focus of focusing according to the gray contrast value includes: selecting a composition that satisfies the following formula:
when n is
2>When i is, A
n=X
iAnd the step left after the elimination is used as a first focusing step; the motor is controlled to move to push a focusing window to focus on the positions corresponding to the first focusing step from near to far, and when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the first focusing step, any position corresponding to two steps with larger gray contrast values in the positions corresponding to the three continuous steps is selected as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; x
iFor the rest of the step, A
nFor the first focusing step, i and n are positive integers; in this embodiment, steps satisfying the above formula are selected as first focus steps, only the selected first focus step is focused, and the gray contrast values at the positions of the corresponding steps are calculated from near to far, and when the gray contrast values at the positions corresponding to three consecutive steps in the first focus step have inflection points, it is not necessary to focus the positions of other first focus steps, but only the positions of the three consecutive steps are focusedAny position corresponding to two steps with larger gray contrast values in the positions corresponding to the steps is used as a focusing focus; the any position comprises a position corresponding to any step between two steps with larger gray contrast values, or a position corresponding to any step left after elimination between two steps with larger gray contrast values; the focusing method has the advantages that the focusing accuracy and clear imaging can be realized by selecting any position as the focusing focus, and in the focusing process, the focusing does not need to be continued only after inflection points appear in the gray contrast values of the positions corresponding to three continuous steps, so that the focus can be found more quickly, and the focusing possibility can be realized.
In this embodiment, since the position between two steps obtained by the first focus is larger, the focus relative error obtained by selecting the focus is also larger, and in order to more accurately obtain the position of the focus, the selected range needs to be narrowed, and the step of narrowing the selected range includes: when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the first focusing step, selecting the gray contrast values which satisfy the following formula:
when 3N is less than or equal to N
AWhen, B
n=X
1And the step left after the elimination is used as a second focusing step; the motor is controlled to move to push the focusing window to focus at the position corresponding to the second focusing step from far to near, namely in the process of focusing, after the focusing of the first focusing step is stopped, namely when an inflection point appears in the gray contrast value in the first focusing step; when inflection points appear in the gray contrast values of the positions corresponding to the continuous three steps in the second focusing step, selecting any position corresponding to two steps with larger gray contrast values in the positions corresponding to the continuous three steps as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; n is a radical of
ANumber of the farthest step determined in the first focusing step, B
nA second focus step; in the present embodiment, bySelecting the steps meeting the formula as second focusing steps, focusing only the selected second focusing steps, calculating the gray contrast values of corresponding stepping positions from far to near, and only needing to use any position corresponding to two steps with larger gray contrast values in the positions corresponding to the continuous three steps as a focusing focus without focusing the positions of other second focusing steps after the gray contrast values of the positions corresponding to the continuous three steps in the second focusing steps have inflection points; similarly, the any position includes a position corresponding to any step between two steps with a larger gray contrast value, or a position corresponding to any step left after rejection between two steps with a larger gray contrast value; selecting either position as the focus of focusing further makes it possible to achieve the accuracy of focusing.
Further, in order to make the determined range of the position of the focused focal point more accurate, when the gray contrast values of the positions corresponding to three consecutive steps in the second focus step have inflection points, the method further includes: selecting to satisfy:
the step left after the elimination is used as a third focusing step; the motor moves to push a focusing window to focus the third focusing step from near to far, and when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the third focusing step, the position corresponding to the step with the largest gray contrast value in the positions corresponding to the three continuous steps is selected as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; c
nFor the third focusing step, N
BA number for a determined closest one of the second focus steps; controlling the motor to move from near to far, from far to near and from near to far respectively through the three steps, focusing respectively to obtain the gray contrast value of each stepping position, and finally obtaining the most accurate stepping position of the gray contrast value in the terminal, so that the gray contrast value is compared with the stepping positionThe value is compared with the currently acquired grey scale contrast value to find how the motor movement should be controlled to optimize the quality of the picture obtained from the current shot.
The method for focusing the target needing to be shot at present specifically comprises the following steps: firstly, determining the gray contrast value of one position where the gray contrast values of the positions corresponding to the three continuous steps in the first focusing step appear inflection points as a first threshold, determining the gray contrast value of one position where the gray contrast values of the positions corresponding to the three continuous steps in the second focusing step appear inflection points as a second threshold, and taking the maximum gray contrast value of the position where the gray contrast values of the positions corresponding to the three continuous steps in the third focusing step appear inflection points as the gray contrast value of a focus, wherein the gray contrast value of the focus is greater than the second threshold, and the second threshold is greater than the first threshold; acquiring a gray contrast value of a current focusing window, and if the current gray contrast value is larger than a second threshold value and smaller than the gray contrast value of a focus, executing a step of selecting a third focusing step so as to obtain accurate focusing for shooting a current target; if the current gray contrast value is larger than the first threshold value and smaller than the second threshold value, executing the step of selecting the second focusing step, and similarly, after the step of executing the second focusing step is finished, continuing to execute the step of performing the third independent angle step for the accuracy of focusing, so that the determined focusing focus is more accurate; if the current grey contrast value is less than the first threshold value, a step of selecting the first focus step is performed, which is similar to the above-described case and will not be described again here.
It should be noted that, in the terminal, the speed of the motor movement is controlled according to the distance between two adjacent steps. In order to reduce the disturbances caused by inertia and by the oscillation of the motor itself, the speed of the motor is also varied during the above-described determination of the gray contrast value for each focus step. For example, for the determination of the position gray contrast value for the first focus step, the scanning speed is x1For the determination of the position gray contrast value for the second focus step, the scanning speed isx2For the determination of the position gray contrast value for the third focus step, the scanning speed is x3(ii) a Wherein the following conditions exist: x is the number of1=x2k1=x3k2,0<k2<k1<1。
For example, the following detailed description explains a method for automatically completing multiple focusing in the present embodiment, as shown in fig. 4, which is a detailed flowchart of an automatic multiple focusing method provided by an embodiment of the present invention, please refer to fig. 4 and 5,
s401: reading the fuzzy diameter of an image sensor, the aperture of a lens, the stroke of a motor and the oscillation frequency and the oscillation time when the motor drives the lens to move, wherein the fuzzy diameter is written in a memory of the terminal;
s402: calculating the corresponding object distance range of each step of the motor after moving according to the fuzzy diameter, the aperture of the lens, the stroke of the motor and the oscillation frequency and the oscillation time when the motor drives the lens to move;
s403: comparing the object distance ranges of the positions of the adjacent steps, eliminating the object distance ranges in the steps contained in the object distance ranges of other steps to obtain the steps left after elimination, and setting the position corresponding to the step as Xi;
S404: selecting a composition that satisfies the following formula:
when n is
2>When i is, A
n=X
iAnd the step left after the elimination is used as a first focusing step; focusing positions corresponding to the first focusing steps from near to far respectively, when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the first focusing steps, selecting the position corresponding to the two steps with larger gray contrast values in the positions corresponding to the three continuous steps as a focus range, and selecting the gray contrast value of the position corresponding to the larger step as a first threshold value Y1;
s405: selecting a composition that satisfies the following formula:
when 3N is less than or equal to N
AWhen, B
n=X
1When the gray contrast values of the positions corresponding to the three continuous steps in the second focusing step have inflection points, selecting the position corresponding to the two steps with larger gray contrast values in the positions corresponding to the three continuous steps as a focus range, and selecting the gray contrast value of one position corresponding to the larger step as a second threshold value Y2;
s406: selecting a composition that satisfies the following formula:
taking the rest steps after the elimination as third focusing steps, respectively focusing positions corresponding to the third focusing steps from near to far, and when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the third focusing steps, selecting the position corresponding to the step with the largest gray contrast value in the positions corresponding to the three continuous steps as a focusing focus, and taking the gray contrast value corresponding to the focus as Yf to finish focusing;
s407: after t ms, acquiring a gray contrast value Y of the current focusing window;
s408: judging whether Y2< Y1< Yf is met, if yes, turning to S406; if not, turning to S409;
s409: judging whether Y1< Y1< Y2 is met, if yes, turning to S405; if not, go to S404.
The embodiment realizes the possibility of continuous focusing, can quickly and accurately realize focusing, improves the imaging quality, saves the focusing time and improves the user experience.
Example two:
as shown in fig. 6, which is a schematic structural diagram of an auto-focusing apparatus according to a second embodiment of the present invention, please refer to fig. 6, wherein the auto-focusing apparatus 60 includes: a parameter obtaining module 601, an object distance range calculating module 602, a stepping eliminating module 603, a gray scale contrast obtaining module 604 and a focus determining module 605; the parameter obtaining module 601 is configured to obtain a blur diameter value of an image sensor in the terminal, an aperture value of a lens, and a motion parameter of a motor; the object distance range calculation module 602 is configured to calculate an object distance range of each step of the motor according to the blur diameter value, an aperture value of the lens, and a motion parameter of the motor; the step elimination module 603 is configured to eliminate steps whose object distance ranges are within the object distance ranges of other steps in the step; the gray contrast obtaining module 604 is configured to obtain a gray contrast value of each step corresponding to the removed step; the focus determining module 605 is configured to determine a step position from the remaining steps after the elimination according to the gray contrast value as a focus for focusing. In the embodiment, the repeated steps in the object distance range with other steps are eliminated, so that the moving times of the motor are reduced, the imaging quality is not reduced, the possibility of quick focusing can be achieved, and the use experience of a user is improved.
In an embodiment, the focus determination module 605 includes: a first focus step selection submodule for selecting a focus step that satisfies the following formula:
when n is
2>When i is, A
n=X
iAnd the step left after the elimination is used as a first focusing step; the first focus determining submodule is used for pushing a focusing window to focus on the position corresponding to the first focusing step from near to far by controlling the motor to move, and when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the first focusing step, any position corresponding to two steps with larger gray contrast values in the positions corresponding to the three continuous steps is selected as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; x
iFor the rest of the step, A
nFor the first focus step, i and n are positive integers.
Further, the focus determination module 605 further comprises: second focusing step selectionThe selecting module is used for selecting the gray contrast values at the positions corresponding to the three continuous steps in the first focusing step to meet the following formula after inflection points appear in the gray contrast values at the positions corresponding to the three continuous steps:
when 3N is less than or equal to N
AWhen, B
n=X
1And the step left after the elimination is used as a second focusing step; the second focus determining submodule is used for pushing a focusing window to focus on the position corresponding to the second focusing step from far to near by controlling the motor to move, and when inflection points appear in the gray contrast values of the positions corresponding to three continuous steps in the second focusing step, any position corresponding to two steps with larger gray contrast values in the positions corresponding to the three continuous steps is selected as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; n is a radical of
ANumber of the farthest step determined in the first focusing step, B
nA second focus step;
preferably, the focus determination module 605 further comprises: a third focusing step selection submodule, configured to select a gray contrast value at a position corresponding to three consecutive steps in the second focusing step, which satisfies:
the step left after the elimination is used as a third focusing step; the third focus determining submodule is used for pushing a focusing window to focus on the third focusing step from near to far through the movement of a motor, and when inflection points appear in the gray contrast values of the positions corresponding to the three continuous steps in the third focusing step, the position corresponding to the step with the largest gray contrast value in the positions corresponding to the three continuous steps is selected as a focusing focus; otherwise, selecting the position corresponding to the step with the maximum gray contrast value as a focusing focus; c
nFor the third focusing step, N
BA number for a determined closest one of the second focus steps;
the auto-focusing apparatus 60 further includes: a threshold determination module, configured to determine, as a first threshold, a grayscale contrast value of one of the positions where the grayscale contrast values of the positions corresponding to three consecutive steps in the first focus step have inflection points, and determine, as a second threshold, a grayscale contrast value of one of the positions where the grayscale contrast values of the positions corresponding to three consecutive steps in the second focus step have inflection points, where the grayscale contrast value of the focus is greater than the second threshold, and the second threshold is greater than the first threshold; the processing module is used for acquiring the gray contrast value of the current focusing window, and if the current gray contrast value is larger than a second threshold value and smaller than the gray contrast value of the focus, a trigger starting instruction is sent to the third focusing step selection submodule; if the current gray scale contrast value is larger than a first threshold value and smaller than a second threshold value, sending a trigger starting instruction to the second focus stepping selection submodule; and if the current gray contrast value is smaller than a first threshold value, sending a trigger starting instruction to the first focusing stepping selection submodule.
The invention provides an automatic focusing method and device, wherein the step elimination of a step object distance range in other step object distance ranges is performed, and the gray contrast value of each step corresponding position left after the elimination is obtained; and determining a stepping position from the steps left after the elimination according to the gray contrast value to be used as a focusing focus. This scheme is through rejecting in the step-by-step of other marching step-by-step object distance within ranges for can not coincide between the step-by-step object distance scope that newly obtains, reduced the number of times that the motor removed, and the step-by-step distance of the removal of motor has also changed, thereby has realized quick auto focus, can not influence its imaging quality yet, has promoted user experience.
The foregoing is a more detailed description of the present invention that is presented in conjunction with specific embodiments, and the practice of the invention is not to be considered limited to those descriptions. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.