CN111780716A - A monocular real-time ranging method based on target pixel area and aspect ratio - Google Patents

A monocular real-time ranging method based on target pixel area and aspect ratio Download PDF

Info

Publication number
CN111780716A
CN111780716A CN202010629609.0A CN202010629609A CN111780716A CN 111780716 A CN111780716 A CN 111780716A CN 202010629609 A CN202010629609 A CN 202010629609A CN 111780716 A CN111780716 A CN 111780716A
Authority
CN
China
Prior art keywords
target
aspect ratio
ranging
real
camera
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010629609.0A
Other languages
Chinese (zh)
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.)
Hangzhou Dianzi University
Original Assignee
Hangzhou Dianzi University
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 Hangzhou Dianzi University filed Critical Hangzhou Dianzi University
Priority to CN202010629609.0A priority Critical patent/CN111780716A/en
Publication of CN111780716A publication Critical patent/CN111780716A/en
Pending legal-status Critical Current

Links

Images

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
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01CMEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
    • G01C11/00Photogrammetry or videogrammetry, e.g. stereogrammetry; Photographic surveying
    • G01C11/02Picture taking arrangements specially adapted for photogrammetry or photographic surveying, e.g. controlling overlapping of pictures

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Electromagnetism (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)
  • Measurement Of Optical Distance (AREA)

Abstract

本发明涉及一种基于目标像素面积和宽高比的单目实时测距方法。本发明方法包含四部分的内容:采用ssd模型实现目标的检测处理,实现较为准确的框定;对相机进行参数标定,获取相机的内部参数和图像分辨率,基于目标检测的宽和高,求目标物的像素面积和宽高比值;通过目标检测的像素面积与距离的关系和特定目标像素宽高比的特性,实现多角度不同距离下的单目测距;由于目标检测的不稳定,在实时测距过程中引入卡尔曼滤波,实时测距的稳定性。本发明针对不同角度成像不同以及实时目标检测的不稳定,提出基于目标像素面积和宽高比的测距方法,并引入卡尔曼滤波方法,提高了多角度测距的适用性,从而提高了实时移动目标测距的稳定性。

Figure 202010629609

The invention relates to a monocular real-time ranging method based on target pixel area and aspect ratio. The method of the invention includes four parts: adopting the ssd model to realize the detection and processing of the target to achieve more accurate framing; calibrating the parameters of the camera to obtain the internal parameters and image resolution of the camera, and finding the target based on the detected width and height of the target. The pixel area and aspect ratio of the object; through the relationship between the pixel area and the distance detected by the target and the characteristics of the specific target pixel aspect ratio, monocular ranging at multiple angles and different distances is realized; due to the instability of target detection, in real time Kalman filter is introduced in the ranging process to stabilize the real-time ranging. Aiming at the difference of imaging at different angles and the instability of real-time target detection, the invention proposes a ranging method based on the target pixel area and aspect ratio, and introduces a Kalman filtering method to improve the applicability of multi-angle ranging, thereby improving the real-time Stability of moving target ranging.

Figure 202010629609

Description

一种基于目标像素面积和宽高比的单目实时测距方法A monocular real-time ranging method based on target pixel area and aspect ratio

技术领域technical field

本发明涉及图像处理和测距领域,特别涉及一种基于目标像素面积和宽高比的单目实时测距方法。The present invention relates to the field of image processing and ranging, in particular to a monocular real-time ranging method based on target pixel area and aspect ratio.

背景技术Background technique

在人力不能直接进行工作的地方,如高温、高福射作业等危险地方以及太空宇宙等遥远的地方,使用图像采集设备进行远距离、非接触测距系统可以对这些复杂环境进行监控以及做出相应的工作指示。通过计算机技术使研究对象和相关环境建立一种联系,为用户工作提供相应参考。目前,视觉测距的应用主要为机器人手臂抓取、定位、工业机器人检测、航空测绘、智能监控交通、反求工程、目标识别、军事运用、医学成像等领域。In places where manpower cannot directly work, such as dangerous places such as high temperature and high radiation operations, and distant places such as space and space, the use of image acquisition equipment for long-distance, non-contact ranging systems can monitor these complex environments and make corresponding work instructions. Through computer technology, a connection between the research object and the relevant environment is established, and the corresponding reference is provided for the user's work. At present, the applications of visual ranging are mainly in the fields of robot arm grasping, positioning, industrial robot detection, aerial surveying and mapping, intelligent monitoring of traffic, reverse engineering, target recognition, military application, medical imaging and other fields.

测距技术在国内外都一直处于快速发展阶段,尤其在对测距系统实时性、稳定性及精确度的高标准要求下,国内外相关人员积极研究视觉测距这一门技术。目前,在图像距离测量上,各种各样数字图像快速处理算法不断的提出与改进。测距方法主要包括:激光测距、超声波测距、雷达测距以及计算机视觉测距。Ranging technology has been in a rapid development stage at home and abroad, especially under the high standard requirements for real-time, stability and accuracy of the ranging system, relevant personnel at home and abroad are actively studying the technology of visual ranging. At present, in image distance measurement, various digital image fast processing algorithms are continuously proposed and improved. Ranging methods mainly include: laser ranging, ultrasonic ranging, radar ranging and computer vision ranging.

激光测距法是一种在特定场合应用的高精度测距方式。激光测距由于光的波长短,光速快,因此对器件和信号处理技术的要求很高。在实际应用中主要利用计数原理和相位原理来实现距离测量计数原理测距工作原理简单,但对计数器的依赖性大,容易导致误差产生;利用相位原理测距可以方便地控制误差,但信号处理过程复杂。因而,激光测距受成本及可靠性限制。Laser ranging method is a high-precision ranging method applied in specific occasions. Due to the short wavelength of light and the fast speed of light, laser ranging has high requirements on devices and signal processing technology. In practical applications, the counting principle and the phase principle are mainly used to realize distance measurement. The counting principle is simple in working principle, but it relies heavily on the counter, which is easy to cause errors. Using the phase principle to measure distance can easily control the error, but signal processing The process is complicated. Therefore, laser ranging is limited by cost and reliability.

超声波测距是一种比较成熟的测距方法,该方法成本低,工作原理简单。超声波是一种主动能量,在传输过程中必然会衰减,其衰减程度与传播距离的平方成正比。即有传播距离越远,反射回来的声波信号越弱,测量误差也就越大。因此,该方法的最佳测距范围为5-10m,测量范围的限制使它的应用场合大大减小。Ultrasonic ranging is a relatively mature ranging method with low cost and simple working principle. Ultrasound is a kind of active energy, and it will be attenuated during the transmission process, and its attenuation degree is proportional to the square of the propagation distance. That is, the longer the propagation distance, the weaker the reflected sound wave signal, and the greater the measurement error. Therefore, the optimal distance measurement range of this method is 5-10m, and the limitation of measurement range greatly reduces its application.

雷达测距是一种具有高精度,受距离、气候条件影响非常小的测距方法。只要被测目标可以反射雷达波即可对距离进行测量。需要注意的是,利用雷达测距时,因为测距装置间相互干扰非常严重,因此不能同时在多个雷达测量环境下使用。此外,还应注意雷达其他通信系统之间的电磁干扰。Radar ranging is a high-precision ranging method that is very little affected by distance and climatic conditions. Distance can be measured as long as the target under test can reflect radar waves. It should be noted that when using radar ranging, because the mutual interference between ranging devices is very serious, it cannot be used in multiple radar measurement environments at the same time. In addition, electromagnetic interference between other communication systems of the radar should also be noted.

计算机视觉测距是一种通过摄像机采集图像后利用计算机对图像进行分析处理,根据相关测距原理求出摄像机与被测目标之间的距离。该方法是一种被动的测距方法,测量设备只需拍摄一幅包含被测目标的图像,而不是向被测物发射检测信号。因此,计算机机器视觉测距主要有测量成本低、测距原理简单、测量不受外界环境影响以及可以在复杂有害环境下应用等优点.Computer vision ranging is a method that uses a computer to analyze and process the image after collecting the image by the camera, and obtain the distance between the camera and the measured target according to the relevant ranging principle. This method is a passive ranging method, and the measuring equipment only needs to take an image containing the measured object, instead of transmitting a detection signal to the measured object. Therefore, computer machine vision ranging mainly has the advantages of low measurement cost, simple ranging principle, measurement unaffected by external environment, and application in complex and harmful environments.

根据使用的视觉成像设备数量的不同,视觉测量方法可以分为单目视觉测量方法、双目视觉测量方法(立体视觉)和多目视觉测量方法(全方位视觉)。由于受到安装平台、场地以及价钱等实际因素影响,单目视觉的实际应用比例远大于双目和多目测距。单目视觉测量方法就是仅利用一台视觉成像设备采集图像,对目标的几何尺寸、目标在空间的位置、姿态等信息进行测量的方法,但是由于单目视觉信息获取不全面,目标的角度在实际运动中变化较多。因此,一直期望能够用单目摄像头对目标较为准确的测距,在目标与相机角度发生变化的条件下,也能有不错的效果。Depending on the number of visual imaging devices used, vision measurement methods can be divided into monocular vision measurement methods, binocular vision measurement methods (stereoscopic vision), and polyocular vision measurement methods (omnidirectional vision). Due to the actual factors such as installation platform, site and price, the actual application ratio of monocular vision is much larger than that of binocular and multi-eye ranging. The monocular vision measurement method is to use only one visual imaging device to collect images and measure the geometric size of the target, the position and attitude of the target in space, etc. However, due to the incomplete acquisition of monocular visual information, the angle of the target is There are many changes in the actual movement. Therefore, it has always been expected that the monocular camera can be used to measure the distance of the target more accurately, and it can also have good results under the condition that the angle between the target and the camera changes.

发明内容SUMMARY OF THE INVENTION

针对现有技术的不足,本发明提供了一种基于目标像素面积和宽高比的单目实时测距方法。In view of the deficiencies of the prior art, the present invention provides a monocular real-time ranging method based on target pixel area and aspect ratio.

本发明进行三部分优化:The present invention carries out three-part optimization:

(1)采用目标像素面积大小来表示目标和相机间的距离关系(1) The size of the target pixel area is used to represent the distance relationship between the target and the camera

针对以往测距一般只依靠目标的像素宽或者高,来表示和距离的关系。可能在目标检测中宽高出现波动问题,采用像素宽高面积来取代单纯的像素宽或者高的方法,在一定程度上提高了测距的稳定性。In the past, ranging generally only relies on the pixel width or height of the target to express the relationship with the distance. There may be fluctuations in width and height in target detection. The pixel width and height area is used to replace the simple pixel width or height method, which improves the stability of ranging to a certain extent.

(2)采用目标检测宽高比来减小视角变化的影响(2) Use the target detection aspect ratio to reduce the influence of viewing angle changes

采用某类固定的目标,其正面角度的检测平均宽高和宽高比是固定的,以正面视角宽高比为基准,当摄像机和目标的视角发生变换时,根据宽高比的变换,推导正面的像素面积,进而达到测距效果。Using a certain type of fixed target, the average aspect ratio and aspect ratio of the frontal angle detection are fixed, and the frontal viewing angle aspect ratio is used as the benchmark. When the viewing angle of the camera and the target is changed, it is derived according to the transformation of the aspect ratio. The pixel area on the front, and then achieve the effect of ranging.

(3)采用卡尔曼滤波处理减小实时测距波动(3) Kalman filtering is used to reduce the fluctuation of real-time ranging

卡尔曼滤波不要求信号和噪声都是平稳过程的假设条件。对于每个时刻的系统扰动和观测误差(即噪声),只要对它们的统计性质做某些适当的假定,通过对含有噪声的观测信号进行处理,就能在平均的意义上,求得误差为最小的真实信号的估计值。因此,自从卡尔曼滤波理论问世以来,在通信系统、电力系统、航空航天、环境污染控制、工业控制、雷达信号处理等许多部门都得到了应用,取得了许多成功应用的成果。例如在图像处理方面,应用卡尔曼滤波对由于某些噪声影响而造成模糊的图像进行复原。在对噪声做了某些统计性质的假定后,就可以用卡尔曼的算法以递推的方式从模糊图像中得到均方差最小的真实图像,使模糊的图像得到复原。由于目标检测每帧之间有波动,会产生测距的误差,采用卡尔曼滤波处理方法,减小帧与帧之间的检测误差,提高实时测距系统的整体稳定性。Kalman filtering does not require the assumption that both signal and noise are stationary processes. For the system disturbance and observation error (that is, noise) at each moment, as long as some appropriate assumptions are made about their statistical properties, and by processing the observation signal containing noise, the error can be obtained in the average sense as The smallest estimate of the true signal. Therefore, since the advent of Kalman filter theory, it has been applied in communication systems, power systems, aerospace, environmental pollution control, industrial control, radar signal processing and many other departments, and achieved many successful application results. For example, in image processing, Kalman filtering is applied to restore blurred images due to some noise. After making some statistical assumptions about the noise, Kalman's algorithm can be used to get the real image with the smallest mean square error from the blurred image in a recursive way, so that the blurred image can be restored. Due to the fluctuation between each frame of target detection, ranging error will occur. Kalman filtering is used to reduce the detection error between frames and improve the overall stability of the real-time ranging system.

本发明方法的具体步骤是:The concrete steps of the inventive method are:

步骤1:采用ssd模型实现目标的检测处理,实现较为准确的框定。Step 1: Use the ssd model to detect the target and achieve a more accurate framing.

步骤2:对相机进行参数标定,获取相机的内部参数,基于目标检测的宽和高,获得目标正面角度的像素面积和宽高比。Step 2: Perform parameter calibration on the camera, obtain the internal parameters of the camera, and obtain the pixel area and aspect ratio of the frontal angle of the target based on the width and height of the target detection.

步骤3:通过目标检测的像素面积与距离的关系和目标像素宽高比的特性,实现多角度不同距离下的单目测距。Step 3: Through the relationship between the pixel area and the distance detected by the target and the characteristics of the target pixel aspect ratio, monocular ranging at different angles and distances is realized.

步骤4:在实时测距中引入卡尔曼滤波,用于减小每帧之间目标检测的误差,进而提高实时测距的稳定性。Step 4: Kalman filter is introduced in real-time ranging to reduce the error of target detection between each frame, thereby improving the stability of real-time ranging.

本发明的有益效果:本发明针对不同角度成像不同以及实时目标检测的不稳定,提出基于目标像素面积和宽高比的测距方法,并引入卡尔曼滤波方法,提高了多角度测距的适用性,从而提高了实时移动目标测距的稳定性。Beneficial effects of the present invention: Aiming at different imaging angles at different angles and the instability of real-time target detection, the present invention proposes a ranging method based on target pixel area and aspect ratio, and introduces a Kalman filtering method, which improves the applicability of multi-angle ranging Therefore, the stability of real-time moving target ranging is improved.

附图说明Description of drawings

图1是针孔成像模型结构图。Figure 1 is a structural diagram of the pinhole imaging model.

图2是基于目标检测的宽和高的选取示意图。FIG. 2 is a schematic diagram of the selection of width and height based on target detection.

图3是相机与目标角度变化的示意图。FIG. 3 is a schematic diagram of the angle change between the camera and the target.

图4是基于目标像素面积和宽高比的单目实时测距流程图。Figure 4 is a flow chart of monocular real-time ranging based on target pixel area and aspect ratio.

图5摄像头载体平台速度等于检测目标速度的滤波效果图。Figure 5 is a filter effect diagram of the camera carrier platform speed equal to the detection target speed.

图6摄像头载体平台速度小于检测目标速度的滤波效果图。Figure 6 is a filter effect diagram of the camera carrier platform speed being less than the detection target speed.

图7摄像头载体平台速度大于检测目标速度的滤波效果图。Figure 7 is a filter effect diagram of the camera carrier platform speed being greater than the detection target speed.

具体实施方式Detailed ways

下面对照附图并结合优选的实施方式对本发明作进一步说明。The present invention will be further described below with reference to the accompanying drawings and in conjunction with the preferred embodiments.

步骤1:采用ssd模型实现目标检测,ssd的网络模型最开始部分是VGG-16,称作为基础网络。SSD在VGG-16网络后,增加了分辨率逐层递减的卷积特征图,这些特征图具有不同的感受,因此SSD能够进行多尺度的目标检测,即利用高分辨率的特征图检测图像中的小目标,利用低分辨率的特征图检测图像中的大目标。这种方法主要有两个优点:一、在高分辨率特征图上通过重定位(relocating)类别(classification)和外边框回归能够更加精确地定位小目标;二、SSD不用先进行区域生成,这种多尺度处理不增加基础网络的计算量,因此它比Faster R-CNN这类需要进行区域生成的方法快得多。本次发明SSD模型在PASCALVOC2012数据集基础上进行训练,在测试测试集过程中(只显示置信度大于0.5的检测框),对于目标的检测框定比较准确。Step 1: Use the ssd model to achieve target detection. The initial part of the ssd network model is VGG-16, which is called the basic network. After the VGG-16 network, SSD adds convolutional feature maps with decreasing resolution layer by layer. These feature maps have different feelings, so SSD can perform multi-scale target detection, that is, use high-resolution feature maps to detect images. small objects, and use low-resolution feature maps to detect large objects in the image. This method has two main advantages: First, small objects can be more accurately located by relocating classification and outer border regression on high-resolution feature maps; second, SSD does not need to generate regions first, which This multi-scale processing does not increase the computational complexity of the underlying network, so it is much faster than methods such as Faster R-CNN that require region generation. The SSD model of this invention is trained on the basis of the PASCALVOC2012 data set. In the process of testing the test set (only the detection frame with a confidence greater than 0.5 is displayed), the detection frame of the target is relatively accurate.

步骤2:如图1和图2所示,本发明实施的基于单目摄像头像素面积方法包括以下步骤:Step 2: As shown in Figure 1 and Figure 2, the method based on the pixel area of a monocular camera implemented by the present invention includes the following steps:

S1:获取单目相机的内部参数;S1: Get the internal parameters of the monocular camera;

该步骤主要是对单目摄像头的焦距f进行相机标定(采用固定目标对相机进行标定),等间距变换固定目标和相机间的距离u,以获取单目摄像头的水平方向焦距fx以及竖直方向焦距值fy。在本实施例中,该单目摄像头可以是普通相机、手机等可以拍照的设备。This step is mainly to perform camera calibration on the focal length f of the monocular camera (using a fixed target to calibrate the camera), and transform the distance u between the fixed target and the camera at equal intervals to obtain the horizontal focal length f x and vertical direction of the monocular camera. Directional focal length value f y . In this embodiment, the monocular camera may be a device that can take pictures, such as a common camera, a mobile phone, and the like.

Figure BDA0002567995680000041
Figure BDA0002567995680000041

Figure BDA0002567995680000042
Figure BDA0002567995680000042

Figure BDA0002567995680000043
Figure BDA0002567995680000043

S2:拍摄目标正面角度不同距离u的图像,设X为目标正面的实际宽度,Y为目标正面的实际高度,xo为目标正面在图像中的像素宽,yo为目标正面在图像中的像素高,目标正面角度的像素面积so和相机的距离u的关系如下所示:S2: Shoot images with different distances u from the front of the target, let X be the actual width of the front of the target, Y be the actual height of the front of the target, x o is the pixel width of the front of the target in the image, and y o is the width of the front of the target in the image. The relationship between the pixel height, the pixel area s o of the frontal angle of the target and the distance u of the camera is as follows:

Figure BDA0002567995680000051
Figure BDA0002567995680000051

Figure BDA0002567995680000052
Figure BDA0002567995680000052

目标正面的像素宽高比ro如下所示:The pixel aspect ratio ro of the front of the target is as follows:

Figure BDA0002567995680000053
Figure BDA0002567995680000053

目标正面角度实际的宽高比R,以及ro与R的关系如下所示:The actual aspect ratio R of the frontal angle of the target, and the relationship between r o and R are as follows:

Figure BDA0002567995680000054
R=ro
Figure BDA0002567995680000054
R=r o

步骤3:如图3所示,本发明实施的基于单目摄像头像素宽高比的多角度测距算法如下所示:Step 3: As shown in FIG. 3, the multi-angle ranging algorithm based on the pixel aspect ratio of the monocular camera implemented by the present invention is as follows:

算法输入B=(x1,y1,x2,y2)表示目标检测左上角点(x1,y1)和右下角点(x2,y2),R表示目标正面角度实际的宽高比,算法输出u表示目标和相机的实际距离。The algorithm input B=(x 1 , y 1 , x 2 , y 2 ) represents the upper left corner point (x 1 , y 1 ) and the lower right corner point (x 2 , y 2 ) of the target detection, and R represents the actual width of the frontal angle of the target High ratio, the algorithm output u represents the actual distance between the target and the camera.

算法主要内容:计算目标的像素宽x=(x2-x1)和像素高y=(y2-y1),计算像素宽高比r=x/y,当像素宽高比r<(R-α)时,相机拍摄目标侧面视角,y与正面视角相比是不变的,x与正面视角相比是减小的,推导出基于正面视角的宽高比例yc=y和xc=yc*R;当像素宽高比r>(R+α)时,相机拍摄目标俯视视角,x与正面视角相比是不变的,y与正面视角相比是减小的,推导出基于正面视角的宽高比例xc=x和yc=xc/R;当处于正面视角时,xc=x和yc=y。最后根据像素面积和距离的计算公式计算出距离u。引入α为提高算法稳定,保证宽高比改变较小时,不会频繁触发前两步的操作。xc和yc为算法处理后用于正真测距的像素宽和高,具体算法的伪代码如下:The main content of the algorithm: calculate the pixel width x=(x 2 -x 1 ) and pixel height y=(y 2 -y 1 ) of the target, calculate the pixel aspect ratio r=x/y, when the pixel aspect ratio r<( R-α), the camera shoots the side view of the target, y is unchanged compared with the front view, x is reduced compared with the front view, and the aspect ratio based on the front view is derived y c =y and x c =y c *R; when the pixel aspect ratio r>(R+α), the top-view angle of the camera shooting target, x is unchanged compared with the frontal angle of view, y is reduced compared with the frontal angle of view, it is derived Aspect ratio x c =x and y c =x c /R based on frontal viewing angle; when in frontal viewing angle, x c =x and yc =y. Finally, the distance u is calculated according to the calculation formula of the pixel area and the distance. The introduction of α is to improve the stability of the algorithm and ensure that the operations of the first two steps will not be triggered frequently when the aspect ratio changes are small. x c and y c are the pixel width and height used for real ranging after the algorithm processing. The pseudo code of the specific algorithm is as follows:

Algorithm 1 Ranging algorithm based on the ratio of width to heightAlgorithm 1 Ranging algorithm based on the ratio of width to height

Input:Object box B=(x1,y1,x2,y2)Input:Object box B=(x 1 ,y 1 ,x 2 ,y 2 )

Ratio of width to height RRatio of width to height R

Output:Distance uOutput: Distance u

1:x=x2-x1 1 :x= x2 -x1

2:y=y2-y1 2: y=y 2 -y 1

3:r=x/y3:r=x/y

4:if r<(R-a)then4: if r<(R-a)then

yc=yy c = y

xc=yc×Rx c =y c ×R

5:else if r>(R+α)then5: else if r>(R+α)then

xc=xx c = x

yc=xc/Ry c =x c /R

6:else6: else

xc=xx c = x

yc=yy c = y

7:end if7: end if

Figure BDA0002567995680000061
Figure BDA0002567995680000061

步骤4:为提高视频实时测距的稳定性,采用卡尔曼滤波处理的方法,对于实时视频的处理,每两帧时间间隔比较小,可以认为目标在相邻帧间运动变化缓慢,近似为匀速运动,由动力学公式:Step 4: In order to improve the stability of video real-time ranging, the Kalman filter processing method is adopted. For real-time video processing, the time interval between every two frames is relatively small, and it can be considered that the target moves slowly between adjacent frames, which is approximately a uniform speed. Motion, by the kinetic formula:

xk=xk-1+vk-1Δt,vk=vk-1其中△t为两帧时间间隔。x k =x k-1 +v k-1 Δt, v k =v k-1 where Δt is the time interval of two frames.

系统为线性动态模型,系统状态方程:The system is a linear dynamic model, and the system state equation:

X(k)=AX(k-1)+G(k)X(k)=AX(k-1)+G(k)

式中

Figure BDA0002567995680000062
X(k)=(x1,y1,x2,y2)T;in the formula
Figure BDA0002567995680000062
X(k)=(x 1 , y 1 , x 2 , y 2 ) T ;

Δt视频两次检测的周期,G(k)表示速率变动,即过程的高斯白噪声。Δt is the period of two detections of the video, and G(k) represents the rate change, that is, the Gaussian white noise of the process.

系统测量值为:The system measurements are:

Y(k)=HkX(k)+C(k)Y(k)=H k X(k)+C(k)

H表示测量系统的参数,C(k)表示测量噪声。目标位置和相关联的误差协方差矩阵P使用卡尔曼滤波器预测:H represents the parameters of the measurement system, and C(k) represents the measurement noise. The target position and associated error covariance matrix P are predicted using a Kalman filter:

Figure BDA0002567995680000071
Figure BDA0002567995680000071

式中,Q是过程噪声的协方差。where Q is the covariance of the process noise.

结合预测值和测量值,可以得到现在状态k的最优化估算值为:Combining the predicted value and the measured value, the optimal estimate of the current state k can be obtained as:

Figure BDA0002567995680000072
Figure BDA0002567995680000072

并更新k状态下X(k|k)的误差协方差and update the error covariance of X(k|k) in k states

P(k|k)=P(k|k-1)-KkHkP(k|k-1)P(k|k)=P(k|k-1)-K k H k P(k|k-1)

式中,Kk为卡尔曼增益where K k is the Kalman gain

Figure BDA0002567995680000073
Figure BDA0002567995680000073

式中,Rk表示测量噪声的协方差,测量协方差的值较低时意味着在当前的测量值上具有更大的加权,此时跟踪系统的灵敏度更高。In the formula, R k represents the covariance of the measurement noise. When the value of the measurement covariance is lower, it means that there is a greater weight on the current measurement value, and the sensitivity of the tracking system is higher at this time.

以下为本发明的检测效果:The following is the detection effect of the present invention:

在图像像素640*480条件下,当摄像机与运动目标之间的距离在275~700cm范围内时,测量误差很小,一般小于5%,距离过大目标特征不明显检测不准确。Under the condition of 640*480 image pixels, when the distance between the camera and the moving target is in the range of 275-700cm, the measurement error is very small, generally less than 5%, and the target feature is not obvious if the distance is too large, and the detection is inaccurate.

编号Numbering 像素面积pixel area 实际距离(cm)Actual distance (cm) 计算距离(cm)Calculated distance (cm) 误差(%)error(%) 11 30854.7730854.77 275275 278.7278.7 1.351.35 22 26883.6126883.61 300300 298.6298.6 0.470.47 33 20284.8120284.81 325325 340.8340.8 4.624.62 44 17884.3117884.31 350350 366.1366.1 4.604.60 55 15963.7315963.73 375375 387.5387.5 3.333.33 66 15137.4515137.45 400400 398.0398.0 0.50.5 77 13006.4613006.46 425425 429.3429.3 1.011.01 88 11080.7811080.78 450450 465.1465.1 3.363.36 99 10291.5110291.51 475475 482.7482.7 1.621.62 1010 9760.079760.07 500500 495.6495.6 0.880.88 1111 9189.839189.83 525525 510.8510.8 2.702.70 1212 7877.287877.28 550550 551.7551.7 0.310.31 1313 7159.287159.28 575575 578.7578.7 0.640.64 1414 6451.966451.96 600600 609.6609.6 1.601.60 1515 6157.566157.56 625625 624.0624.0 0.160.16 1616 5807.325807.32 650650 642.5642.5 1.151.15 1717 5232.535232.53 675675 676.9676.9 0.280.28 1818 4882.894882.89 700700 700.7700.7 0.100.10

保持摄像机与目标之间的距离保持在2.6m。改变摄像机光轴与水平面的夹角10°—60°。基于宽高比的多角度测距误差小于5%。Keep the distance between the camera and the target at 2.6m. Change the angle between the optical axis of the camera and the horizontal plane by 10°-60°. The multi-angle ranging error based on aspect ratio is less than 5%.

角度angle 只基于面积based on area only 误差(%)error(%) 面积和比例Area and Proportion 误差(%)error(%) 1010 268.4268.4 3.233.23 267.9267.9 3.043.04 2020 268.0268.0 3.083.08 265.4265.4 2.082.08 3030 266.8266.8 2.622.62 260.5260.5 0.190.19 4040 273.1273.1 5.045.04 258.1258.1 0.730.73 5050 288.7288.7 11.0411.04 267.9267.9 3.043.04 6060 306.2306.2 17.7717.77 270.4270.4 4.004.00

结合图5、图6和图7引入卡尔曼滤波在载体平台速度与目标相同,载体平台速度小于目标和载体平台速度大于目标三种情况下,卡尔曼滤波处理后,明显提高实时测距的稳定性,三种情况下,滤波处理之后平均减小25.221%的波动。Combined with Fig. 5, Fig. 6 and Fig. 7, Kalman filter is introduced in three cases when the speed of the carrier platform is the same as that of the target, the speed of the carrier platform is smaller than the target and the speed of the carrier platform is greater than the target. After Kalman filtering processing, the stability of real-time ranging is obviously improved In the three cases, the fluctuation is reduced by an average of 25.221% after filtering.

Claims (3)

1. A monocular real-time distance measurement method based on target pixel area and aspect ratio is characterized by comprising the following steps:
the method comprises the following steps: the ssd model is adopted to realize the detection processing of the target, and more accurate framing is realized;
step two: calibrating the focal length of the camera, acquiring internal parameters of the camera, and acquiring the pixel area and the aspect ratio of the front angle of the target based on the width and the height of the target detection;
step three: the monocular distance measurement under different distances from multiple angles is realized by the relationship between the pixel area and the distance detected by a target and the characteristic of the aspect ratio of the target pixel, and specifically, the monocular distance measurement is as follows:
let the coordinate of the upper left corner point of the target be (x)1,y1) And the coordinate of the lower right corner point is (x)2,y2) R is the aspect ratio of the target front angle;
calculating the pixel width x ═ x of the target2-x1) And pixel height y ═ y (y)2-y1) Calculating the actual pixel aspect ratio r as x/y; when the pixel aspect ratio r<(R- α) when α is a threshold value set by experiment, the camera photographs the side view of the subject, y is constant as compared with the frontal view, and x is reduced as compared with the frontal view, and a width and a height y based on the frontal view are derivedcY and xc=yc*R;
When the pixel aspect ratio r>(R + α), the camera shoots the subjectFrom the top view, x is constant compared to the frontal view and y is reduced compared to the frontal view, deriving x based on the width and height of the frontal viewcX and yc=xc/R;
Threshold value set for alpha
When in frontal view, xcX and yc=y;
Finally, calculating the distance u according to a calculation formula of the pixel area and the distance;
step four: kalman filtering is introduced into the real-time distance measurement, so that the error of target detection between frames is reduced, and the stability of the real-time distance measurement is improved.
2. The monocular real-time ranging method of claim 1, wherein: based on a pinhole imaging model, shooting a front angle image of a target by adopting a fixed target and a distance u between equidistant transformation and cameras to obtain a camera focal length f:
Figure FDA0002567995670000011
wherein f isxIs the horizontal focal length of the monocular camera, fyIs the vertical focal length value of the monocular camera, X is the actual width of the front of the target, Y is the actual height of the front of the target, XoPixel width, y, of the front of the object in the imageoThe pixels in the image for the front of the object are high.
3. The monocular real-time ranging method of claim 2, wherein: the size of the object is represented by its pixel area, and the pixel area value s of the object is calculated using the following formulao
Figure FDA0002567995670000021
CN202010629609.0A 2020-07-03 2020-07-03 A monocular real-time ranging method based on target pixel area and aspect ratio Pending CN111780716A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010629609.0A CN111780716A (en) 2020-07-03 2020-07-03 A monocular real-time ranging method based on target pixel area and aspect ratio

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010629609.0A CN111780716A (en) 2020-07-03 2020-07-03 A monocular real-time ranging method based on target pixel area and aspect ratio

Publications (1)

Publication Number Publication Date
CN111780716A true CN111780716A (en) 2020-10-16

Family

ID=72759172

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010629609.0A Pending CN111780716A (en) 2020-07-03 2020-07-03 A monocular real-time ranging method based on target pixel area and aspect ratio

Country Status (1)

Country Link
CN (1) CN111780716A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112284330A (en) * 2020-11-18 2021-01-29 青岛科美创视智能科技有限公司 Distance measuring system and method based on fisheye camera
CN112489116A (en) * 2020-12-07 2021-03-12 青岛科美创视智能科技有限公司 Method and system for estimating target distance by using single camera
CN113865617A (en) * 2021-08-30 2021-12-31 中国人民解放军火箭军工程大学 Method for correcting matching accurate pose of rear view image of maneuvering launching active section of aircraft
CN114219767A (en) * 2021-11-24 2022-03-22 慧之安信息技术股份有限公司 Sheep flock counting management method based on Internet of things edge box
CN114755444A (en) * 2022-06-14 2022-07-15 天津所托瑞安汽车科技有限公司 Target speed measuring method, target speed measuring device, electronic apparatus, and storage medium
CN115578470A (en) * 2022-09-22 2023-01-06 虹软科技股份有限公司 Monocular vision positioning method and device, storage medium and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109318227A (en) * 2018-09-21 2019-02-12 厦门理工学院 A method of rolling dice based on humanoid robot and humanoid robot
CN109506628A (en) * 2018-11-29 2019-03-22 东北大学 Object distance measuring method under a kind of truck environment based on deep learning
CN111046843A (en) * 2019-12-27 2020-04-21 华南理工大学 A monocular ranging method in intelligent driving environment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109318227A (en) * 2018-09-21 2019-02-12 厦门理工学院 A method of rolling dice based on humanoid robot and humanoid robot
CN109506628A (en) * 2018-11-29 2019-03-22 东北大学 Object distance measuring method under a kind of truck environment based on deep learning
CN111046843A (en) * 2019-12-27 2020-04-21 华南理工大学 A monocular ranging method in intelligent driving environment

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112284330A (en) * 2020-11-18 2021-01-29 青岛科美创视智能科技有限公司 Distance measuring system and method based on fisheye camera
CN112489116A (en) * 2020-12-07 2021-03-12 青岛科美创视智能科技有限公司 Method and system for estimating target distance by using single camera
CN113865617A (en) * 2021-08-30 2021-12-31 中国人民解放军火箭军工程大学 Method for correcting matching accurate pose of rear view image of maneuvering launching active section of aircraft
CN114219767A (en) * 2021-11-24 2022-03-22 慧之安信息技术股份有限公司 Sheep flock counting management method based on Internet of things edge box
CN114755444A (en) * 2022-06-14 2022-07-15 天津所托瑞安汽车科技有限公司 Target speed measuring method, target speed measuring device, electronic apparatus, and storage medium
CN114755444B (en) * 2022-06-14 2022-10-21 天津所托瑞安汽车科技有限公司 Target speed measuring method, target speed measuring device, electronic apparatus, and storage medium
CN115578470A (en) * 2022-09-22 2023-01-06 虹软科技股份有限公司 Monocular vision positioning method and device, storage medium and electronic equipment
CN115578470B (en) * 2022-09-22 2024-06-07 虹软科技股份有限公司 Monocular vision positioning method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN111780716A (en) A monocular real-time ranging method based on target pixel area and aspect ratio
CN102798350B (en) Method, device and system for measuring deflection of arm support
US9501839B1 (en) Methods and systems for detecting moving objects in a sequence of image frames produced by sensors with inconsistent gain, offset, and dead pixels
CN105547635B (en) A kind of contactless structural dynamic response measurement method for wind tunnel test
CN111385558B (en) TOF camera module accuracy measurement method and system
CN112880642A (en) Distance measuring system and distance measuring method
CN107861920B (en) Point cloud data registration method
CN106503605A (en) Human body target recognition methods based on stereovision technique
Fasiolo et al. Comparing LiDAR and IMU-based SLAM approaches for 3D robotic mapping
CN107084680A (en) Target depth measuring method based on machine monocular vision
CN106249267A (en) Target positioning and tracking method and device
CN108596117B (en) A scene monitoring method based on two-dimensional laser rangefinder array
CN115717867A (en) Bridge deformation measurement method based on airborne double cameras and target tracking
CN115824170A (en) A Method of Fusion of Photogrammetry and LiDAR to Measure Ocean Waves
CN117075099A (en) Three-dimensional deformation measurement method, three-dimensional deformation measurement device, computer equipment and medium
Jiang et al. Bridge Deformation Measurement Using Unmanned Aerial Dual Camera and Learning‐Based Tracking Method
CN104713478B (en) A kind of linear motor rotor location measurement method
CN115049784B (en) Three-dimensional velocity field reconstruction method based on binocular particle image
Wang et al. The human-height measurement scheme by using image processing techniques
Zhou et al. A new algorithm for the establishing data association between a camera and a 2-D LIDAR
CN107945166B (en) Binocular vision-based method for measuring three-dimensional vibration track of object to be measured
CN102798380A (en) Method for measuring motion parameters of target in linear array image
Su et al. Obtaining obstacle information by an omnidirectional stereo vision system
CN105717502B (en) A kind of high-rate laser range unit based on line array CCD
CN205300519U (en) Iron tower warp measuring device

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20201016