CN104215216B - A kind of range unit and terminal - Google Patents

A kind of range unit and terminal Download PDF

Info

Publication number
CN104215216B
CN104215216B CN201410416509.4A CN201410416509A CN104215216B CN 104215216 B CN104215216 B CN 104215216B CN 201410416509 A CN201410416509 A CN 201410416509A CN 104215216 B CN104215216 B CN 104215216B
Authority
CN
China
Prior art keywords
distance
contrast
motor
image distance
camera
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201410416509.4A
Other languages
Chinese (zh)
Other versions
CN104215216A (en
Inventor
冯垒
卢伟冰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Jinli Communication Equipment Co Ltd
Original Assignee
Shenzhen Jinli Communication Equipment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Jinli Communication Equipment Co Ltd filed Critical Shenzhen Jinli Communication Equipment Co Ltd
Priority to CN201410416509.4A priority Critical patent/CN104215216B/en
Publication of CN104215216A publication Critical patent/CN104215216A/en
Application granted granted Critical
Publication of CN104215216B publication Critical patent/CN104215216B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01CMEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
    • G01C3/00Measuring distances in line of sight; Optical rangefinders

Landscapes

  • Physics & Mathematics (AREA)
  • Electromagnetism (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Studio Devices (AREA)
  • Focusing (AREA)
  • Automatic Focus Adjustment (AREA)

Abstract

The embodiment of the invention discloses a kind of range unit, including:Detection unit, the destination object selected in the preview image gathered for detecting user from camera, and the destination object is focused;Adjustment unit, for adjusting the position of the motor built in the camera, obtain motor contrast corresponding to the destination object in diverse location;First determining unit, for determining maximum contrast angle value in the contrast that is obtained from the adjustment unit, image distance corresponding to the maximum contrast angle value is obtained, the image distance is the distance between the camera lens of camera and sensor;Computing unit, for the image distance obtained according to first determining unit, calculate the object distance between the destination object and the camera lens.The embodiment of the invention also discloses a kind of terminal.Using the present invention, the distance between subject and camera can be effectively obtained.

Description

A kind of range unit and terminal
Technical field
The present invention relates to electronic technology field, more particularly to a kind of range unit and terminal.
Background technology
When by intelligent terminal camera shooting image, people may need to know between shooting object and camera Distance.In the prior art, a kind of distance-finding method is to realize measurement shooting object the distance between to camera by external equipment, For example the distance-measuring equipment (such as ultrasonic ranging equipment or Laser Distance Measuring Equipment etc.) of auxiliary is loaded in intelligent terminal, so as to pass through The distance-measuring equipment realizes measurement shooting object the distance between to camera.Although this mode can obtain subject body to taking the photograph As the distance between head, but need by outside distance-measuring equipment.
The content of the invention
The embodiment of the present invention provides a kind of range unit and terminal, can effectively obtain subject and camera it Between distance.
The embodiments of the invention provide a kind of range unit, including:
Detection unit, the destination object selected in the preview image gathered for detecting user from camera, and to described Destination object is focused;
Adjustment unit, for adjusting the position of the motor built in the camera, the motor is obtained in diverse location Contrast corresponding to the destination object;
First determining unit, for determining maximum contrast angle value in the contrast that is obtained from the adjustment unit, obtain Image distance corresponding to the maximum contrast angle value, the image distance are the distance between the camera lens of camera and sensor;
Computing unit, for the image distance obtained according to first determining unit, calculate the destination object and the mirror Object distance between head.
Correspondingly, the embodiment of the present invention additionally provides a kind of terminal, including:Detection means and ranging as described above dress Put;Wherein,
The detection means, for detecting whether needing to start the range unit progress ranging.
Correspondingly, the embodiment of the present invention additionally provides a kind of terminal, including:Camera, memory and processor, its In, batch processing code is stored in the memory, and the processor calls the program code stored in the memory, uses Operated below performing:
The destination object selected in the preview image that detection user gathers from the camera, and the destination object is entered Row focusing;
The position of the motor built in the camera is adjusted, obtains motor destination object pair in diverse location The contrast answered;
Maximum contrast angle value is determined from the contrast, obtains image distance corresponding to the maximum contrast angle value, it is described Image distance is the distance between the camera lens of camera and sensor;
According to the image distance, the object distance between the destination object and the camera lens is calculated.
Implement the embodiment of the present invention, have the advantages that:
The embodiment of the present invention can be by adjusting motor position and from lens image contrast corresponding to different motor positions The contrast value of maximum is selected, so as to obtain image distance corresponding to the maximum contrast angle value, and the target is calculated by the image distance Object distance between object and camera lens, it can effectively obtain the distance between subject and camera.
Brief description of the drawings
In order to illustrate the technical solution of the embodiments of the present invention more clearly, required use in being described below to embodiment Accompanying drawing be briefly described, it should be apparent that, drawings in the following description are some embodiments of the present invention, for this area For those of ordinary skill, on the premise of not paying creative work, other accompanying drawings can also be obtained according to these accompanying drawings.
Fig. 1 is a kind of schematic flow sheet of distance-finding method provided in an embodiment of the present invention;
Fig. 2 is a kind of principle schematic of the method for calculating object distance of the embodiment of the present invention;
Fig. 3 is the schematic flow sheet of another distance-finding method provided in an embodiment of the present invention;
Fig. 4 is a kind of schematic diagram of the method for calculating image distance correction value of the embodiment of the present invention;
Fig. 5 is a kind of structural representation of range unit provided in an embodiment of the present invention;
Fig. 6 is the structural representation of another range unit provided in an embodiment of the present invention;
Fig. 7 is a kind of structural representation of terminal provided in an embodiment of the present invention;
Fig. 8 is the structural representation of another terminal provided in an embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
Fig. 1 is referred to, is a kind of schematic flow sheet of distance-finding method provided in an embodiment of the present invention, methods described can be specific It is provided with applied to mobile phone, tablet personal computer, camera etc. in the terminal device of camera, specifically, methods described includes:
S101:The destination object selected in the preview image that detection user gathers from camera, and to the destination object Focused.
In specific embodiment, distance measurement function can be pre-set.Needing to measure between object distance i.e. destination object and camera Distance before, then open the distance measurement function, camera alignment needed into the object i.e. destination object tested, and work as by detection The operational order of preceding user obtains destination object, the destination object is focused so as to trigger, for example can detect use Using the object as destination object when the jobbie on display screen is clicked at family, and trigger and the destination object is focused.
S102:The position of the motor built in the camera is adjusted, obtains motor target in diverse location Contrast corresponding to object.
S103:Maximum contrast angle value is determined from the contrast, obtains image distance corresponding to the maximum contrast angle value, The image distance is the distance between the camera lens of camera and sensor.
It should be noted that the contrast of the camera acquired image is associated with the motor position.Specifically, can be pre- First set and obtain the contrast and the mapping relations of motor position, and obtained not by adjusting the position of camera built-in motor It is maximum to picture contrast when adjusting motor with the contrast of motor position corresponding image, i.e., when image is most clear, you can root According to motor position corresponding to the maximum contrast angle value, image distance corresponding to the destination object is determined.
Specifically, first motor can be recovered to initial position, then promote successively motor be moved to the left a step (it is assumed here that Initial position is at most right place), obtain the contrast of the preview image that mobile motor acquires every time respectively, and from the contrast Maximum contrast angle value is determined in degree, obtains the motor number of steps corresponding to the maximum contrast angle value, so as to according to the horse Up to initial position and the motor number of steps, image distance corresponding to the destination object is calculated.
S104:According to the image distance, the object distance between the destination object and the camera lens is calculated.
In specific embodiment, the picture can be obtained by the product for the lens focus for obtaining the image distance and pre-setting Away from the difference with the lens focus, and using the business of the product and the difference as the destination object and the camera lens it Between object distance.
Specifically, as shown in Fig. 2 be a kind of principle schematic of the method for calculating object distance of the embodiment of the present invention, wherein, It is that subject is destination object at C points, A points are cam lens, and B points (sense for the imaging surface sensor of camera Device).As shown in Fig. 2 lines with the arrow are the propagation schematic diagram of light.Assuming that the distance between destination object C to camera lens A (object distance) is Lac, and camera lens A to sensor B distance (image distance) is Lab, and F points are the focus of camera lens, if lens focus (i.e. camera lens The distance between focus F) it is f.After the completion of focusing, the picture of object is just clearly indicated on sensor, i.e. object C is passed through Camera lens forms clearly image on imaging surface B, also just meets optical principle of the object in camera internal imaging, i.e., and (1/ Lac)+(1/Lab)=1/f.Wherein, the focal length f of camera lens is fixed known conditions, therefore by determining that image distance Lab can be counted Calculate object distance Lac.
Implementing the embodiment of the present invention can contrast by adjusting motor position and from lens image corresponding to different motor positions The contrast value of maximum is selected in degree, so as to obtain image distance corresponding to the maximum contrast angle value, and is calculated and is somebody's turn to do by the image distance Object distance between destination object and camera lens, realizes in the case of without outside distance-measuring equipment effectively to obtain and is taken The distance between object and camera.
Fig. 3 is referred to, is the schematic flow sheet of another distance-finding method provided in an embodiment of the present invention, specifically, described Method includes:
S301:The destination object selected in the preview image that detection user gathers from camera, and to the destination object Focused.
In specific embodiment, distance measurement function can be pre-set.Needing to measure between object distance i.e. destination object and camera Distance before, then open the distance measurement function, camera alignment needed into the object i.e. destination object tested, and work as by detection The operational order of preceding user obtains destination object, the destination object is focused so as to trigger, for example can detect use Using the object as destination object when the jobbie on display screen is clicked at family, and trigger and the destination object is focused.
S302:Motor built in camera is returned into initial position.
S303:The motor is moved to the left by a stepping relative to initial position according to default step distance successively, Obtain contrast of the motor at each shift position corresponding to the destination object.
In specific embodiment, it is determined that during destination object, then the motor built in camera can be recovered to initial position, than Motor is such as promoted to drive camera lens to recover to most right home position, to obtain the contrast of present preview image.Then with default Step distance (such as 0.1mm) promotes motor to be moved to the left a step successively, i.e., motor is moved to the left into 0.1mm every time, obtains different The contrast of preview image corresponding to motor position.
It should be noted that in certain number of steps, the contrast of mobile motor acquired image is higher than the last time every time The contrast of mobile motor acquired image, the i.e. contrast of latter image are higher than the contrast of previous image.
S304:Maximum contrast angle value is determined from the contrast, obtains the horse corresponding to the maximum contrast angle value Up to number of steps.
S305:According to the initial position of the motor and the motor number of steps, the maximum contrast angle value pair is calculated The image distance answered.
Specifically, after more than certain motor number of steps, the contrast of present preview image starts to reduce, it is assumed that by horse Up to when promoting n+1 steps to the left, contrast when obtained contrast walks than n is low, then can confirm the motor promoting n steps When contrast be highest, that is, it is most clear to be imaged, then motor can be promoted to the position that n is walked as optimal focusing position to the left, right Should maximum contrast angle value, so as to obtain image distance corresponding to current target object.
Further, can be by obtaining the motor first in initial position between the camera lens and the sensor Distance;According to the step distance and the motor number of steps, obtain the motor corresponding to the maximum contrast angle value and move Dynamic second distance;And by first distance and the second distance and be defined as the corresponding picture of the maximum contrast angle value Away from.I.e. the image distance is that distance (L ' ab) of the motor in initial position between camera lens and imaging surface sensor is added currently most The distance of motor movement corresponding to big contrast value.Wherein, the distance that motor corresponding to maximum contrast angle value moves is n's and L Product (assuming that being L by the step distance of motor 1 step of movement).That is, the image distance Lab=L ' ab+n*L obtained.
S306:Using motor number of steps corresponding to the maximum contrast angle value as target motor number of steps, and obtain difference With the first contrast value and the second contrast value corresponding to the adjacent number of steps of the target motor number of steps or so.
Further, because the stepping of motor has one fixed width, general optimal focusing may not be just in motor On the integral multiple of stepping, thus obtain the image distance error be present, then need by the target motor number of steps is modified from And realize and current image distance is modified.
Walked specifically, motor number of steps corresponding to first contrast value is less than motor corresponding to second contrast value Enter number.
S307:According to the target motor number of steps, the maximum contrast angle value, first contrast value and described Second contrast value, it is determined that carrying out the image distance correction value of error correction to the image distance.
S308:The image distance is modified by the image distance correction value.
In specific embodiment, can by obtaining the first difference of the maximum contrast angle value and first contrast value, Calculate the first product of first difference and twice of target motor number of steps;Obtain second contrast value with it is described Second difference of the first contrast value, calculate first product and second difference and;Will it is described and with described in twice The business of first difference is as the image distance correction value that error correction is carried out to the image distance, so that by the image distance correction value to current Image distance is modified.
S309:According to revised image distance, the object distance between the destination object and the camera lens is calculated.
In specific embodiment, the revised image distance and the second product of the lens focus pre-set can be obtained;Obtain Take the 3rd difference of the amendment image distance and the lens focus;And using the business of second product and the 3rd difference as institute State the object distance between destination object and the camera lens.
Further, as shown in figure 4, being a kind of schematic diagram of the method for calculating image distance correction value of the embodiment of the present invention. After motor recovery initial position, it is assumed that motor promotes n steps to find the maximum point of picture contrast to the left, then regard n as this Target motor number of steps, then it is respectively n-1 in motor number of steps, the contrast of the width figure of n, n+1 tri- is the width figure of highest three, if Its contrast is respectively Dn-1、Dn、Dn+1(i.e. Dn-1For the first contrast value, DnFor maximum contrast angle value, Dn+1For the second contrast Value, and Dn-1Corresponding motor number of steps (n-1) is less than Dn+1Corresponding motor number of steps (n+1)).As shown in figure 4, the longitudinal axis represents Picture contrast, transverse axis represent motor number of steps, then the optimal focusing of image can be determined between n-1 and n+1.Specifically, (D can be passed throughn-1, n-1) and (Dn, n) 2 points determine straight line 1, as the increase of motor number of steps, picture contrast are first linear It is gradually reduced after increasing to highest, so as to can determine that the point of highest contrast on the straight line 1.(D can then be passed throughn+1, n+ 1) point determines straight line 2, and the slope and straight line 1 of the straight line 2 are on the contrary, then the crosspoint of two straight lines is highest contrast Point (the maximum contrast angle value corrected), so that it is determined that going out motor number of steps X corresponding to the maximum contrast angle value of the amendment, the X The as image distance correction value.
Specifically, can be by obtaining the first difference i.e. (D of the maximum contrast angle value and first contrast valuen- Dn-1), the first product for calculating first difference and twice of target motor number of steps is [2*n* (Dn-Dn-1)];Obtain Second difference of second contrast value and first contrast value is (Dn+1-Dn-1), calculate first product and institute State the second difference and i.e. [2*n* (Dn-Dn-1)+(Dn+1-Dn-1)];Using described and business with twice of first difference as pair The image distance carries out the image distance correction value of error correction, so as to be modified by the image distance correction value to current image distance.It is based on Contrast Dn-1、Dn、Dn+1And target motor number of steps n can calculate to obtain:
Image distance correction value X=[Dn+1-Dn-1+2*n*(Dn-Dn-1)]/[2*(Dn-Dn-1)]。
Further, the image distance correction value can be calculated by above-mentioned formula, and by the image distance correction value to current picture Away from being modified so that it is determined that going out revised image distance, the revised image distance is Lab=L ' ab+X*L.
Further, can be former by convex lens when calculating the object distance between the destination object and the camera lens Manage, and the object distance between the destination object and current lens is calculated by formula (1/Lac)+(1/Lab)=1/f.Wherein The Lab is revised image distance, and the Lac is the object distance, and the f is the lens focus pre-set.So as to logical Object distance Lac can be calculated by crossing the image distance Lab of aforesaid way determination.
Implementing the embodiment of the present invention can be it is determined that by the way that the motor built in camera is returned into initial bit during destination object Put, and successively to the left (or to the right) adjustment motor position in order to being selected most from the contrast of different motor position correspondence images Big contrast value, and the image distance correction value that error correction is currently carried out to image distance is further calculated, it is more accurate so as to obtain Image distance, and the object distance between the destination object and camera is calculated by the image distance, realize and set without outside ranging The distance between subject and camera are effectively obtained in the case of standby.
Fig. 5 is referred to, is a kind of structural representation of range unit provided in an embodiment of the present invention, described device can be specific It is arranged in the terminal device with camera such as mobile phone, tablet personal computer, camera, specifically, described device includes:Detection unit 11st, adjustment unit 12, the first determining unit 13 and computing unit 14.Wherein,
The detection unit 11, the destination object selected in the preview image gathered for detecting user from camera, and The destination object is focused.
In specific embodiment, camera can be directed to the object i.e. destination object for needing to test, and pass through detection unit 11 The operational order for detecting active user obtains destination object, and the destination object is focused so as to trigger, for example detection is single Member 11 can be realized to the target pair when detecting that user clicks on the jobbie on display screen using the object as destination object As being focused.
Adjustment unit 12, for adjusting the position of the motor built in the camera, the motor is obtained in diverse location Contrast corresponding to Shi Suoshu destination objects;
First determining unit 13, for determining maximum contrast angle value in the contrast that is obtained from the adjustment unit 12, Image distance corresponding to the maximum contrast angle value is obtained, the image distance is the distance between the camera lens of camera and sensor.
In specific embodiment, different motor positions can be obtained by the position of the adjustment camera built-in motor of adjustment unit 12 The contrast of corresponding image is put, maximum is selected in each contrast that the first determining unit 13 obtains from the adjustment unit 12 Contrast value, and the motor position according to corresponding to the maximum contrast angle value determines the image distance of the target object.
Computing unit 14, for the image distance obtained according to first determining unit 13, calculate the destination object and institute State the object distance between camera lens.
Specifically, object distance corresponding to the destination object can be calculated by formula (1/Lac)+(1/Lab)=1/f.Its In, the focal length f of camera lens is fixed known conditions, the image distance that the Lab is as currently obtained, and the Lac as needs the thing tried to achieve Away from.
Implementing the embodiment of the present invention can contrast by adjusting motor position and from lens image corresponding to different motor positions The contrast value of maximum is selected in degree, so as to obtain image distance corresponding to the maximum contrast angle value, and is calculated and is somebody's turn to do by the image distance Object distance between destination object and camera lens, realizes in the case of without outside distance-measuring equipment effectively to obtain and is taken The distance between object and camera.
Fig. 6 is referred to, is the structural representation of another range unit provided in an embodiment of the present invention, described device includes Detection unit 11, adjustment unit 12, the first determining unit 13 and the computing unit 14 of above-mentioned range unit, further, In the embodiment of the present invention, described device can also further comprise:
Position recovery unit 15, for the motor built in the camera to be returned into initial position.
The adjustment unit 12 can be specifically used for:
According to default step distance successively by the camera built in motor be moved to the left one relative to initial position Individual stepping, obtain motor contrast corresponding to the destination object at each shift position;Or according to default stepping Distance successively moves right the motor one stepping relative to initial position, obtains the motor at each shift position Contrast corresponding to the destination object.
In specific embodiment, when detection unit 11 determines destination object, then it be able to will be imaged by position recovery unit 15 Motor built in head recovers to initial position, for example promotes motor to drive camera lens to recover to most right home position.Adjustment unit 12 promote motor to be moved to the left a step successively with default step distance (such as 0.1mm), i.e., are every time moved to the left motor 0.1mm, and obtain the contrast of preview image corresponding to different motor positions.
It should be noted that in certain number of steps, the contrast of mobile motor acquired image is higher than the last time every time The contrast of mobile motor acquired image, the i.e. contrast of latter image are higher than the contrast of previous image.
Alternatively, in embodiments of the present invention, first determining unit 13 can further comprise:
Information acquisition unit 131, for determining maximum contrast angle value from the contrast, obtain the maximum contrast Motor number of steps corresponding to angle value;
Image distance determining unit 132, for the initial position according to the motor and the motor number of steps, described in calculating Image distance corresponding to maximum contrast angle value.
The image distance determining unit 132 is specifically used for:
Obtain first distance of the motor in initial position between the camera lens and the sensor;According to the step Enter distance and the motor number of steps, obtain the second distance of the motor movement corresponding to the maximum contrast angle value;Will First distance and the second distance and be defined as the corresponding image distance of the maximum contrast angle value.
Specifically, after more than certain motor number of steps, the contrast of present preview image starts to reduce, it is assumed that by horse Up to when promoting n+1 steps to the left, contrast when obtained contrast walks than n is low, then information acquisition unit 131 can confirm Contrast is highest when the motor is promoted into n steps, that is, it is most clear to be imaged, then information acquisition unit 131 can push away motor to the left The position of dynamic n steps as optimal focusing position, to should maximum-contrast value, and trigger image distance determining unit 132 and obtain currently Image distance corresponding to destination object.I.e. the image distance is distance of the motor in initial position between camera lens and imaging surface sensor (L ' ab) adds step distance corresponding to current maximum contrast angle value.Wherein, step distance corresponding to maximum contrast angle value is n With L product (assuming that being L by the step distance of motor 1 step of movement).That is, the image distance Lab=L ' ab+n*L obtained.
Further, in embodiments of the present invention, described device may also include:
Acquiring unit 16, for using motor number of steps corresponding to the maximum contrast angle value as target motor number of steps, And obtain respectively with the first contrast value corresponding to the adjacent number of steps of the target motor number of steps or so and the second contrast Angle value.
Further, because the stepping of motor has one fixed width, general optimal focusing may be in motor stepping On integral multiple, therefore there is error in the image distance obtained, then needs to be modified image distance corresponding to the destination object determined.
Second determining unit 17, for according to the target motor number of steps, the maximum contrast angle value, described first pair Than angle value and second contrast value, it is determined that carrying out the image distance correction value of error correction to the image distance;
Amending unit 18, the image distance correction value for being determined by second determining unit 17 are repaiied to the image distance Just.
Alternatively, in embodiments of the present invention, second determining unit 17 can be specifically used for:
The first difference of the maximum contrast angle value and first contrast value is obtained, calculates first difference and two First product of the target motor number of steps again;Obtain second contrast value and first contrast value second is poor Value, calculate first product and second difference and;Using described and business with twice of first difference as to institute State the image distance correction value that image distance carries out error correction.
Further, after motor is recovered initial position by position recovery unit 15, acquiring unit 16 obtains maximum right Than motor number of steps corresponding to angle value, it is assumed that motor promotes n steps to find the maximum point of picture contrast to the left, then can make the n For target motor number of steps, and it is respectively n-1 to obtain motor number of steps, the contrast of n, n+1 three width figures, that is, corresponds to Dn-1 (being the first contrast value), Dn(being maximum contrast angle value), Dn+1(being the second contrast value).Second determining unit 17 According to n, the Dn-1、Dn、Dn+1The image distance correction value to the target motor number of steps can be acquired, and amending unit 18 passes through this Image distance correction value can be modified to image distance corresponding to current target object.
Specifically, second determining unit 17 can be according to formula X=[Dn+1-Dn-1+2*n*(Dn-Dn-1)]/[2*(Dn- Dn-1)] image distance correction value X is calculated, and the image distance currently determined is carried out by the image distance correction value by amending unit 18 Amendment, so that it is determined that it is Lab=L ' ab+X*L to go out revised image distance.
Alternatively, in embodiments of the present invention, the computing unit 14 can be specifically used for:
Obtain the image distance and the second product of the lens focus pre-set;Obtain the image distance and the lens focus The 3rd difference;Using the business of second product and the 3rd difference as the thing between the destination object and the camera lens Away from.
Specifically, computing unit 14 can be by convex lens imaging principle, and pass through formula (1/Lac)+(1/Lab)=1/f The object distance between the destination object and current lens is calculated.That is, computing unit 14 can be by obtaining the image distance With the second product i.e. (Lab*f) of the lens focus pre-set, and the 3rd poor of the image distance and the lens focus is obtained Value is (Lab-f), so as to acquire the object distance between the destination object and current lens i.e. Lac=(Lab*f)/(Lab-f). Wherein described Lab is revised image distance, and the Lac is the object distance, and the f is the lens focus pre-set.
Implementing the embodiment of the present invention can be it is determined that by the way that the motor built in camera is returned into initial bit during destination object Put, and successively to the left (or to the right) adjustment motor position in order to being selected most from the contrast of different motor position correspondence images Big contrast value, and the image distance correction value that error correction is currently carried out to image distance is further calculated, it is more accurate so as to obtain Image distance, and the object distance between the destination object and camera is calculated by the image distance, realize and set without outside ranging The distance between subject and camera are effectively obtained in the case of standby.
Fig. 7 is referred to, is a kind of structural representation of terminal provided in an embodiment of the present invention, the terminal includes:Detection dress Put 10 and range unit 20;Wherein,
The detection means 10, for detecting whether needing to start the progress of range unit 20 ranging;
The range unit 20, for when the detection means 10 detects and needs to start ranging, user to be from taking the photograph for detection The destination object selected in the preview image gathered as head, and the destination object is focused;Adjust in the camera The position for the motor put, obtain motor contrast corresponding to the destination object in diverse location;From the contrast In determine maximum contrast angle value, obtain image distance corresponding to the maximum contrast angle value, the image distance for camera camera lens with The distance between sensor;According to the image distance, the object distance between the destination object and the camera lens is calculated.
Herein, other concrete structures of range unit 20 may refer to that example is performed as described above, specific visible Fig. 5 and Fig. 6.
Implementing the embodiment of the present invention can contrast by adjusting motor position and from lens image corresponding to different motor positions The contrast value of maximum is selected in degree, so as to obtain image distance corresponding to the maximum contrast angle value, and is calculated and is somebody's turn to do by the image distance Object distance between destination object and camera lens, realizes in the case of without outside distance-measuring equipment effectively to obtain and is taken The distance between object and camera.
Further, Fig. 8 is referred to, is the structural representation of another terminal provided in an embodiment of the present invention.Such as Fig. 8 institutes Show, the terminal includes:Processor 100, such as CPU, input unit 300, output device 400, camera 500 and memory 200, The camera 500 includes image processor 5001.The input unit 300, output device 400, camera 500, memory 200 And data connection can be carried out by bus between processor 100, data it can also connect by other means.The present embodiment In with bus connection illustrate.Memory 200 can be high-speed RAM memory or non-labile memory (non-volatile memory), for example, at least a magnetic disk storage.Memory 200 optionally can also be at least one It is located remotely from the storage device of aforementioned processor 100.Wherein processor 100 can be with reference to the ranging dress described by Fig. 5 and Fig. 6 Put, batch processing code is stored in memory 200, and processor 100 calls the program code stored in memory 200, is used for Perform following operate:
Selected destination object in the preview image that gather from camera of detection user, and the destination object is carried out pair It is burnt;
The position of the motor built in the camera is adjusted, and the motor is obtained in difference by image processor 5001 Contrast corresponding to destination object during position;
Maximum contrast angle value is determined from the contrast, obtains image distance corresponding to the maximum contrast angle value, it is described Image distance is the distance between the camera lens of camera and sensor;
According to the image distance, the object distance between the destination object and the camera lens is calculated.
In an alternative embodiment, input unit 300 is used to carry out selected target object for user;Output device 400 is used for defeated The object distance gone out between destination object and camera lens.
In an alternative embodiment, processor 100 is additionally operable to perform following steps:
Motor built in the camera is returned into initial position.
In an alternative embodiment, processor 100 calls the program code stored in memory 200 to perform described in the adjustment The position of motor built in camera, and motor target pair in diverse location is obtained by image processor 5001 As corresponding contrast, it is specifically as follows:
Motor built in camera is returned into initial position;
According to default step distance successively by the camera built in motor be moved to the left one relative to initial position Individual stepping, image processor 5001 is called to obtain motor contrast corresponding to the destination object at each shift position Degree;Or the motor is moved right a stepping relative to initial position successively according to default step distance, calling figure picture Processor 5001 is to obtain motor contrast corresponding to the destination object at each shift position.
Processor 100 calls to be determined most described in the program code stored in memory 200 execution from the contrast Big contrast value, obtain the maximum contrast angle value corresponding to image distance, be specifically as follows:
Maximum contrast angle value is determined from the contrast, obtains the motor stepping corresponding to the maximum contrast angle value Number;
According to the initial position of the motor and the motor number of steps, picture corresponding to the maximum contrast angle value is calculated Away from.
In an alternative embodiment, processor 100 calls the program code stored in memory 200 to perform described in the basis The initial position of motor and the motor number of steps, calculate the maximum contrast angle value corresponding to image distance, be specifically as follows:
Obtain first distance of the motor in initial position between the camera lens and the sensor;
According to the step distance and the motor number of steps, the motor corresponding to the maximum contrast angle value is obtained Mobile second distance;
By first distance and the second distance and be defined as the corresponding image distance of the maximum contrast angle value.
In an alternative embodiment, processor 100 calls the program code stored in memory 200 to perform described according to institute Image distance is stated, before calculating the object distance between the destination object and the camera lens, processor 100 can also carry out following steps:
Using motor number of steps corresponding to the maximum contrast angle value as target motor number of steps, and pass through image processor 5001 obtain respectively with the first contrast value corresponding to the adjacent number of steps of the target motor number of steps or so and second pair Compare angle value;
According to the target motor number of steps, the maximum contrast angle value, first contrast value and described second Contrast value, it is determined that carrying out the image distance correction value of error correction to the image distance;
The image distance is modified by the image distance correction value.
In an alternative embodiment, processor 100 calls the program code stored in memory 200 to perform described in the basis Target motor number of steps, the maximum contrast angle value, first contrast value and second contrast value, it is determined that to institute The image distance correction value that image distance carries out error correction is stated, is specifically as follows:
The first difference of the maximum contrast angle value and first contrast value is obtained, calculates first difference and two First product of the target motor number of steps again;
The second difference of second contrast value and first contrast value is obtained, calculates first product and institute State the sum of the second difference;
Using described and business with twice of first difference as the image distance correction value that error correction is carried out to the image distance.
In an alternative embodiment, processor 100 calls the program code stored in memory 200 to perform described in the basis Image distance, the object distance between the destination object and the camera lens is obtained, is specifically as follows:
Obtain the image distance and the second product of the lens focus pre-set;
Obtain the 3rd difference of the image distance and the lens focus;
Using the business of second product and the 3rd difference as the object distance between the destination object and the camera lens.
Specifically, the terminal introduced in the present embodiment can combine Fig. 1 to the ranging side of Fig. 4 introductions to implement the present invention Part or all of flow in method embodiment.
One of ordinary skill in the art will appreciate that realize all or part of flow in above-described embodiment method, being can be with The hardware of correlation is instructed to complete by computer program, described program can be stored in a computer read/write memory medium In, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, described storage medium can be magnetic Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM) etc..
It should be noted that in the above-described embodiments, the description to each embodiment all emphasizes particularly on different fields, in some embodiment The part being not described in, it may refer to the associated description of other embodiment.Secondly, those skilled in the art should also know Know, embodiment described in this description belongs to preferred embodiment, and involved action and unit are not necessarily of the invention It is necessary.
Step in present invention method can be sequentially adjusted, merged and deleted according to actual needs.
Module or unit in device of the embodiment of the present invention can be combined, divided and deleted according to actual needs.
Module described in the embodiment of the present invention or unit, universal integrated circuit, such as CPU (Central can be passed through Processing Unit, central processing unit), or pass through ASIC (Application Specific Integrated Circuit, application specific integrated circuit) realize.
The text message display methods and terminal provided above the embodiment of the present invention is described in detail, herein Apply specific case to be set forth the principle and embodiment of the present invention, the explanation of above example is only intended to help Understand the method and its core concept of the present invention;Meanwhile for those of ordinary skill in the art, according to the thought of the present invention, There will be changes in specific embodiments and applications, in summary, this specification content should not be construed as to this The limitation of invention.

Claims (8)

  1. A kind of 1. range unit, it is characterised in that including:
    Detection unit, the destination object selected in the preview image gathered for detecting user from camera, and to the target Object is focused;
    Adjustment unit, for adjusting the position of the motor built in the camera, the motor is obtained described in diverse location Contrast corresponding to destination object;
    First determining unit, for determining maximum contrast angle value in the contrast that is obtained from the adjustment unit, described in acquisition Image distance corresponding to maximum contrast angle value, the image distance are the distance between the camera lens of camera and sensor;
    Computing unit, for the image distance obtained according to first determining unit, calculate the destination object and the camera lens it Between object distance;
    Acquiring unit, for using motor number of steps corresponding to the maximum contrast angle value as target motor number of steps, and obtain Respectively with the adjacent number of steps of the target motor number of steps or so corresponding to the first contrast value and the second contrast value;
    Second determining unit, for according to the target motor number of steps, the maximum contrast angle value, first contrast value And second contrast value, it is determined that carrying out the image distance correction value of error correction to the image distance;
    Amending unit, the image distance correction value for being determined by second determining unit are modified to the image distance;
    Wherein, second determining unit is specifically used for:
    The first difference of the maximum contrast angle value and first contrast value is obtained, calculates first difference and twice of institute State the first product of target motor number of steps;The second difference of second contrast value and first contrast value is obtained, Calculate first product and second difference and;Using described and business with twice of first difference as to the picture Away from the image distance correction value for carrying out error correction;
    The amending unit is specifically used for:
    Pass through Lab=L ' ab+X*L to be modified image distance;Wherein, Lab is revised image distance, and L ' ab are motor in initial bit The first distance when putting between camera lens and sensor, X are image distance correction value, and L is default step distance, i.e., described motor movement The distance of one stepping.
  2. 2. device as claimed in claim 1, it is characterised in that described device also includes:
    Position recovery unit, for the motor built in the camera to be returned into initial position.
  3. 3. device as claimed in claim 2, it is characterised in that the adjustment unit is specifically used for:
    According to default step distance successively by the camera built in motor be moved to the left a step relative to initial position Enter, obtain motor contrast corresponding to the destination object at each shift position;Or according to default step distance The motor is moved right a stepping relative to initial position successively, obtains the motor described at each shift position Contrast corresponding to destination object.
  4. 4. device as claimed in claim 3, it is characterised in that first determining unit includes:
    Information acquisition unit, for determining maximum contrast angle value from the contrast, obtain the maximum contrast angle value institute Corresponding motor number of steps;
    Image distance determining unit, for the initial position according to the motor and the motor number of steps, it is right to calculate the maximum Than image distance corresponding to angle value.
  5. 5. device as claimed in claim 4, it is characterised in that the image distance determining unit is specifically used for:
    Obtain first distance of the motor in initial position between the camera lens and the sensor;According to the stepping away from From and the motor number of steps, obtain the second distance of motor movement corresponding to the maximum contrast angle value;By described in First distance and the second distance and be defined as the corresponding image distance of the maximum contrast angle value.
  6. 6. device as claimed in claim 1, it is characterised in that the computing unit is specifically used for:
    Obtain the image distance and the second product of the lens focus pre-set;Obtain the of the image distance and the lens focus Three differences;Using the business of second product and the 3rd difference as the object distance between the destination object and the camera lens.
  7. A kind of 7. terminal, it is characterised in that including:Detection means and the range unit as described in claim any one of 1-6;Its In,
    The detection means, for detecting whether needing to start the range unit progress ranging.
  8. A kind of 8. terminal, it is characterised in that including:Camera, memory and processor, wherein, stored in the memory Batch processing code, and the processor calls the program code stored in the memory, for performing following operation:
    Selected destination object in the preview image that gather from the camera of detection user, and the destination object is carried out pair It is burnt;
    The position of the motor built in the camera is adjusted, obtains the motor in diverse location corresponding to the destination object Contrast;
    Maximum contrast angle value is determined from the contrast, obtains image distance corresponding to the maximum contrast angle value, the image distance The distance between camera lens and sensor for camera;
    According to the image distance, the object distance between the destination object and the camera lens is calculated;
    Motor number of steps corresponding to the maximum contrast angle value is included as target motor number of steps, and by the camera Image processor obtain respectively with the adjacent number of steps of the target motor number of steps or so corresponding to the first contrast value With the second contrast value;
    The first difference of the maximum contrast angle value and first contrast value is obtained, calculates first difference and twice of institute State the first product of target motor number of steps;The second difference of second contrast value and first contrast value is obtained, Calculate first product and second difference and;Using described and business with twice of first difference as to the picture Away from the image distance correction value for carrying out error correction;
    Pass through Lab=L ' ab+X*L to be modified image distance;Wherein, Lab is revised image distance, and L ' ab are motor in initial bit The first distance when putting between camera lens and sensor, X are image distance correction value, and L is default step distance, i.e., described motor movement The distance of one stepping.
CN201410416509.4A 2014-08-21 2014-08-21 A kind of range unit and terminal Expired - Fee Related CN104215216B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410416509.4A CN104215216B (en) 2014-08-21 2014-08-21 A kind of range unit and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410416509.4A CN104215216B (en) 2014-08-21 2014-08-21 A kind of range unit and terminal

Publications (2)

Publication Number Publication Date
CN104215216A CN104215216A (en) 2014-12-17
CN104215216B true CN104215216B (en) 2018-02-09

Family

ID=52096955

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410416509.4A Expired - Fee Related CN104215216B (en) 2014-08-21 2014-08-21 A kind of range unit and terminal

Country Status (1)

Country Link
CN (1) CN104215216B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105578053A (en) * 2015-12-29 2016-05-11 广东欧珀移动通信有限公司 Automatic focusing method, automatic focusing device, selfie stick, mobile terminal and self-timer system
CN106197366A (en) * 2016-08-01 2016-12-07 珠海格力电器股份有限公司 Distance information processing method and device
CN106595489A (en) * 2016-10-28 2017-04-26 惠州Tcl移动通信有限公司 Mobile terminal for real-time distance measurement and method
CN108007426B (en) * 2017-11-29 2020-10-16 珠海亿智电子科技有限公司 Camera ranging method
CN108931191A (en) * 2018-06-01 2018-12-04 普联技术有限公司 Distance measuring method, dimension measurement method and terminal
CN110602397A (en) * 2019-09-16 2019-12-20 RealMe重庆移动通信有限公司 Image processing method, device, terminal and storage medium
CN112136312A (en) * 2019-10-21 2020-12-25 深圳市大疆创新科技有限公司 Method for obtaining target distance, control device and mobile platform
CN111044039B (en) * 2019-12-25 2024-03-19 中航华东光电有限公司 Monocular target area self-adaptive high-precision distance measurement device and method based on IMU
CN112019723B (en) * 2020-09-07 2021-12-07 龙腾数科科技(成都)有限公司 Big data target monitoring method and system of block chain

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1523324A (en) * 2003-02-17 2004-08-25 奥林巴斯株式会社 Distance measuring device
CN102980561A (en) * 2012-11-30 2013-03-20 广东欧珀移动通信有限公司 Distance measuring method and distance measuring device of mobile terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002023044A (en) * 2000-07-12 2002-01-23 Canon Inc Focus detector, range-finding device and camera

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1523324A (en) * 2003-02-17 2004-08-25 奥林巴斯株式会社 Distance measuring device
CN102980561A (en) * 2012-11-30 2013-03-20 广东欧珀移动通信有限公司 Distance measuring method and distance measuring device of mobile terminal

Also Published As

Publication number Publication date
CN104215216A (en) 2014-12-17

Similar Documents

Publication Publication Date Title
CN104215216B (en) A kind of range unit and terminal
JP6731738B2 (en) Image generation apparatus for generating depth map using phase detection pixels
US10061182B2 (en) Systems and methods for autofocus trigger
CN104215215B (en) A kind of distance-finding method
US10277889B2 (en) Method and system for depth estimation based upon object magnification
CN108028887B (en) Photographing focusing method, device and equipment for terminal
RU2612892C2 (en) Method and device of auto focus
CN102196166B (en) Imaging device and display method
CN105578024B (en) Camera focusing method, focusing mechanism and mobile terminal
JP5412092B2 (en) Bar arrangement information acquisition apparatus and bar arrangement information acquisition method
JP2012123296A (en) Electronic device
CN107223330A (en) A kind of depth information acquisition method, device and image capture device
CN105007420A (en) Focusing method and mobile terminal
CN104854496A (en) Imaging device, out-of-focus-amount computation method, and imaging optics
US10742868B2 (en) Imaging device and focusing control method
JP6000446B2 (en) Image processing apparatus, imaging apparatus, image processing method, and image processing program
CN109996005B (en) Focus correction method and device
TWI392852B (en) Portable electric device using auto focus for distance measurement and distance measuring method using the same
WO2022116675A1 (en) Object detection method and apparatus, storage medium, and electronic device
CN110873717A (en) Image acquisition device and method for operating image acquisition device
JP2013213903A (en) Imaging device
JP7233261B2 (en) Three-dimensional surveying device, imaging device, control method and program
JP2009239460A (en) Focus control method, distance measuring equipment, imaging device
JP5062095B2 (en) Imaging device
WO2016194576A1 (en) Information processing device and method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20180209

Termination date: 20200821