CN104215215A - Ranging method - Google Patents

Ranging method Download PDF

Info

Publication number
CN104215215A
CN104215215A CN201410416508.XA CN201410416508A CN104215215A CN 104215215 A CN104215215 A CN 104215215A CN 201410416508 A CN201410416508 A CN 201410416508A CN 104215215 A CN104215215 A CN 104215215A
Authority
CN
China
Prior art keywords
distance
contrast
motor
value
image distance
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.)
Granted
Application number
CN201410416508.XA
Other languages
Chinese (zh)
Other versions
CN104215215B (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 Microphone Holdings 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 CN201410416508.XA priority Critical patent/CN104215215B/en
Publication of CN104215215A publication Critical patent/CN104215215A/en
Application granted granted Critical
Publication of CN104215215B publication Critical patent/CN104215215B/en
Active 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)
  • Measurement Of Optical Distance (AREA)
  • Studio Devices (AREA)
  • Focusing (AREA)

Abstract

The embodiment of the invention discloses a ranging method. The ranging method comprises the following steps: detecting a target object selected by a user from preview images acquired by a camera, and focusing the target object; adjusting the position of a built-in motor of the camera to obtain the contrasts corresponding to the target object when the motor is in different positions; determining the maximum contrast value in the contrasts, thereby obtaining the image distance corresponding to the maximum contrast value, wherein the image distance is the distance between the lens of the camera and a sensor; computing the object distance between the target object and the lens according to the image distance. The distance between a shot object and the camera can be effectively obtained by adopting the ranging method.

Description

A kind of distance-finding method
Technical field
The present invention relates to electronic technology field, particularly relate to a kind of distance-finding method.
Background technology
When by intelligent terminal camera shooting image, people may need the distance known between shot object and camera.In prior art, a kind of distance-finding method is realize measuring the distance between shot object to camera by external unit, such as load auxiliary distance-measuring equipment (such as ultrasonic ranging equipment or Laser Distance Measuring Equipment etc.) at intelligent terminal, thus realize measuring the distance between shot object to camera by this distance-measuring equipment.Although this mode can obtain the distance between shot object to camera, need by outside distance-measuring equipment.
Summary of the invention
The embodiment of the present invention provides a kind of distance-finding method, effectively can obtain the distance between subject and camera.
A kind of distance-finding method that the embodiment of the present invention provides, comprising:
Detect the destination object that user is selected from the preview image of camera collection, and described destination object is focused;
Adjust the position of the built-in motor of described camera, obtain the described motor contrast that described destination object is corresponding when diverse location;
From described contrast, determine maximum contrast angle value, obtain the image distance that described maximum contrast angle value is corresponding, described image distance is the distance between the camera lens of camera and sensor;
According to described image distance, calculate the object distance between described destination object and described camera lens.
Implement the embodiment of the present invention, there is following beneficial effect:
The embodiment of the present invention is by adjustment motor position and select maximum contrast value from lens image contrast corresponding to different motor position, thus obtain image distance corresponding to this maximum contrast angle value, and calculate the object distance between this destination object and camera lens by this image distance, effectively can obtain the distance between subject and camera.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme of the embodiment of the present invention, below the accompanying drawing used required in describing embodiment is briefly described, apparently, accompanying drawing in the following describes is some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the schematic flow sheet of a kind of distance-finding method that the embodiment of the present invention provides;
Fig. 2 is a kind of principle schematic calculating the method for object distance of the embodiment of the present invention;
Fig. 3 is the schematic flow sheet of the another kind of distance-finding method that the embodiment of the present invention provides;
Fig. 4 is a kind of schematic diagram calculating the method for image distance modified value of the embodiment of the present invention;
Fig. 5 is the structural representation of a kind of distance measuring equipment that the embodiment of the present invention provides;
Fig. 6 is the structural representation of the another kind of distance measuring equipment that the embodiment of the present invention provides;
Fig. 7 is the structural representation of a kind of terminal that the embodiment of the present invention provides;
Fig. 8 is the structural representation of the another kind of terminal that the embodiment of the present invention provides.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Refer to Fig. 1, be the schematic flow sheet of a kind of distance-finding method that the embodiment of the present invention provides, described method can be applied particularly to mobile phone, panel computer, camera etc. and be provided with in the terminal device of camera, and concrete, described method comprises:
S101: detect the destination object that user is selected from the preview image of camera collection, and described destination object is focused.
In specific embodiment, distance measurement function can be pre-set.Before needing to measure object distance and the distance between destination object and camera, then open this distance measurement function, camera is aimed at the object and destination object that need test, and obtain destination object by the operational order detecting active user, thus triggering is focused to described destination object, such as can when the jobbie that user clicks on display screen being detected using this object as destination object, and trigger this destination object focused.
S102: the position adjusting the built-in motor of described camera, obtains the described motor contrast that described destination object is corresponding when diverse location.
S103: determine maximum contrast angle value from described contrast, obtains the image distance that described maximum contrast angle value is corresponding, and described image distance is the distance between the camera lens of camera and sensor.
It should be noted that, this camera obtain image contrast be associated with this motor position.Concrete, the mapping relations obtaining this contrast and motor position can be pre-set, and by the position of adjustment camera built-in motor to obtain the contrast of different motor position corresponding image, when adjustment motor is maximum to picture contrast, namely when image is the most clear, motor position that can be corresponding according to this maximum contrast angle value, determines the image distance that this destination object is corresponding.
Concrete, first motor can be returned to initial position, then promote motor successively and be moved to the left a step (supposing that initial position is at the rightest place here), obtain the contrast of the preview image that each mobile motor acquires respectively, and maximum contrast angle value is determined from described contrast, obtain the motor number of steps corresponding to described maximum contrast angle value, thus according to described motor initial position and described motor number of steps, calculate the image distance that described destination object is corresponding.
S104: according to described image distance, calculates the object distance between described destination object and described camera lens.
In specific embodiment, by obtaining described image distance and the product of lens focus pre-set, obtain the difference of described image distance and described lens focus, and using the business of described product and described difference as the object distance between described destination object and described camera lens.
Concrete, as shown in Figure 2, be a kind of principle schematic calculating the method for object distance of the embodiment of the present invention, wherein, C point place is subject and destination object, and A point is cam lens, and B point is the imaging surface sensor (sensor) of camera.As shown in Figure 2, the lines of band arrow are the propagation schematic diagram of light.Distance (object distance) between hypothetical target object C to camera lens A is Lac, the distance (image distance) of camera lens A to sensor B for Lab, F point be the focus of camera lens, if lens focus (distance namely between camera lens and focal point F) is f.After having focused, the picture of object is just presented at above sensor clearly, namely object C forms image clearly through camera lens on imaging surface B, also just meets the optical principle of object at camera internal imaging, i.e. (1/Lac)+(1/Lab)=1/f.Wherein, the focal distance f of camera lens is fixing known conditions, therefore by determining that image distance Lab can calculate object distance Lac.
Implement the embodiment of the present invention by adjustment motor position selects maximum contrast value from lens image contrast corresponding to different motor position, thus obtain image distance corresponding to this maximum contrast angle value, and calculate the object distance between this destination object and camera lens by this image distance, achieve when without the need to by the distance effectively obtained when outside distance-measuring equipment between subject and camera.
Refer to Fig. 3, be the schematic flow sheet of the another kind of distance-finding method that the embodiment of the present invention provides, concrete, described method comprises:
S301: detect the destination object that user is selected from the preview image of camera collection, and described destination object is focused.
In specific embodiment, distance measurement function can be pre-set.Before needing to measure object distance and the distance between destination object and camera, then open this distance measurement function, camera is aimed at the object and destination object that need test, and obtain destination object by the operational order detecting active user, thus triggering is focused to described destination object, such as can when the jobbie that user clicks on display screen being detected using this object as destination object, and trigger this destination object focused.
S302: motor built-in for camera is returned to initial position.
S303: described motor is moved to the left a stepping relative to initial position by step distance according to presetting successively, obtains the contrast of described motor when each shift position corresponding to described destination object.
In specific embodiment, when determining destination object, then motor built-in for camera can be returned to initial position, such as promoting motor driving camera lens and returning to the rightest original position, obtaining the contrast of present preview image.Then promote motor be successively moved to the left a step with the step distance (as 0.1mm) preset, namely each motor is moved to the left 0.1mm, obtain the contrast of preview image corresponding to different motor position.
It should be noted that, in certain number of steps, each mobile motor obtain image contrast higher than last time mobile motor obtain the contrast of image, namely, the contrast of an image is higher than the contrast of previous image.
S304: determine maximum contrast angle value from described contrast, obtains the motor number of steps corresponding to described maximum contrast angle value.
S305: according to initial position and the described motor number of steps of described motor, calculate the image distance that described maximum contrast angle value is corresponding.
Concrete, after exceeding certain motor number of steps, the contrast of present preview image starts to reduce, when supposing motor to be promoted n+1 step left, the contrast time contrast obtained walks than n is low, then when can confirm this motor to be promoted n step, contrast is the highest, namely imaging is the most clear, the position that then motor can be promoted n step left, as best focusing position, to should maximum-contrast value, thus obtains image distance corresponding to current target object.
Further, by obtaining first distance of described motor when initial position between described camera lens and described sensor; According to described step distance and described motor number of steps, obtain the second distance of described motor movement corresponding to described maximum contrast angle value; And by described first distance and described second distance and be defined as image distance corresponding to described maximum contrast angle value.Namely this image distance is the distance that the distance of this motor when initial position between camera lens with imaging surface sensor (L ' ab) adds motor movement corresponding to current maximum contrast angle value.Wherein, the distance of the motor movement that maximum contrast angle value is corresponding is the product (step distance supposing motor to move 1 step is L) of n and L.That is, the image distance Lab=L ' ab+n*L of acquisition.
S306: using motor number of steps corresponding for described maximum contrast angle value as target motor number of steps, and obtain the first contrast value corresponding to number of steps adjacent with described target motor number of steps left and right respectively and the second contrast value.
Further, because the stepping of motor has one fixed width, general best focusing may not be just in time on the integral multiple of motor stepping, and this image distance therefore obtained exists error, then need by revising this target motor number of steps thus realizing revising current image distance.
Concrete, the motor number of steps that this first contrast value is corresponding is less than motor number of steps corresponding to described second contrast value.
S307: according to described target motor number of steps, described maximum contrast angle value, described first contrast value and described second contrast value, determines the image distance modified value of described image distance being carried out to error correction.
S308: described image distance is revised by described image distance modified value.
In specific embodiment, by obtaining the first difference of described maximum contrast angle value and described first contrast value, calculate the first product of target motor number of steps described in described first difference and twice; Obtain the second difference of described second contrast value and described first contrast value, calculate described first product and described second difference and; Using described and with the business of the first difference described in twice as the image distance modified value of described image distance being carried out to error correction, thus by this image distance modified value, current image distance to be revised.
S309: according to revised image distance, calculates the object distance between described destination object and described camera lens.
In specific embodiment, described revised image distance and the second product of lens focus pre-set can be obtained; Obtain the 3rd difference of this correction image distance and described lens focus; And using the business of described second product and described 3rd difference as the object distance between described destination object and described camera lens.
Further, as shown in Figure 4, be a kind of schematic diagram calculating the method for image distance modified value of the embodiment of the present invention.After motor is recovered initial position, suppose that motor promotes n left and walks the point finding picture contrast maximum, then using n as this target motor number of steps, then be respectively n-1 in motor number of steps, n, n+1 tri-the contrast of width figure be three the highest width figure, if its contrast is respectively D n-1, D n, D n+1(i.e. D n-1be the first contrast value, D nfor maximum contrast angle value, D n+1be the second contrast value, and D n-1corresponding motor number of steps (n-1) is less than D n+1corresponding motor number of steps (n+1)).As shown in Figure 4, longitudinal axis representative image contrast, transverse axis represents motor number of steps, then can determine image optimum focusing between n-1 and n+1.Concrete, by (D n-1,and (D n-1) n, n) determine straight line 1 at 2, along with the increase of motor number of steps, picture contrast be first linearly increased to the highest after reduce gradually, thus can determine that the point of the highest contrast is on described straight line 1.Then by (D n+1,n+1) point determines straight line 2, the slope of this straight line 2 is contrary with straight line 1, then the point of crossing of these two straight lines is the point (the maximum contrast angle value namely revised) of most high-contrast, thus determining the motor number of steps X that the maximum contrast angle value of this correction is corresponding, this X is this image distance modified value.
Concrete, by obtaining the first difference i.e. (D of described maximum contrast angle value and described first contrast value n-D n-1), calculate the first product i.e. [2*n* (D of target motor number of steps described in described first difference and twice n-D n-1)]; Obtain the second difference i.e. (D of described second contrast value and described first contrast value n+1-D n-1), calculate described first product and described second difference and i.e. [2*n* (D n-D n-1)+(D n+1-D n-1)]; Using described and with the business of the first difference described in twice as the image distance modified value of described image distance being carried out to error correction, thus by this image distance modified value, current image distance to be revised.Based on contrast D n-1, D n, D n+1and target motor number of steps n can calculate and obtains:
This image distance modified value X=[D n+1-D n-1+ 2*n* (D n-D n-1)]/[2* (D n-D n-1)].
Further, go out this image distance modified value by above-mentioned formulae discovery, and to be revised current image distance by this image distance modified value thus determine revised image distance, this revised image distance is Lab=L ' ab+X*L.
Further, when calculating the object distance between described destination object and described camera lens, by convex lens imaging principle, and the object distance between this destination object and current lens is calculated by formula (1/Lac)+(1/Lab)=1/f.Wherein said Lab is revised image distance, and described Lac is described object distance, and described f is the lens focus pre-set.Thus the image distance Lab determined by the way can calculate object distance Lac.
Implementing the embodiment of the present invention can when determining destination object by returning to initial position by motor built-in for camera, and successively left (or to the right) adjust motor position so that select maximum contrast angle value from the contrast of different motor position correspondence image, and calculate current image distance modified value of image distance being carried out to error correction further, thus obtain image distance more accurately, and calculate the object distance between this destination object and camera by this image distance, achieve when without the need to by the distance effectively obtained when outside distance-measuring equipment between subject and camera.
Refer to Fig. 5, it is the structural representation of a kind of distance measuring equipment that the embodiment of the present invention provides, described device specifically can be arranged at mobile phone, panel computer, camera etc. with in the terminal device of camera, concrete, described device comprises: detecting unit 11, adjustment unit 12, first determining unit 13 and computing unit 14.Wherein,
Described detecting unit 11, for detecting user's destination object selected from the preview image of camera collection, and focuses to described destination object.
In specific embodiment, camera can be aimed at the object and destination object that need test, and the operational order acquisition destination object of active user is detected by detecting unit 11, thus triggering is focused to described destination object, such as detecting unit 11 can when the jobbie that user clicks on display screen being detected using this object as destination object, realize focusing to this destination object.
Adjustment unit 12, for adjusting the position of the built-in motor of described camera, obtains the described motor contrast that described destination object is corresponding when diverse location;
First determining unit 13, determine maximum contrast angle value in the contrast that obtains from described adjustment unit 12, obtain the image distance that described maximum contrast angle value is corresponding, described image distance is the distance between the camera lens of camera and sensor.
In specific embodiment, the position of camera built-in motor is adjusted to obtain the contrast of different motor position corresponding image by adjustment unit 12, first determining unit 13 selects maximum contrast value from each contrast that this adjustment unit 12 obtains, and the motor position corresponding according to this maximum contrast angle value determines the image distance of this target object.
Computing unit 14, for the image distance obtained according to described first determining unit 13, calculates the object distance between described destination object and described camera lens.
Concrete, calculate object distance corresponding to this destination object by formula (1/Lac)+(1/Lab)=1/f.Wherein, the focal distance f of camera lens is fixing known conditions, and this Lab is the image distance of current acquisition, and this Lac is the object distance needing to try to achieve.
Implement the embodiment of the present invention by adjustment motor position selects maximum contrast value from lens image contrast corresponding to different motor position, thus obtain image distance corresponding to this maximum contrast angle value, and calculate the object distance between this destination object and camera lens by this image distance, achieve when without the need to by the distance effectively obtained when outside distance-measuring equipment between subject and camera.
Refer to Fig. 6, it is the structural representation of the another kind of distance measuring equipment that the embodiment of the present invention provides, described device comprises the detecting unit 11 of above-mentioned distance measuring equipment, adjustment unit 12, first determining unit 13 and computing unit 14, further, in embodiments of the present invention, described device also can comprise further:
Location restore unit 15, for returning to initial position by motor built-in for described camera.
Described adjustment unit 12 can be specifically for:
Motor built-in for described camera is moved to the left a stepping relative to initial position by step distance according to presetting successively, obtains the described motor contrast that described destination object is corresponding when each shift position; Or successively described motor to be moved right a stepping relative to initial position according to the step distance preset, obtain the described motor contrast that described destination object is corresponding when each shift position.
In specific embodiment, when detecting unit 11 determines destination object, then by location restore unit 15, motor built-in for camera is returned to initial position, such as promote motor driving camera lens and return to the rightest original position.Adjustment unit 12 promotes motor be successively moved to the left a step with the step distance (as 0.1mm) preset, and namely each motor is moved to the left 0.1mm, and obtains the contrast of preview image corresponding to different motor position.
It should be noted that, in certain number of steps, each mobile motor obtain image contrast higher than last time mobile motor obtain the contrast of image, namely, the contrast of an image is higher than the contrast of previous image.
Alternatively, in embodiments of the present invention, described first determining unit 13 can comprise further:
Information acquisition unit 131, for determining maximum contrast angle value from described contrast, obtains the motor number of steps corresponding to described maximum contrast angle value;
Image distance determining unit 132, for according to the initial position of described motor and described motor number of steps, calculates the image distance that described maximum contrast angle value is corresponding.
Described image distance determining unit 132 specifically for:
Obtain first distance of described motor when initial position between described camera lens and described sensor; According to described step distance and described motor number of steps, obtain the second distance of described motor movement corresponding to described maximum contrast angle value; By described first distance and described second distance and be defined as image distance corresponding to described maximum contrast angle value.
Concrete, after exceeding certain motor number of steps, the contrast of present preview image starts to reduce, when supposing motor to be promoted n+1 step left, the contrast time contrast obtained walks than n is low, when then information acquisition unit 131 can confirm this motor to be promoted n step, contrast is the highest, namely imaging is the most clear, then motor can be promoted the position of n step left as best focusing position by information acquisition unit 131, to should maximum-contrast value, and trigger image distance determining unit 132 and obtain image distance corresponding to current target object.Namely this image distance is that the distance of this motor when initial position between camera lens with imaging surface sensor (L ' ab) adds step distance corresponding to current maximum contrast angle value.Wherein, the step distance that maximum contrast angle value is corresponding is the product (step distance supposing motor to move 1 step is L) of n and L.That is, the image distance Lab=L ' ab+n*L of acquisition.
Further, in embodiments of the present invention, described device also can comprise:
Acquiring unit 16, for using motor number of steps corresponding for described maximum contrast angle value as target motor number of steps, and obtain the first contrast value corresponding to number of steps adjacent with described target motor number of steps left and right respectively and the second contrast value.
Further, because the stepping of motor has one fixed width, general best focusing may not on the integral multiple of motor stepping, and this image distance therefore obtained exists error, then need the image distance corresponding to this destination object determined to revise.
Second determining unit 17, for according to described target motor number of steps, described maximum contrast angle value, described first contrast value and described second contrast value, determines the image distance modified value of described image distance being carried out to error correction;
Amending unit 18, is revised described image distance for the image distance modified value determined by described second determining unit 17.
Alternatively, in embodiments of the present invention, described second determining unit 17 can be specifically for:
Obtain the first difference of described maximum contrast angle value and described first contrast value, calculate the first product of target motor number of steps described in described first difference and twice; Obtain the second difference of described second contrast value and described first contrast value, calculate described first product and described second difference and; Using described and with the business of the first difference described in twice as the image distance modified value of described image distance being carried out to error correction.
Further, after motor is recovered initial position by position recovery unit 15, acquiring unit 16 obtains motor number of steps corresponding to maximum contrast angle value, suppose that motor promotes n left and walks the point finding picture contrast maximum, then can using this n as target motor number of steps, and obtain motor number of steps and be respectively n-1, n, the contrast of the three width figure of n+1, namely corresponds to D n-1(being the first contrast value), D n(being maximum contrast angle value), D n+1(being the second contrast value).Second determining unit 17 is according to this n, D n-1, D n, D n+1can acquire the image distance modified value to this target motor number of steps, and amending unit 18 image distance corresponding to current target object can be revised by this image distance modified value.
Concrete, this second determining unit 17 can according to formula X=[D n+1-D n-1+ 2*n* (D n-D n-1)]/[2* (D n-D n-1)] calculate this image distance modified value X, and the current image distance determined is revised by this image distance modified value by amending unit 18, thus determine that revised image distance is Lab=L ' ab+X*L.
Alternatively, in embodiments of the present invention, described computing unit 14 can be specifically for:
Obtain described image distance and the second product of lens focus pre-set; Obtain the 3rd difference of described image distance and described lens focus; Using the business of described second product and described 3rd difference as the object distance between described destination object and described camera lens.
Concrete, computing unit 14 by convex lens imaging principle, and calculates the object distance between this destination object and current lens by formula (1/Lac)+(1/Lab)=1/f.That is, computing unit 14 is (Lab*f) by obtaining described image distance with the second product of the lens focus pre-set, and the 3rd difference obtaining described image distance and described lens focus is (Lab-f), thus the object distance acquired between this destination object and current lens and Lac=(Lab*f)/(Lab-f).Wherein said Lab is revised image distance, and described Lac is described object distance, and described f is the lens focus pre-set.
Implementing the embodiment of the present invention can when determining destination object by returning to initial position by motor built-in for camera, and successively left (or to the right) adjust motor position so that select maximum contrast angle value from the contrast of different motor position correspondence image, and calculate current image distance modified value of image distance being carried out to error correction further, thus obtain image distance more accurately, and calculate the object distance between this destination object and camera by this image distance, achieve when without the need to by the distance effectively obtained when outside distance-measuring equipment between subject and camera.
Refer to Fig. 7, be the structural representation of a kind of terminal that the embodiment of the present invention provides, this terminal comprises: pick-up unit 10 and distance measuring equipment 20; Wherein,
Described pick-up unit 10, finds range the need of the described distance measuring equipment 20 of startup for detecting;
Described distance measuring equipment 20, when needing to start range finding for detecting at described pick-up unit 10, detecting the destination object that user is selected from the preview image of camera collection, and focusing to described destination object; Adjust the position of the built-in motor of described camera, obtain the described motor contrast that described destination object is corresponding when diverse location; From described contrast, determine maximum contrast angle value, obtain the image distance that described maximum contrast angle value is corresponding, described image distance is the distance between the camera lens of camera and sensor; According to described image distance, calculate the object distance between described destination object and described camera lens.
Herein, other concrete structures of distance measuring equipment 20 can see as above embodiment, concrete visible Fig. 5 and Fig. 6.
Implement the embodiment of the present invention by adjustment motor position selects maximum contrast value from lens image contrast corresponding to different motor position, thus obtain image distance corresponding to this maximum contrast angle value, and calculate the object distance between this destination object and camera lens by this image distance, achieve when without the need to by the distance effectively obtained when outside distance-measuring equipment between subject and camera.
Further, referring to Fig. 8, is the structural representation of the another kind of terminal that the embodiment of the present invention provides.As shown in Figure 8, this terminal comprises: processor 100, such as CPU, input media 300, output unit 400, camera 500 and storer 200, and this camera 500 comprises image processor 5001.Data cube computation can be carried out by bus between described input media 300, output unit 400, camera 500, storer 200 and processor 100, also can data cube computation by other means.Connect with bus in the present embodiment and be described.Storer 200 can be high-speed RAM storer, also can be non-labile storer (non-volatile memory), such as at least one magnetic disk memory.Storer 200 can also be optionally that at least one is positioned at the memory storage away from aforementioned processor 100.Wherein processor 100 can composition graphs 5 and the distance measuring equipment described by Fig. 6, stores batch processing code in storer 200, and processor 100 calls the program code stored in storer 200, for performing following operation:
Detect the destination object that user is selected from the preview image of camera collection, and described destination object is focused;
Adjust the position of the built-in motor of described camera, and obtain contrast corresponding to described motor described destination object when diverse location by image processor 5001;
From described contrast, determine maximum contrast angle value, obtain the image distance that described maximum contrast angle value is corresponding, described image distance is the distance between the camera lens of camera and sensor;
According to described image distance, calculate the object distance between described destination object and described camera lens.
In an alternative embodiment, input media 300 is for carrying out selected target object for user; Output unit 400 is for exporting the object distance between destination object and camera lens.
In an alternative embodiment, processor 100 is also for performing following steps:
Motor built-in for described camera is returned to initial position.
In an alternative embodiment, processor 100 calls the position that the program code stored in storer 200 performs the built-in motor of the described camera of described adjustment, and obtain contrast corresponding to described motor described destination object when diverse location by image processor 5001, be specifically as follows:
Motor built-in for camera is returned to initial position;
Motor built-in for described camera is moved to the left a stepping relative to initial position by step distance according to presetting successively, calls image processor 5001 to obtain contrast corresponding to described motor described destination object when each shift position; Or successively described motor to be moved right a stepping relative to initial position according to the step distance preset, call image processor 5001 to obtain contrast corresponding to described motor described destination object when each shift position.
Processor 100 call in storer 200 store program code perform described in from described contrast, determine maximum contrast angle value, obtain the image distance that described maximum contrast angle value is corresponding, be specifically as follows:
From described contrast, determine maximum contrast angle value, obtain the motor number of steps corresponding to described maximum contrast angle value;
According to initial position and the described motor number of steps of described motor, calculate the image distance that described maximum contrast angle value is corresponding.
In an alternative embodiment, processor 100 calls the program code stored in storer 200 and performs the described initial position according to described motor and described motor number of steps, calculates the image distance that described maximum contrast angle value is corresponding, is specifically as follows:
Obtain first distance of described motor when initial position between described camera lens and described sensor;
According to described step distance and described motor number of steps, obtain the second distance of described motor movement corresponding to described maximum contrast angle value;
By described first distance and described second distance and be defined as image distance corresponding to described maximum contrast angle value.
In an alternative embodiment, processor 100 calls the program code stored in storer 200 and performs described according to described image distance, and before calculating the object distance between described destination object and described camera lens, processor 100 can also perform following steps:
Using motor number of steps corresponding for described maximum contrast angle value as target motor number of steps, and obtain the first contrast value corresponding to number of steps adjacent with described target motor number of steps left and right respectively and the second contrast value by image processor 5001;
According to described target motor number of steps, described maximum contrast angle value, described first contrast value and described second contrast value, determine the image distance modified value of described image distance being carried out to error correction;
By described image distance modified value, described image distance is revised.
In an alternative embodiment, processor 100 calls the program code stored in storer 200 and performs described according to described target motor number of steps, described maximum contrast angle value, described first contrast value and described second contrast value, determine the image distance modified value of described image distance being carried out to error correction, be specifically as follows:
Obtain the first difference of described maximum contrast angle value and described first contrast value, calculate the first product of target motor number of steps described in described first difference and twice;
Obtain the second difference of described second contrast value and described first contrast value, calculate described first product and described second difference and;
Using described and with the business of the first difference described in twice as the image distance modified value of described image distance being carried out to error correction.
In an alternative embodiment, processor 100 calls the program code stored in storer 200 and performs described according to described image distance, obtains the object distance between described destination object and described camera lens, is specifically as follows:
Obtain described image distance and the second product of lens focus pre-set;
Obtain the 3rd difference of described image distance and described lens focus;
Using the business of described second product and described 3rd difference as the object distance between described destination object and described camera lens.
Concrete, the terminal introduced in the present embodiment can in order to implement the part or all of flow process in the distance-finding method embodiment of composition graphs 1 to Fig. 4 of the present invention introduction.
One of ordinary skill in the art will appreciate that all or part of flow process realized in above-described embodiment method, that the hardware that can carry out instruction relevant by computer program has come, described program can be stored in a computer read/write memory medium, this program, when performing, can comprise the flow process of the embodiment as above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-Only Memory, ROM) or random store-memory body (Random Access Memory, RAM) etc.
It should be noted that, in the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields in certain embodiment, there is no the part described in detail, can see the associated description of other embodiments.Secondly, those skilled in the art also should know, the embodiment described in instructions all belongs to preferred embodiment, and involved action and unit might not be that the present invention is necessary.
Step in embodiment of the present invention method can be carried out order according to actual needs and be adjusted, merges and delete.
Module in embodiment of the present invention device or unit can carry out merging, divide and deleting according to actual needs.
Module described in the embodiment of the present invention or unit, universal integrated circuit can be passed through, such as CPU (Central Processing Unit, central processing unit), or realized by ASIC (Application Specific Integrated Circuit, special IC).
The text message display packing provided the embodiment of the present invention above and terminal are described in detail, apply specific case herein to set forth principle of the present invention and embodiment, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (10)

1. a distance-finding method, is characterized in that, comprising:
Detect the destination object that user is selected from the preview image of camera collection, and described destination object is focused;
Adjust the position of the built-in motor of described camera, obtain the described motor contrast that described destination object is corresponding when diverse location;
From described contrast, determine maximum contrast angle value, obtain the image distance that described maximum contrast angle value is corresponding, described image distance is the distance between the camera lens of camera and sensor;
According to described image distance, calculate the object distance between described destination object and described camera lens.
2. the method for claim 1, is characterized in that, in the position of the built-in motor of the described camera of described adjustment, before obtaining the described motor contrast that described destination object is corresponding when diverse location, described method also comprises:
Motor built-in for described camera is returned to initial position.
3. method as claimed in claim 1 or 2, is characterized in that the position of the motor that the described camera of described adjustment is built-in obtains the described motor contrast that described destination object is corresponding when diverse location, comprising:
Motor built-in for described camera is moved to the left a stepping relative to initial position by step distance according to presetting successively, obtains the described motor contrast that described destination object is corresponding when each shift position; Or successively described motor to be moved right a stepping relative to initial position according to the step distance preset, obtain the described motor contrast that described destination object is corresponding when each shift position.
4. method as claimed in claim 3, is characterized in that, describedly from described contrast, determines maximum contrast angle value, obtains the image distance that described maximum contrast angle value is corresponding, comprising:
From described contrast, determine maximum contrast angle value, obtain the motor number of steps corresponding to described maximum contrast angle value;
According to initial position and the described motor number of steps of described motor, calculate the image distance that described maximum contrast angle value is corresponding.
5. method as claimed in claim 4, it is characterized in that, the described initial position according to described motor and described motor number of steps, calculate the image distance that described maximum contrast angle value is corresponding, comprising:
Obtain first distance of described motor when initial position between described camera lens and described sensor;
According to described step distance and described motor number of steps, obtain the second distance of described motor movement corresponding to described maximum contrast angle value;
By described first distance and described second distance and be defined as image distance corresponding to described maximum contrast angle value.
6. method as claimed in claim 4, is characterized in that, described according to described image distance, before calculating the object distance between described destination object and described camera lens, also comprise:
Using motor number of steps corresponding for described maximum contrast angle value as target motor number of steps, and obtain the first contrast value corresponding to number of steps adjacent with described target motor number of steps left and right respectively and the second contrast value;
According to described target motor number of steps, described maximum contrast angle value, described first contrast value and described second contrast value, determine the image distance modified value of described image distance being carried out to error correction;
By described image distance modified value, described image distance is revised.
7. method as claimed in claim 6, it is characterized in that, described according to described target motor number of steps, described maximum contrast angle value, described first contrast value and described second contrast value, determine the image distance modified value of described image distance being carried out to error correction, comprising:
Obtain the first difference of described maximum contrast angle value and described first contrast value, calculate the first product of target motor number of steps described in described first difference and twice;
Obtain the second difference of described second contrast value and described first contrast value, calculate described first product and described second difference and;
Using described and with the business of the first difference described in twice as the image distance modified value of described image distance being carried out to error correction.
8. the method for claim 1, is characterized in that, described according to described image distance, obtains the object distance between described destination object and described camera lens, comprising:
Obtain described image distance and the second product of lens focus pre-set;
Obtain the 3rd difference of described image distance and described lens focus;
Using the business of described second product and described 3rd difference as the object distance between described destination object and described camera lens.
9. method as claimed in claim 6, it is characterized in that, the motor number of steps that described first contrast value is corresponding is less than motor number of steps corresponding to described second contrast value.
10. method as claimed in claim 3, it is characterized in that, described step distance is 0.1 millimeter.
CN201410416508.XA 2014-08-21 2014-08-21 A kind of distance-finding method Active CN104215215B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410416508.XA CN104215215B (en) 2014-08-21 2014-08-21 A kind of distance-finding method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410416508.XA CN104215215B (en) 2014-08-21 2014-08-21 A kind of distance-finding method

Publications (2)

Publication Number Publication Date
CN104215215A true CN104215215A (en) 2014-12-17
CN104215215B CN104215215B (en) 2017-07-25

Family

ID=52096954

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410416508.XA Active CN104215215B (en) 2014-08-21 2014-08-21 A kind of distance-finding method

Country Status (1)

Country Link
CN (1) CN104215215B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105571495A (en) * 2015-12-30 2016-05-11 青岛海信移动通信技术股份有限公司 Measuring method and device
CN105827961A (en) * 2016-03-22 2016-08-03 努比亚技术有限公司 Mobile terminal and focusing method
CN106197366A (en) * 2016-08-01 2016-12-07 珠海格力电器股份有限公司 The treating method and apparatus of range information
CN108931191A (en) * 2018-06-01 2018-12-04 普联技术有限公司 Distance measuring method, dimension measurement method and terminal
CN109087354A (en) * 2018-08-29 2018-12-25 浙江霖研精密科技有限公司 A kind of position algorithm of the best object distance of automatic search and image distance

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1514297A (en) * 2002-11-08 2004-07-21 奥林巴斯株式会社 Camera and its range finding method
DE102004009484A1 (en) * 2003-10-16 2005-05-19 Sensopart Industriesensorik Gmbh Optical distance sensor using the triangulation principle has lens associated with receiver with second main surface divided into N cylindrical lens segments in addition to first main surface with certain total opening
JP2009244808A (en) * 2008-03-31 2009-10-22 Fujifilm Corp Distance measuring method, and exposure device
CN102980561A (en) * 2012-11-30 2013-03-20 广东欧珀移动通信有限公司 Distance measuring method and distance measuring device of mobile terminal
CN103458159A (en) * 2012-05-31 2013-12-18 鸿富锦精密工业(深圳)有限公司 Electronic device with distance measurement function and distance measurement method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1514297A (en) * 2002-11-08 2004-07-21 奥林巴斯株式会社 Camera and its range finding method
DE102004009484A1 (en) * 2003-10-16 2005-05-19 Sensopart Industriesensorik Gmbh Optical distance sensor using the triangulation principle has lens associated with receiver with second main surface divided into N cylindrical lens segments in addition to first main surface with certain total opening
JP2009244808A (en) * 2008-03-31 2009-10-22 Fujifilm Corp Distance measuring method, and exposure device
CN103458159A (en) * 2012-05-31 2013-12-18 鸿富锦精密工业(深圳)有限公司 Electronic device with distance measurement function and distance measurement method
CN102980561A (en) * 2012-11-30 2013-03-20 广东欧珀移动通信有限公司 Distance measuring method and distance measuring device of mobile terminal

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105571495A (en) * 2015-12-30 2016-05-11 青岛海信移动通信技术股份有限公司 Measuring method and device
CN105827961A (en) * 2016-03-22 2016-08-03 努比亚技术有限公司 Mobile terminal and focusing method
CN106197366A (en) * 2016-08-01 2016-12-07 珠海格力电器股份有限公司 The treating method and apparatus of range information
CN108931191A (en) * 2018-06-01 2018-12-04 普联技术有限公司 Distance measuring method, dimension measurement method and terminal
CN109087354A (en) * 2018-08-29 2018-12-25 浙江霖研精密科技有限公司 A kind of position algorithm of the best object distance of automatic search and image distance

Also Published As

Publication number Publication date
CN104215215B (en) 2017-07-25

Similar Documents

Publication Publication Date Title
CN104215216A (en) Ranging device and terminal
US10337861B2 (en) Image generating device for generating depth map with phase detection pixel
US10061182B2 (en) Systems and methods for autofocus trigger
CN104215215A (en) Ranging method
US10277889B2 (en) Method and system for depth estimation based upon object magnification
US20070297784A1 (en) Method of and apparatus for generating a depth map utilized in autofocusing
JP6157249B2 (en) Imaging apparatus, distance information acquisition method, and program
CN104683693A (en) Automatic focusing method
CN111158107B (en) Focusing method, device and equipment of lens module
CN105227838A (en) A kind of image processing method and mobile terminal
EP2474809A1 (en) Device for processing stereo images, method for processing stereo images, and program
JP2012123296A (en) Electronic device
CN104534992A (en) Length measurement method and terminal
CN105007425A (en) Contrast type focusing method and mobile terminal
US10742868B2 (en) Imaging device and focusing control method
CN103235397A (en) Automatic focusing method and automatic focusing device
CN104680563B (en) The generation method and device of a kind of image data
CN103809348A (en) Automatic focusing method applied to camera module
CN113900346B (en) Automatic focusing method of projector and projector
US10225450B2 (en) Image capturing apparatus and image capturing unit
CN113487678A (en) Camera calibration method, system and processing circuit
CN112153271B (en) Control method and control device for optical lens of electronic equipment and storage medium
CN117294938A (en) Camera focusing method and device, electronic equipment and computer readable storage medium
US10339665B2 (en) Positional shift amount calculation apparatus and imaging apparatus
CN114286011B (en) Focusing method and device

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
PP01 Preservation of patent right

Effective date of registration: 20180428

Granted publication date: 20170725

PP01 Preservation of patent right
PD01 Discharge of preservation of patent

Date of cancellation: 20210428

Granted publication date: 20170725

PD01 Discharge of preservation of patent
TR01 Transfer of patent right

Effective date of registration: 20210608

Address after: 518057 Desai Science and Technology Building, 9789 Shennan Avenue, Yuehai Street, Nanshan District, Shenzhen City, Guangdong Province, 17th Floor (15th Floor of Natural Floor) 1702-1703

Patentee after: Shenzhen Microphone Holdings Co.,Ltd.

Address before: 518040 21 floor, east block, Times Technology Building, 7028 Shennan Road, Futian District, Shenzhen, Guangdong.

Patentee before: DONGGUAN GOLDEX COMMUNICATION TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right