Contrast detection autofocus using adaptive step
Abstract
A method for moving an optical device relative to an image sensor to focus an image includes obtaining a first contrast value of a first image captured by the image sensor at a first moment and a first contrast variation rate of the first image, determining, according to the first contrast value and the first contrast variation rate, a first position of the optical device at the first moment, moving the optical device from the first position to a second position corresponding to a second moment subsequent to the first moment, and in response to a second contrast variation value being a preset value, determining a current position of the optical device to be the second position corresponding to the second contrast variation value.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1 . A method for moving an optical device relative to an image sensor to focus an image, comprising:
obtaining a first contrast value of a first image captured by the image sensor at a first moment and a first contrast variation rate of the first image; determining, according to the first contrast value and the first contrast variation rate, a first position of the optical device at the first moment; moving the optical device from the first position to a second position corresponding to a second moment subsequent to the first moment; and in response to a second contrast variation value being a preset value, determining a current position of the optical device to be the second position corresponding to the second contrast variation value.
2 . The method of claim 1 , further comprising:
moving the optical device from the second position to a third position corresponding to a third moment subsequent to the second moment, including:
determining a second step size, wherein the second step size is:
greater than a first step size used for moving the optical device to the second position in response to be second contrast variation rate exceeding a first threshold gradient value, or
smaller than the first step size in response to the second contrast variation rate not exceeding the first threshold gradient value; and
moving the optical device from the second position to a third position according to the second step size, wherein the third position of the optical device corresponds to a third moment subsequent to the second moment.
3 . The method of claim 2 , wherein determining the step size comprises:
generating a curve based on a plurality of contrast values including the current contrast value; determining a position of the optical device relative to the image sensor at which the curve has a peak value; and determining the step size using the position of the optical device relative to the image sensor at which the curve has a peak value.
4 . The method of claim 1 , wherein the current contrast value is determined using an average of at least one luminance gradient value from the current image, a respective luminance gradient value being a luminance gradient across a portion of the current image.
5 . The method of claim 1 , wherein the optical device moves relative to the image sensor during an autofocus operation and the autofocus operation is a contrast detection autofocus operation.
6 . The method of claim 5 , wherein the contrast detection autofocus operation includes determining the contrast variation rate.
7 . The method of claim 1 , wherein the contrast value is determined using a pixel subset at a position corresponding to one of: a selected location, a target, or a portion of a target included in the first image.
8 . The method of claim 1 , wherein:
the current contrast variation rate is a gradient value indicating a rate of change of a contrast value from a previous image to the current image; a contrast value difference is a difference between the current contrast value and a contrast value of a previous image; a distance difference is a difference between a current distance between the optical device and the image sensor at which the current image is captured and a previous distance between the optical device and the image sensor at which the previous image was captured; and the rate of change of the contrast value is the contrast value difference divided by the distance difference.
9 . The method of claim 1 , further comprising:
in response to determining that a third contrast variation rate at a third moment subsequent to the second moment exceeds the second threshold gradient value, applying a filter to a plurality of obtained contrast values to generate a filtered curve; determining whether the filtered curve at the second position of the optical device relative to the image sensor satisfies an end criterion; and in response to determining that the filtered curve does not satisfy the end criterion, initializing the optical device at an initial position relative to the image sensor.
10 . The method of claim 9 , wherein determining whether the filtered curve at the second position of the optical device relative to the image sensor satisfies the end criterion includes determining whether a gradient of the filtered curve at the second position of the optical device relative to the image sensor meets a third threshold criterion.
11 . An unmanned aerial vehicle (UAV), comprising:
a propulsion system; an imaging device comprising an image sensor and an optical device; and one or more processors individually or collectively configured to:
obtain a first contrast value of a first image captured by the image sensor at a first moment and a first contrast variation rate of the first image;
determine, according to the first contrast value and the first contrast variation rate, a first position of the optical device at the first moment;
move the optical device from the first position to a second position corresponding to a second moment subsequent to the first moment; and
in response to a second contrast variation value being a preset value, determine a current position of the optical device to be the second position corresponding to the second contrast variation value.
12 . The UAV of claim 11 , wherein the one or more processors are further configured to, individually or collectively, move the optical device from the second position to a third position corresponding to a third moment subsequent to the second moment, including:
determine a second step size, wherein the second step size is:
greater than a first step size used for moving the optical device to the second position in response to be second contrast variation rate exceeding a first threshold gradient value, or
smaller than the first step size in response to the second contrast variation rate not exceeding the first threshold gradient value; and
move the optical device from the second position to a third position according to the second step size, wherein the third position of the optical device corresponds to a third moment subsequent to the second moment.
13 . The UAV of claim 12 , wherein the one or more processors are further configured to:
generate a curve based on a plurality of contrast values including the current contrast value; determine a position of the optical device relative to the image sensor at which the curve has a peak value; and determine the step size using the position of the optical device relative to the image sensor at which the curve has a peak value.
14 . The UAV of claim 11 , wherein the current contrast value is determined using an average of at least one luminance gradient value from the current image, a respective luminance gradient value being a luminance gradient across a portion of the current image.
15 . The UAV of claim 11 , wherein the one or more processors are further configured to control the optical device move relative to the image sensor during an autofocus operation and the autofocus operation is a contrast detection autofocus operation.
16 . The UAV of claim 15 , wherein the contrast detection autofocus operation includes determining the contrast variation rate.
17 . The UAV of claim 11 , wherein the contrast value is determined using a pixel subset at a position corresponding to one of: a selected location, a target, or a portion of a target included in the first image.
18 . The UAV of claim 1 , wherein:
the current contrast variation rate is a gradient value indicating a rate of change of a contrast value from a previous image to the current image; a contrast value difference is a difference between the current contrast value and a contrast value of a previous image; a distance difference is a difference between a current distance between the optical device and the image sensor at which the current image is captured and a previous distance between the optical device and the image sensor at which the previous image was captured; and the rate of change of the contrast value is the contrast value difference divided by the distance difference.
19 . The UAV of claim 1 , wherein the one or more processors are further configured to:
in response to determining that a third contrast variation rate at a third moment subsequent to the second moment exceeds the second threshold gradient value, apply a filter to a plurality of obtained contrast values to generate a filtered curve; determine whether the filtered curve at the second position of the optical device relative to the image sensor satisfies an end criterion; and in response to determining that the filtered curve does not satisfy the end criterion, initialize the optical device at an initial position relative to the image sensor.
20 . The UAV of claim 19 , wherein the one or more processors are further configured to determine whether a gradient of the filtered curve at the second position of the optical device relative to the image sensor meets a third threshold criterion.Join the waitlist — get patent alerts
Track US2021211581A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.