FOCUSING METHOD AND FOCUSING SYSTEM BASED ON A DISTANCE SENSOR OF MOBILE TERMINAL
20170257555 · 2017-09-07
Assignee
Inventors
Cpc classification
H04N23/671
ELECTRICITY
H04M1/72403
ELECTRICITY
G02B7/38
PHYSICS
G02B7/285
PHYSICS
H04M2250/12
ELECTRICITY
International classification
Abstract
A focusing method and a focusing system based on a distance sensor of mobile terminal is provided. The method may include: acquiring an initial distance between a camera and an object to be shot by using the distance sensor; judging whether the distance between the camera and the object changed; in response to judging that the distance changed, acquiring a micro-adjustment range of a motor according to the distance; controlling the motor to move based on the micro-adjustment ranges; collecting images from the camera in a real-time manner; acquiring focus values of the collected images; and moving the motor to a position corresponding to a largest focus value of the focus values to focus the camera.
Claims
1-4. (canceled)
5. A focusing method based on a distance sensor of a mobile terminal, comprising: acquiring and storing an initial distance between a camera and an object to be shot by using the distance sensor after detecting that a shooting function of the mobile terminal has started; judging whether a current distance acquired by the distance sensor is equal to the initial distance; in response to the judging that the current distance is not equal to the initial distance, querying a correspondence table to acquire a target micro-adjustment range of the motor according to the current distance, controlling the motor to move within the target micro-adjustment range, and collecting images from the camera; and acquiring focus values of the images when the motor moves into different positions within the target micro-adjustment range, and controlling the motor to move to a position corresponding to a largest focus value of the focus values, thereby focusing the camera.
6. The method according to claim 5, wherein the method further comprises, prior to the judging: presetting and storing the correspondence table of distances between the distance sensor and the object to be shot and associated micro-adjustment ranges of the motor.
7. The method according to claim 5, wherein the method further comprises: controlling the motor to keep still at a current position in response to the judging that the current distance is equal to the initial distance.
8. The method according to claim 5, wherein the collecting of the images is in a real-time manner.
9. The method according to claim 5, wherein the acquiring of the focus values of the images comprises: acquiring and storing the focus values of the images when the motor moves into the different positions within the target micro-adjustment range; comparing all of the focus values, and acquiring the position corresponding to the largest focus value; and controlling the motor to move to the position corresponding to the largest focus value of the focus values, thereby focusing the camera.
10. A focusing system based on a distance sensor of a mobile terminal, comprising: a detection and acquisition module acquiring and storing an initial distance between a camera and the object to be shot by using the distance sensor after detecting that a shooting function of the mobile terminal has started; a judgment module judging whether a current distance acquired by the distance sensor is equal to the initial distance; in response to the judgment module judging that the current distance is not equal to the initial distance, a query and image collection module querying a correspondence table to acquire the target micro-adjustment range of a motor according to the current distance, controlling the motor to move within the target micro-adjustment range, and collecting images from the camera; and an acquisition and control module acquiring focus values of the images when the motor moves into different positions within the target micro-adjustment range, and controlling the motor to move to a position corresponding to a largest focus value of the focus values, thereby focusing the camera.
11. The system according to claim 10, further comprising: a presetting and storage module presetting and storing the correspondence table of distances between the distance sensor and the object to be shot and associated micro-adjustment ranges of the motor.
12. The system according to claim 10, wherein the judgment module further comprises: a judgment and control unit controlling the motor to keep still at a current position in response to the judging that the current distance is equal to the initial distance.
13. The system according to claim 10, wherein the query and image collection module comprises: a detection and acquisition unit for acquiring the current distance between the distance sensor and the object to be shot in response to judging that the current distance has changed; a query unit querying the correspondence table to acquire the target micro-adjustment range of the motor according to the current distance; and a control and collection unit for controlling the motor to move within the target micro-adjustment range, and collecting images from the camera.
14. The system according to claim 10, wherein the acquisition and control module comprises: an acquisition and storage unit acquiring and storing the focus values of the images when the motor moves into the different positions within the target micro-adjustment range; a comparison unit comparing all of the focus values, and acquiring the position corresponding to the largest focus value of the focus values; and a control unit controlling the motor to move to a position corresponding to a largest focus value of the focus values, thereby focusing the camera.
15. A storage medium for storing a processor-executable instruction therein, wherein the processor-executable instruction is configured to cause, when executed by a processor: acquiring and storing an initial distance between a camera and the object to be shot by using the distance sensor after detecting that a shooting function of the mobile terminal has started; judging whether a current distance acquired by the distance sensor is equal to the initial distance; in response to the judging that the current distance is not equal to the initial distance, querying the correspondence table to acquire the target micro-adjustment range of the motor according to the current distance, controlling the motor to move within the target micro-adjustment range, and collecting images from the camera; and acquiring focus values of the images when the motor moves into different positions within the target micro-adjustment range, and controlling the motor to move to a position corresponding to a largest focus value of the focus values, thereby focusing the camera.
16. The storage medium according to claim 15, wherein the processor-executable instruction is further configured to cause, prior to the judging: presetting and storing the correspondence table of distances between the distance sensor and the object to be shot and associated micro-adjustment ranges of the motor.
17. The storage medium according to claim 15, wherein the processor-executable instruction is further configured to cause: controlling the motor to keep still at a current position in response to the judging that the current distance is equal to the initial distance.
18. The storage medium according to claim 15, wherein the processor-executable instruction is further configured to cause the collecting of the images in a real-time manner.
19. The storage medium according to claim 15, wherein the processor-executable instruction is further configured so that the acquiring of the focus values comprises: acquiring and storing the focus values of the images when the motor moves into the different positions within the target micro-adjustment range; comparing all of the focus values, and acquiring the position corresponding to the largest focus value; and controlling the motor to move to the position corresponding to the largest focus value of the focus values, thereby focusing the camera.
20. The system according to claim 10, wherein the collecting of the images from the camera is in a real-time manner.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0052]
[0053]
[0054]
[0055]
DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solutions and advantages of the present invention more clear, the invention is described in detail in combination with accompanied figures and exemplary embodiments. It should be understood that exemplary embodiments described herein are for illustrative purposes only. The exemplary embodiments are not intended to limit the scope of the claimed invention in any way.
[0057] Turning to
[0059] In an example, a distance sensor is introduced into a mobile terminal, with the distance sensor in the same plane with an image sensor so that both the distance sensor and the image sensor have the same distance from an object. A new drive device is pre-registered for a mobile terminal. In this example, a drive distance sensor is pre-registered in a system by using a Linux operating system to add a new device by matching the driver device through a bus. Therefore, the device is registered to be a misc. device on the iic bus. The specific method is ret=i2c_add_driver(&stmvl6180_driver); i2c_register_board_info(1, &i2c_stmvl6180, 1) in probe, so that stmv6180 device is registered in the iic bus. The device is registered when the bus is subject to probe (misc_register(&stmvl6180_ranging_dev), which prepares for an algorithm to acquire distance information in the future.
[0060] One specific method for acquiring distance is as follows: opening the newly-registered device through device node, and acquiring the current distance information through ioctl. For example: UCHAR cBuf[128]=“/dev/stmvl6180”; ISTMV6180=open(cBuf, O_RDWR); acquiring distance information: ioctlerr=ioctl(ISTMV6180_HANDLE,VL6180_IOCTL_GETDATA, &distance); and acquiring real-time distance information through the working focusing algorithm described above.
[0061] The distance sensor is installed at the position parallel to the image sensor and is provided with a laser transmitter and a laser receiver. An infrared transmitter (if used) will transmit a laser beam, and the current distance is calculated through the distance between the transmitting position and the receiving position and is stored.
[0062] The method may further include, prior to S100: [0063] presetting and storing the correspondence table of distances between the distance sensor and the object to be shot and associated micro-adjustment ranges of the motor. (Block S1)
[0064] An example of the distances between the distance sensor and the object to be shot and the correspondence table of the focusing micro adjustment ranges of the motor is depicted in
[0065] The method may further include: [0066] judging whether a current distance acquired by the distance sensor is equal to the initial distance. (block S200)
[0067] In an example, block S200 further includes: [0068] controlling the motor to keep still at a current position in response to the judging that the current distance is equal to the initial distance. (block S201)
[0069] Thus, the method may include acquiring the current distance with an object by using the distance sensor, comparing it with the object distance stored previously and judging whether the distance has changed; if the distance with the object to be shot does not change, directly taking photos with the original position of the motor, which saves time by avoiding a refocusing.
[0070] The method may further include: [0071] in response to the judging that the current distance is not equal to the initial distance, querying a correspondence table to acquire a target micro-adjustment range of the motor according to the current distance, controlling the motor to move within the target micro-adjustment range, and collecting images from the camera. (block S300)
[0072] In an example, block S300 includes: [0073] acquiring the current distance between the distance sensor and the object to be shot in response to judging that the current distance has changed; (block S301) [0074] querying the correspondence table to acquire the target micro-adjustment range of the motor according to the current distance; and [0075] controlling the motor to move within the target micro-adjustment range, and collecting images from the camera in a real-time manner.
[0076] In an example, when detecting that the current distance has changed, the method includes acquiring the current distance (230 cm, for example) between the current distance sensor and the object to be shot; querying the table as shown in
[0077] The method may further include: [0078] acquiring focus values of the images when the motor moves into different positions within the target micro-adjustment range, and controlling the motor to move to a position corresponding to a largest focus value of the focus values, thereby focusing the camera. (block S400)
[0079] In an example, block S400 includes: [0080] acquiring and storing the focus values of the images when the motor moves into the different positions within the target micro-adjustment range; (block S401) [0081] comparing all of the focus values, and acquiring the position corresponding to the largest focus value; (block S402) and [0082] controlling the motor to move to the position corresponding to the largest focus value of the focus values, thereby focusing the camera. (block S403)
[0083] In an example, when the motor moves within the micro-adjustment range, the method includes acquiring the focus values of the images of the motor at different positions, that is FV; judging whether the current FV is the position corresponding to the largest FV; and acquiring the specific FV by a set focusing algorithm (the larger the FV is, the clearer an image is). After acquiring the position corresponding to the largest focus value, the method includes moving the motor to the position corresponding to the largest focus value to finish focusing. If photos are taken at this time, photos with the best quality can be acquired.
[0084] In an example of a focusing method based on a distance sensor of a mobile terminal (see
[0095] According to the examples described above, the invention provides a focusing method based on a distance sensor of a mobile terminal, which includes judging whether a distance between a camera and an object changes. If the distance has not changed, the current motor position is kept without adjustment. If the distance has changed, a preset micro-adjustment range is found according to the current position, a movement of the motor within the micro-adjustment range is controlled, and an image of the current position is acquired to get the current FV. The largest FV distance is acquired in the FV values within micro-adjustment range to finish focusing, which increases the focusing speed of the shooting process.
[0096] Based on the examples above, a focusing system based on distance terminal of a mobile terminal is also provided (see
[0101] In an example, the focusing system may further include: [0102] a presetting and storage module presetting and storing the correspondence table of distances between the distance sensor and the object to be shot and associated micro-adjustment ranges of the motor (see description above for details).
[0103] In an example, the judgment module of the focusing system may include: [0104] a judgment and control unit controlling the motor to keep still at a current position in response to the judging that the current distance is equal to the initial distance (see description above for details).
[0105] In an example, the query and image collection module of the focusing system may include: [0106] a detection and acquisition unit for acquiring the current distance between the distance sensor and the object to be shot in response to judging that the current distance has changed (see description above for details); [0107] a query unit querying the correspondence table to acquire the target micro-adjustment range of the motor according to the current distance (see description above for details); and [0108] a control and collection unit for controlling the motor to move within the target micro-adjustment range, and collecting images from the camera (see description above for details).
[0109] In an example, the collecting of the images of the focusing system may be done in a real-time manner (see description above for details).
[0110] In conclusion, a focusing method and focusing system based on a distance sensor of a mobile terminal has been provided, which may include: acquiring and storing an initial distance between a camera and an object to be shot by using the distance sensor after detecting that a shooting function of the mobile terminal has started; judging whether a current distance acquired by the distance sensor is equal to the initial distance; in response to the judging that the current distance is not equal to the initial distance, querying a correspondence table to acquire a target micro-adjustment range of the motor according to the current distance, controlling the motor to move within the target micro-adjustment range, and collecting images from the camera; and acquiring focus values of the images when the motor moves into different positions within the target micro-adjustment range, and controlling the motor to move to a position corresponding to a largest focus value of the focus values, thereby focusing the camera. Accordingly, refocusing can be avoided when the object remains still relative to the camera, whereas relative movement of the object will immediately trigger focusing. Furthermore, as the focusing micro-adjustment range has been set at the debugging stage and a large-scale search of the focusing table is not required, the best focal length can be found only by comparing 0-3 frames to finish focusing, which increases focusing speed and facilitates users to take photos. It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can improve or change the invention based on the descriptions above, and the improvement and changes shall fall within the protection scope of the appended claims.