WO2017113075A1 - 自动对焦方法、装置及设备 - Google Patents

自动对焦方法、装置及设备 Download PDF

Info

Publication number
WO2017113075A1
WO2017113075A1 PCT/CN2015/099261 CN2015099261W WO2017113075A1 WO 2017113075 A1 WO2017113075 A1 WO 2017113075A1 CN 2015099261 W CN2015099261 W CN 2015099261W WO 2017113075 A1 WO2017113075 A1 WO 2017113075A1
Authority
WO
WIPO (PCT)
Prior art keywords
lens
focus
determining
imaging member
images
Prior art date
Application number
PCT/CN2015/099261
Other languages
English (en)
French (fr)
Inventor
徐荣跃
王君
易彦
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2015/099261 priority Critical patent/WO2017113075A1/zh
Priority to CN201580078572.4A priority patent/CN107534723B/zh
Publication of WO2017113075A1 publication Critical patent/WO2017113075A1/zh

Links

Images

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

Definitions

  • the present invention relates to an autofocus technology, and more particularly to an autofocus method, apparatus and apparatus.
  • Focusing refers to the process of forming a sharp image in an imaging member such as a charge coupled image sensor by adjusting the position of the lens.
  • Currently used focus methods include manual focus and auto focus.
  • Manual focus is a kind of focusing method that adjusts the camera lens by turning the focus ring manually to make the captured photos clear. This method relies heavily on the human eye to judge the image on the focusing screen and the proficiency of the photographer. The photographer's eyesight.
  • Autofocus is a type of focusing that automatically controls lens movement based on the sharpness of the image formed on the imaging unit by the autofocus processing device. Compared to manual focus, autofocus reduces the technical requirements of the photographer and is highly appreciated by users and manufacturers.
  • the autofocus processing device controls the movement of the lens by the motor according to the degree of sharpness of the image formed on the imaging unit, so that the focal length and the object distance of the camera device are constant (the object distance is constant when the lens is moved), Get a clear image by adjusting the image distance.
  • the image sharpness calculation has different implementation methods.
  • the mainstream method is the contrast method. In this method, the focus value of the whole image is calculated by the specified contrast operator, and the focus value is higher. Explain that the image is clearer.
  • Contrast-based autofocus generally consists of two processes: coarse step search and fine step positioning.
  • the coarse step search means that the auto focus processing device divides the entire movable stroke of the lens into a plurality of equidistant steps, and controls the motor to drive the lens to gradually move according to the above step. Specifically, each step of the lens moves, and the auto focus is performed.
  • the processing device acquires at least one image from the imaging component, and the autofocus processing device calculates the obtained focus value of the series of images, uses the lens position corresponding to the image with the highest focus value as the coarse focus position, and controls the motor to move the lens to the coarse lens.
  • the autofocus processing device determines the final focus position by fine step positioning at the coarse step focus position.
  • the party In the method in order to enable the lens to cover the depth of field in the adjacent step position, it is necessary to ensure that the equidistant step size is small enough.
  • the autofocus processing device in order to determine the coarse focus position of the lens, the autofocus processing device needs to control the lens to perform a series of movements in the equidistant steps over the entire movable stroke of the lens, and the focusing steps are relatively compared. It is cumbersome and the focusing time is relatively long.
  • Embodiments of the present invention provide an autofocus method, apparatus, and device to simplify an autofocus step and improve an autofocus speed.
  • an embodiment of the present invention provides an autofocus method, including:
  • the focus position of the lens is determined based on the object distance.
  • the method of the embodiment of the present invention determines the focus position of the lens according to the object distance after determining the object distance, and the moving lens according to the prior art is clear according to the image formed by the lens at each position.
  • the method of the embodiment of the invention can reduce the number of movements of the lens during the coarse focus process and improve the focus speed.
  • the determining, according to the object distance, determining an in-focus position of the lens includes:
  • the lens is finely focused according to the coarse focus position to determine an in-focus position of the lens.
  • the technical solution may include the following beneficial effects: the method of the embodiment of the present invention first determines a coarse focus position of the lens according to the object distance; and then performs fine step focusing on the lens according to the coarse focus position, thereby simplifying the focusing process. Under the premise, improve the accuracy of the camera device focus.
  • the determining, according to the first images, the photographing object is The object distance of the lens, including:
  • Determining the subject relative to the physical displacement of the lens at the at least two different locations, the relative displacement of the first image on the imaging member, and the distance between the lens and the imaging member The object distance of the lens.
  • the technical solution may include the following beneficial effects: a method for determining an object distance in camera focusing, and further determining an object distance by an image formed on an imaging member when the lens is at least two different positions in the same plane, for determining The focus position of the lens provides data support to reduce the number of lens movements during focusing.
  • the physical parameter of the imaging component comprises: a pixel size of the imaging component
  • Determining a relative displacement of each of the first images on the imaging component according to a pixel difference between the first images and a physical parameter of the imaging component including:
  • the physical displacement of the lens according to the at least two different positions Determining a relative displacement of each of the first images on the imaging member and a distance between the lens and the imaging member, determining an object distance of the photographic subject with respect to the lens, comprising:
  • the pixel difference between the first images and The physical parameters of the imaging component, after determining the relative displacement of the first images on the imaging component further includes:
  • determining the physical displacement according to the lens at the at least two different positions, the relative displacement of the first images on the imaging member, and the distance between the lens and the imaging member The object distance of the subject relative to the lens.
  • the technical solution may include the following beneficial effects: by determining the consistency of the moving direction of the image formed on the imaging member with the moving direction of the lens, it is ensured that the autofocus method of the embodiment of the present invention can be correctly implemented.
  • the object distance determines a coarse focus position of the lens, including:
  • a coarse focus position of the lens is determined based on the image distance.
  • the image distance of the lens may be determined by consulting the depth of field table or calculating according to the imaging formula, and determining the image distance as the coarse focus of the lens. Position, then fine-step focus, which improves the accuracy of the camera's autofocus while simplifying the camera's focusing process.
  • the determining, according to the image distance, determining a coarse focus position of the lens includes:
  • the coarse focus debugging position corresponding to the maximum value among the focus values of the respective second images is taken as a coarse focus position.
  • the technical solution may include the following beneficial effects: determining a coarse focus position from each coarse focus debugging position according to a focus value of each second image corresponding to each coarse focus debugging position, and reducing the coarse focus setting and the actual focus position as much as possible The difference between the two increases the accuracy of the auto focus.
  • the determining, according to the image distance, determining each coarse focus debugging position includes:
  • At least one position is respectively taken in the direction of the imaging member, and the distance between the at least one position and the reference position is an integer multiple of a preset step size;
  • the technical solution may include the following beneficial effects: a method for determining the position of each coarse focus debugging according to the image distance is provided, and the implementation process is simple.
  • the determining, by the image distance, the determining the respective coarse focus debugging positions the determining, by the image distance, the determining the respective coarse focus debugging positions
  • the lens movable stroke is pre-divided into at least two movement intervals, the at least two movement intervals do not overlap, and the union of the at least two movement intervals is equal to the lens Moving itinerary
  • the technical solution may include the following beneficial effects: a method for determining the position of each coarse focus debugging according to the image distance is provided, and the implementation process is simple.
  • the maximum of the focus values of the second images is used as the coarse focus position, including:
  • a focus value of each of the second images formed on the imaging member exhibits an arrangement rule of increasing first and then decreasing The position is the coarse focus position.
  • the method further includes:
  • the movement is continued in a direction away from the imaging member.
  • the mirror until the obtained focus value of each of the second images exhibits an arrangement rule of increasing first and then decreasing, and determining a position corresponding to the maximum value of the focus values as a coarse focus position.
  • the method further includes:
  • the coarse focus debugging position from the initial movement of the lens follows a direction close to the imaging member
  • the lens is continuously moved until the obtained focus value of each second image exhibits an arrangement rule of increasing first and then decreasing, and determining a position corresponding to the maximum value of the focus values as a coarse focus position.
  • the method further includes:
  • each second image formed on the imaging member exhibits an arrangement rule of decreasing first and then increasing according to a direction away from the imaging member
  • the lens is continuously moved in a direction away from the imaging member until the lens is moved away from the imaging member.
  • the obtained focus values of the second images exhibit an arrangement rule of increasing first and then decreasing, and determining a position corresponding to the maximum value of the focus values as a coarse focus position.
  • the tenth to thirteenth possible implementations of the first aspect may include the following beneficial effects: determining the focus position from each of the coarse focus debugging positions according to the arrangement rule of the focus values of the second images, and improving the auto focus of the camera device The accuracy.
  • an auto focus processing apparatus including:
  • An image acquisition module configured to acquire respective first images formed by the imaging component on the photographic subject at at least two different positions, wherein the at least two different positions are located on a same plane, and the same plane and the imaging component are used Forming an image plane parallel to each of the first images;
  • a object distance determining module configured to determine an object distance of the photographic subject with respect to the lens according to each of the first images
  • a focusing module configured to determine an in-focus position of the lens according to the object distance.
  • the method of the embodiment of the present invention determines the focus position of the lens according to the object distance after determining the object distance, and the moving lens according to the prior art is clear according to the image formed by the lens at each position.
  • the method of the embodiment of the invention can reduce the number of movements of the lens during the coarse focus process and improve the focus speed.
  • the focusing module is specifically configured to:
  • the lens is finely focused according to the coarse focus position to determine an in-focus position of the lens.
  • the technical solution may include the following beneficial effects: the method of the embodiment of the present invention first determines a coarse focus position of the lens according to the object distance; and then performs fine step focusing on the lens according to the coarse focus position, thereby simplifying the focusing process. Under the premise, improve the accuracy of the camera device focus.
  • the object distance determining module is specifically configured to:
  • Determining the subject relative to the physical displacement of the lens at the at least two different locations, the relative displacement of the first image on the imaging member, and the distance between the lens and the imaging member The object distance of the lens.
  • the technical solution may include the following beneficial effects: a method for determining an object distance in camera focusing, and further determining an object distance by an image formed on an imaging member when the lens is at least two different positions in the same plane, for determining The focus position of the lens provides data support to reduce the number of lens movements during focusing.
  • the physical parameter of the imaging component comprises: a pixel size of the imaging component
  • the object distance determining module is specifically configured to:
  • the object distance determining module is specifically configured to:
  • the object distance determining module is further configured to:
  • determining the physical displacement according to the lens at the at least two different positions, the relative displacement of the first images on the imaging member, and the distance between the lens and the imaging member The object distance of the subject relative to the lens.
  • the technical solution may include the following beneficial effects: by determining the consistency of the moving direction of the image formed on the imaging member with the moving direction of the lens, it is ensured that the autofocus method of the embodiment of the present invention can be correctly implemented.
  • a coarse focus position of the lens is determined based on the image distance.
  • the image distance of the lens may be determined by consulting the depth of field table or calculating according to the imaging formula, and determining the image distance as the coarse focus of the lens. Position, then fine-step focus, which improves the accuracy of the camera's autofocus while simplifying the camera's focusing process.
  • the coarse focus debugging position corresponding to the maximum value among the focus values of the respective second images is taken as a coarse focus position.
  • the technical solution may include the following beneficial effects: determining a coarse focus position from each coarse focus debugging position according to a focus value of each second image corresponding to each coarse focus debugging position, and reducing the coarse focus setting and the actual focus position as much as possible The difference between the two increases the accuracy of the auto focus.
  • the focusing module is specifically configured to:
  • the distance is an integer multiple of the preset step size
  • the technical solution may include the following beneficial effects: a method for determining the position of each coarse focus debugging according to the image distance is provided, and the implementation process is simple.
  • the focusing module is specifically configured to:
  • the lens movable stroke is pre-divided into at least two movement intervals, the at least two movement intervals do not overlap, and the union of the at least two movement intervals is equal to the lens Moving itinerary
  • the technical solution may include the following beneficial effects: a method for determining the position of each coarse focus debugging according to the image distance is provided, and the implementation process is simple.
  • the focusing module is specifically configured to:
  • a focus value of each of the second images formed on the imaging member exhibits an arrangement rule of increasing first and then decreasing The position is the coarse focus position.
  • the eleventh possible implementation of the second aspect is further configured to:
  • the lens is continuously moved in a direction away from the imaging member until the obtained
  • the focus value of the two images exhibits an arrangement rule of increasing first and then decreasing, and determining a position corresponding to the maximum value of the focus values as a coarse focus position.
  • the focusing module is further configured to:
  • the coarse focus debugging position from the initial movement of the lens follows a direction close to the imaging member
  • the lens is continuously moved until the obtained focus value of each second image exhibits an arrangement rule of increasing first and then decreasing, and determining a position corresponding to the maximum value of the focus values as a coarse focus position.
  • the focusing module is further configured to:
  • each second image formed on the imaging member exhibits an arrangement rule of decreasing first and then increasing according to a direction away from the imaging member
  • the lens is continuously moved in a direction away from the imaging member until the lens is moved away from the imaging member.
  • the obtained focus values of the second images exhibit an arrangement rule of increasing first and then decreasing, and determining a position corresponding to the maximum value of the focus values as a coarse focus position.
  • the tenth to thirteenth possible implementations of the second aspect may include the following beneficial effects: determining the focus position from each of the coarse focus debug positions according to the arrangement rule of the focus values of the second images, and improving the auto focus of the camera device The accuracy.
  • an embodiment of the present invention provides an auto-focus processing device, where the auto-focus processing device is deployed in a camera device, including:
  • a communication interface a memory, a processor, and a communication bus, wherein the communication interface, the memory, and the processor communicate via the communication bus;
  • the memory is for storing a program
  • the processor is configured to execute the program stored by the memory; when the auto focus processing device is running, the processor runs a program, the program comprising:
  • the focus position of the lens is determined based on the object distance.
  • the technical solution may include the following beneficial effects: in the solution, determining the focus position of the lens according to the object distance after determining the object distance, compared with the prior art, the stepwise moving lens is based on the sharpness of the image formed by the lens at each position.
  • the method of the embodiment of the invention can reduce the number of movements of the lens during the coarse focus process and improve the focus speed.
  • Figure 1 shows a schematic diagram of the distribution of the various components of the camera device
  • Figure 2 shows a schematic diagram of the focus of the camera device
  • Figure 3 is a schematic view showing the effect of stepwise movement of the lens
  • Figure 4 is a graph showing the lens moving distance-focus value plotted by the hill climbing method
  • FIG. 5 is a flow chart showing an autofocus method according to an embodiment of the present invention.
  • Figure 6 is a schematic view showing the effect of the OIS motor driving the lens
  • FIG. 7 is a flow chart showing a method of autofocusing according to Embodiment 2 of the present invention.
  • Figure 8 is a diagram showing the relationship of various parameters of the lens of the camera device moving in the same plane
  • FIG. 9 is a flowchart showing a third autofocus method according to Embodiment 3 of the present invention.
  • FIG. 10 is a schematic structural diagram of an autofocus processing apparatus according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of an autofocus processing apparatus according to an embodiment of the present invention.
  • the invention is mainly applied to an autofocus scene of a camera device, and the camera device includes a special camera device, such as a SLR camera, and the like, and also includes various terminal devices integrated with a camera module, such as a mobile phone, a computer, and the like.
  • a special camera device such as a SLR camera, and the like
  • various terminal devices integrated with a camera module such as a mobile phone, a computer, and the like.
  • Figure 1 shows a schematic diagram of the distribution of the various components of the camera device.
  • the camera device Generally, the lens, the imaging component and the focusing device are included, wherein the lens coincides with the optical axis of the imaging component, and the focusing device is not shown in FIG. 1.
  • the main function of the focusing device is to drive the lens to realize the focusing function of the camera device.
  • Imaging of the camera device satisfies the principle of optical imaging, ie, satisfies the imaging formula Where u is the object distance, v is the image distance, and f is the focal length.
  • the object distance refers to the distance between the object and the center of the lens
  • the image distance is the distance from the center of the lens to the imaging member
  • the focal length is the distance from the center of the lens to the focus of the light collection.
  • the focal length thereof Is a fixed value.
  • the image distance is equal to the focal length, and the position of the lens is set to the lens in the camera device.
  • Figure 2 shows a schematic diagram of the focus of the camera device.
  • the initial position of the lens is the position where the image distance is equal to the focal length, and the distance between the subject and the lens (ie, the object distance) can be regarded as a fixed value, according to the focus formula, at the object distance and the focal length.
  • focusing is the process of changing the image distance by moving the position of the lens to make the image formed on the imaging part clearer.
  • the lens is moved from the initial position in a direction away from the imaging member, thereby changing the image distance value to achieve the purpose of focusing.
  • the focus mode of the camera device is divided into manual focus and auto focus, depending on the subject that moves the lens position.
  • the focusing device in the camera device includes a focus ring, and the lens position is moved by manually rotating the focus ring to achieve focusing of the camera device.
  • the focusing device in the camera device comprises: an autofocus processing device and a motor, wherein the autofocus processing device collects an image formed on the imaging component, and controls the rotation of the motor according to the degree of clarity of the acquired image, and the motor rotates to drive The movement of the lens position enables autofocus of the camera device.
  • the distance between the subject and the center of the lens (ie, the object distance) is unknown to the autofocus processing device.
  • the focal length is known, the object distance and the image distance are unknown.
  • the autofocus processing device uses a combination of coarse step focusing and fine step focusing to focus. The following is an example of an autofocus method based on the contrast method, which automatically controls the camera device. The focusing process is described in detail.
  • the autofocus method based on the contrast method includes a coarse step focusing process and a fine step focusing process.
  • the autofocus processing device controls the motor to drive the lens to gradually move from the starting position of the lens in the movable step of the lens in an equidistant step.
  • the starting position of the lens refers to the position where the image distance of the lens is equal to the focal length.
  • the movable stroke of the lens refers to the range of distances between the starting position of the lens and the maximum distance that can be remote from the imaging member.
  • the above step size needs to be designed to be sufficiently small.
  • the depth of field coverage means that the lens moves in an equidistant step and is located in the phase. At the two adjacent positions, the image on the imaging unit is still a sharp image.
  • Fig. 3 is a view showing the effect of the stepwise movement of the lens. As shown in FIG. 3, the position corresponding to 0 is the starting position of the lens, and the position corresponding to N is the maximum distance of the lens away from the imaging member, and the distance between 0 and N is the movable stroke of the lens.
  • the driving lens is gradually moved from the starting position of the lens in the movable stroke of the lens according to the equidistant step size, which means that the driving lens is in the corresponding position of the N pairs according to the equidistant step from the position corresponding to 0.
  • Moving step by step wherein the distance between two adjacent moving positions (i.e., 0 and 1, 1 and 2, ..., N-1 and N) is the above-described equidistant step size.
  • the autofocus processing device acquires an image formed by the lens at each of the moving positions.
  • Each moving position refers to a position where the lens is moved after moving in an equidistant step, and the distance between two adjacent moving positions is an equidistant step.
  • 0, 1, 2, ... N can be used as the moving position of the lens, and the autofocus processing device acquires the lens at 0, 1, 2...N images at various locations where the imaging component is formed.
  • the autofocus processing device calculates the focus value of the image formed by the lens at each moving position according to a preset contrast operator.
  • the focus value can be calculated once for each image, and the image values of each image can be calculated separately after all the images to be acquired are obtained.
  • the autofocus processing device uses the hill climbing method to draw the moving distance-focus value graph of the lens, and determines the coarse focus position of the lens according to the moving distance-the peak value of the focus value graph.
  • Fig. 4 is a graph showing the lens moving distance-focus value plotted by the hill climbing method.
  • the direction of the lens away from the imaging member is the positive direction of the abscissa
  • the starting point of the abscissa is the starting position of the movable path of the lens (ie, the position of the image distance is equal to the focal length)
  • the abscissa is the moving distance of the lens
  • the abscissa is the largest
  • the value is the maximum distance the lens can move in a direction away from the imaging member
  • the ordinate is the focus value of the image formed by the imaging member at each moving position of the lens.
  • the autofocus processing device determines the coarse focus position of the lens based on the position corresponding to the maximum value of the focus value in the lens movement distance-focus value graph.
  • the autofocus processing device moves the lens to the determined coarse focus position.
  • the lens is finely focused, wherein the fine step focusing method is basically the same as the coarse step focusing method, that is, the coarse focus position is used as the reference position of the lens fine step focusing. And the control lens moves based on the coarse focus position. Unlike the coarse step focus, the step size of the fine step focusing process is smaller and more accurate.
  • the autofocus processing device finally determines the optimal focus position of the lens by focusing on the lens.
  • an embodiment of the present invention provides an auto-focusing method, which first determines an object distance, and then determines a lens by querying a preset depth of field table or calculating according to an imaging formula.
  • the coarse focus position reduces the number of movements of the lens, simplifies the autofocus process of the camera device, and speeds up the autofocus speed.
  • FIG. 5 is a flowchart of an auto-focusing method according to an embodiment of the present invention.
  • the main body of the method is an auto-focus processing device in a camera device.
  • the main processing steps include:
  • Step S101 Acquire each first image formed by the imaging component on the photographic subject at at least two different positions.
  • the at least two different positions are located on the same plane, and the same plane is first formed with the imaging member
  • the imaging planes of the images are parallel, and when the autofocus processing device in the camera device controls the lens to move in the same plane, the distance between the lens and the imaging member does not change.
  • the autofocus device can drive the movement of the lens by controlling the rotation of the motor.
  • the autofocus device utilizes an OIS (Optical Image Stabilization) motor to drive the movement of the lens, wherein the OIS motor corrects the "optical axis offset" by a floating lens in the camera lens.
  • OIS Optical Image Stabilization
  • the principle is to detect the tiny movement of the camera through the gyroscope in the lens, and then transmit the signal to the autofocus processing device.
  • the autofocus processing device immediately calculates the amount of displacement to be compensated, and then compensates the lens group according to the lens shake direction and The amount of displacement is compensated; thereby effectively overcoming image blurring caused by camera device shake.
  • FIG. 6 is a schematic diagram showing the effect of the movement of the OIS motor to drive the lens, wherein a diagram in FIG. 6 is a schematic diagram of the lens translation effect, b is a schematic diagram of the lens rotation effect, and c is a schematic diagram of the module rotation effect, which is mainly utilized in the embodiment of the present invention.
  • the OIS motor drives the lens to translate.
  • the OIS motor drives the lens translation to include the OIS motor to drive the lens to move up or down, wherein the a diagram in FIG. 6 will be along the direction of the optical axis of the lens away from the imaging member.
  • the direction in which the imaging member is approached along the optical axis direction of the lens is taken as the lower side.
  • the OIS motor drives the lens translation further including the OIS motor driving the lens to move in the same plane along a direction perpendicular to the optical axis.
  • the OIS motor can drive the lens to move left or right in the same plane, and the left and right are shown in Figure a of Figure 6.
  • Step S102 Determine the object distance of the photographic subject with respect to the lens according to each of the first images.
  • the autofocus processing device determines the object distance of the photographic object relative to the lens according to the image of the lens at at least two different positions on the same plane.
  • the specific determination method may be:
  • the autofocus processing device determines the pixel difference between the acquired first images by image registration.
  • the method for obtaining the relative displacement of each first image on the imaging member is not limited in the embodiment of the present invention.
  • the physical parameter of the imaging component is the pixel size of the imaging component
  • the autofocus processing device is configured according to the first image.
  • the product of the pixel difference and the pixel size of the imaging component determines the relative displacement of the respective first images on the imaging component.
  • the autofocus processing device can be based on a formula Determine the object distance of the subject relative to the lens, where D is the object distance, d1 is the distance between the lens and the imaging member, oo' is the physical displacement of the lens between two different positions, vv' is two of them The relative displacement of an image on the imaging member.
  • the autofocus processing device can directly calculate according to the object distance formula, and obtain the result as the object distance between the object and the lens.
  • the auto-focus processing device may perform a pairwise calculation on each of the first images to obtain a plurality of object distance results, and the auto-focus processing device averages the plurality of object distance results, and The average value of the object distance is taken as the object distance between the subject and the lens.
  • the number of the first image acquired by the auto-focus processing device can be determined according to the actual required object distance precision, and the auto-focus processing device can minimize the lens movement by ensuring the object distance accuracy with an appropriate number of first images. frequency.
  • Step S103 Determine the focus position of the lens according to the object distance of the photographic subject with respect to the lens.
  • the object distance is first determined by the image formed on the imaging member when the lens is at at least two different positions on the same plane, and then the focus position of the lens can be calculated according to the object distance, compared with the prior art.
  • the stepwise moving lens searches for the coarse focus position according to the sharpness of the image formed by the lens at each position, and the method of the embodiment of the invention can reduce the number of movements of the lens during the coarse focusing process and improve the focusing speed.
  • the focus position of the lens can be determined according to the object distance.
  • the determining method may be: determining the in-focus position by referring to the preset depth of field table shown in Table 1 below, and directly passing the imaging formula. (where u is the object distance, v is the image distance, f is the focal length) Determines the image distance, and determines the focus position of the camera device based on the calculated image distance.
  • Object distance (m) Lens moving distance (mm) Deep depth of view (m) Close depth of field (m) 3 -0.005 772.725 1.5 0.3 -0.05 0.332 0.273 0.14 -0.109 0.146 0.134 0.06 -0.265 0.061 0.059 0.05 -0.323 0.051 0.049
  • an object distance-lens moving distance depth table is shown.
  • different lens moving distances are respectively identified corresponding to different object distances, wherein the lens moving distances in Table 1 are different.
  • the distance that the object needs to move from the initial position of the lens Specifically, the initial position of the lens refers to the focal position of the lens, and the moving direction is the direction away from the imaging member.
  • the lens when the object distance is 3 meters, the lens needs to move 5 micrometers from the initial position away from the imaging member. When the object distance is 0.3 meters, the lens needs to move 50 micrometers from the initial position away from the imaging member. When the object distance is 6 cm, the lens needs to move 265 micrometers from the initial position away from the imaging member. The closer the object distance is, the larger the distance the lens needs to move. If the lens is determined by the stepwise movement in the existing method, the lens is determined. The coarse focus position, when the step size is set to 10 micrometers, and the moving distance is 265 micrometers, the lens needs to move 26 steps. Compared with the way of directly determining the focus position of the lens by referring to the depth of field table in the present application, the existing method is cumbersome. complex.
  • the image distance position determined by consulting the depth of field table or according to the imaging formula is directly used as the focus position of the lens, there may be a problem of inaccurate focus, in order to improve the focus of the camera device.
  • Accuracy when determining the in-focus position of the lens according to the object distance of the lens, first determining a coarse focus position of the lens according to the object distance; then performing fine step focusing on the lens according to the coarse focus position, determining The in-focus position of the lens.
  • the image distance calculated according to the depth of field table or the imaging formula can be used as the coarse focus position, and then the camera device is finely focused on the basis of the coarse focus position, thereby improving the camera while simplifying the focusing process.
  • the accuracy of the device's focus can be used as the coarse focus position, and then the camera device is finely focused on the basis of the coarse focus position, thereby improving the camera while simplifying the focusing process.
  • the method for fine-step focusing the lens in the embodiment of the present invention is the same as the method for focusing the lens in fine steps in the prior art, and details are not described herein again.
  • FIG. 7 is a flowchart of a method for autofocusing according to Embodiment 2 of the present invention, and the present embodiment is based on a lens The image formed at two different positions on the same plane determines the object distance of the photographic subject with respect to the lens.
  • the main body of the method is an auto-focus processing device, and the main steps include:
  • Step S201 The autofocus processing device in the camera device acquires an A image formed by the imaging member on the photographic subject when the lens is in the first position.
  • Figure 8 is a diagram showing the relationship of parameters of the lens of the camera device moving in the same plane.
  • the A image formed by the subject X on the imaging member is located at v.
  • Step S202 The autofocus processing device in the camera device moves the lens to the second position.
  • the lens moves from the o position to the o', o and o' Located in the same plane, the distance to the imaging unit is d1.
  • Step S203 The autofocus processing device acquires a B image formed by the imaging member on the subject X when the lens is in the second position.
  • the B image formed by the subject X on the imaging member is located at v'.
  • Step S204 The autofocus processing device determines the pixel difference between the A image and the B image by image registration.
  • Step S205 The autofocus processing device calculates the relative displacement of the A image and the B image in the imaging member based on the calculated pixel difference and the physical parameters of the imaging unit.
  • the autofocus processing device multiplies the calculated pixel difference by the pixel size of the imaging member to obtain a relative displacement of the A image and the B image on the imaging member.
  • the relative displacement of the A image and the B image on the imaging member is vv'.
  • Step S206 The autofocus processing device determines whether the relative displacement direction between the A image and the B image is the same as the displacement direction between the first position and the second position of the lens. If they are the same, step S27 is performed.
  • the lens moves from the o position to o', and the movement direction is o points to o'; when the lens moves from the o position to o', the image position formed on the imaging member is moved from v to v', The direction of movement is v pointing to v', o pointing to o' is the same as v pointing to v'.
  • Step S207 The autofocus processing device determines the object distance of the photographic subject with respect to the lens.
  • the autofocus processing device can be based on the formula Determine the object distance of the subject relative to the lens, where D is the object distance, d1 is the distance between the lens and the imaging member, oo' is the physical displacement of the lens between two different positions, vv' is two of them The relative displacement of an image on the imaging member.
  • the autofocus processing device can determine the coarse focus position by gradually moving the lens position in the prior art.
  • the autofocus processing device can determine the coarse focus position by gradually moving the lens position in the prior art. .
  • Step S208 The autofocus processing device determines the coarse focus position of the lens based on the calculated object distance.
  • the autofocus processing device determines the coarse focus position of the lens, it is possible to refer to the depth of field table or the method of calculating the image distance using the imaging formula.
  • Step S209 The autofocus processing device moves the lens to a position corresponding to the coarse focus position.
  • Step S210 The auto focus processing device performs fine step focusing on the lens to determine the focus position of the lens.
  • the object distance of the photographic subject relative to the lens is determined by the image of the lens at two positions in the same plane, and the coarse focus position of the lens is determined according to the depth of field table or the calculation of the image distance. Reduce the number of coarse step searches and improve autofocus efficiency.
  • the position of the lens may be directly determined by referring to the depth of field table or calculating the image distance, but if the depth of field table or the calculated image distance is obtained, The position directly serves as a coarse focus position, which is difficult to avoid, which causes inaccurate focus.
  • the present invention also combines the object distance and the contrast method, thereby improving the accuracy of the autofocus while simplifying the autofocus process. Sex. The following embodiment will explain in detail the autofocus method combining the object distance and contrast methods.
  • FIG. 9 is a flowchart of a method for autofocusing according to a third embodiment of the present invention.
  • the method of the embodiment adopts a combination of object distance and contrast method to realize autofocus of the camera device.
  • Executive body of the method For autofocus processing devices including:
  • Step S301 The auto focus processing device determines the object distance of the photographic subject with respect to the lens.
  • the method for determining the distance of the photographic subject with respect to the lens object in the embodiment is as described in the first embodiment and the second embodiment, and details are not described herein again.
  • Step S302 The autofocus processing device determines the image distance of the lens according to the object distance of the photographic subject with respect to the lens and the focal length of the lens.
  • the autofocus processing device is based on an imaging formula Where u is the object distance, v is the image distance, f is the focal length, and the image distance is calculated; or, the auto focus processing device determines the image distance by referring to the depth of field table.
  • Step S303 The auto focus processing device determines each coarse focus debugging position according to the image distance.
  • the lens movable stroke is pre-divided into at least two movement intervals, at least two movement intervals do not overlap, and a union of at least two movement intervals is equal to a lens movable stroke;
  • Step S304 The autofocus processing device acquires a focus value of each second image formed by the imaging unit on the photographic subject at each coarse focus debugging position.
  • Step S305 the auto focus processing device corresponds to the maximum value of the focus values of the second images.
  • the coarse focus debug position is used as the coarse focus position.
  • Step S306 The autofocus processing device moves the lens to a position corresponding to the coarse focus position.
  • Step S307 The auto focus processing device performs fine step focusing on the lens to determine the focus position of the lens.
  • the camera device combines the calculated object distance with the contrast method, and determines the coarse focus position of the lens according to the focus value of the image formed by the imaging unit when the lens is in the plurality of coarse focus debugging positions, thereby avoiding related technologies.
  • the disadvantage of step-by-step search is needed, and the number of coarse step searches for autofocus of the camera device is reduced, and the autofocus rate is increased.
  • the embodiment of the present invention further provides a method for determining the lens based on the method 1 and method 2. The method of focusing the position.
  • an example of determining a coarse focus position of the lens includes:
  • the calculated image distance position is taken as the reference position d2.
  • the method of comparing the FV(n-1), FV(n), and FV(n+1) values by using the hill climbing method includes: determining the second position formed on the imaging component by the lens at each coarse focus debugging position.
  • the arrangement rule of the focus value of the image, and the coarse focus debugging position is determined according to the arrangement rule of the focus values of the second images, specifically:
  • the lens position corresponding to the maximum value in the focus value is determined as a rough Focus position.
  • FV(n-1), FV(n), and FV(n+1) are presented in the direction away from the imaging unit.
  • the lens is continuously moved in a direction away from the imaging member until the obtained focus value of each second image is firstly incremented and then decreased, and the position corresponding to the maximum value in the focus value is determined as the coarse focus position. .
  • the coarse focus debugging position from the initial movement of the lens continues to move the lens in the direction close to the imaging member.
  • the obtained focus value of each second image exhibits an arrangement rule of increasing first and then decreasing, and determining a position corresponding to the maximum value among the focus values as a coarse focus position.
  • the lens is continuously moved in a direction away from the imaging member until the obtained ones are obtained.
  • the focus value of the second image exhibits an arrangement rule of increasing first and then decreasing, and determines a position corresponding to the maximum value among the focus values as a coarse focus position.
  • an example of determining a coarse focus position of the lens includes:
  • the entire movable stroke of the lens is [0, 50], wherein the starting position of the movable stroke of the lens is the focal length position, and the moving direction is the direction away from the imaging member, in one example, [0, 50] Divided into [0,10), [10,20), [20,30), [30,40), [40,50], when the calculated image distance d2 is 12, it is determined that d2 is located in the division [10 , 20) within the range.
  • the method for comparing the numerical values of the FV(n-1), the FV(n), and the FV(n+1) by the hill climbing method in this example is the same as the method of the first method in the third embodiment, and details are not described herein again.
  • the coarse focus position of the lens can be determined according to the method given in the third embodiment. The process is as described in the third embodiment and will not be described again.
  • FIG. 10 is a schematic structural diagram of an autofocus processing apparatus according to an embodiment of the present invention.
  • the apparatus includes an image acquisition module 601, an object distance determination module 602, and a focus module 603, wherein:
  • the image acquisition module 601 is configured to acquire, according to at least two different positions, the first image formed by the imaging component on the photographic subject, wherein at least two different positions are located on the same plane, and the same plane and the imaging component are used to form each first The imaging plane of the image is parallel;
  • the object distance determining module 602 is configured to determine an object distance of the photographic object relative to the lens according to each of the first images;
  • the focusing module 603 is configured to determine an in-focus position of the lens according to the object distance.
  • the focusing module 603 is specifically configured to: determine a coarse focus position of the lens according to the object distance; perform fine step focusing on the lens according to the coarse focus position, and determine a focus position of the lens.
  • the object distance determining module 602 is specifically configured to:
  • the object distance of the subject relative to the lens is determined based on the physical displacement of the lens at at least two different locations, the relative displacement of each of the first images on the imaging member, and the distance between the lens and the imaging member.
  • the physical parameters of the imaging member include: a pixel size of the imaging member;
  • the object distance determining module 602 is specifically configured to:
  • a relative displacement of each of the first images on the imaging member is determined based on a product between a pixel difference between the respective first images and a pixel size of the imaging member.
  • the object distance determining module 602 is specifically configured to:
  • the object distance determining module 602 is further configured to determine the first first after determining the relative displacement of each first image on the imaging component according to the pixel difference between the first images and the physical parameters of the imaging component. Whether the direction of movement of the image on the imaging member is the same as the direction of movement of at least two different positions of the lens;
  • each first image is formed.
  • the object-to-object distance relative to the lens is determined by the relative displacement on the component and the distance between the lens and the imaging member.
  • the focusing module 603 is specifically configured to:
  • the coarse focus position of the lens is determined based on the image distance.
  • the focusing module 603 is specifically configured to:
  • the coarse focus debugging position corresponding to the maximum value among the focus values of the respective second images is taken as the coarse focus position.
  • the focusing module 603 is specifically configured to:
  • At least one position is respectively taken in a direction in which the reference position is away from the imaging member and in a direction in which the reference position is close to the imaging member, and a distance between each of the at least one position and the reference position is an integral multiple of a preset step size;
  • each of the at least one position and the reference position are each coarse focus debugging position.
  • the focusing module 603 is specifically configured to:
  • a starting position of the lens movable stroke is a focal length position of the lens
  • an end position of the movable stroke is a maximum distance of the lens away from the imaging member, and the lens is movable
  • the stroke is pre-divided into at least two movement intervals, at least two movement intervals do not overlap, and the union of the at least two movement intervals is equal to the lens movable stroke;
  • At least one end position of the moving section in which the image distance position is located and each intermediate position obtained by the equidistant division are determined as the respective coarse focus debugging positions.
  • the focusing module 603 is further configured to:
  • the lens position corresponding to the maximum value in the focus value is determined. For the coarse focus position.
  • the focusing module 603 is further configured to: if the focus value of each second image formed on the imaging component is in an increasing arrangement rule according to the direction away from the imaging component, continue to move the lens in a direction away from the imaging component, Until the obtained focus value of each second image exhibits an arrangement rule of increasing first and then decreasing, and determining a position corresponding to the maximum value among the focus values as a coarse focus position.
  • the focusing module 603 is specifically configured to:
  • the coarse focus debugging position from the initial movement of the lens continues to move the lens in the direction close to the imaging member until the obtained each
  • the focus value of the second image exhibits an arrangement rule of increasing first and then decreasing, and determines a position corresponding to the maximum value among the focus values as a coarse focus position.
  • the focusing module 603 is further configured to:
  • the lens is continuously moved in a direction away from the imaging member until the obtained second image is in focus.
  • the value presents an arrangement rule that is incremented first and then decremented, and the position corresponding to the maximum value in the focus value is determined as the coarse focus position.
  • the autofocus processing device 1100 includes a communication interface 1101, a memory 1103, and a processor 1102.
  • the communication interface 1101, the processor 1102, the memory 1103, and the 1104 is interconnected; the bus 1104 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 11, but it does not mean that there is only one bus or one type of bus.
  • the communication interface 1101 is for communicating with the transmitting end.
  • the memory 1103 is configured to store a program.
  • the program can include program code, the program code including computer operating instructions.
  • the memory 1103 may include a random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage.
  • the processor 1102 executes the program stored in the memory 1103 to implement the method of the foregoing method embodiment of the present invention:
  • the focus position of the lens is determined based on the object distance.
  • the processor 1102 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP Processor, etc.), or a digital signal processor (DSP), an application specific integrated circuit. (ASIC), Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component.
  • CPU central processing unit
  • NP Processor network processor
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA Field Programmable Gate Array
  • the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed.
  • the foregoing steps include the steps of the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

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

Abstract

一种自动对焦方法、装置及设备,该方法包括:获取透镜在至少两个不同位置上成像部件对拍摄对象所成的各第一图像(S101),其中所述至少两个不同位置位于同一平面,所述同一平面与所述成像部件用于形成所述各第一图像的成像面平行;根据所述各第一图像,确定所述拍摄对象相对于所述透镜的物距(S102);根据所述物距,确定所述透镜的对焦位置(S103)。所述自动对焦方法、装置及设备能够简化自动对焦过程,提高自动对焦速度。

Description

自动对焦方法、装置及设备 技术领域
本发明涉及自动对焦技术,尤其涉及一种自动对焦方法、装置及设备。
背景技术
随着科学技术的发展,相机设备的种类和数量越来越多,应用也越来越广泛。为了满足各类相机设备的拍摄需求,使拍摄出的图像越来越清晰,在拍摄前需要对相机设备进行对焦。所谓对焦就是指通过调整透镜位置,从而在成像部件(如电荷耦合图像传感器)中结成清晰图像的过程。目前常用的对焦方式包括手动对焦和自动对焦。手动对焦是通过手工转动对焦环来调节相机镜头从而使拍摄出来的照片清晰的一种对焦方式,这种方式很大程度上依赖人眼对对焦屏上的影像的判别以及拍摄者的熟练程度甚至拍摄者的视力。自动对焦是通过自动对焦处理装置根据在成像部件上所成图像的清晰程度自动控制透镜移动的一种对焦方式。相对于手动对焦,自动对焦降低了对拍摄者的技术要求,备受使用者和生产商的青睐。
自动对焦方式中,自动对焦处理装置根据成像部件上所成图像的清晰程度控制马达带动透镜移动,以在相机设备焦距及物距不变(透镜移动时视为物距不变)的前提下,通过调整像距得到清晰图像。在相机设备的自动对焦过程中,图像的清晰度计算有不同的实现方式,比较主流的方式是对比度法,该方法中通过指定的对比度算子计算整幅图像的对焦值,对焦值越高,说明图像越清晰。
基于对比度法的自动对焦一般包括两个过程:粗步搜索和细步定位。其中粗步搜索是指自动对焦处理装置将透镜的整个可移动行程划分为若干个等距步长,并控制马达带动透镜按照上述步长逐步移动,具体的,透镜每移动一个步长,自动对焦处理装置从成像部件中至少获取一次图像,自动对焦处理装置通过计算得到的一系列图像的对焦值,将对焦值最高的图像所对应的透镜位置作为粗对焦位置,并控制马达将透镜移动到粗步对焦位置上,之后自动对焦处理装置在粗步对焦位置通过细步定位确定最终的对焦位置。该方 法中,为使透镜在相邻的步长位置能够做到景深覆盖,需保证设置的等距步长足够小。
上述基于对比对度法的自动对焦方法中,为了确定透镜的粗对焦位置,自动对焦处理装置需要控制透镜在透镜的整个可移动行程内按照等距步长做一系列的移动,对焦步骤相对比较繁琐,对焦时间相对较长。
发明内容
本发明实施例提供了一种自动对焦方法、装置及设备,以简化自动对焦步骤,提高自动对焦速度。
第一方面,本发明实施例提供了一种自动对焦方法,包括:
获取透镜在至少两个不同位置上成像部件对拍摄对象所成的各第一图像,其中所述至少两个不同位置位于同一平面,所述同一平面与所述成像部件用于形成所述各第一图像的成像面平行;
根据所述各第一图像,确定所述拍摄对象相对于所述透镜的物距;
根据所述物距,确定所述透镜的对焦位置。
该技术方案可以包括以下有益效果:本发明实施例方法确定物距之后根据物距确定透镜的对焦位置,相较于现有技术中,逐步移动透镜根据透镜在每个位置上所成图像的清晰度搜索粗对焦位置的方式而言,本发明实施例方法能够减少粗对焦过程中透镜的移动次数,提高对焦速度。
在第一方面的第一种可能的实现方式中,所述根据所述物距,确定所述透镜的对焦位置,包括:
根据所述物距,确定所述透镜的粗对焦位置;
根据所述粗对焦位置对所述透镜进行细步对焦,确定所述透镜的对焦位置。
该技术方案可以包括以下有益效果:本发明实施例方法首先根据所述物距,确定所述透镜的粗对焦位置;之后根据所述粗对焦位置对所述透镜进行细步对焦,在简化对焦过程的前提下,提高相机设备对焦的精确性。
根据第一方面或第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,所述根据所述各第一图像,确定所述拍摄对象相对于所述透镜的物距,包括:
通过图像配准,确定所述各第一图像之间的像素差;
根据所述各第一图像之间的像素差以及所述成像部件的物理参数,确定所述各第一图像在成像部件上的相对位移;
根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距。
该技术方案可以包括以下有益效果:提供了一种相机对焦中确定物距的方法,另外,通过透镜在同一平面内的至少两个不同位置时成像部件上所成的图像确定物距,为确定透镜的对焦位置提供数据支持,减少对焦过程中,透镜移动次数。
根据第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,所述成像部件的物理参数包括:所述成像部件的像素大小;
所述根据所述各第一图像之间的像素差以及所述成像部件的物理参数,确定所述各第一图像在成像部件上的相对位移,包括:
根据所述各第一图像之间的像素差与所述成像部件的像素大小之间的乘积,确定所述各第一图像在成像部件上的相对位移。
根据第一方面的第二种或第三种可能的实现方式,在第一方面的第四种可能的实现方式中,所述根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距,包括:
根据公式
Figure PCTCN2015099261-appb-000001
确定所述拍摄对象相对于所述透镜的物距,其中,所述D为物距,所述d1为所述透镜与所述成像部件之间的距离,所述oo’为所述透镜在两个不同位置之间的物理位移,所述vv’为其中两个所述第一图像在成像部件上的相对位移。
根据第一方面的第二种、第三种或第四种可能的实现方式,在第一方面的第五种可能的实现方式中,所述根据所述各第一图像之间的像素差以及所述成像部件的物理参数,确定所述各第一图像在成像部件上的相对位移之后,还包括:
确定所述各第一图像在所述成像部件上的移动方向是否与所述透镜的所 述至少两个不同位置的移动方向相同;
若相同,则根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距。
该技术方案可以包括以下有益效果:通过确定成像部件上所成图像的移动方向与透镜移动方向的一致性,确保本发明实施例自动对焦方法能够正确实施。
根据第一方面的第一种、第二种、第三种、第四种或第五种可能的实现方式,在第一方面的第六种可能的实现方式中,可选的,所述根据所述物距,确定所述透镜的粗对焦位置,包括:
根据所述物距,确定所述透镜的像距;
根据所述像距,确定所述透镜的粗对焦位置。
该技术方案可以包括以下有益效果:本发明实施例方法中,在确定物距后可以通过查阅景深表或根据成像公式的计算确定透镜的像距,并将确定出的像距作为透镜的粗对焦位置,之后再进行细步对焦,从而在简化相机设备对焦过程的同时,提高相机设备自动对焦的精确性。
根据第一方面的第六种可能的实现方式,在第一方面的第七种可能的实现方式中,可选的,所述根据所述像距,确定所述透镜的粗对焦位置,包括:
根据所述像距,确定各粗对焦调试位置;
获取所述透镜在所述各粗对焦调试位置上成像部件对拍摄对象所成的各第二图像的对焦值;
将所述各第二图像的对焦值中的最大值所对应的粗对焦调试位置作为粗对焦位置。
该技术方案可以包括以下有益效果:根据对应各粗对焦调试位置的各第二图像的对焦值,从各粗对焦调试位置中确定粗对焦位置,尽可能减小粗对焦置位与实际对焦位置之间的差值,提高自动对焦的精确性。
根据第一方面的第七种可能的实现方式,在第一方面的第八种可能的实现方式中,所述根据所述像距,确定各粗对焦调试位置,包括:
将所述像距位置作为基准位置;
在所述基准位置远离所述成像部件的方向以及在所述基准位置接近所述 成像部件的方向上分别各取至少一个位置,所述各取的所述至少一个位置与所述基准位置之间的距离为预设步长的整数倍;
确定所述各取的所述至少一个位置及所述基准位置为所述各粗对焦调试位置。
该技术方案可以包括以下有益效果:提供了一种根据像距确定各粗对焦调试位置的方式,实现过程简单。
根据第一方面的第七种可能的实现方式,在第一方面的第九种可能的实现方式中,可选的,所述根据所述像距,确定各粗对焦调试位置,包括:
确定所述像距位置在透镜可移动行程中所位于的移动区间,其中所述透镜可移动行程的起始位置为透镜的焦距位置,所述可移动行程的终点位置为所述透镜远离所述成像部件的最大距离处,所述透镜可移动行程预先划分为至少两个移动区间,所述至少两个移动区间之间不重叠,且所述至少两个移动区间的并集等于所述透镜可移动行程;
对所述像距位置所位于的移动区间进行等距划分;
确定所述像距位置所位于的移动区间的至少一个端点位置及所述等距划分得到的各个中间位置,作为所述各粗对焦调试位置。
该技术方案可以包括以下有益效果:提供了一种根据像距确定各粗对焦调试位置的方式,实现过程简单。
根据第一方面的第七种、第八种或第九种可能的实现方式,在第一方面的第十种可能的实现方式中,所述将所述各第二图像的对焦值中的最大值所对应的粗对焦调试位置作为粗对焦位置,包括:
确定所述透镜在所述各粗对焦调试位置上,所述成像部件上所成的各第二图像的对焦值的排列规则;
若按照远离所述成像部件的方向,所述成像部件上所成的所述各第二图像的对焦值呈现先递增后递减的排列规则,则确定所述对焦值中的最大值所对应的透镜位置作为粗对焦位置。
根据第一方面的第十种可能的实现方式,在第一方面的第十一种可能的实现方式中,所述方法还包括:
若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现递增排列规则,则按照远离所述成像部件的方向继续移动所述透 镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
根据第一方面的第十种可能的实现方式,在第一方面的第十二种可能的实现方式中,所述方法还包括:
若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现递减排列规则,则从所述透镜初始移动的粗对焦调试位置按照接近所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
根据第一方面的第十种可能的实现方式,在第一方面的第十三种可能的实现方式中,所述方法还包括:
若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现先递减后递增的排列规则,则按照远离所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
第一方面的第十至第十三种可能的实现方案可以包括以下有益效果:根据各第二图像的对焦值的排列规则,从各粗对焦调试位置中确定出对焦位置,提高相机设备自动对焦的准确性。
第二方面,本发明实施例提供了一种自动对焦处理装置,包括:
图像获取模块,用于获取透镜在至少两个不同位置上成像部件对拍摄对象所成的各第一图像,其中所述至少两个不同位置位于同一平面,所述同一平面与所述成像部件用于形成所述各第一图像的成像面平行;
物距确定模块,用于根据所述各第一图像,确定所述拍摄对象相对于所述透镜的物距;
对焦模块,用于根据所述物距,确定所述透镜的对焦位置。
该技术方案可以包括以下有益效果:本发明实施例方法确定物距之后根据物距确定透镜的对焦位置,相较于现有技术中,逐步移动透镜根据透镜在每个位置上所成图像的清晰度搜索粗对焦位置的方式而言,本发明实施例方法能够减少粗对焦过程中透镜的移动次数,提高对焦速度。
在第二方面的第一种可能的实现方式中,所述对焦模块,具体用于:
根据所述物距,确定所述透镜的粗对焦位置;
根据所述粗对焦位置对所述透镜进行细步对焦,确定所述透镜的对焦位置。
该技术方案可以包括以下有益效果:本发明实施例方法首先根据所述物距,确定所述透镜的粗对焦位置;之后根据所述粗对焦位置对所述透镜进行细步对焦,在简化对焦过程的前提下,提高相机设备对焦的精确性。
根据第二方面或第一方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述物距确定模块,具体用于:
通过图像配准,确定所述各第一图像之间的像素差;
根据所述各第一图像之间的像素差以及所述成像部件的物理参数,确定所述各第一图像在成像部件上的相对位移;
根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距。
该技术方案可以包括以下有益效果:提供了一种相机对焦中确定物距的方法,另外,通过透镜在同一平面内的至少两个不同位置时成像部件上所成的图像确定物距,为确定透镜的对焦位置提供数据支持,减少对焦过程中,透镜移动次数。
根据第二方面的第二种可能的实现方式,在第二方面的第三种可能的实现方式中,所述成像部件的物理参数包括:所述成像部件的像素大小;
所述物距确定模块,具体用于:
根据所述各第一图像之间的像素差与所述成像部件的像素大小之间的乘积,确定所述各第一图像在成像部件上的相对位移。
根据第二方面的第二种或第三种可能的实现方式,在第二方面的第四种可能的实现方式中,所述物距确定模块,具体用于:
根据公式
Figure PCTCN2015099261-appb-000002
确定所述拍摄对象相对于所述透镜的物距,其中,所述D为物距,所述d1为所述透镜与所述成像部件之间的距离,所述oo’为所述透镜在两个不同位置之间的物理位移,所述vv’为其中两个所述第一图像在成像部件上的相对位移。
根据第二方面的第二种、第三种或第四种可能的实现方式,在第二方面的第五种可能的实现方式中,所述物距确定模块,还用于:
根据所述各第一图像之间的像素差以及所述成像部件的物理参数,确定所述各第一图像在成像部件上的相对位移之后,确定所述各第一图像在所述成像部件上的移动方向是否与所述透镜的所述至少两个不同位置的移动方向相同;
若相同,则根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距。
该技术方案可以包括以下有益效果:通过确定成像部件上所成图像的移动方向与透镜移动方向的一致性,确保本发明实施例自动对焦方法能够正确实施。
根据第二方面的第一种、第二种、第三种、第四种或第五种可能的实现方式,在第二方面的第六种可能的实现方式中,,所述对焦模块,具体用于:
根据所述物距,确定所述透镜的像距;
根据所述像距,确定所述透镜的粗对焦位置。
该技术方案可以包括以下有益效果:本发明实施例方法中,在确定物距后可以通过查阅景深表或根据成像公式的计算确定透镜的像距,并将确定出的像距作为透镜的粗对焦位置,之后再进行细步对焦,从而在简化相机设备对焦过程的同时,提高相机设备自动对焦的精确性。
根据第二方面的第六种可能的实现方式,在第二方面的第七种可能的实现方式中,所述对焦模块,具体用于:
根据所述像距,确定各粗对焦调试位置;
获取所述透镜在所述各粗对焦调试位置上成像部件对拍摄对象所成的各第二图像的对焦值;
将所述各第二图像的对焦值中的最大值所对应的粗对焦调试位置作为粗对焦位置。
该技术方案可以包括以下有益效果:根据对应各粗对焦调试位置的各第二图像的对焦值,从各粗对焦调试位置中确定粗对焦位置,尽可能减小粗对焦置位与实际对焦位置之间的差值,提高自动对焦的精确性。
根据第二方面的第七种可能的实现方式,在第二方面的第八种可能的实现方式中,所述对焦模块,具体用于:
将所述像距位置作为基准位置;
在所述基准位置远离所述成像部件的方向以及在所述基准位置接近所述成像部件的方向上分别各取至少一个位置,所述各取的所述至少一个位置与所述基准位置之间的距离为预设步长的整数倍;
确定所述各取的所述至少一个位置及所述基准位置为所述各粗对焦调试位置。
该技术方案可以包括以下有益效果:提供了一种根据像距确定各粗对焦调试位置的方式,实现过程简单。
根据第二方面的第七种可能的实现方式,在第二方面的第九种可能的实现方式中,所述对焦模块,具体用于:
确定所述像距位置在透镜可移动行程中所位于的移动区间,其中所述透镜可移动行程的起始位置为透镜的焦距位置,所述可移动行程的终点位置为所述透镜远离所述成像部件的最大距离处,所述透镜可移动行程预先划分为至少两个移动区间,所述至少两个移动区间之间不重叠,且所述至少两个移动区间的并集等于所述透镜可移动行程;
对所述像距位置所位于的移动区间进行等距划分;
确定所述像距位置所位于的移动区间的至少一个端点位置及所述等距划分得到的各个中间位置,作为所述各粗对焦调试位置。
该技术方案可以包括以下有益效果:提供了一种根据像距确定各粗对焦调试位置的方式,实现过程简单。
根据第二方面的第七种、第八种或第九种可能的实现方式,在第二方面的第十种可能的实现方式中,所述对焦模块,具体用于:
确定所述透镜在所述各粗对焦调试位置上,所述成像部件上所成的各第二图像的对焦值的排列规则;
若按照远离所述成像部件的方向,所述成像部件上所成的所述各第二图像的对焦值呈现先递增后递减的排列规则,则确定所述对焦值中的最大值所对应的透镜位置作为粗对焦位置。
根据第二方面的第十种可能的实现方式,在第二方面的第十一种可能的 实现方式中,所述对焦模块,还用于:
若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现递增排列规则,则按照远离所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
根据第二方面的第十种可能的实现方式,在第二方面的第十二种可能的实现方式中,所述对焦模块,还用于:
若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现递减排列规则,则从所述透镜初始移动的粗对焦调试位置按照接近所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
根据第二方面的第十种可能的实现方式,在第二方面的第十三种可能的实现方式中,所述对焦模块,还用于:
若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现先递减后递增的排列规则,则按照远离所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
第二方面的第十至第十三种可能的实现方案可以包括以下有益效果:根据各第二图像的对焦值的排列规则,从各粗对焦调试位置中确定出对焦位置,提高相机设备自动对焦的准确性。
第三方面,本发明实施例提供了一种自动对焦处理设备,所述自动对焦处理设备部署于相机设备中,包括:
通信接口、存储器、处理器和通信总线,其中,所述通信接口、所述存储器和所述处理器通过所述通信总线通信;
所述存储器用于存放程序,所述处理器用于执行所述存储器存储的程序;当自动对焦处理设备运行时,所述处理器运行程序,所述程序包括:
获取透镜在至少两个不同位置上成像部件对拍摄对象所成的各第一图像,其中所述至少两个不同位置位于同一平面,所述同一平面与所述成像部件用于形成所述各第一图像的成像面平行;
根据所述各第一图像,确定所述拍摄对象相对于所述透镜的物距;
根据所述物距,确定所述透镜的对焦位置。
该技术方案可以包括以下有益效果:本方案中,确定物距之后根据物距确定透镜的对焦位置,相较于现有技术中,逐步移动透镜根据透镜在每个位置上所成图像的清晰度搜索粗对焦位置的方式而言,本发明实施例方法能够减少粗对焦过程中透镜的移动次数,提高对焦速度。
附图说明
图1示出了相机设备各部件分布的一种示意图;
图2示出了相机设备对焦的一种示意图;
图3示出了透镜逐步移动的效果示意图;
图4示出了采用爬山法绘制的透镜移动距离-对焦值的曲线图;
图5示出了本发明实施例一自动对焦方法的流程图;
图6示出了OIS马达带动透镜移动的效果示意图;
图7示出了本发明实施例二自动对焦方法的流程图;
图8示出了了相机设备的透镜在同一平面移动的各参数关系示意图;
图9示出了本发明实施例三自动对焦方法的流程图;
图10示出了本发明实施例一自动对焦处理装置的结构示意图;
图11示出了本发明实施例一自动对焦处理设备的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明主要应用在相机设备的自动对焦场景中,所述的相机设备包括专门的相机设备,如单反相机等,也包括各种集成有相机模块的终端设备,如手机、电脑等终端等。
图1示出了相机设备各部件分布的一种示意图。如图1所示,相机设备 一般包括透镜、成像部件及对焦装置,其中,透镜与成像部件的光轴重合,对焦装置在图1中未画出,对焦装置的主要作用是带动透镜移动,实现相机设备的对焦功能。
为了清楚阐述本发明实施例的自动对焦方法,以下将结合附图首先对相机设备的成像及对焦原理进行说明。
相机设备的成像满足光学成像原理,即满足成像公式
Figure PCTCN2015099261-appb-000003
其中,u为物距,v为像距,f为焦距。
具体的,物距是指拍摄对象到透镜中心之间的距离,像距为透镜中心到成像部件之间的距离,焦距为透镜中心到光聚集之焦点的距离,对于一个相机设备而言其焦距是一个固定值。
如图1所示,根据上述的成像公式,当拍摄对象与透镜中心之间的距离为无穷远(即物距为无穷大)时,像距等于焦距,此时透镜的位置设置为透镜在相机设备中的初始位置。
图2示出了相机设备对焦的一种示意图。如图2所示,对焦过程中,透镜的初始位置为像距等于焦距的位置,拍摄对象与透镜之间的距离(即物距)可视为固定值,根据对焦公式,在物距及焦距为固定值的前提下,对焦就是通过移动透镜的位置改变像距,使成像部件上所成图像更为清晰的过程。如图2所示,对焦过程中,将透镜从初始位置沿着远离成像部件的方向移动透镜,从而改变像距值,达到对焦的目的。
根据带动透镜位置移动的对象的不同,相机设备的对焦方式分为手动对焦和自动对焦。为了支持手动对焦,相机设备中的对焦装置包括对焦环,通过手动转动对焦环实现透镜位置的移动从而实现相机设备的对焦。
为了支持自动对焦,相机设备中的对焦装置包括:自动对焦处理装置及马达,其中自动对焦处理装置采集成像部件上所成的图像,并根据所采集图像的清晰程度,控制马达转动,马达转动带动透镜位置的移动,从而实现相机设备的自动对焦。
初始对焦时,拍摄对象与透镜中心之间的距离(即物距)对于自动对焦处理装置而言是未知数,在焦距已知,物距及像距未知的前提下,为了确定透镜的较佳位置,自动对焦处理装置采用粗步对焦与细步对焦相结合的方式进行对焦,以下将以基于对比度法的自动对焦方法为例,对相机设备的自动 对焦过程进行详细说明。
基于对比度法的自动对焦方法包括:粗步对焦过程及细步对焦过程
1、粗步对焦过程
(1)自动对焦处理装置控制马达带动透镜从透镜的起始位置按照等距步长在透镜的可移动行程中逐步移动。
透镜的起始位置是指透镜的像距与焦距相等的位置。透镜的可移动行程是指透镜的起始位置至可远离成像部件的最大距离之间的距离范围。
为了保证透镜按照等距步长移动时能够在相邻两个位置上实现景深覆盖,上述的步长需要设计的足够小,具体的,景深覆盖是指透镜按照等距步长移动,在位于相邻的两个位置上,成像部件上的图像仍为清晰图像。
图3示出了透镜逐步移动的效果示意图。如图3所示,0所对应的位置为透镜的起始位置,N对应的位置为透镜远离成像部件的最大距离,0与N之间的距离范围为透镜的可移动行程。
如图3所示,带动透镜从透镜的起始位置按照等距步长在透镜的可移动行程中逐步移动,是指带动透镜从0所对应的位置按照等距步长在N对对应的位置逐步移动,其中相邻两个移动位置(即0与1,1与2,……,N-1与N)之间的距离为上述的等距步长。
(2)自动对焦处理装置获取透镜在各个移动位置上所成的图像。
各个移动位置是指透镜按照等距步长移动后所位于的位置,相邻的两个移动位置之间的距离为等距步长。
如图3所示,假设透镜从0位置开始逐步移动并一直移动到N的位置,则0、1、2……N可以作为透镜的移动位置,自动对焦处理装置获取透镜在在0、1、2……N各个位置上时,成像部件所成的图像。
(3)自动对焦处理装置按照预设的对比度算子计算透镜在各个移动位置上所成图像的对焦值。
自动对焦处理装置计算各个图像的对焦值时,可以每得到一幅图像计算一次对焦值,也可以得到需获取的所有图像后分别计算各幅图像的对焦值。
(4)自动对焦处理装置采用爬山法绘制透镜的移动距离-对焦值曲线图,并根据移动距离—对焦值曲线图的峰值确定透镜的粗定焦位置。
图4示出了采用爬山法绘制的透镜移动距离-对焦值的曲线图。如图4所 示,透镜远离成像部件的方向为横坐标正方向,横坐标的起点为透镜可移动行程的起始位置(即像距等于焦距的位置),横坐标取值为透镜移动距离,横坐标最大取值为透镜按照远离成像部件方向可移动的最大距离;纵坐标为透镜在各个移动位置上成像部件所成图像的对焦值。
如图4所示,在实际应用中,若与各个移动位置对应的图像的对焦值呈现先递增后下降的分布规律,则图像的对焦值呈现明显下降后,不再继续按照等距步长移动透镜。自动对焦处理装置根据透镜移动距离-对焦值的曲线图中对焦值的最大值所对应的位置确定透镜的粗对焦位置。
确定透镜的粗对焦位置后,自动对焦处理装置将透镜移动到所确定的粗对焦位置上。
二、细步对焦过程
自动对焦处理装置将透镜移动到粗步对焦位置后,对透镜进行细步对焦,其中细步对焦的方法与粗步对焦的方法基本相同,即以粗对焦位置作为透镜细步对焦的基准位置,并控制透镜基于粗对焦位置进行移动,与粗步对焦所不同的是,细步对焦过程的步长取值更小,更为精确。
自动对焦处理装置通过对透镜的细步对焦过程,最终确定透镜的最佳对焦位置。
从以上分析可以看出,自动对焦中确定透镜的粗对焦位置是关键,现有的自动对焦方法中,采用逐步移动透镜的方法确定透镜的粗对焦位置,对焦过程相对比较繁琐复杂。
为了解决相机设备自动对焦方法中所存在的上述问题,本发明实施例提出了一种自动对焦方法,该方法首先确定物距,之后采用查询预设的景深表或者根据成像公式计算的方式确定透镜的粗对焦位置,减少透镜的移动次数,简化相机设备自动对焦过程,加快自动对焦速度。
以下将结合附图对本发明实施例的自动对焦方法进行详细说明。
图5示出了本发明实施例一自动对焦方法的流程图,该方法的执行主体为相机设备中的自动对焦处理装置,主要处理步骤包括:
步骤S101:获取透镜在至少两个不同位置上成像部件对拍摄对象所成的各第一图像。
上述至少两个不同位置位于同一平面,该同一平面与成像部件所成第一 图像的成像面平行,当相机设备中的自动对焦处理装置控制透镜在该同一平面内移动时,透镜与成像部件之间距离不变。
具体实施时,自动对焦装置可以通过控制马达的转动带动透镜的移动。
例如,自动对焦装置利用OIS(Optical Image Stabilization,光学图像防抖)马达带动透镜的移动,其中OIS马达通过相机镜头中的浮动透镜来纠正“光轴偏移”。其原理是通过镜头内的陀螺仪侦测相机微小的移动,然后将信号传至自动对焦处理装置,自动对焦处理装置立即计算需要补偿的位移量,然后通过补偿透镜组,根据镜头的抖动方向及位移量加以补偿;从而有效地克服因相机设备抖动产生的影像模糊。
图6示出了OIS马达带动透镜移动的效果示意图,其中图6中的a图为透镜平移效果示意图,b图为透镜旋转效果示意图,c图为模组旋转效果示意图,本发明实施例主要利用OIS马达带动透镜进行平移。
如图6中的a图所示,OIS马达带动透镜平移包括OIS马达带动透镜向上或向下移动,其中,图6中的a图中将沿着透镜的光轴方向远离成像部件的方向作为上,将沿着透镜的光轴方向接近成像部件的方向作为下。进一步,OIS马达带动透镜平移还包括OIS马达带动透镜沿着与光轴垂直的方向在同一平面内移动,透镜在该同一平面内移动时,透镜与成像部件之间的距离不变,如图6中的a图所示,OIS马达可以带动透镜在同一平面内向左或向右移动,其中的左、右为图6中的a图所示。
步骤S102:根据各第一图像,确定拍摄对象相对于透镜的物距。
本步骤中自动对焦处理装置根据透镜在同一平面的至少两个不同位置上的图像确定出拍摄对象相对于透镜的物距,具体确定方法可以为:
A、自动对焦处理装置通过图像配准,确定获取的各幅第一图像之间的像素差。
B、根据各第一图像之间的像素差以及成像部件的物理参数,确定各第一图像在成像部件上的相对位移。
本发明实施例中不限定获取各第一幅图像在成像部件上的相对位移的方法,例如,成像部件的物理参数为成像部件的像素大小,自动对焦处理装置根据所述各第一图像之间的像素差与所述成像部件的像素大小之间的乘积,确定所述各第一图像在成像部件上的相对位移。
C、根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距。
例如,自动对焦处理装置可以根据公式
Figure PCTCN2015099261-appb-000004
确定拍摄对象相对于透镜的物距,其中,D为物距,d1为透镜与成像部件之间的距离,oo’为透镜在两个不同位置之间的物理位移,vv’为其中两个第一图像在成像部件上的相对位移。
本实施例中,当获取的第一图像的数量为两个时,自动对焦处理装置可以直接按该物距公式进行计算,并将得到结果作为拍摄对象相对于透镜之间的物距。
当第一图像的数量为多于两个时,自动对焦处理装置可以将各第一图像进行两两计算,得到多个物距结果,自动对焦处理装置将多个物距结果取平均值,并将该物距的均值作为拍摄对象相对于透镜之间的物距。
具体实施时,自动对焦处理装置获取第一图像的数量可以根据实际要求的物距精度确定,自动对焦处理装置可以通过适当数量的第一图像在保证物距精度的前提下,尽量减少透镜移动的次数。
步骤S103:根据拍摄对象相对于透镜的物距,确定透镜的对焦位置。
本发明实施例中,首先通过透镜在同一平面的至少两个不同位置时在成像部件上所成的图像确定物距,之后可以根据物距计算透镜的对焦位置,相较于现有技术中,逐步移动透镜根据透镜在每个位置上所成图像的清晰度搜索粗对焦位置的方式而言,本发明实施例方法能够减少粗对焦过程中透镜的移动次数,提高对焦速度。
本发明实施例中,在确定透镜的物距后,可以根据物距确定出透镜的对焦位置。具体地确定方法可以是通过查阅预设的如下表1所示的景深表确定对焦位置,还可以直接通过成像公式
Figure PCTCN2015099261-appb-000005
(其中,u为物距,v为像距,f为焦距)确定像距,根据计算到的像距确定相机设备的对焦位置。
表1 物距-透镜移动距离景深表
物距(米) 透镜移动距离(毫米) 远景深点(米) 近景深点(米)
3 -0.005 772.725 1.5
0.3 -0.05 0.332 0.273
0.14 -0.109 0.146 0.134
0.06 -0.265 0.061 0.059
0.05 -0.323 0.051 0.049
如表1示出了一种物距-透镜移动距离景深表,从表1中可以看出,对应不同的物距分别标识有不同的透镜移动距离,其中表1中的透镜移动距离是对应不同的物距透镜从初始位置所需要移动的距离,具体的,透镜的初始位置是指透镜的焦距位置,移动方向是远离成像部件的方向。
如表1中,当物距为3米时,透镜需要从初始位置按照远离成像部件的方向移动5微米,当物距为0.3米时,透镜需要从初始位置按照远离成像部件的方向移动50微米,当物距为6厘米时,透镜需要从初始位置按照远离成像部件的方向移动265微米,可见物距越近,透镜需要移动的距离越大,若利用现有方法中逐步移动的方式确定透镜的粗对焦位置,当步长设置为10微米,移动距离为265微米时,透镜需要移动26步,相较于本申请中通过查阅景深表直接确定透镜对焦位置的方式,可见现有方法比较繁琐复杂。
本发明实施例中,确定透镜的物距后,若直接将通过查阅景深表或根据成像公式确定的像距位置作为透镜的对焦位置,可能会存在对焦不准确的问题,为了提高相机设备对焦的准确性,在根据透镜的物距,确定透镜的对焦位置时,首先根据所述物距,确定所述透镜的粗对焦位置;之后根据所述粗对焦位置对所述透镜进行细步对焦,确定所述透镜的对焦位置。
具体实施时,可以将根据景深表或成像公式计算得到的像距作为粗对焦位置,之后在粗对焦位置的基础上再对相机设备进行细步对焦,从而在简化对焦过程的前提下,提高相机设备对焦的精确性。
本发明实施例中对透镜进行细步对焦的方式和现有方法中对透镜细步对焦的方法相同,不再赘述。
图7示出了本发明实施例二自动对焦方法的流程图,本实施例根据透镜 在同一平面的两个不同位置上时所成的图像确定拍摄对象相对于透镜的物距,该方法的执行主体为自动对焦处理装置,主要步骤包括:
步骤S201:相机设备中的自动对焦处理装置获取透镜位于第一位置时成像部件对拍摄对象所成的A图像。
图8示出了了相机设备的透镜在同一平面移动的各参数关系示意图。
如图8,透镜位于o位置时,拍摄对象X在成像部件上所成的A图像位于v处。
步骤S202:相机设备中的自动对焦处理装置移动透镜至第二位置。
其中,第二位置与第一位置位于同一平面内,第一位置及第二位置与成像部件之间的距离相等,如图8所示,透镜从o位置移动到o’处,o与o’位于同一平面内,到成像部件的距离均为d1。
步骤S203:自动对焦处理装置获取透镜位于第二位置时成像部件对拍摄对象X所成的B图像。
如图8所示,透镜位于o’位置时,拍摄对象X在成像部件上所成的B图像位于v’处。
步骤S204:自动对焦处理装置通过图像配准确定A图像和B图像的像素差。
步骤S205:自动对焦处理装置根据计算得到的像素差以及成像部件的物理参数计算A图像和B图像在成像部件的相对位移。
例如,自动对焦处理装置将计算得到的像素差乘以成像部件的像素大小,得到A图像和B图像在成像部件上的相对位移。
如图8中,A图像和B图像在成像部件上的相对位移为vv’。
步骤S206:自动对焦处理装置确定A图像和B图像之间的相对位移方向与透镜的第一位置和第二位置之间的位移方向是否相同,若相同,执行步骤S27。
如图8所示,透镜从o位置移动到o’,移动方向为o指向o’;当透镜从o位置移动到o’时,在成像部件上所成的图像位置由v移动到v’,移动方向为v指向v’,o指向o’与v指向v’相同。
步骤S207:自动对焦处理装置确定拍摄对象相对于透镜的物距。
如图8中,自动对焦处理装置可以根据公式
Figure PCTCN2015099261-appb-000006
确定拍摄对象相 对于透镜的物距,其中,D为物距,d1为透镜与成像部件之间的距离,oo’为透镜在两个不同位置之间的物理位移,vv’为其中两个第一图像在成像部件上的相对位移。
进一步的,若A图像和B图像之间的相对位移方向与透镜的第一位置和第二位置之间的位移方向不相同,则认为,此次对焦过程不适用本发明实施例所示的对焦方法,自动对焦处理装置可以采用现有技术中的逐步移动透镜位置的方式确定粗对焦位置。
例如,如图8中,当透镜从o位置移动到o’时,拍摄对象在成像部件上所成的图像的位置从v’移动到v’此时透镜的移动方向为o指向o’,在成像部件上所成的图像移动方向为v’指向v’o指向o’与v’指向v方向相反,此时自动对焦处理装置可以采用现有技术中的逐步移动透镜位置的方式确定粗对焦位置。
步骤S208:自动对焦处理装置根据计算得到的物距,确定透镜的粗对焦位置。
自动对焦处理装置确定透镜的粗对焦位置时,可以采用查阅景深表或者利用成像公式的计算像距的方式。
步骤S209:自动对焦处理装置将透镜移动到与粗定焦位置所对应的位置。
步骤S210:自动对焦处理装置对透镜进行细步对焦,确定透镜的对焦位置。
本实施例的自动对焦方法,通过透镜在同一平面内两个位置上的图像确定出拍摄对象相对于透镜的物距,并根据景深表或者计算像距的方式确定透镜的粗定焦位置,大大减少粗步搜索次数,提高自动对焦效率。
本实施例中的自动对焦方法,确定拍摄对象相对于透镜的物距后,可以直接通过查阅景深表或者以计算像距的方式确定透镜的位置,但若将查阅景深表或计算像距得到的位置直接作为粗对焦位置,难易避免的会带来对焦不准确的问题,为了提高对焦的精度,本发明还将物距与对比度法相结合,从而在简化自动对焦过程的同时提高自动对焦的准确性。以下实施例将对物距与对比度法相结合的自动对焦方法进行详细说明。
图9示出了本发明实施例三自动对焦方法的流程图,本实施例方法采用物距与对比度法相结合的方式实现相机设备的自动对焦。该方法的执行主体 为自动对焦处理装置,包括:
步骤S301:自动对焦处理装置确定拍摄对象相对于透镜的物距。
本实施例中自动对焦处理装置确定拍摄对象相对于透镜物距的方法如实施例一和实施例二中所述,不再赘述。
步骤S302:自动对焦处理装置根据拍摄对象相对于透镜的物距及透镜的焦距,确定透镜的像距。
本实施例中,自动对焦处理装置根据成像公式
Figure PCTCN2015099261-appb-000007
其中,u为物距,v为像距,f为焦距,计算像距;或者,自动对焦处理装置通过查阅景深表确定像距。
步骤S303:自动对焦处理装置根据像距,确定各粗对焦调试位置。
本发明实施例中,给出了自动对焦处理装置确定各粗对焦调试位置的两个示例方法,对于其它确定各粗对焦调试位置的方法,本实施例不一一列举:
方法一:
(1)将像距位置作为基准位置;
(2)在基准位置远离成像部件的方向以及在基准位置接近成像部件的方向上分别各取至少一个位置,各取的至少一个位置与基准位置之间的距离为预设步长的整数倍;
(3)确定各取的至少一个位置及基准位置为各粗对焦调试位置。
方法二:
(1)确定像距位置在透镜可移动行程中所位于的移动区间,其中透镜可移动行程的起始位置为透镜的焦距位置,可移动行程的终点位置为透镜远离成像部件的最大距离处,透镜可移动行程预先划分为至少两个移动区间,至少两个移动区间之间不重叠,且至少两个移动区间的并集等于透镜可移动行程;
(2)对像距位置所位于的移动区间进行等距划分;
(3)确定像距位置所位于的移动区间的两个端点位置及等距划分得到的各个中间位置,作为各粗对焦调试位置。
步骤S304:自动对焦处理装置获取透镜在各粗对焦调试位置上成像部件对拍摄对象所成的各第二图像的对焦值。
步骤S305:自动对焦处理装置将各第二图像的对焦值中的最大值所对应 的粗对焦调试位置作为粗对焦位置。
步骤S306:自动对焦处理装置将透镜移动到与粗定焦位置相对应的位置。
步骤S307:自动对焦处理装置对透镜进行细步对焦,确定透镜的对焦位置。
本实施例中,相机设备将计算得到的物距与对比度法相结合,根据透镜在多个粗定焦调试位置上时成像部件所成图像的对焦值确定出透镜的粗对焦位置,避免了相关技术中为确定透镜粗对焦位置需要逐步搜索的弊端,减少相机设备自动对焦的粗步搜索次数,提高自动对焦速率。
为了对本实施例的实现过程进行详细说明,对应于本实施例三所给出的两个确定各粗对焦调试位置的示例,本发明实施例还提供了基于该方法一及方法二的确定透镜粗对焦位置的方法。
对应于本实施例三中的上述方法一,其中一个确定透镜粗对焦位置的实例包括:
(1)将计算出的像距位置作为基准位置d2。
(2)将d2-s、d2及d2+s分别确定为粗对焦调试位置,其中s为透镜的移动步长,d2-s是以d2所在的位置为基准,沿着接近成像部件的方向移动一个步长,d2+s是以d2所在的位置为基准,沿着远离成像部件的方向移动一个步长;
(3)分别获取透镜位于d2-s、d2及d2+s位置时,成像部件上所成图像的对焦值,分别记作FV(n-1)、FV(n)及FV(n+1)。
(4)采用爬山法比较FV(n-1)、FV(n)及FV(n+1)数值大小,并根据比较的结果,确定透镜的粗对焦位置。
具体的,采用爬山法比较FV(n-1)、FV(n)及FV(n+1)数值大小的方法包括:确定透镜在各粗对焦调试位置上,成像部件上所成的各第二图像的对焦值的排列规则,根据各第二图像的对焦值的排列规则确定粗对焦调试位置,具体的:
若按照远离成像部件的方向,FV(n-1)、FV(n)及FV(n+1)呈现先递增后递减的排列规则,则确定对焦值中的最大值所对应的透镜位置作为粗对焦位置。
若按照远离成像部件的方向,FV(n-1)、FV(n)及FV(n+1)呈现递 增排列规则,则按照远离成像部件的方向继续移动透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定对焦值中的最大值所对应的位置作为粗对焦位置。
若按照远离成像部件的方向,FV(n-1)、FV(n)及FV(n+1)呈现递减排列规则,则从透镜初始移动的粗对焦调试位置按照接近成像部件的方向继续移动透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定对焦值中的最大值所对应的位置作为粗对焦位置。
若按照远离成像部件的方向,FV(n-1)、FV(n)及FV(n+1)呈现先递减后递增的排列规则,则按照远离成像部件的方向继续移动透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定对焦值中的最大值所对应的位置作为粗对焦位置。
对应于本实施例三中的上述方法二,其中一个确定透镜粗对焦位置的实例包括:
(1)确定计算出的像距d2所位于的移动区间。
例如,透镜的整个可移动行程为[0,50],其中,透镜的可移动行程的起点位置为焦距位置,移动方向为远离成像部件的方向,在其中一个示例中可以将[0,50]划分为[0,10),[10,20),[20,30),[30,40),[40,50],当计算出的像距d2为12时,确定d2位于划分的[10,20)区间范围内。
(2)对[10,20)进行等距划分,如对[10,20)按照步长为1进行划分,则确定该区间的10、11、12、13、14、15、16、17、18、19为粗对焦调试位置。
(3)获取透镜在10、11、12、13、14、15、16、17、18、19各个粗对焦调试位置上时,拍摄对象分别在透镜成像部件上所成的各图像的对焦值。
(4)采用爬山法比较FV(n-1)、FV(n)及FV(n+1)数值大小,并根据比较的结果,确定透镜的粗对焦位置。
其中,本实例中采用爬山法比较FV(n-1)、FV(n)及FV(n+1)数值大小的方法与本实施例三中的上述方法一的方法相同,不再赘述。
进一步的,当采用查景深表的方法确定,透镜需要移动的距离后,将透镜按照查表得到的位置作为基准位置,则可以按照本实施例三给出的方法确定透镜的粗对焦位置,具体过程如实施例三所述,不再赘述。
图10示出了本发明实施例一自动对焦处理装置的结构示意图,该装置包括图像获取模块601、物距确定模块602及对焦模块603,其中:
图像获取模块601,用于获取透镜在至少两个不同位置上成像部件对拍摄对象所成的各第一图像,其中至少两个不同位置位于同一平面,同一平面与成像部件用于形成各第一图像的成像面平行;
物距确定模块602,用于根据各第一图像,确定拍摄对象相对于透镜的物距;
对焦模块603,用于根据物距,确定透镜的对焦位置。
在上述实施例中,对焦模块603,具体用于:根据物距,确定透镜的粗对焦位置;根据粗对焦位置对透镜进行细步对焦,确定透镜的对焦位置。
在上述实施例中,物距确定模块602,具体用于:
通过图像配准,确定各第一图像之间的像素差;
根据各第一图像之间的像素差以及成像部件的物理参数,确定各第一图像在成像部件上的相对位移;
根据透镜在至少两个不同位置的物理位移、各第一图像在成像部件上的相对位移以及透镜与成像部件之间的距离,确定拍摄对象相对于透镜的物距。
在上述实施例中,成像部件的物理参数包括:成像部件的像素大小;
物距确定模块602,具体用于:
根据各第一图像之间的像素差与成像部件的像素大小之间的乘积,确定各第一图像在成像部件上的相对位移。
在上述实施例中,物距确定模块602,具体用于:
根据公式
Figure PCTCN2015099261-appb-000008
确定拍摄对象相对于透镜的物距,其中,D为物距,d1为透镜与成像部件之间的距离,oo’为透镜在两个不同位置之间的物理位移,vv’为其中两个第一图像在成像部件上的相对位移。
在上述实施例中,物距确定模块602,还用于根据各第一图像之间的像素差以及成像部件的物理参数,确定各第一图像在成像部件上的相对位移之后,确定各第一图像在成像部件上的移动方向是否与透镜的至少两个不同位置的移动方向相同;
若相同,则根据透镜在至少两个不同位置的物理位移、各第一图像在成 像部件上的相对位移以及透镜与成像部件之间的距离,确定拍摄对象相对于透镜的物距。
在上述实施例中,对焦模块603,具体用于:
根据物距,确定透镜的像距;
根据像距,确定透镜的粗对焦位置。
在上述实施例中,对焦模块603,具体用于:
根据像距,确定各粗对焦调试位置;
获取透镜在各粗对焦调试位置上成像部件对拍摄对象所成的各第二图像的对焦值;
将各第二图像的对焦值中的最大值所对应的粗对焦调试位置作为粗对焦位置。
在上述实施例中,对焦模块603,具体用于:
将像距位置作为基准位置;
在基准位置远离成像部件的方向以及在基准位置接近成像部件的方向上分别各取至少一个位置,各取的至少一个位置与基准位置之间的距离为预设步长的整数倍;
确定各取的至少一个位置及基准位置为各粗对焦调试位置。
对焦模块603,具体用于:
确定像距位置在透镜可移动行程中所位于的移动区间,其中透镜可移动行程的起始位置为透镜的焦距位置,可移动行程的终点位置为透镜远离成像部件的最大距离处,透镜可移动行程预先划分为至少两个移动区间,至少两个移动区间之间不重叠,且至少两个移动区间的并集等于透镜可移动行程;
对像距位置所位于的移动区间进行等距划分;
确定像距位置所位于的移动区间的至少一个端点位置及等距划分得到的各个中间位置,作为各粗对焦调试位置。
在上述实施例中,对焦模块603还用于:
确定透镜在各粗对焦调试位置上,成像部件上所成的各第二图像的对焦值的排列规则;
若按照远离成像部件的方向,成像部件上所成的各第二图像的对焦值呈现先递增后递减的排列规则,则确定对焦值中的最大值所对应的透镜位置作 为粗对焦位置。
在上述实施例中,对焦模块603还用于:若按照远离成像部件的方向,成像部件上所成的各第二图像的对焦值呈现递增排列规则,则按照远离成像部件的方向继续移动透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定对焦值中的最大值所对应的位置作为粗对焦位置。
在上述实施例中,对焦模块603,具体用于:
若按照远离成像部件的方向,成像部件上所成的各第二图像的对焦值呈现递减排列规则,则从透镜初始移动的粗对焦调试位置按照接近成像部件的方向继续移动透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定对焦值中的最大值所对应的位置作为粗对焦位置。
在上述实施例中,对焦模块603,还用于:
若按照远离成像部件的方向,成像部件上所成的各第二图像的对焦值呈现先递减后递增的排列规则,则按照远离成像部件的方向继续移动透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定对焦值中的最大值所对应的位置作为粗对焦位置。
图11示出了本发明实施例一自动对焦处理设备的结构示意图,自动对焦处理设备1100包括通信接口1101、存储器1103和处理器1102,其中,通信接口1101、处理器1102、存储器1103、通过总线1104相互连接;总线1104可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图11中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
通信接口1101用于与发送端通信。存储器1103,用于存放程序。具体地,程序可以包括程序代码,程序代码包括计算机操作指令。存储器1103可能包含随机存取存储器(random access memory,简称RAM),也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。
处理器1102执行存储器1103所存放的程序,实现本发明前述方法实施例的方法:
获取透镜在至少两个不同位置上成像部件对拍摄对象所成的各第一图像,其中至少两个不同位置位于同一平面,同一平面与成像部件用于形成各第一 图像的成像面平行;
根据各第一图像,确定拍摄对象相对于透镜的物距;
根据物距,确定透镜的对焦位置。
上述的处理器1102可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (29)

  1. 一种自动对焦方法,其特征在于,包括:
    获取透镜在至少两个不同位置上成像部件对拍摄对象所成的各第一图像,其中所述至少两个不同位置位于同一平面,所述同一平面与所述成像部件用于形成所述各第一图像的成像面平行;
    根据所述各第一图像,确定所述拍摄对象相对于所述透镜的物距;
    根据所述物距,确定所述透镜的对焦位置。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述物距,确定所述透镜的对焦位置,包括:
    根据所述物距,确定所述透镜的粗对焦位置;
    根据所述粗对焦位置对所述透镜进行细步对焦,确定所述透镜的对焦位置。
  3. 根据权利要求1或2所述的方法,其特征在于,所述根据所述各第一图像,确定所述拍摄对象相对于所述透镜的物距,包括:
    通过图像配准,确定所述各第一图像之间的像素差;
    根据所述各第一图像之间的像素差以及所述成像部件的物理参数,确定所述各第一图像在成像部件上的相对位移;
    根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距。
  4. 根据权利要求3所述的方法,其特征在于,所述成像部件的物理参数包括:所述成像部件的像素大小;
    所述根据所述各第一图像之间的像素差以及所述成像部件的物理参数,确定所述各第一图像在成像部件上的相对位移,包括:
    根据所述各第一图像之间的像素差与所述成像部件的像素大小之间的乘积,确定所述各第一图像在成像部件上的相对位移。
  5. 根据权利要求3或4所述的方法,其特征在于,所述根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距,包括:
    根据公式
    Figure PCTCN2015099261-appb-100001
    确定所述拍摄对象相对于所述透镜的物距,其中,所述D为物距,所述d1为所述透镜与所述成像部件之间的距离,所述oo’为所述透镜在两个不同位置之间的物理位移,所述vv’为其中两个所述第一图像在成像部件上的相对位移。
  6. 根据权利要求3~5中任一项所述的方法,其特征在于,所述根据所述各第一图像之间的像素差以及所述成像部件的物理参数,确定所述各第一图像在成像部件上的相对位移之后,还包括:
    确定所述各第一图像在所述成像部件上的移动方向是否与所述透镜的所述至少两个不同位置的移动方向相同;
    若相同,则根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距。
  7. 根据权利要求2~6中任一项所述的方法,其特征在于,所述根据所述物距,确定所述透镜的粗对焦位置,包括:
    根据所述物距,确定所述透镜的像距;
    根据所述像距,确定所述透镜的粗对焦位置。
  8. 根据权利要求7所述的方法,其特征在于,所述根据所述像距,确定所述透镜的粗对焦位置,包括:
    根据所述像距,确定各粗对焦调试位置;
    获取所述透镜在所述各粗对焦调试位置上成像部件对拍摄对象所成的各第二图像的对焦值;
    将所述各第二图像的对焦值中的最大值所对应的粗对焦调试位置作为粗对焦位置。
  9. 根据权利要求8所述的方法,其特征在于,所述根据所述像距,确定各粗对焦调试位置,包括:
    将所述像距位置作为基准位置;
    在所述基准位置远离所述成像部件的方向以及在所述基准位置接近所述成像部件的方向上分别各取至少一个位置,所述各取的所述至少一个位置与所述基准位置之间的距离为预设步长的整数倍;
    确定所述各取的所述至少一个位置及所述基准位置为所述各粗对焦调试位置。
  10. 根据权利要求8所述的方法,其特征在于,所述根据所述像距,确定各粗对焦调试位置,包括:
    确定所述像距位置在透镜可移动行程中所位于的移动区间,其中所述透镜可移动行程的起始位置为透镜的焦距位置,所述可移动行程的终点位置为所述透镜远离所述成像部件的最大距离处,所述透镜可移动行程预先划分为至少两个移动区间,所述至少两个移动区间之间不重叠,且所述至少两个移动区间的并集等于所述透镜可移动行程;
    对所述像距位置所位于的移动区间进行等距划分;
    确定所述像距位置所位于的移动区间的至少一个端点位置及所述等距划分得到的各个中间位置,作为所述各粗对焦调试位置。
  11. 根据权利要求8~10中任一项所述的方法,其特征在于,所述将所述各第二图像的对焦值中的最大值所对应的粗对焦调试位置作为粗对焦位置,包括:
    确定所述透镜在所述各粗对焦调试位置上,所述成像部件上所成的各第二图像的对焦值的排列规则;
    若按照远离所述成像部件的方向,所述成像部件上所成的所述各第二图像的对焦值呈现先递增后递减的排列规则,则确定所述对焦值中的最大值所对应的透镜位置作为粗对焦位置。
  12. 根据权利要求11所述的方法,其特征在于,还包括:
    若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现递增排列规则,则按照远离所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
  13. 根据权利要求11所述的方法,其特征在于,还包括:
    若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现递减排列规则,则从所述透镜初始移动的粗对焦调试位置按照接近所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置 作为粗对焦位置。
  14. 根据权利要求11所述的方法,其特征在于,还包括:
    若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现先递减后递增的排列规则,则按照远离所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
  15. 一种自动对焦处理装置,其特征在于,包括:
    图像获取模块,用于获取透镜在至少两个不同位置上成像部件对拍摄对象所成的各第一图像,其中所述至少两个不同位置位于同一平面,所述同一平面与所述成像部件用于形成所述各第一图像的成像面平行;
    物距确定模块,用于根据所述各第一图像,确定所述拍摄对象相对于所述透镜的物距;
    对焦模块,用于根据所述物距,确定所述透镜的对焦位置。
  16. 根据权利要求15所述的装置,其特征在于,所述对焦模块,具体用于:
    根据所述物距,确定所述透镜的粗对焦位置;
    根据所述粗对焦位置对所述透镜进行细步对焦,确定所述透镜的对焦位置。
  17. 根据权利要求15或16所述的装置,其特征在于,所述物距确定模块,具体用于:
    通过图像配准,确定所述各第一图像之间的像素差;
    根据所述各第一图像之间的像素差以及所述成像部件的物理参数,确定所述各第一图像在成像部件上的相对位移;
    根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距。
  18. 根据权利要求17所述的装置,其特征在于,所述成像部件的物理参数包括:所述成像部件的像素大小;
    所述物距确定模块,具体用于:
    根据所述各第一图像之间的像素差与所述成像部件的像素大小之间的乘 积,确定所述各第一图像在成像部件上的相对位移。
  19. 根据权利要求17或18所述的装置,其特征在于,所述物距确定模块,具体用于:
    根据公式
    Figure PCTCN2015099261-appb-100002
    确定所述拍摄对象相对于所述透镜的物距,其中,所述D为物距,所述d1为所述透镜与所述成像部件之间的距离,所述oo’为所述透镜在两个不同位置之间的物理位移,所述vv’为其中两个所述第一图像在成像部件上的相对位移。
  20. 根据权利要求17~19中任一项所述的装置,其特征在于,所述物距确定模块,还用于:
    根据所述各第一图像之间的像素差以及所述成像部件的物理参数,确定所述各第一图像在成像部件上的相对位移之后,确定所述各第一图像在所述成像部件上的移动方向是否与所述透镜的所述至少两个不同位置的移动方向相同;
    若相同,则根据所述透镜在所述至少两个不同位置的物理位移、所述各第一图像在成像部件上的相对位移以及所述透镜与所述成像部件之间的距离,确定所述拍摄对象相对于所述透镜的物距。
  21. 根据权利要求16~20中任一项所述的装置,其特征在于,所述对焦模块,具体用于:
    根据所述物距,确定所述透镜的像距;
    根据所述像距,确定所述透镜的粗对焦位置。
  22. 根据权利要求21所述的装置,其特征在于,所述对焦模块,具体用于:
    根据所述像距,确定各粗对焦调试位置;
    获取所述透镜在所述各粗对焦调试位置上成像部件对拍摄对象所成的各第二图像的对焦值;
    将所述各第二图像的对焦值中的最大值所对应的粗对焦调试位置作为粗对焦位置。
  23. 根据权利要求22所述的装置,其特征在于,所述对焦模块,具体用于:
    将所述像距位置作为基准位置;
    在所述基准位置远离所述成像部件的方向以及在所述基准位置接近所述成像部件的方向上分别各取至少一个位置,所述各取的所述至少一个位置与所述基准位置之间的距离为预设步长的整数倍;
    确定所述各取的所述至少一个位置及所述基准位置为所述各粗对焦调试位置。
  24. 根据权利要求22所述的装置,其特征在于,所述对焦模块,具体用于:
    确定所述像距位置在透镜可移动行程中所位于的移动区间,其中所述透镜可移动行程的起始位置为透镜的焦距位置,所述可移动行程的终点位置为所述透镜远离所述成像部件的最大距离处,所述透镜可移动行程预先划分为至少两个移动区间,所述至少两个移动区间之间不重叠,且所述至少两个移动区间的并集等于所述透镜可移动行程;
    对所述像距位置所位于的移动区间进行等距划分;
    确定所述像距位置所位于的移动区间的至少一个端点位置及所述等距划分得到的各个中间位置,作为所述各粗对焦调试位置。
  25. 根据权利要求22~24中任一项所述的装置,其特征在于,所述对焦模块,具体用于:
    确定所述透镜在所述各粗对焦调试位置上,所述成像部件上所成的各第二图像的对焦值的排列规则;
    若按照远离所述成像部件的方向,所述成像部件上所成的所述各第二图像的对焦值呈现先递增后递减的排列规则,则确定所述对焦值中的最大值所对应的透镜位置作为粗对焦位置。
  26. 根据权利要求25所述的装置,其特征在于,所述对焦模块,还用于:
    若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现递增排列规则,则按照远离所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
  27. 根据权利要求25所述的装置,其特征在于,所述对焦模块,还用 于:
    若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现递减排列规则,则从所述透镜初始移动的粗对焦调试位置按照接近所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
  28. 根据权利要求25所述的装置,其特征在于,所述对焦模块,还用于:
    若按照远离所述成像部件的方向,所述成像部件上所成的各第二图像的对焦值呈现先递减后递增的排列规则,则按照远离所述成像部件的方向继续移动所述透镜,直至得到的各第二图像的对焦值呈现先递增后递减的排列规则,并确定所述对焦值中的最大值所对应的位置作为粗对焦位置。
  29. 一种自动对焦处理设备,其特征在于,所述自动对焦处理设备部署于相机设备中,其特征在于,包括:
    通信接口、存储器、处理器和通信总线,其中,所述通信接口、所述存储器和所述处理器通过所述通信总线通信;
    所述存储器用于存放程序,所述处理器用于执行所述存储器存储的程序;当自动对焦处理设备运行时,所述处理器运行程序,所述程序包括:
    获取透镜在至少两个不同位置上成像部件对拍摄对象所成的各第一图像,其中所述至少两个不同位置位于同一平面,所述同一平面与所述成像部件用于形成所述各第一图像的成像面平行;
    根据所述各第一图像,确定所述拍摄对象相对于所述透镜的物距;
    根据所述物距,确定所述透镜的对焦位置。
PCT/CN2015/099261 2015-12-28 2015-12-28 自动对焦方法、装置及设备 WO2017113075A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2015/099261 WO2017113075A1 (zh) 2015-12-28 2015-12-28 自动对焦方法、装置及设备
CN201580078572.4A CN107534723B (zh) 2015-12-28 2015-12-28 自动对焦方法、装置及设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/099261 WO2017113075A1 (zh) 2015-12-28 2015-12-28 自动对焦方法、装置及设备

Publications (1)

Publication Number Publication Date
WO2017113075A1 true WO2017113075A1 (zh) 2017-07-06

Family

ID=59224269

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/099261 WO2017113075A1 (zh) 2015-12-28 2015-12-28 自动对焦方法、装置及设备

Country Status (2)

Country Link
CN (1) CN107534723B (zh)
WO (1) WO2017113075A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831609A (zh) * 2019-03-05 2019-05-31 上海炬佑智能科技有限公司 Tof深度相机及其自动对焦方法
CN110336951A (zh) * 2019-08-26 2019-10-15 厦门美图之家科技有限公司 反差式对焦方法、装置及电子设备
CN111818261A (zh) * 2020-07-07 2020-10-23 深圳市中江天华科技有限公司 一种基于飞行时间的自动对焦方法及***
CN112839166A (zh) * 2020-12-02 2021-05-25 维沃移动通信(杭州)有限公司 拍摄方法、装置及电子设备
CN113364968A (zh) * 2020-03-05 2021-09-07 浙江宇视科技有限公司 一种对焦方法、装置、摄像机和可读存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114827392B (zh) * 2021-01-29 2024-02-13 北京小米移动软件有限公司 一种光学组件调整方法、装置、终端及存储介质
WO2024092396A1 (en) * 2022-10-31 2024-05-10 Qualcomm Incorporated Autofocus convergence processes within imaging devices

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040170418A1 (en) * 2002-12-10 2004-09-02 Naoki Matsuo Camera having distance measuring apparatus
CN101790043A (zh) * 2009-01-22 2010-07-28 华为终端有限公司 一种自动聚焦控制的方法及其装置
CN102984530A (zh) * 2011-09-02 2013-03-20 宏达国际电子股份有限公司 图像处理***及自动对焦方法
CN103246130A (zh) * 2013-04-16 2013-08-14 广东欧珀移动通信有限公司 一种对焦方法及装置
US20150281554A1 (en) * 2014-03-28 2015-10-01 Panasonic Intellectual Property Management Co., Ltd. Image-capturing apparatus

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8045046B1 (en) * 2010-04-13 2011-10-25 Sony Corporation Four-dimensional polynomial model for depth estimation based on two-picture matching
CN104469168A (zh) * 2014-12-29 2015-03-25 信利光电股份有限公司 摄像模组及其自动对焦方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040170418A1 (en) * 2002-12-10 2004-09-02 Naoki Matsuo Camera having distance measuring apparatus
CN101790043A (zh) * 2009-01-22 2010-07-28 华为终端有限公司 一种自动聚焦控制的方法及其装置
CN102984530A (zh) * 2011-09-02 2013-03-20 宏达国际电子股份有限公司 图像处理***及自动对焦方法
CN103246130A (zh) * 2013-04-16 2013-08-14 广东欧珀移动通信有限公司 一种对焦方法及装置
US20150281554A1 (en) * 2014-03-28 2015-10-01 Panasonic Intellectual Property Management Co., Ltd. Image-capturing apparatus

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109831609A (zh) * 2019-03-05 2019-05-31 上海炬佑智能科技有限公司 Tof深度相机及其自动对焦方法
CN110336951A (zh) * 2019-08-26 2019-10-15 厦门美图之家科技有限公司 反差式对焦方法、装置及电子设备
CN113364968A (zh) * 2020-03-05 2021-09-07 浙江宇视科技有限公司 一种对焦方法、装置、摄像机和可读存储介质
CN113364968B (zh) * 2020-03-05 2023-06-20 浙江宇视科技有限公司 一种对焦方法、装置、摄像机和可读存储介质
CN111818261A (zh) * 2020-07-07 2020-10-23 深圳市中江天华科技有限公司 一种基于飞行时间的自动对焦方法及***
CN112839166A (zh) * 2020-12-02 2021-05-25 维沃移动通信(杭州)有限公司 拍摄方法、装置及电子设备
CN112839166B (zh) * 2020-12-02 2023-08-22 维沃移动通信(杭州)有限公司 拍摄方法、装置及电子设备

Also Published As

Publication number Publication date
CN107534723A (zh) 2018-01-02
CN107534723B (zh) 2020-04-14

Similar Documents

Publication Publication Date Title
WO2017113075A1 (zh) 自动对焦方法、装置及设备
US10462374B2 (en) Zooming control apparatus, image capturing apparatus and control methods thereof
US9998650B2 (en) Image processing apparatus and image pickup apparatus for adding blur in an image according to depth map
EP3318054B1 (en) Systems and methods for autofocus trigger
WO2015180509A1 (zh) 一种图像获取终端和图像获取方法
US8447178B2 (en) Image pickup apparatus and method for controlling image pickup apparatus
WO2020200093A1 (zh) 对焦方法、装置、拍摄设备及飞行器
US10298835B2 (en) Image control methods and apparatuses, and imaging devices with control of deformation of image sensor
CN102984530A (zh) 图像处理***及自动对焦方法
JP2013008018A (ja) 撮像装置およびその制御方法
TW201501533A (zh) 調整對焦位置的方法及電子裝置
CN108769533B (zh) 一种自动对焦方法
JP6447840B2 (ja) 画像装置、及び画像装置における自動的な焦点合わせのための方法、並びに対応するコンピュータプログラム
CN109151328B (zh) 镜头对焦方法、装置及变焦镜头
CN106154688B (zh) 一种自动对焦的方法及装置
CN109698902B (zh) 一种同步聚焦方法及装置
JP6198437B2 (ja) 撮像装置およびその制御方法
WO2013069279A1 (ja) 撮像装置
CN105676563A (zh) 一种变焦相机的对焦方法及相机
KR102350926B1 (ko) 자동 초점 조절방법
KR102334751B1 (ko) 렌즈 조심 장치 및 방법
JP6627116B1 (ja) 制御装置
CN114979472B (zh) 一种自动对焦方法、装置、设备及可读存储介质
CN109429004B (zh) 一种拍照方法、装置及移动终端
TWI619390B (zh) 電子裝置及其鏡頭切換方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15911706

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15911706

Country of ref document: EP

Kind code of ref document: A1