CN104677329B - Target ranging method and device based on camera - Google Patents

Target ranging method and device based on camera Download PDF

Info

Publication number
CN104677329B
CN104677329B CN201510122328.5A CN201510122328A CN104677329B CN 104677329 B CN104677329 B CN 104677329B CN 201510122328 A CN201510122328 A CN 201510122328A CN 104677329 B CN104677329 B CN 104677329B
Authority
CN
China
Prior art keywords
camera
target
angle
place
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.)
Expired - Fee Related
Application number
CN201510122328.5A
Other languages
Chinese (zh)
Other versions
CN104677329A (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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201510122328.5A priority Critical patent/CN104677329B/en
Publication of CN104677329A publication Critical patent/CN104677329A/en
Application granted granted Critical
Publication of CN104677329B publication Critical patent/CN104677329B/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)
  • Image Processing (AREA)
  • Studio Devices (AREA)

Abstract

本发明适用于摄像头测距领域,提供了一种基于摄像头的目标测距方法及装置,所述方法包括:在摄像头的第一位置获取第一图像;确定目标与第一图像的视野中心垂直线的角度α;在摄像头的第二位置获取第二图像;确定目标与第二图像的视野中心垂直线的角度β;确定摄像头从第一位置旋转到第二位置的角度θ;根据所述α、β、θ以及摄像头的旋转半径R确定摄像头的第一位置到目标的距离x,和/或,确定摄像头的第二位置到目标的距离y。本发明实施例能够降低测距耗费的成本。

The present invention is applicable to the field of camera distance measurement, and provides a camera-based target distance measurement method and device, the method comprising: acquiring a first image at a first position of the camera; determining a vertical line between the target and the center of the field of view of the first image Obtain the second image at the second position of the camera; determine the angle β of the vertical line between the target and the center of the field of view of the second image; determine the angle θ of the camera rotating from the first position to the second position; according to the α, β, θ and the rotation radius R of the camera determine the distance x from the first position of the camera to the target, and/or determine the distance y from the second position of the camera to the target. The embodiment of the present invention can reduce the cost of ranging.

Description

基于摄像头的目标测距方法及装置Target ranging method and device based on camera

技术领域technical field

本发明实施例属于摄像头测距领域,尤其涉及一种基于摄像头的目标测距方法及装置。The embodiments of the present invention belong to the field of camera distance measurement, and in particular relate to a method and device for camera-based target distance measurement.

背景技术Background technique

随着移动科技的不断进步,移动终端的发展也越来越进步,双摄像头开始出现在移动终端上。With the continuous advancement of mobile technology, the development of mobile terminals has also become more and more advanced, and dual cameras have begun to appear on mobile terminals.

现有的物体测距方法中,通常利用移动终端设置的双摄像头具有不同的视角以及双摄像头的间距,再结合相应的几何关系计算出不同物体到摄像头的距离(即景深信息)。但由于需要移动终端设置两个摄像头才能测量物体的距离,而两个摄像头所耗费的成本较高,因此,现有的物体测距方法耗费的成本较高。In the existing object ranging methods, the dual cameras set on the mobile terminal are usually used to have different viewing angles and the distance between the dual cameras, and then the distance from different objects to the cameras (that is, the depth of field information) is calculated in combination with the corresponding geometric relationship. However, since the mobile terminal needs to be equipped with two cameras to measure the distance of the object, and the cost of the two cameras is relatively high, the existing method for measuring the distance of the object consumes relatively high cost.

发明内容Contents of the invention

本发明实施例提供了一种基于摄像头的目标测距方法及装置,旨在解决现有方法需采用双摄像头进行目标测距,从而导致测距耗费的成本较高的问题。Embodiments of the present invention provide a camera-based object ranging method and device, aiming to solve the problem that the existing method needs to use dual cameras for object ranging, resulting in high cost of ranging.

本发明实施例是这样实现的,一种基于摄像头的目标测距方法,所述方法包括:The embodiment of the present invention is achieved in this way, a camera-based target ranging method, the method comprising:

在摄像头的第一位置获取第一图像;Obtain the first image at the first position of the camera;

确定目标与第一图像的视野中心垂直线的角度α;Determine the angle α between the target and the vertical line of the center of the field of view of the first image;

在摄像头的第二位置获取第二图像;acquiring a second image at a second position of the camera;

确定目标与第二图像的视野中心垂直线的角度β;Determining an angle β between the target and the vertical line of the center of the field of view of the second image;

确定摄像头从第一位置旋转到第二位置的角度θ;Determine the angle θ at which the camera rotates from the first position to the second position;

根据所述α、β、θ以及摄像头的旋转半径R确定摄像头的第一位置到目标的距离x,和/或,确定摄像头的第二位置到目标的距离y。Determine the distance x from the first position of the camera to the target according to the α, β, θ and the rotation radius R of the camera, and/or determine the distance y from the second position of the camera to the target.

本发明实施例的另一目的在于提供一种基于摄像头的目标测距装置,所述装置包括:Another object of the embodiments of the present invention is to provide a camera-based target ranging device, the device comprising:

第一图像获取单元,用于在摄像头的第一位置获取第一图像;a first image acquisition unit, configured to acquire a first image at a first position of the camera;

目标第一角度确定单元,用于确定目标与第一图像的视野中心垂直线的角度α;A target first angle determination unit, configured to determine an angle α between the target and the vertical line of the center of the field of view of the first image;

第二图像获取单元,用于在摄像头的第二位置获取第二图像;A second image acquisition unit, configured to acquire a second image at a second position of the camera;

目标第二角度确定单元,用于确定目标与第二图像的视野中心垂直线的角度β;A target second angle determination unit, configured to determine an angle β between the target and the vertical line of the center of the field of view of the second image;

旋转角度确定单元,用于确定摄像头从第一位置旋转到第二位置的角度θ;A rotation angle determination unit is used to determine the angle θ at which the camera rotates from the first position to the second position;

距离确定单元,用于根据所述α、β、θ以及摄像头的旋转半径R确定摄像头的第一位置到目标的距离x,和/或,确定摄像头的第二位置到目标的距离y。The distance determination unit is configured to determine the distance x from the first position of the camera to the target according to the α, β, θ and the rotation radius R of the camera, and/or determine the distance y from the second position of the camera to the target.

在本发明实施例中,由于只需在移动终端设置一个摄像头,就能通过旋转该摄像头获取第一图像和第二图像,最后通过对获取的第一图像与第二图像进行处理确定移动终端与目标的距离,从而降低测距耗费的成本。In the embodiment of the present invention, since only one camera needs to be installed on the mobile terminal, the first image and the second image can be obtained by rotating the camera, and finally the mobile terminal and the second image can be determined by processing the obtained first image and the second image. The distance of the target, thereby reducing the cost of ranging.

附图说明Description of drawings

图1是本发明第一实施例提供的一种基于摄像头的目标测距方法的流程图;Fig. 1 is a flow chart of a camera-based target ranging method provided in the first embodiment of the present invention;

图2是本发明第一实施例提供的第一图像的视野中心垂直线的示意图;FIG. 2 is a schematic diagram of a vertical line at the center of the field of view of the first image provided by the first embodiment of the present invention;

图3是本发明第一实施例提供的摄像头在第一位置和在第二位置与目标的几何关系示意图;3 is a schematic diagram of the geometric relationship between the camera at the first position and at the second position and the target provided by the first embodiment of the present invention;

图4是本发明第二实施例提供的一种基于摄像头的目标测距装置的结构图。Fig. 4 is a structural diagram of a camera-based object distance measuring device provided by the second embodiment of the present invention.

具体实施方式detailed description

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

本发明实施例中,在摄像头的第一位置获取第一图像,并确定目标与第一图像的视野中心垂直线的角度α,再在摄像头的第二位置获取第二图像,确定目标与第二图像的视野中心垂直线的角度β,以及确定摄像头从第一位置旋转到第二位置的角度θ,最后根据所述α、β、θ以及摄像头的旋转半径R确定摄像头的第一位置到目标的距离x,以及确定摄像头的第二位置到目标的距离y。In the embodiment of the present invention, the first image is acquired at the first position of the camera, and the angle α between the target and the vertical line of the center of the field of view of the first image is determined, and the second image is acquired at the second position of the camera, and the angle α between the target and the second Angle β of the vertical line of the center of the field of view of the image, and determine the angle θ of the camera rotating from the first position to the second position, and finally determine the distance from the first position of the camera to the target according to the α, β, θ and the rotation radius R of the camera distance x, and determine the distance y from the second position of the camera to the target.

为了说明本发明所述的技术方案,下面通过具体实施例来进行说明。In order to illustrate the technical solutions of the present invention, specific examples are used below to illustrate.

实施例一:Embodiment one:

图1示出了本发明第一实施例提供的一种基于摄像头的目标测距方法的流程图,本发明实施例中,通过设置在移动终端的同一个摄像头,确定目标与摄像头的距离,详述如下:Fig. 1 shows a flow chart of a camera-based target ranging method provided in the first embodiment of the present invention. In the embodiment of the present invention, the distance between the target and the camera is determined by using the same camera installed in the mobile terminal. as follows:

步骤S11,在摄像头的第一位置获取第一图像。Step S11, acquiring a first image at a first position of the camera.

其中,获取的第一图像包括目标对应的图像信息。在该步骤中,摄像头通过接收用户发出的拍照指令获取第一图像,具体地,用户通过按压移动终端的按键或者触摸移动终端的屏幕或者发出相应的音频等发出拍照指令。Wherein, the acquired first image includes image information corresponding to the target. In this step, the camera acquires the first image by receiving a photographing instruction from the user. Specifically, the user sends a photographing instruction by pressing a button of the mobile terminal or touching a screen of the mobile terminal or sending out corresponding audio.

步骤S12,确定目标与第一图像的视野中心垂直线的角度α。Step S12, determining an angle α between the target and the vertical line of the center of the visual field of the first image.

其中,第一图像的视野中心垂直线是指,第一位置与第一图像的中心连接形成的直线,具体如图2所示。Wherein, the vertical line to the center of the field of view of the first image refers to a straight line formed by connecting the first position and the center of the first image, as shown in FIG. 2 .

步骤S13,在摄像头的第二位置获取第二图像。Step S13, acquiring a second image at the second position of the camera.

其中,获取的第二图像也包括第一图像包括的目标对应的图像信息。在该步骤中,摄像头从第一位置旋转到第二位置后,接收用户发出的拍照指令以获取第二图像,具体地,用户通过按压移动终端的按键或者触摸移动终端的屏幕或者发出相应的音频等发出拍照指令。Wherein, the acquired second image also includes image information corresponding to the target included in the first image. In this step, after the camera rotates from the first position to the second position, it receives a camera instruction from the user to obtain the second image. Wait for the command to take pictures.

步骤S14,确定目标与第二图像的视野中心垂直线的角度β。Step S14, determining an angle β between the target and the vertical line of the center of the visual field of the second image.

其中,第二图像的视野中心垂直线是指,第二位置与第二图像的中心连接形成的直线。Wherein, the vertical line to the center of the field of view of the second image refers to a straight line formed by connecting the second position with the center of the second image.

步骤S15,确定摄像头从第一位置旋转到第二位置的角度θ。Step S15 , determining an angle θ at which the camera rotates from the first position to the second position.

具体地,可通过传感器检测摄像头从第一位置旋转到第二位置的角度。Specifically, a sensor may be used to detect the angle at which the camera rotates from the first position to the second position.

步骤S16,根据所述α、β、θ以及摄像头的旋转半径R确定摄像头的第一位置到目标的距离x,和/或,确定摄像头的第二位置到目标的距离y。Step S16, according to the α, β, θ and the rotation radius R of the camera, determine the distance x from the first position of the camera to the target, and/or determine the distance y from the second position of the camera to the target.

其中,摄像头的旋转半径R预先设定,如在设计摄像头时设定。Wherein, the rotation radius R of the camera is preset, such as when designing the camera.

可选地,所述根据所述α、β、θ以及摄像头的旋转半径R确定摄像头的第一位置到目标的距离x,和/或,确定摄像头的第二位置到目标的距离y,具体包括:Optionally, the determining the distance x from the first position of the camera to the target according to the α, β, θ and the rotation radius R of the camera, and/or determining the distance y from the second position of the camera to the target, specifically includes :

A1、根据所述α、β、θ确定摄像头的第一位置、第二位置以及目标形成的三角形的三个夹角。所述A1具体包括:A11、根据下式确定角 所述为摄像头的第一位置和摄像头的第二位置所在的直线与摄像头的第一位置和目标所在的直线形成的夹角。A12、根据下式确定角γ,γ=(90-β)+(90-θ/2),所述γ为摄像头的第一位置和摄像头的第二位置所在的直线与第二位置和目标所在的直线形成的夹角。A13、根据下式确定角φ,所述φ为摄像头的第一位置和目标所在的直线与摄像头的第二位置和目标所在的直线形成的夹角。A1. Determine the first position, the second position of the camera, and the three included angles of the triangle formed by the target according to the α, β, and θ. Described A1 specifically comprises: A11, determine angle according to following formula said is the angle formed by the line between the first position of the camera and the second position of the camera and the line between the first position of the camera and the target. A12. Determine the angle γ according to the following formula, γ=(90-β)+(90-θ/2), where the γ is the straight line where the first position of the camera and the second position of the camera are located and the second position and the target The angle formed by the straight line. A13. Determine the angle φ according to the following formula, The φ is the angle formed between the first position of the camera and the line where the target is located, and the second position of the camera and the line where the target is located.

A2、根据所述θ和R确定摄像头的第一位置到第二位置的距离。所述A2具体包括:z=2×sin(θ/2)×R,所述z为摄像头的第一位置到第二位置的距离。A2. Determine the distance from the first position to the second position of the camera according to the θ and R. The A2 specifically includes: z=2×sin(θ/2)×R, and the z is the distance from the first position to the second position of the camera.

A3、根据确定的摄像头的第一位置、第二位置以及目标形成的三角形的三个夹角以及摄像头的第一位置到第二位置的距离确定x和/或y的距离。可选地,所述A3具体包括:A3. Determine the distance of x and/or y according to the determined first position of the camera, the second position, the three included angles of the triangle formed by the target, and the distance from the first position of the camera to the second position. Optionally, the A3 specifically includes:

如图3所示,上述A1~A3,为CD与AC的夹角,γ为CD与AD的夹角,φ为AC与AD的夹角。由于BC与BD相等,都为R,因此∠BCE=∠EDB,则∠BDC=∠BCD=(180-θ)/2=90-θ/2,又由于∠BCA=90-α,因此,γ=∠CDA=∠CDB+∠BDA=(90-θ/2)+(90-β), As shown in Figure 3, above-mentioned A1~A3, is the angle between CD and AC, γ is the angle between CD and AD, and φ is the angle between AC and AD. Since BC and BD are equal, they are both R, so ∠BCE=∠EDB, then ∠BDC=∠BCD=(180-θ)/2=90-θ/2, and because ∠BCA=90-α, therefore, γ=∠CDA=∠CDB+∠BDA=(90-θ/2)+(90-β),

当确定摄像头的第一位置、第二位置以及目标形成的三角形的三个夹角时,确定摄像头的第一位置到第二位置的距离,即确定图3所示的CD线段的距离。在三角形BED中,可知,sin(θ/2)=(CD/2)/R,即CD=2×sin(θ/2)×R,最后在三角形ACD中,根据正弦定理,得到从而确定AC(即x)、AD(即y)的距离。实际情况中,CD远小于AC、AD的距离(长度),这时,可采用AC或AD的距离(长度)作为移动终端与目标的距离。When determining the first position of the camera, the second position and the three included angles of the triangle formed by the target, determine the distance from the first position of the camera to the second position, that is, determine the distance of the CD line segment shown in FIG. 3 . In the triangle BED, it can be seen that sin(θ/2)=(CD/2)/R, that is, CD=2×sin(θ/2)×R, and finally in the triangle ACD, according to the sine law, we get Thus determine the distance of AC (ie x), AD (ie y). In actual situations, CD is much smaller than the distance (length) of AC and AD. At this time, the distance (length) of AC or AD can be used as the distance between the mobile terminal and the target.

本发明第一实施例中,在摄像头的第一位置获取第一图像,并确定目标与第一图像的视野中心垂直线的角度α,再在摄像头的第二位置获取第二图像,确定目标与第二图像的视野中心垂直线的角度β,以及确定摄像头从第一位置旋转到第二位置的角度θ,最后根据所述α、β、θ以及摄像头的旋转半径R确定摄像头的第一位置到目标的距离x,以及确定摄像头的第二位置到目标的距离y。由于只需在移动终端设置一个摄像头,就能通过旋转该摄像头获取第一图像和第二图像,最后通过对获取的第一图像与第二图像进行处理确定移动终端与目标的距离,从而降低测距耗费的成本。In the first embodiment of the present invention, the first image is acquired at the first position of the camera, and the angle α between the target and the vertical line of the center of the field of view of the first image is determined, and the second image is acquired at the second position of the camera, and the angle α between the target and the center of the field of view is determined. The angle β of the vertical line of the center of the field of view of the second image, and the angle θ of the rotation of the camera from the first position to the second position are determined, and finally the first position of the camera is determined according to the α, β, θ and the rotation radius R of the camera. The distance x of the target, and the distance y from the second position of the camera to the target are determined. Since only one camera needs to be installed on the mobile terminal, the first image and the second image can be acquired by rotating the camera, and finally the distance between the mobile terminal and the target can be determined by processing the acquired first image and the second image, thereby reducing the measurement distance. The cost of distance consumption.

应理解,在本发明实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。It should be understood that in the embodiment of the present invention, the sequence numbers of the above-mentioned processes do not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, rather than the implementation process of the embodiment of the present invention. constitute any limitation.

实施例二:Embodiment two:

图4示出了本发明第二实施例提供的一种基于摄像头的目标测距装置的结构图,该基于摄像头的目标测距装置可以应用于移动终端中,该移动终端可以包括经无线接入网RAN与一个或多个核心网进行通信的用户设备,该用户设备可以是移动电话(或称为“蜂窝”电话)、具有移动设备的计算机等,例如,用户设备还可以是便携式、袖珍式、手持式、计算机内置的或者车载的移动装置,它们与无线接入网交换语音和/或数据。又例如,该移动设备可以包括智能手机、平板电脑、个人数字助理PDA、销售终端POS或车载电脑等。为了便于说明,仅示出了与本发明实施例相关的部分。Fig. 4 shows a structural diagram of a camera-based target distance measuring device provided by the second embodiment of the present invention. The camera-based target distance measuring device can be applied to a mobile terminal, and the mobile terminal can include Network RAN communicates with one or more core network user equipment, the user equipment can be a mobile phone (or called "cellular" phone), a computer with a mobile device, etc., for example, the user equipment can also be portable, pocket-sized , handheld, computer built-in, or vehicle-mounted mobile devices that exchange voice and/or data with the wireless access network. For another example, the mobile device may include a smart phone, a tablet computer, a personal digital assistant PDA, a sales terminal POS, or a vehicle-mounted computer. For ease of description, only parts related to the embodiments of the present invention are shown.

该基于摄像头的目标测距装置包括:第一图像获取单元41、目标第一角度确定单元42、第二图像获取单元43、目标第二角度确定单元44、旋转角度确定单元45、距离确定单元46。其中:The target ranging device based on the camera includes: a first image acquisition unit 41, a first target angle determination unit 42, a second image acquisition unit 43, a target second angle determination unit 44, a rotation angle determination unit 45, and a distance determination unit 46 . in:

第一图像获取单元41,用于在摄像头的第一位置获取第一图像。The first image acquisition unit 41 is configured to acquire a first image at the first position of the camera.

其中,获取的第一图像包括目标对应的图像信息。摄像头通过接收用户发出的拍照指令获取第一图像,具体地,用户通过按压移动终端的按键或者触摸移动终端的屏幕或者发出相应的音频等发出拍照指令。Wherein, the acquired first image includes image information corresponding to the target. The camera obtains the first image by receiving a photographing instruction from the user. Specifically, the user sends a photographing instruction by pressing a button of the mobile terminal or touching a screen of the mobile terminal or sending a corresponding audio.

目标第一角度确定单元42,用于确定目标与第一图像的视野中心垂直线的角度α。The target first angle determining unit 42 is configured to determine an angle α between the target and the vertical line of the visual field center of the first image.

其中,第一图像的视野中心垂直线是指,第一位置与第一图像的中心连接形成的直线。Wherein, the vertical line to the center of the field of view of the first image refers to a straight line formed by connecting the first position and the center of the first image.

第二图像获取单元43,用于在摄像头的第二位置获取第二图像。The second image acquisition unit 43 is configured to acquire a second image at the second position of the camera.

其中,获取的第二图像也包括第一图像包括的目标对应的图像信息。摄像头从第一位置旋转到第二位置后,接收用户发出的拍照指令以获取第二图像,具体地,用户通过按压移动终端的按键或者触摸移动终端的屏幕或者发出相应的音频等发出拍照指令。Wherein, the acquired second image also includes image information corresponding to the target included in the first image. After the camera rotates from the first position to the second position, it receives a camera instruction from the user to obtain the second image. Specifically, the user sends a camera instruction by pressing a button of the mobile terminal or touching the screen of the mobile terminal or sending a corresponding audio.

目标第二角度确定单元44,用于确定目标与第二图像的视野中心垂直线的角度β。The target second angle determining unit 44 is configured to determine an angle β between the target and the vertical line of the center of the field of view of the second image.

其中,第二图像的视野中心垂直线是指,第二位置与第二图像的中心连接形成的直线。Wherein, the vertical line to the center of the field of view of the second image refers to a straight line formed by connecting the second position with the center of the second image.

旋转角度确定单元45,用于确定摄像头从第一位置旋转到第二位置的角度θ。The rotation angle determining unit 45 is configured to determine an angle θ at which the camera rotates from the first position to the second position.

距离确定单元46,用于根据所述α、β、θ以及摄像头的旋转半径R确定摄像头的第一位置到目标的距离x,和/或,确定摄像头的第二位置到目标的距离y。The distance determining unit 46 is configured to determine the distance x from the first position of the camera to the target according to the α, β, θ and the rotation radius R of the camera, and/or determine the distance y from the second position of the camera to the target.

其中,摄像头的旋转半径R预先设定,如在设计摄像头时设定。Wherein, the rotation radius R of the camera is preset, such as when designing the camera.

可选地,所述距离确定单元46具体包括:Optionally, the distance determining unit 46 specifically includes:

夹角确定模块,用于根据所述α、β、θ确定摄像头的第一位置、第二位置以及目标形成的三角形的三个夹角。具体地,所述夹角确定模块具体包括:第一夹角确定模块,用于根据下式确定角 所述为摄像头的第一位置和摄像头的第二位置所在的直线与摄像头的第一位置和目标所在的直线形成的夹角。第二夹角确定模块,用于根据下式确定角γ,γ=(90-β)+(90-θ/2),所述γ为摄像头的第一位置和摄像头的第二位置所在的直线与第二位置和目标所在的直线形成的夹角。第三夹角确定模块,用于根据下式确定角φ,所述φ为摄像头的第一位置和目标所在的直线与摄像头的第二位置和目标所在的直线形成的夹角。The included angle determination module is used to determine the first position, the second position of the camera and the three included angles of the triangle formed by the target according to the α, β, θ. Specifically, the included angle determination module specifically includes: a first included angle determination module, used to determine the angle according to the following formula said is the angle formed by the line between the first position of the camera and the second position of the camera and the line between the first position of the camera and the target. The second included angle determination module is used to determine the angle γ according to the following formula, γ=(90-β)+(90-θ/2), and the γ is the straight line where the first position of the camera and the second position of the camera are located The angle formed by the line where the second position and the target lie. The third included angle determination module is used to determine the angle φ according to the following formula, The φ is the angle formed between the first position of the camera and the line where the target is located, and the second position of the camera and the line where the target is located.

旋转距离确定模块,用于根据所述θ和R确定摄像头的第一位置到第二位置的距离。具体地,所述旋转距离确定模块具体包括:两个位置间距确定模块z=2×sin(θ/2)×R,所述z为摄像头的第一位置到第二位置的距离。A rotation distance determination module, configured to determine the distance from the first position to the second position of the camera according to the θ and R. Specifically, the rotation distance determination module specifically includes: two position distance determination modules z=2×sin(θ/2)×R, where z is the distance from the first position to the second position of the camera.

摄像头与目标距离确定模块,用于根据确定的摄像头的第一位置、第二位置以及目标形成的三角形的三个夹角以及摄像头的第一位置到第二位置的距离确定x和/或y的距离。具体地,所述摄像头与目标距离确定模块具体包括:第一位置与目标距离确定模块,用于第二位置与目标距离确定模块,用于 The distance between the camera and the target is determined by a module, configured to determine the distance between the first position of the camera, the second position and the three angles of the triangle formed by the target and the distance from the first position of the camera to the second position of the x and/or y distance. Specifically, the module for determining the distance between the camera and the target specifically includes: a first position and target distance determining module for The second position and the target distance determination module are used for

本发明第二实施例中,由于只需在移动终端设置一个摄像头,就能通过旋转该摄像头获取第一图像和第二图像,最后通过对获取的第一图像与第二图像进行处理确定移动终端与目标的距离,从而降低测距耗费的成本。In the second embodiment of the present invention, since only one camera needs to be installed on the mobile terminal, the first image and the second image can be acquired by rotating the camera, and finally the mobile terminal can be determined by processing the acquired first image and the second image. The distance to the target, thereby reducing the cost of ranging.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes. .

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims (9)

1. a kind of target ranging method based on camera, it is characterised in that methods described includes:
The first image is obtained in the first position of camera;
Determine the angle [alpha] of target and the central region vertical line of the first image;
The second image is obtained in the second place of camera, the second place is true after camera rotates from first position It is fixed;
Determine the angle beta of target and the central region vertical line of the second image;
Determine that camera rotates to the angle, θ of the second place from first position;
Radius of turn R according to described α, β, θ and camera determines the first position range-to-go x of camera, and/ Or, determining the second place range-to-go y of camera;
The radius of turn R according to described α, β, θ and camera determines the first position range-to-go x of camera, And/or, determine the second place range-to-go y of camera, specifically include:
Three angles of the triangle that first position, the second place and the target of camera are formed are determined according to described α, β, θ;
The first position of camera to the distance of the second place is determined according to the θ and R;
Three angles of the triangle that first position, the second place and target according to the camera for determining are formed and shooting The first position of head determines the distance of x and/or y to the distance of the second place.
2. method according to claim 1, it is characterised in that first that camera is determined according to described α, β, θ Put, three angles of the triangle that the second place and target are formed, specifically include:
Angle is determined according to following formula It is describedFirst position and camera for camera The angle that straight line where the second place is formed with the straight line where the first position of camera and target;
Angle γ is determined according to following formula, γ=(90- β)+(90- θ/2), the γ for camera first position and camera the The angle that straight line where two positions is formed with the straight line where the second place and target;
Angle φ is determined according to following formula,Straight lines of the φ where the first position of camera and target The angle formed with the straight line where the second place and target of camera.
3. method according to claim 1, it is characterised in that the first position that camera is determined according to the θ and R Distance to the second place is specifically included:
Z=2 × sin (θ/2) × R, the z are the first position of camera to the distance of the second place.
4. method according to claim 3, it is characterised in that first position, second according to the camera for determining Three angles of triangle and the first position of camera that position and target are formed determine x to the distance of the second place And/or the distance of y, specifically include:
x = z × s i n [ ( 90 - β ) + ( 90 - θ / 2 ) ] s i n { 180 - [ ( 90 - θ / 2 ) - ( 90 - α ) ] - [ ( 90 - β ) + ( 90 - θ / 2 ) ] } ;
y = z × s i n [ ( 90 - θ / 2 ) + ( 90 - α ) ] s i n { 180 - [ ( 90 - θ / 2 ) - ( 90 - α ) ] - [ ( 90 - β ) + ( 90 - θ / 2 ) ] } .
5. a kind of object ranging device based on camera, it is characterised in that described device includes:
First image acquisition unit, for obtaining the first image in the first position of camera;
Target first angle determining unit, the angle [alpha] for determining target and the central region vertical line of the first image;
Second image acquisition unit, for obtaining the second image in the second place of camera, the second place is by shooting Head determines from after the rotation of first position;
Target second angle determining unit, the angle beta for determining target and the central region vertical line of the second image;
Anglec of rotation determining unit, for determining that camera rotates to the angle, θ of the second place from first position;
Distance determining unit, for determining that the first position of camera is arrived according to the radius of turn R of described α, β, θ and camera Target apart from x, and/or, determine the second place range-to-go y of camera;
The distance determining unit is specifically included:
Angle determining module, what first position, the second place and target for determining camera according to described α, β, θ were formed Three angles of triangle;
Rotary distance determining module, for determining the first position of camera to the distance of the second place according to the θ and R;
Camera and target range determining module, for the first position according to the camera for determining, the second place and target Three angles of the triangle of formation and the first position of camera determine the distance of x and/or y to the distance of the second place.
6. device according to claim 5, it is characterised in that the angle determining module is specifically included:
First angle determining module, for determining angle according to following formula It is describedIt is camera First position and camera the second place where straight line formed with the straight line where the first position of camera and target Angle;
Second angle determining module, for determining angle γ, γ=(90- β)+(90- θ/2) according to following formula, the γ is camera First position and camera the second place where straight line and the second place and the angle that is formed of the straight line where target;
3rd angle determining module, for determining angle φ according to following formula,The φ is the of camera The angle that straight line where one position and target is formed with the straight line where the second place and target of camera.
7. device according to claim 5, it is characterised in that the rotary distance determining module is specifically included:
Two position spacing determining module z=2 × sin (θ/2) × R, the z arrive the second place for the first position of camera Distance.
8. device according to claim 7, it is characterised in that the camera is specifically wrapped with target range determining module Include:
First position and target range determining module, are used for
The second place and target range determining module, are used for
9. a kind of storage medium, the storage medium is stored with computer program, it is characterised in that the computer program is located Reason device is realized such as the step of Claims 1-4 any one methods described when performing.
CN201510122328.5A 2015-03-19 2015-03-19 Target ranging method and device based on camera Expired - Fee Related CN104677329B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510122328.5A CN104677329B (en) 2015-03-19 2015-03-19 Target ranging method and device based on camera

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510122328.5A CN104677329B (en) 2015-03-19 2015-03-19 Target ranging method and device based on camera

Publications (2)

Publication Number Publication Date
CN104677329A CN104677329A (en) 2015-06-03
CN104677329B true CN104677329B (en) 2017-06-30

Family

ID=53312699

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510122328.5A Expired - Fee Related CN104677329B (en) 2015-03-19 2015-03-19 Target ranging method and device based on camera

Country Status (1)

Country Link
CN (1) CN104677329B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105627995B (en) 2016-03-31 2018-03-23 京东方科技集团股份有限公司 Camera device, tumbler, range unit, range-measurement system and distance-finding method
CN105698751B (en) * 2016-04-28 2018-05-08 京东方科技集团股份有限公司 A kind of range-measurement system, distance measuring method, range unit and filming apparatus
CN107094223A (en) * 2017-03-17 2017-08-25 奥克斯空调股份有限公司 Obtain the method and device of the high-definition image of intrusion target
CN108195345A (en) * 2017-12-20 2018-06-22 合肥英睿系统技术有限公司 A kind of distance measuring method and system based on electronic imager
CN112639400A (en) * 2020-01-21 2021-04-09 深圳市大疆创新科技有限公司 Distance measurement method, device, equipment and system based on semantic segmentation
WO2021146969A1 (en) * 2020-01-21 2021-07-29 深圳市大疆创新科技有限公司 Distance measurement method, movable platform, device, and storage medium
CN113409387A (en) * 2021-05-11 2021-09-17 深圳拓邦股份有限公司 Robot vision positioning method and robot

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001336930A (en) * 2000-05-26 2001-12-07 Maeda Science:Kk Method for detecting three-dimensional position of target point
KR20020097172A (en) * 2001-02-08 2002-12-31 닛폰 고칸 가부시키가이샤 Method for Measuring Three- dimensional Coordinate, Apparatus Thereof and Method for Building Large Construction Therewith
JP2005164434A (en) * 2003-12-03 2005-06-23 Fukuoka Institute Of Technology Non-contact three-dimensional measurement method and apparatus
CN101943580B (en) * 2009-07-07 2012-08-29 宏达国际电子股份有限公司 Object distance detection method and device

Also Published As

Publication number Publication date
CN104677329A (en) 2015-06-03

Similar Documents

Publication Publication Date Title
CN104677329B (en) Target ranging method and device based on camera
US11455738B2 (en) Electronic device and method for applying image effect to images obtained using image sensor
US10574895B2 (en) Image capturing method and camera equipped electronic device
EP3989089B1 (en) Face image transmission method and apparatus, numerical value transfer method and apparatus, and electronic device
EP2769289B1 (en) Method and apparatus for determining the presence of a device for executing operations
US9184620B2 (en) Method and apparatus for improved wireless charging efficiency
US9277391B2 (en) Pairing method between bluetooth devices and bluetooth system using the same
WO2020042754A1 (en) Method and apparatus for verifying holographic anti-counterfeiting code
CN108027650A (en) For measuring the method for the angle between display and the electronic equipment using this method
US20150220171A1 (en) Method for processing input and electronic device thereof
CN106097428B (en) Method and device for labeling three-dimensional model measurement information
TWI706332B (en) Graphic coding display method and device and computer equipment
WO2017035977A1 (en) Method and system for confirming pairing connection of terminal devices
EP3062515A1 (en) Image processing method and electronic device supporting the same
CN105446619A (en) Apparatus and method for identifying object
JP2019522848A (en) Processing method and terminal
CN106648378A (en) Image display method, device and mobile terminal
CN108171182A (en) Electronic device, face identification method and Related product
JP2016062604A (en) Method, device, and program for connecting multiple mobile devices
KR102305114B1 (en) Method for processing data and an electronic device thereof
CN106909272B (en) A display control method and mobile terminal
US10681280B2 (en) Camera component location indicator on display
CN104469156B (en) Switching method, device and the mobile terminal of camera
US20150029351A1 (en) Display method, image capturing method and electronic device
CN115439554A (en) Target, information detection method, device, terminal and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before: Changan town in Guangdong province Dongguan 523841 usha Beach Road No. 18

Patentee before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

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: 20170630