CN111754574A - Distance testing method, device, system and storage medium based on binocular camera - Google Patents
Distance testing method, device, system and storage medium based on binocular camera Download PDFInfo
- Publication number
- CN111754574A CN111754574A CN202010466128.2A CN202010466128A CN111754574A CN 111754574 A CN111754574 A CN 111754574A CN 202010466128 A CN202010466128 A CN 202010466128A CN 111754574 A CN111754574 A CN 111754574A
- Authority
- CN
- China
- Prior art keywords
- measured
- target
- binocular
- ranging
- monocular
- 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.)
- Pending
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 29
- 238000000034 method Methods 0.000 claims abstract description 31
- 238000005259 measurement Methods 0.000 claims abstract description 21
- 238000001514 detection method Methods 0.000 claims abstract description 10
- 238000000605 extraction Methods 0.000 claims description 13
- 238000010801 machine learning Methods 0.000 claims description 3
- 230000000007 visual effect Effects 0.000 claims description 2
- 238000004364 calculation method Methods 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 238000003384 imaging method Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 230000001360 synchronised effect Effects 0.000 description 4
- 230000000694 effects Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000010998 test method Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/70—Determining position or orientation of objects or cameras
- G06T7/73—Determining position or orientation of objects or cameras using feature-based methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/15—Correlation function computation including computation of convolution operations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/80—Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Optimization (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Pure & Applied Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Computing Systems (AREA)
- Algebra (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Measurement Of Optical Distance (AREA)
Abstract
本发明公开了一种基于双目相机的距离测试方法、装置、系统和存储介质,该方法首先获取双目相机在预设图像范围内的盲区位置,判定待测目标处于盲区位置时,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果;在判定所述待测目标不处于盲区位置时,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果。该方法融合了双目视差测距原理和单目测距原理的各自优点,利用单双目结合测距,提高了测距精度,从而解决了传统双目相机在障碍物距离检测时受限于盲区而导致的测距精度低的技术问题。
The invention discloses a distance testing method, device, system and storage medium based on a binocular camera. The method first obtains the blind spot position of the binocular camera within a preset image range, and when it is determined that the target to be tested is in the blind spot position, the method is adopted. The monocular measures the distance of the target to be measured, and outputs the distance measurement result obtained by the monocular distance measurement; when it is determined that the target to be measured is not in the blind spot, the monocular and binocular are used to measure the target to be measured separately. Ranging, and after the weight calculation of the obtained monocular ranging results and binocular ranging results, the comprehensive ranging results are obtained and output. This method combines the respective advantages of the binocular parallax ranging principle and the monocular ranging principle, and uses the monocular and binocular combined ranging to improve the ranging accuracy, thereby solving the limitation of the traditional binocular camera in obstacle distance detection. The technical problem of low ranging accuracy caused by blind spots.
Description
技术领域technical field
本发明涉及双目相机成像技术领域,具体涉及一种基于双目相机的距离测试方法、装置、系统和存储介质。The invention relates to the technical field of binocular camera imaging, in particular to a distance testing method, device, system and storage medium based on a binocular camera.
背景技术Background technique
随着传感器技术和机器视觉技术的发展,基于双目相机的障碍物测试技术日趋广泛地应用于机器人领域、智能汽车等领域。但是,现有技术中多通过对双目视差的分析进行目标距离检测,容易受到环境和双目匹配盲区等诸多限制,存在测距精度不高,盲区无法测距以及鲁棒性较差等缺陷。With the development of sensor technology and machine vision technology, obstacle testing technology based on binocular camera is increasingly widely used in robotics, smart cars and other fields. However, in the prior art, the target distance detection is mostly performed by analyzing the binocular disparity, which is easily subject to many limitations such as the environment and the blind spot of binocular matching. .
发明内容SUMMARY OF THE INVENTION
为此,本发明实施例提供一种基于双目相机的距离测试方法、装置、系统和存储介质,以至少部分解决传统双目相机在障碍物距离检测时受限于盲区而导致的测距精度低的技术问题。To this end, embodiments of the present invention provide a method, device, system, and storage medium for distance measurement based on a binocular camera, so as to at least partially solve the ranging accuracy caused by the limitation of blind spots in the distance detection of obstacles by traditional binocular cameras Low technical issues.
为了实现上述目的,本发明实施例提供如下技术方案:In order to achieve the above purpose, the embodiments of the present invention provide the following technical solutions:
一种基于双目相机的距离测试方法,其特征在于,所述方法包括:A distance testing method based on a binocular camera, characterized in that the method comprises:
获取双目相机在预设图像范围内的盲区位置;Obtain the blind spot position of the binocular camera within the preset image range;
判定待测目标处于盲区位置,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果;If it is determined that the target to be measured is located in the blind area, the target to be measured is measured using a monocular, and the ranging result obtained by the monocular ranging is output;
判定所述待测目标不处于盲区位置,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果。It is determined that the target to be measured is not located in the blind area, then the target to be measured is measured separately by monocular and binocular, and after the obtained monocular ranging result and binocular ranging result are weighted, the result is obtained. Output comprehensive ranging results.
进一步地,所述方法还包括:Further, the method also includes:
采集待测目标的双目图像,提取双目图像中所述待测目标的位置信息,并通过特征提取框标注所述位置信息;Collecting a binocular image of the target to be measured, extracting the position information of the target to be measured in the binocular image, and marking the position information through a feature extraction frame;
获取所述待测目标在所述特征提取框范围内的有效视差比例;obtaining the effective parallax ratio of the target to be tested within the range of the feature extraction frame;
判定所述有效视差比例低于设定阈值、且所述待测目标处于盲区位置,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果;If it is determined that the effective parallax ratio is lower than the set threshold, and the target to be measured is in the blind area, the target to be measured is measured using a monocular, and the ranging result obtained by the monocular distance measurement is output;
判定所述有效视差比例高于设定阈值、且所述待测目标不处于盲区位置,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果。It is determined that the effective parallax ratio is higher than the set threshold, and the target to be measured is not located in the blind spot, then the target to be measured is measured separately by monocular and binocular, and the obtained monocular ranging result is compared with that. After the binocular ranging results are weighted, the comprehensive ranging results are obtained and output.
进一步地,所述采集待测目标的双目图像,提取双目图像中所述待测目标的位置信息,并通过特征提取框标注所述位置信息,具体包括:Further, collecting the binocular image of the target to be measured, extracting the position information of the target to be measured in the binocular image, and marking the position information through a feature extraction frame, specifically including:
采集包含所述待测目标的同一帧图像下的左目图像和右目图像,并获取视差图;Collect the left eye image and the right eye image under the same frame image including the target to be tested, and obtain a disparity map;
通过机器学习或者特征检测提取视差图中的待测目标的位置信息;Extract the position information of the object to be tested in the disparity map through machine learning or feature detection;
利用矩形框框选所述位置信息。Use a rectangular box to frame the location information.
进一步地,所述综合测距结果通过公式Dz=w*dist1+(1-w)*dist2获得;Further, the comprehensive ranging result is obtained by the formula Dz=w*dist1+(1-w)*dist2;
其中,w为权重,w为和所述有效视差比例正相关的参数,dist1为双目测距结果,dist2为单目测距结果。Wherein, w is a weight, w is a parameter positively related to the effective disparity ratio, dist1 is a binocular ranging result, and dist2 is a monocular ranging result.
进一步地,所述权重与所述有效视差比例的函数关系包括:Further, the functional relationship between the weight and the effective disparity ratio includes:
其中,η为所述有效视差比例,ηmax为所述设定阈值的最大值。Wherein, n is the effective parallax ratio, and nmax is the maximum value of the set threshold.
进一步地,所述获取双目相机在预设图像范围内的盲区位置,具体包括:Further, the obtaining the blind spot position of the binocular camera within the preset image range specifically includes:
获取双目相机的内外参数和视场角;Obtain the internal and external parameters and field of view of the binocular camera;
根据所述内外参数和视场角获取所述盲区位置。The blind spot position is acquired according to the internal and external parameters and the field of view angle.
本发明还提供一种基于双目相机的距离测试装置,用于实施如上所述的方法,所述装置包括:The present invention also provides a distance testing device based on a binocular camera for implementing the above method, the device comprising:
盲区获取单元,用于获取双目相机在预设图像范围内的盲区位置;The blind spot acquisition unit is used to obtain the blind spot position of the binocular camera within the preset image range;
第一测距结果输出单元,用于判定待测目标处于盲区位置时,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果;The first ranging result output unit is used to determine that when the target to be measured is located in the blind area, use a monocular to measure the distance of the target to be measured, and output the ranging result obtained by the monocular ranging;
第二测距结果输出单元,用于判定所述待测目标不处于盲区位置时,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果。The second ranging result output unit is used to determine that the target to be measured is not located in the blind area, then use monocular and binocular to measure the distance of the target to be measured separately, and compare the obtained monocular ranging result with the binocular range. After the weight of the visual ranging result is calculated, the comprehensive ranging result is obtained and output.
进一步地,所述装置还包括:Further, the device also includes:
位置采集单元,用于采集待测目标的双目图像,提取双目图像中所述待测目标的位置信息,并通过特征提取框标注所述位置信息;a position acquisition unit, configured to collect a binocular image of the target to be measured, extract the position information of the target to be measured in the binocular image, and mark the position information through a feature extraction frame;
视差比例获取单元,用于获取所述待测目标在所述特征提取框范围内的有效视差比例;A parallax ratio acquiring unit, configured to acquire the effective parallax ratio of the object to be tested within the range of the feature extraction frame;
所述第一测距结果输出单元,还用于判定所述有效视差比例低于设定阈值、且所述待测目标处于盲区位置时,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果;The first ranging result output unit is further configured to determine that the effective parallax ratio is lower than a set threshold and the target to be measured is located in a blind area, then use a monocular to measure the distance to the target to be measured, and Output the ranging result obtained by monocular ranging;
所述第二测距结果输出单元,还用于判定所述有效视差比例高于设定阈值、且所述待测目标不处于盲区位置时,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果。The second ranging result output unit is further configured to determine that when the effective parallax ratio is higher than a set threshold and the target to be measured is not located in the blind spot, then monocular and binocular are used to measure the target to be measured. Ranging is measured separately, and after the obtained monocular ranging results and binocular ranging results are weighted, the comprehensive ranging results are obtained and output.
本发明还提供一种基于双目相机的距离测试系统,所述系统包括:处理器和存储器;The present invention also provides a distance testing system based on a binocular camera, the system comprising: a processor and a memory;
所述存储器用于存储一个或多个程序指令;the memory for storing one or more program instructions;
所述处理器,用于运行一个或多个程序指令,用以执行如上所述的方法。The processor is configured to execute one or more program instructions for executing the method as described above.
本发明还提供一种计算机存储介质,所述计算机存储介质中包含一个或多个程序指令,所述一个或多个程序指令用于被一种基于双目相机的距离测试系统执行如上所述的方法。The present invention also provides a computer storage medium, wherein the computer storage medium contains one or more program instructions, and the one or more program instructions are used to be executed by a binocular camera-based distance testing system as described above. method.
本发明所提供的基于双目相机的距离测试方法、装置、系统和存储介质,该方法首先获取双目相机在预设图像范围内的盲区位置,判定待测目标处于盲区位置时,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果;在判定所述待测目标不处于盲区位置时,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果。该方法解决了单纯的通过双目视差进行目标距离检测,容易受到环境和双目匹配盲区等诸多限制的问题,融合了双目视差测距原理和单目测距原理的各自优点,利用单双目结合测距,提高了测距精度,从而解决了传统双目相机在障碍物距离检测时受限于盲区而导致的测距精度低的技术问题。The method, device, system and storage medium for distance testing based on binocular cameras provided by the present invention firstly obtain the blind spot position of the binocular camera within the preset image range, and when it is determined that the target to be tested is in the blind spot position, the single Measure the distance of the target to be measured by eye, and output the distance measurement result obtained by the monocular distance measurement; when it is determined that the target to be measured is not in the blind spot, then use the monocular and binocular to measure the target to be measured separately. After calculating the weight of the obtained monocular ranging results and the binocular ranging results, the comprehensive ranging results are obtained and output. This method solves the problem that the target distance detection purely through binocular parallax is easily limited by the environment and the blind spot of binocular matching. It combines the respective advantages of the binocular parallax ranging principle and the monocular ranging principle. Combined with the distance measurement, the distance measurement accuracy is improved, thus solving the technical problem of low range measurement accuracy caused by the limitation of the blind spot when the traditional binocular camera detects the distance of obstacles.
附图说明Description of drawings
为了更清楚地说明本发明的实施方式或现有技术中的技术方案,下面将对实施方式或现有技术描述中所需要使用的附图作简单地介绍。显而易见地,下面描述中的附图仅仅是示例性的,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图引伸获得其它的实施附图。In order to illustrate the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that are required to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only exemplary, and for those of ordinary skill in the art, other implementation drawings can also be obtained according to the extension of the drawings provided without creative efforts.
本说明书所绘示的结构、比例、大小等,均仅用以配合说明书所揭示的内容,以供熟悉此技术的人士了解与阅读,并非用以限定本发明可实施的限定条件,故不具技术上的实质意义,任何结构的修饰、比例关系的改变或大小的调整,在不影响本发明所能产生的功效及所能达成的目的下,均应仍落在本发明所揭示的技术内容得能涵盖的范围内。The structures, proportions, sizes, etc. shown in this specification are only used to cooperate with the contents disclosed in the specification, so as to be understood and read by those who are familiar with the technology, and are not used to limit the conditions for the implementation of the present invention, so there is no technical The substantive meaning above, any modification of the structure, the change of the proportional relationship or the adjustment of the size should still fall within the technical content disclosed in the present invention without affecting the effect and the purpose that the present invention can produce. within the range that can be covered.
图1为本发明所提供的距离测试方法一种具体实施方式的流程图;1 is a flowchart of a specific embodiment of a distance testing method provided by the present invention;
图2为双目立体相机的双目测距原理图;Figure 2 is a schematic diagram of the binocular ranging principle of the binocular stereo camera;
图3为基于图2的双目测距得到的测距盲区的示意图;FIG. 3 is a schematic diagram of a ranging blind area obtained based on the binocular ranging of FIG. 2;
图4为双目立体相机的单目测距原理图;FIG. 4 is a schematic diagram of the monocular ranging principle of the binocular stereo camera;
图5为图1所示距离测试方法一种实时场景下的实施流程图;Fig. 5 is the implementation flow chart under a kind of real-time scene of the distance test method shown in Fig. 1;
图6为本发明所提供的距离测试装置一种具体实施方式的结构框图;6 is a structural block diagram of a specific embodiment of the distance testing device provided by the present invention;
图7为本发明所提供的距离测试系统一种具体实施方式的结构框图。FIG. 7 is a structural block diagram of a specific implementation manner of the distance testing system provided by the present invention.
附图标记说明:Description of reference numbers:
100-盲区获取单元 200-第一测距结果输出单元100-blind zone acquisition unit 200-first ranging result output unit
300-第二测距结果输出单元 400-位置采集单元 500-视差比例获取单元300-Second ranging result output unit 400-Position acquisition unit 500-Parallax ratio acquisition unit
具体实施方式Detailed ways
以下由特定的具体实施例说明本发明的实施方式,熟悉此技术的人士可由本说明书所揭露的内容轻易地了解本发明的其他优点及功效,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The embodiments of the present invention are described below by specific specific embodiments. Those who are familiar with the technology can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are part of the present invention. , not all examples. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
本发明提供的基于双目相机的距离测试方法,利用单目相机和双目相机结合测试的方法,避免了双目测距时存在的盲点问题,以此解决传统双目相机在障碍物距离检测时受限于盲区而导致的测距精度低的问题。在一种具体实施方式中,如图1所示,该方法包括:The distance testing method based on the binocular camera provided by the present invention uses the combined testing method of the monocular camera and the binocular camera to avoid the problem of blind spots existing in the binocular ranging, so as to solve the obstacle distance detection of the traditional binocular camera. The problem of low ranging accuracy caused by the time limit of blind spots. In a specific embodiment, as shown in Figure 1, the method includes:
S1:获取双目相机在预设图像范围内的盲区位置;获取盲区位置具体包括获取双目相机的内外参数和视场角,并根据所述内外参数和视场角获取所述盲区位置。S1: Acquire the blind spot position of the binocular camera within the preset image range; the obtaining of the blind spot position specifically includes acquiring the internal and external parameters and field of view of the binocular camera, and obtaining the blind spot position according to the internal and external parameters and the field of view.
在实际操作过程中,根据如图2所示的双目测距原理可知,由图2中三角几何关系可得到如下公式:In the actual operation process, according to the principle of binocular ranging shown in Figure 2, the following formula can be obtained from the triangular geometric relationship in Figure 2:
其中,f表示相机焦距,B表示两个相机中心之间的距离,若令D=Xleft-Xright,则可以得到z方向距离为:Among them, f represents the focal length of the camera, and B represents the distance between the centers of the two cameras. If D=X left -X right , the distance in the z direction can be obtained as:
由此可知,双目测距需要找到空间中某一点同时在左、右相机中的成像位置才能计算距离,若该点仅能够出现在一台相机的成像面,则无法获取相应的视差,得不到距离信息,从而形成如图3所示的测距盲区。It can be seen from this that binocular ranging needs to find the imaging position of a certain point in space on the left and right cameras to calculate the distance. If the point can only appear on the imaging surface of one camera, the corresponding parallax cannot be obtained. There is no distance information, thus forming a ranging blind area as shown in Figure 3.
S2:判定待测目标处于盲区位置,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果,也就是说,当判定待测目标刚好出在相机的盲点区域时,双目测量无法检测,此时需采用左目相机或者右目相机测量,通过单目输出较为准确的测距结果。S2: It is determined that the target to be measured is located in the blind spot, and the target to be measured is measured using a monocular, and the ranging result obtained by the monocular ranging is output. That is to say, when it is determined that the target to be measured is just in the blind spot of the camera When the area is large, binocular measurement cannot be detected. In this case, the left-eye camera or the right-eye camera needs to be used for measurement, and a relatively accurate ranging result is output through the monocular.
如图4所示,根据单目测距原理可以通过单目测距的方法得到上述处于盲区位置的待测目标的参数信息,图4中,θe表示相机主光轴和水平地面的夹角,OE表示相机主光轴,OB表示待测距目标与地面的交点和相机光心所在的直线,f表示相机焦距,Hcam表示相机距离地面的安装高度,θb表示OB直线和OE直线的夹角。通常情况下,OZ投影到成像面上的V点叫做消失点,该点可以通过标定相机姿态得到。图像坐标系下,ye表示消失点的y方向坐标,y0表示光心点的y方向坐标,该参数可以通过标定相机内参得到,yb表示待测距目标与地面的交点B的y方向坐标。As shown in Figure 4, according to the principle of monocular ranging, the parameter information of the target to be measured in the blind spot can be obtained by the method of monocular ranging. In Figure 4, θe represents the angle between the main optical axis of the camera and the horizontal ground, OE represents the main optical axis of the camera, OB represents the intersection of the target to be ranged and the ground and the line where the optical center of the camera is located, f represents the focal length of the camera, Hcam represents the installation height of the camera from the ground, and θb represents the angle between the OB line and the OE line. Usually, the V point projected by OZ onto the imaging surface is called the vanishing point, which can be obtained by calibrating the camera pose. In the image coordinate system, ye represents the y-direction coordinate of the vanishing point, y0 represents the y-direction coordinate of the optical center point, which can be obtained by calibrating the camera's internal parameters, and yb represents the y-direction coordinate of the intersection point B of the target to be ranged and the ground.
通过几何关系得到待测目标的Z方向距离为:The Z-direction distance of the target to be measured is obtained through the geometric relationship as:
S3:判定所述待测目标不处于盲区位置,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果,也就是说,当判定待测目标并不处于盲区位置时,分别采集双目和单目的数据,并对得到的数据进行权重计算,以输出较为准确的最终结果。S3: It is determined that the target to be measured is not located in the blind area, then the target to be measured is measured separately by monocular and binocular, and after the obtained monocular ranging result and binocular ranging result are weighted, Obtain and output the comprehensive ranging result, that is to say, when it is determined that the target to be measured is not in the blind spot, binocular and monocular data are collected respectively, and the weight of the obtained data is calculated to output a more accurate final result.
具体地,在一种具体实施例中,如图5所示,所述方法的实施过程包括:Specifically, in a specific embodiment, as shown in FIG. 5 , the implementation process of the method includes:
采集包含所述待测目标的同一帧图像下的左目图像和右目图像,并获取视差图;Collect the left eye image and the right eye image under the same frame image including the target to be tested, and obtain a disparity map;
通过机器学习或者特征检测提取视差图中的待测目标的位置信息;Extract the position information of the object to be tested in the disparity map through machine learning or feature detection;
利用矩形框框选所述位置信息;Use a rectangular frame to select the location information;
获取所述待测目标在所述特征提取框范围内的有效视差比例;obtaining the effective parallax ratio of the target to be tested within the range of the feature extraction frame;
判定所述有效视差比例低于设定阈值、且所述待测目标处于盲区位置,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果;If it is determined that the effective parallax ratio is lower than the set threshold, and the target to be measured is in the blind area, the target to be measured is measured using a monocular, and the ranging result obtained by the monocular distance measurement is output;
判定所述有效视差比例高于设定阈值、且所述待测目标不处于盲区位置,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果。It is determined that the effective parallax ratio is higher than the set threshold, and the target to be measured is not located in the blind spot, then the target to be measured is measured separately by monocular and binocular, and the obtained monocular ranging result is compared with that. After the binocular ranging results are weighted, the comprehensive ranging results are obtained and output.
综合测距结果通过公式Dz=w*dist1+(1-w)*dist2获得;The comprehensive ranging result is obtained by the formula Dz=w*dist1+(1-w)*dist2;
其中,w为权重,w为和所述有效视差比例正相关的参数,dist1为双目测距结果,dist2为单目测距结果。Wherein, w is a weight, w is a parameter positively related to the effective disparity ratio, dist1 is a binocular ranging result, and dist2 is a monocular ranging result.
进一步地,所述权重与所述有效视差比例的函数关系包括:Further, the functional relationship between the weight and the effective disparity ratio includes:
其中,η为所述有效视差比例,ηmax为所述设定阈值的最大值。Wherein, n is the effective parallax ratio, and nmax is the maximum value of the set threshold.
在上述具体实施方式中,本发明所提供的基于双目相机的距离测试方法首先获取双目相机在预设图像范围内的盲区位置,判定待测目标处于盲区位置时,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果;在判定所述待测目标不处于盲区位置时,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果。该方法解决了单纯的通过双目视差进行目标距离检测,容易受到环境和双目匹配盲区等诸多限制的问题,融合了双目视差测距原理和单目测距原理的各自优点,利用单双目结合测距,提高了测距精度,从而解决了传统双目相机在障碍物距离检测时受限于盲区而导致的测距精度低的技术问题。In the above-mentioned specific embodiments, the distance testing method based on the binocular camera provided by the present invention first obtains the blind spot position of the binocular camera within the preset image range, and when it is determined that the target to be tested is in the blind spot position, the monocular camera is used to measure the blind spot. When it is determined that the target to be measured is not in the blind spot position, the target to be measured is measured by monocular and binocular respectively, and the After the obtained monocular ranging results and binocular ranging results are weighted, the comprehensive ranging results are obtained and output. This method solves the problem that the target distance detection purely through binocular parallax is easily limited by the environment and the blind spot of binocular matching. It combines the respective advantages of the binocular parallax ranging principle and the monocular ranging principle. Combined with the distance measurement, the distance measurement accuracy is improved, thus solving the technical problem of low range measurement accuracy caused by the limitation of the blind spot when the traditional binocular camera detects the distance of obstacles.
除了上述测距方法,本发明还提供一种基于双目相机的距离测试装置,用于实施如上所述的方法,在一种具体实施方式中,如图6所示,所述装置包括:In addition to the above distance measuring method, the present invention also provides a distance testing device based on a binocular camera, which is used to implement the above method. In a specific implementation manner, as shown in FIG. 6 , the device includes:
盲区获取单元100,用于获取双目相机在预设图像范围内的盲区位置;获取盲区位置具体包括获取双目相机的内外参数和视场角,并根据所述内外参数和视场角获取所述盲区位置。The blind spot obtaining unit 100 is used to obtain the blind spot position of the binocular camera within the preset image range; obtaining the blind spot position specifically includes obtaining the internal and external parameters and the field of view of the binocular camera, and obtaining all the internal and external parameters and the field of view according to the internal and external parameters. the blind spot location.
第一测距结果输出单元200,用于判定待测目标处于盲区位置时,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果,也就是说,当判定待测目标刚好出在相机的盲点区域时,双目测量无法检测,此时需采用左目相机或者右目相机测量,通过单目输出较为准确的测距结果。The first ranging result output unit 200 is used to determine that when the target to be measured is located in the blind area, the target to be measured is measured using a monocular, and the ranging result obtained by the monocular ranging is output, that is, when When it is determined that the target to be measured is just in the blind spot area of the camera, the binocular measurement cannot be detected. In this case, the left-eye camera or the right-eye camera must be used for measurement, and a more accurate ranging result is output through the monocular.
第二测距结果输出单元300,用于判定所述待测目标不处于盲区位置时,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果,也就是说,当判定待测目标并不处于盲区位置时,分别采集双目和单目的数据,并对得到的数据进行权重计算,以输出较为准确的最终结果。The second ranging result output unit 300 is used to determine that the target to be measured is not located in the blind spot, then use monocular and binocular to measure the distance of the target to be measured separately, and compare the obtained monocular ranging result with the After the binocular ranging results are weighted, the comprehensive ranging results are obtained and output. That is to say, when it is determined that the target to be measured is not in the blind spot, binocular and monocular data are collected respectively, and the obtained data is weighted calculation to output a more accurate final result.
为了获取准确的盲区位置,该装置还包括:In order to obtain the accurate blind spot position, the device also includes:
位置采集单元400,用于采集待测目标的双目图像,提取双目图像中所述待测目标的位置信息,并通过特征提取框标注所述位置信息;The position acquisition unit 400 is configured to collect a binocular image of the target to be measured, extract the position information of the target to be measured in the binocular image, and mark the position information through a feature extraction frame;
视差比例获取单元500,用于获取所述待测目标在所述特征提取框范围内的有效视差比例;A parallax ratio acquiring unit 500, configured to acquire the effective parallax ratio of the object to be measured within the range of the feature extraction frame;
此时,所述第一测距结果输出单元还用于判定所述有效视差比例低于设定阈值、且所述待测目标处于盲区位置时,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果;At this time, the first ranging result output unit is further configured to determine that the effective parallax ratio is lower than a set threshold and the target to be measured is located in a blind area, and the target to be measured is measured using a monocular. , and output the ranging result obtained by monocular ranging;
所述第二测距结果输出单元还用于判定所述有效视差比例高于设定阈值、且所述待测目标不处于盲区位置时,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果。The second ranging result output unit is further configured to determine that the effective parallax ratio is higher than a set threshold and the target to be measured is not located in the blind spot, then use monocular and binocular to respectively measure the target to be measured. Ranging, and after the weight calculation of the obtained monocular ranging results and binocular ranging results, the comprehensive ranging results are obtained and output.
在上述具体实施方式中,本发明所提供的基于双目相机的距离测试装置首先获取双目相机在预设图像范围内的盲区位置,判定待测目标处于盲区位置时,则采用单目对所述待测目标测距,并输出单目测距得到的测距结果;在判定所述待测目标不处于盲区位置时,则采用单目和双目对所述待测目标分别测距,并将获得的单目测距结果与双目测距结果进行权重计算后,得到并输出综合测距结果。该方法解决了单纯的通过双目视差进行目标距离检测,容易受到环境和双目匹配盲区等诸多限制的问题,融合了双目视差测距原理和单目测距原理的各自优点,利用单双目结合测距,提高了测距精度,从而解决了传统双目相机在障碍物距离检测时受限于盲区而导致的测距精度低的技术问题。In the above specific embodiment, the distance testing device based on the binocular camera provided by the present invention first obtains the blind spot position of the binocular camera within the preset image range, and when it is determined that the target to be tested is in the blind spot position, the monocular camera is used to measure the blind spot. When it is determined that the target to be measured is not in the blind spot position, the target to be measured is measured by monocular and binocular respectively, and the After the obtained monocular ranging results and binocular ranging results are weighted, the comprehensive ranging results are obtained and output. This method solves the problem that the target distance detection purely through binocular parallax is easily limited by the environment and the blind spot of binocular matching. It combines the respective advantages of the binocular parallax ranging principle and the monocular ranging principle. Combined with the distance measurement, the distance measurement accuracy is improved, thus solving the technical problem of low range measurement accuracy caused by the limitation of the blind spot when the traditional binocular camera detects the distance of obstacles.
根据本发明实施例的第三方面,本发明还提供一种基于双目相机的距离测试系统,如图7所示,所述系统包括:处理器201和存储器202;According to a third aspect of the embodiments of the present invention, the present invention further provides a distance testing system based on a binocular camera. As shown in FIG. 7 , the system includes: a processor 201 and a memory 202;
所述存储器用于存储一个或多个程序指令;the memory for storing one or more program instructions;
所述处理器,用于运行一个或多个程序指令,用以执行如上所述的方法。The processor is configured to execute one or more program instructions for executing the method as described above.
与上述实施例相对应的,本发明实施例还提供了一种计算机存储介质,该计算机存储介质中包含一个或多个程序指令。其中,所述一个或多个程序指令用于被一种距离测试系统执行如上所述的方法。Corresponding to the foregoing embodiments, an embodiment of the present invention further provides a computer storage medium, where the computer storage medium includes one or more program instructions. Wherein, the one or more program instructions are used to perform the method as described above by a distance testing system.
在本发明实施例中,处理器可以是一种集成电路芯片,具有信号的处理能力。处理器可以是通用处理器、数字信号处理器(Digital Signal Processor,简称DSP)、专用集成电路(Application Specific工ntegrated Circuit,简称ASIC)、现场可编程门阵列(FieldProgrammable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。In this embodiment of the present invention, the processor may be an integrated circuit chip, which has signal processing capability. The processor may be a general-purpose processor, a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field programmable gate array (FPGA for short), or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。处理器读取存储介质中的信息,结合其硬件完成上述方法的步骤。Various methods, steps, and logical block diagrams disclosed in the embodiments of the present invention can be implemented or executed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in conjunction with the embodiments of the present invention may be directly embodied as executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other storage media mature in the art. The processor reads the information in the storage medium, and completes the steps of the above method in combination with its hardware.
存储介质可以是存储器,例如可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。The storage medium may be memory, eg, may be volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory.
其中,非易失性存储器可以是只读存储器(Read-Only Memory,简称ROM)、可编程只读存储器(Programmable ROM,简称PROM)、可擦除可编程只读存储器(Erasable PROM,简称EPROM)、电可擦除可编程只读存储器(Electrically EPROM,简称EEPROM)或闪存。Among them, the non-volatile memory may be a read-only memory (Read-Only Memory, referred to as ROM), a programmable read-only memory (Programmable ROM, referred to as PROM), an erasable programmable read-only memory (Erasable PROM, referred to as EPROM) , Electrically Erasable Programmable Read-Only Memory (Electrically EPROM, EEPROM for short) or flash memory.
易失性存储器可以是随机存取存储器(Random Access Memory,简称RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,简称SRAM)、动态随机存取存储器(Dynamic RAM,简称DRAM)、同步动态随机存取存储器(Synchronous DRAM,简称SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data RateSDRAM,简称DDRSDRAM)、增强型同步动态随机存取存储器(EnhancedSDRAM,简称ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,简称SLDRAM)和直接内存总线随机存取存储器(DirectRambus RAM,简称DRRAM)。The volatile memory may be a random access memory (Random Access Memory, RAM for short), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic RAM (DRAM), Synchronous DRAM, referred to as SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, referred to as DDRSDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, referred to as ESDRAM), synchronous connection dynamic random access memory (Synchlink DRAM) , referred to as SLDRAM) and direct memory bus random access memory (DirectRambus RAM, referred to as DRRAM).
本发明实施例描述的存储介质旨在包括但不限于这些和任意其它适合类型的存储器。The storage medium described in the embodiments of the present invention is intended to include, but not limited to, these and any other suitable types of memory.
本领域技术人员应该可以意识到,在上述一个或多个示例中,本发明所描述的功能可以用硬件与软件组合来实现。当应用软件时,可以将相应功能存储在计算机可读介质中或者作为计算机可读介质上的一个或多个指令或代码进行传输。计算机可读介质包括计算机存储介质和通信介质,其中通信介质包括便于从一个地方向另一个地方传送计算机程序的任何介质。存储介质可以是通用或专用计算机能够存取的任何可用介质。Those skilled in the art should appreciate that, in one or more of the above examples, the functions described in the present invention may be implemented by a combination of hardware and software. When the software is applied, the corresponding functions may be stored in or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage medium can be any available medium that can be accessed by a general purpose or special purpose computer.
以上的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本发明的保护范围之内。The above specific embodiments further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific embodiments of the present invention, and are not intended to limit the protection scope of the present invention. On the basis of the technical solutions of the present invention, any modifications, equivalent replacements, improvements, etc. made shall be included within the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010466128.2A CN111754574A (en) | 2020-05-28 | 2020-05-28 | Distance testing method, device, system and storage medium based on binocular camera |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010466128.2A CN111754574A (en) | 2020-05-28 | 2020-05-28 | Distance testing method, device, system and storage medium based on binocular camera |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111754574A true CN111754574A (en) | 2020-10-09 |
Family
ID=72673643
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010466128.2A Pending CN111754574A (en) | 2020-05-28 | 2020-05-28 | Distance testing method, device, system and storage medium based on binocular camera |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111754574A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113959398A (en) * | 2021-10-09 | 2022-01-21 | 广东汇天航空航天科技有限公司 | Vision-based distance measurement method and device, travelable equipment and storage medium |
CN114463388A (en) * | 2022-04-13 | 2022-05-10 | 北京中科慧眼科技有限公司 | Binocular camera-based height limiting device detection method and system and intelligent terminal |
CN117372494A (en) * | 2023-08-07 | 2024-01-09 | 合肥工业大学 | Power grid operator parallax estimation and positioning method based on single-binocular vision cooperation |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102298818A (en) * | 2011-08-18 | 2011-12-28 | 中国科学技术大学 | Binocular shooting fire detecting and positioning device and fire positioning method thereof |
US20150279022A1 (en) * | 2014-03-31 | 2015-10-01 | Empire Technology Development Llc | Visualization of Spatial and Other Relationships |
CN110926408A (en) * | 2019-12-04 | 2020-03-27 | 北京中科慧眼科技有限公司 | Short-distance measuring method, device and system based on characteristic object and storage medium |
-
2020
- 2020-05-28 CN CN202010466128.2A patent/CN111754574A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102298818A (en) * | 2011-08-18 | 2011-12-28 | 中国科学技术大学 | Binocular shooting fire detecting and positioning device and fire positioning method thereof |
US20150279022A1 (en) * | 2014-03-31 | 2015-10-01 | Empire Technology Development Llc | Visualization of Spatial and Other Relationships |
CN110926408A (en) * | 2019-12-04 | 2020-03-27 | 北京中科慧眼科技有限公司 | Short-distance measuring method, device and system based on characteristic object and storage medium |
Non-Patent Citations (1)
Title |
---|
曹文君 等: "一种单双目结合的全景避障测距方法", 现代电子技术, vol. 40, no. 5, pages 38 - 41 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113959398A (en) * | 2021-10-09 | 2022-01-21 | 广东汇天航空航天科技有限公司 | Vision-based distance measurement method and device, travelable equipment and storage medium |
CN113959398B (en) * | 2021-10-09 | 2024-04-12 | 广东汇天航空航天科技有限公司 | Distance measurement method and device based on vision, drivable equipment and storage medium |
CN114463388A (en) * | 2022-04-13 | 2022-05-10 | 北京中科慧眼科技有限公司 | Binocular camera-based height limiting device detection method and system and intelligent terminal |
CN117372494A (en) * | 2023-08-07 | 2024-01-09 | 合肥工业大学 | Power grid operator parallax estimation and positioning method based on single-binocular vision cooperation |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112906449B (en) | Road surface pothole detection method, system and equipment based on dense disparity map | |
CN109035309B (en) | Stereoscopic vision-based pose registration method between binocular camera and laser radar | |
WO2019184885A1 (en) | Method, apparatus and electronic device for calibrating extrinsic parameters of camera | |
US10909395B2 (en) | Object detection apparatus | |
CN103065323B (en) | Subsection space aligning method based on homography transformational matrix | |
CN111754574A (en) | Distance testing method, device, system and storage medium based on binocular camera | |
CN113792707A (en) | Terrain environment detection method and system based on binocular stereo camera and intelligent terminal | |
US12183026B2 (en) | Method and system for detecting long-distance target through binocular camera, and intelligent terminal | |
CN111178150B (en) | Lane marking detection method, system and storage medium | |
CN110334678A (en) | A Pedestrian Detection Method Based on Vision Fusion | |
WO2022183685A1 (en) | Target detection method, electronic medium and computer storage medium | |
CN113205604A (en) | Feasible region detection method based on camera and laser radar | |
CN111160232B (en) | Front face reconstruction method, device and system | |
CN105286871A (en) | Video processing-based body height measurement method | |
CN110779491A (en) | Method, device and equipment for measuring distance of target on horizontal plane and storage medium | |
CN110926408A (en) | Short-distance measuring method, device and system based on characteristic object and storage medium | |
CN113965742B (en) | Dense disparity map extraction method and system based on multi-sensor fusion and intelligent terminal | |
CN112465831B (en) | Bend scene sensing method, system and device based on binocular stereo camera | |
CN114495043B (en) | Method and system for detecting up-and-down slope road conditions based on binocular vision system and intelligent terminal | |
CN114494200B (en) | Method and device for measuring rotation angle of trailer | |
US12229979B2 (en) | Real-time ground fusion method and system based on binocular stereo vision, and intelligent terminal | |
CN111382591B (en) | Binocular camera ranging correction method and vehicle-mounted equipment | |
JP2023021087A (en) | Binocular image matching method, apparatus, device, and storage medium | |
CN113140002B (en) | Road condition detection method and system based on binocular stereo camera and intelligent terminal | |
CN111798507A (en) | Power transmission line safety distance measuring method, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201009 |