CN103716579A - Video monitoring method and system - Google Patents
Video monitoring method and system Download PDFInfo
- Publication number
- CN103716579A CN103716579A CN201210370526.XA CN201210370526A CN103716579A CN 103716579 A CN103716579 A CN 103716579A CN 201210370526 A CN201210370526 A CN 201210370526A CN 103716579 A CN103716579 A CN 103716579A
- Authority
- CN
- China
- Prior art keywords
- sport foreground
- coordinate
- picture frame
- dimensional space
- foreground
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Image Processing (AREA)
- Image Analysis (AREA)
Abstract
一种视频监控方法:采集多个摄像头的图像帧,根据所述图像帧提取运动前景;获取所述运动前景在所述图像帧中的像素坐标;根据所述像素坐标、多个摄像头的焦距和空间距离计算所述运动前景的三维空间坐标;根据所述三维空间坐标触发所述运动前景的异常事件。此外,还提供了一种视频监控系统。上述视频监控方法和系统能够提高异常事件触发的准确度,从而提高了安全性。
A video monitoring method: collecting image frames of multiple cameras, extracting moving foreground according to the image frames; obtaining pixel coordinates of the moving foreground in the image frames; according to the pixel coordinates, the focal lengths and The spatial distance is used to calculate the three-dimensional space coordinates of the moving foreground; an abnormal event of the moving foreground is triggered according to the three-dimensional space coordinates. In addition, a video monitoring system is also provided. The above video monitoring method and system can improve the accuracy of abnormal event triggering, thereby improving security.
Description
技术领域 technical field
本发明涉及图像处理技术领域,特别是涉及一种视频监控方法及系统。The invention relates to the technical field of image processing, in particular to a video monitoring method and system.
背景技术 Background technique
传统技术中的视频监控方法,通常预先在监控现场设置摄像头,通过该摄像头采集监控现场的视频数据,视频数据通常为连续的图像帧的形式。图像帧包括背景和运动前景,运动前景即图像帧中像素发生变化的区域。例如,当一个行人从监控现场经过时,获取到的连续的图像帧中行人占据的运动的区域即为运动前景,而相对静止的监控现场则为图像帧的背景部分。In the traditional video monitoring method, a camera is usually set in advance at the monitoring site, and the video data of the monitoring site is collected through the camera, and the video data is usually in the form of continuous image frames. The image frame includes a background and a moving foreground, and the moving foreground is an area where pixels in the image frame change. For example, when a pedestrian passes by the monitoring scene, the moving area occupied by the pedestrian in the acquired continuous image frames is the moving foreground, while the relatively static monitoring scene is the background part of the image frame.
传统技术中,通常先提取图像帧的运动前景,然后检测提取到的运动前景是否进入预先划定的危险区域中,从而判断是否有异常情况发生并发出相应的警报。In the traditional technology, the moving foreground of the image frame is usually extracted first, and then it is detected whether the extracted moving foreground enters a pre-defined dangerous area, so as to judge whether there is an abnormal situation and issue a corresponding alarm.
然而,传统技术中的视频监控方法,通过摄像头得到的图像帧只能反映监控现场的平面信息,当运动前景在摄像头焦距方向上轴向运动时,无法判断其是否进入危险区域,使得监控时会遗漏部分异常情况而发出警报报警,从而降低了安全性。However, in the video surveillance method in traditional technology, the image frame obtained by the camera can only reflect the plane information of the surveillance scene. When the moving foreground moves axially in the focal length direction of the camera, it is impossible to judge whether it enters the dangerous area, which makes the monitoring process difficult. Omit some abnormal conditions and send out alarms, thereby reducing safety.
发明内容 Contents of the invention
基于此,有必要提供一种能提高安全性的视频监控方法。Based on this, it is necessary to provide a video monitoring method that can improve security.
一种视频监控方法,包括:A video surveillance method, comprising:
采集多个摄像头的图像帧,根据所述图像帧提取运动前景;Collect image frames of multiple cameras, and extract moving foreground according to the image frames;
获取所述运动前景在所述图像帧中的像素坐标;Obtaining the pixel coordinates of the moving foreground in the image frame;
根据所述像素坐标、多个摄像头的焦距和空间距离计算所述运动前景的三维空间坐标;calculating the three-dimensional spatial coordinates of the moving foreground according to the pixel coordinates, focal lengths and spatial distances of multiple cameras;
根据所述三维空间坐标触发所述运动前景的异常事件。An abnormal event of the moving foreground is triggered according to the three-dimensional space coordinates.
在其中一个实施例中,所述根据所述图像帧提取运动前景的步骤为:In one of the embodiments, the step of extracting the moving foreground according to the image frame is:
根据混合高斯模型通过背景差分提取所述图像帧的运动前景。The moving foreground of the image frame is extracted by background difference according to the mixed Gaussian model.
在其中一个实施例中,所述摄像头的数量为2个,且水平设置;In one of the embodiments, the number of the cameras is 2, and they are arranged horizontally;
所述获取到的图像帧为同一时间由所述2个摄像头分别采集的左图像帧和右图像帧;The acquired image frames are left image frames and right image frames collected respectively by the two cameras at the same time;
所述根据所述像素坐标、多个摄像头的焦距和空间距离计算所述运动前景的三维空间坐标的步骤为:The step of calculating the three-dimensional spatial coordinates of the moving foreground according to the pixel coordinates, the focal length and the spatial distance of multiple cameras is:
根据公式:According to the formula:
Disparity=Xleft-Xright Disparity=X left -X right
计算所述左图像帧和右图像帧的视察,其中,Disparity为视差,Xleft为运动前景在所述左图像帧中的水平坐标,Xright为运动前景在所述右图像帧中的水平坐标;Calculate the observation of the left image frame and the right image frame, wherein Disparity is a parallax, X left is the horizontal coordinate of the moving foreground in the left image frame, and X right is the horizontal coordinate of the moving foreground in the right image frame ;
根据公式:According to the formula:
计算所述运动前景的三维空间坐标;其中,(xc,yc,zc)即为所述运动前景的三维空间坐标,且xc和yc为可视平面坐标,zc为深度信息,B为所述两个摄像头之间的水平距离,f为所述摄像头的焦距,Y为运动前景在所述左图像帧和所述右图像帧中得垂直坐标,Disparity为左图像帧和右图像帧的视差。Calculate the three-dimensional space coordinates of the moving foreground; where (x c , y c , z c ) are the three-dimensional space coordinates of the moving foreground, and x c and y c are visual plane coordinates, and z c is depth information , B is the horizontal distance between the two cameras, f is the focal length of the camera, Y is the vertical coordinate of the moving foreground in the left image frame and the right image frame, Disparity is the left image frame and the right image frame The disparity of the image frame.
在其中一个实施例中,所述根据所述三维空间坐标触发所述运动前景的异常事件的步骤为:In one of the embodiments, the step of triggering the abnormal event of the moving foreground according to the three-dimensional space coordinates is:
判断所述三维空间坐标是否位于预设的危险区域,若是,则触发所述运动前景的异常事件。Judging whether the three-dimensional space coordinates are located in a preset dangerous area, and if so, triggering an abnormal event of the moving foreground.
在其中一个实施例中,所述判断所述三维空间坐标是否位于预设的危险区域的步骤为:In one of the embodiments, the step of judging whether the three-dimensional space coordinates are located in a preset dangerous area is as follows:
获取所述图像帧对应的深度图像,所述深度图像为灰度图,其像素点的坐标对应三维空间坐标的可视平面坐标,其灰度值对应三维空间坐标的深度信息;Acquiring the depth image corresponding to the image frame, the depth image is a gray scale image, the coordinates of its pixel points correspond to the visual plane coordinates of the three-dimensional space coordinates, and its gray value corresponds to the depth information of the three-dimensional space coordinates;
通过所述深度图像判断所述三维空间坐标是否位于预设的危险区域。Whether the three-dimensional space coordinates are located in a preset dangerous area is judged through the depth image.
在其中一个实施例中,所述触发所述运动前景的异常事件的步骤之前还包括:In one of the embodiments, before the step of triggering the abnormal event of the moving foreground, the step further includes:
根据所述深度信息判断所述运动前景是否为人体手势图像,若是,则继续执行所述触发所述运动前景的异常事件的步骤。Judging whether the moving foreground is a human body gesture image according to the depth information, and if so, continue to execute the step of triggering the abnormal event of the moving foreground.
在其中一个实施例中,所述根据所述深度信息判断所述运动前景是否为人体手势图像的步骤为:In one of the embodiments, the step of judging whether the moving foreground is a human body gesture image according to the depth information is:
根据公式:According to the formula:
计算所述运动前景的深度值,其中d(I,c)即为深度图像I中坐标c处像素点的深度值,u和v为在阈值范围内随机选取的任意两点的坐标,z为运动前景上的深度信息;Calculate the depth value of the moving foreground, wherein d (I, c) is the depth value of the pixel at coordinate c in the depth image I, u and v are the coordinates of any two points randomly selected within the threshold range, and z is Depth information on the motion foreground;
获取预设的人体手势图像的训练分类器;Obtain a training classifier for preset human gesture images;
根据所述运动前景的深度值以及所述训练分类器通过决策树判断所述运动前景是否为人体手势图像。According to the depth value of the moving foreground and the training classifier, it is judged whether the moving foreground is a human gesture image through a decision tree.
此外,还有必要提供一种能提高安全性的视频监控系统。In addition, it is also necessary to provide a video surveillance system that can improve security.
一种视频监控系统,包括:A video surveillance system comprising:
多目摄像头,用于采集图像帧;Multi-eye camera for collecting image frames;
运动前景提取装置,用于根据所述图像帧提取运动前景;A moving foreground extracting device, configured to extract a moving foreground according to the image frame;
坐标换算装置,用于获取所述运动前景在所述图像帧中的像素坐标,根据所述像素坐标、多目摄像头的焦距和空间距离计算所述运动前景的三维空间坐标;A coordinate conversion device, configured to obtain the pixel coordinates of the moving foreground in the image frame, and calculate the three-dimensional space coordinates of the moving foreground according to the pixel coordinates, the focal length and the spatial distance of the multi-eye camera;
异常事件触发装置,用于根据所述三维空间坐标触发所述运动前景的异常事件。An abnormal event triggering device, configured to trigger an abnormal event of the moving foreground according to the three-dimensional space coordinates.
在其中一个实施例中,所述运动前景提取装置还用于根据混合高斯模型通过背景差分提取所述图像帧的运动前景。In one of the embodiments, the moving foreground extracting device is further configured to extract the moving foreground of the image frame by background difference according to the mixed Gaussian model.
在其中一个实施例中,所述多目摄像头为水平设置的双目摄像头;In one of the embodiments, the multi-eye camera is a horizontally arranged binocular camera;
所述获取到的图像帧为同一时间由所述双目摄像头采集的左图像帧和右图像帧;The acquired image frame is a left image frame and a right image frame collected by the binocular camera at the same time;
所述坐标换算装置还用于根据公式:The coordinate conversion device is also used for according to the formula:
Disparity=Xleft-Xright Disparity=X left -X right
计算所述左图像帧和右图像帧的视察,其中,Disparity为视差,Xleft为运动前景在所述左图像帧中的水平坐标,Xright为运动前景在所述右图像帧中的水平坐标,并根据公式:Calculate the observation of the left image frame and the right image frame, wherein Disparity is a parallax, X left is the horizontal coordinate of the moving foreground in the left image frame, and X right is the horizontal coordinate of the moving foreground in the right image frame , and according to the formula:
计算所述运动前景的三维空间坐标;其中,(xc,yc,zc)即为所述运动前景的三维空间坐标,且xc和yc为可视平面坐标,zc为深度信息,B为所述两个摄像头之间的水平距离,f为所述摄像头的焦距,Y为运动前景在所述左图像帧和所述右图像帧中得垂直坐标,Disparity为左图像帧和右图像帧的视差。Calculate the three-dimensional space coordinates of the moving foreground; where (x c , y c , z c ) are the three-dimensional space coordinates of the moving foreground, and x c and y c are visual plane coordinates, and z c is depth information , B is the horizontal distance between the two cameras, f is the focal length of the camera, Y is the vertical coordinate of the moving foreground in the left image frame and the right image frame, Disparity is the left image frame and the right image frame The disparity of the image frame.
在其中一个实施例中,所述异常事件触发装置还用于判断所述三维空间坐标是否位于预设的危险区域,若是,则触发所述运动前景的异常事件。In one of the embodiments, the abnormal event triggering device is further used to judge whether the three-dimensional space coordinates are located in a preset dangerous area, and if so, trigger the abnormal event of the moving foreground.
在其中一个实施例中,所述异常事件触发装置还用于In one of the embodiments, the abnormal event triggering device is also used for
获取所述图像帧对应的深度图像,所述深度图像为灰度图,其像素点的坐标对应三维空间坐标的可视平面坐标,其灰度值对应三维空间坐标的深度信息,并通过所述深度图像判断所述三维空间坐标是否位于预设的危险区域。Obtain the depth image corresponding to the image frame, the depth image is a grayscale image, the coordinates of its pixels correspond to the visual plane coordinates of the three-dimensional space coordinates, and its grayscale value corresponds to the depth information of the three-dimensional space coordinates, and through the The depth image judges whether the three-dimensional space coordinates are located in a preset dangerous area.
在其中一个实施例中,所述触发所述运动前景的异常事件的步骤之前还包括:In one of the embodiments, before the step of triggering the abnormal event of the moving foreground, the step further includes:
根据所述深度信息判断所述运动前景是否为人体手势图像,若是,则继续执行所述触发所述运动前景的异常事件的步骤。Judging whether the moving foreground is a human body gesture image according to the depth information, and if so, continue to execute the step of triggering the abnormal event of the moving foreground.
在其中一个实施例中,所述异常事件触发装置还用于根据公式:In one of the embodiments, the abnormal event triggering device is also used according to the formula:
计算所述运动前景的深度值,其中d(I,c)即为深度图像I中坐标c处像素点的深度值,u和v为在阈值范围内随机选取的任意两点的坐标,z为运动前景上的深度信息;获取预设的人体手势图像的训练分类器;根据所述运动前景的深度值以及所述训练分类器通过决策树判断所述运动前景是否为人体手势图像。Calculate the depth value of the moving foreground, wherein d (I, c) is the depth value of the pixel at coordinate c in the depth image I, u and v are the coordinates of any two points randomly selected within the threshold range, and z is Depth information on the moving foreground; obtaining a training classifier of a preset human gesture image; judging whether the moving foreground is a human gesture image through a decision tree according to the depth value of the moving foreground and the training classifier.
上述视频监控方法和装置,通过多目摄像头采集图像帧,并根据图像帧提取运动前景,然后将运动前景在图像帧中得像素坐标换算成其所处的实际位置的三维空间坐标,并根据运动前景所处的三维空间坐标触发异常事件,与传统技术相比,不仅可根据运动前景在二维平面上的位置触发异常事件,还可根据换算得到的运动前景的三维空间坐标中得深度信息(距离摄像头的距离)触发异常事件,使得异常事件的触发更加准确,从而提高了安全性。The above video surveillance method and device collects image frames through multi-eye cameras, extracts the moving foreground according to the image frames, then converts the pixel coordinates of the moving foreground in the image frames into the three-dimensional space coordinates of its actual position, and according to the motion The three-dimensional space coordinates of the foreground trigger abnormal events. Compared with the traditional technology, not only the abnormal events can be triggered according to the position of the moving foreground on the two-dimensional plane, but also the depth information can be obtained from the converted three-dimensional space coordinates of the moving foreground ( The distance from the camera) triggers abnormal events, which makes the triggering of abnormal events more accurate, thereby improving security.
附图说明 Description of drawings
图1为一个实施例中视频监控方法的流程图;Fig. 1 is the flowchart of video monitoring method in an embodiment;
图2为一个实施例中2个摄像头成像即坐标换算原理图;Fig. 2 is a schematic diagram of coordinate conversion of two camera imaging in one embodiment;
图3为一个实施例中深度图像示意图;Fig. 3 is a schematic diagram of a depth image in an embodiment;
图4为一个实施例中视频监控系统的结构示意图;Fig. 4 is the structural representation of video monitoring system in an embodiment;
图5为一个实施例中双目摄像头的结构示意图。Fig. 5 is a schematic structural diagram of a binocular camera in an embodiment.
具体实施方式 Detailed ways
在一个实施例中,如图1所示,一种获取图片信息的方法,包括以下步骤:In one embodiment, as shown in Figure 1, a method for obtaining picture information includes the following steps:
步骤S102,采集多个摄像头的图像帧,根据图像帧提取运动前景。Step S102, collecting image frames of multiple cameras, and extracting a moving foreground according to the image frames.
摄像头采集的图像的数据形式为连续的图像帧。运动前景即连续的图像帧中发生变化的像素区域。The image data collected by the camera is in the form of continuous image frames. A moving foreground is a region of pixels that changes in successive image frames.
在一个实施例中,可根据混合高斯模型通过背景差分提取图像帧的运动前景。In one embodiment, the moving foreground of the image frame can be extracted by background subtraction according to the mixed Gaussian model.
在本实施例中,可预先进行混合高斯模型的定义,定义后的混合高斯模型为:In this embodiment, the mixed Gaussian model can be defined in advance, and the defined mixed Gaussian model is:
其中,Xt为时刻t(由于摄像机在拍摄视频图像时,采样图像帧的采样频率为固定值,因此t也可以是帧数)时像素点(x,y)的像素值,K为预设的混合高斯模型的个数(通常为3至5),wk,t是预设的时刻t时第k个高斯分布的权值,μk,t是时刻t时第k个高斯分布的均值,∑k,t是时刻t时第k个高斯分布的协方差矩阵,N是高斯分布概率密度函数,为第k个高斯分布的方差,E为高斯分布的期望值。Among them, X t is the pixel value of the pixel point (x, y) at time t (since the sampling frequency of the sampling image frame is a fixed value when the camera is shooting video images, t can also be the number of frames), and K is the preset The number of mixed Gaussian models (usually 3 to 5), w k, t is the weight of the kth Gaussian distribution at the preset time t, μ k, t is the mean value of the kth Gaussian distribution at time t , ∑ k, t is the covariance matrix of the kth Gaussian distribution at time t, N is the probability density function of Gaussian distribution, is the variance of the kth Gaussian distribution, and E is the expected value of the Gaussian distribution.
在获取到图像帧后,可根据当前时刻对高斯模型进行更新。可采用在线K均值算法来近似的对参数进行估计。在线K均值算法将当前时刻的像素与K个高斯分布分别进行匹配,如果匹配成功,则更新该分布的均值和方差,增大分布的权值;如果没有匹配,则产生一个新的分布去替换现有混合分布中的权值较小的项。After the image frame is acquired, the Gaussian model can be updated according to the current moment. The online K-means algorithm can be used to approximate the parameters. The online K-means algorithm matches the pixel at the current moment with K Gaussian distributions. If the matching is successful, the mean and variance of the distribution are updated, and the weight of the distribution is increased; if there is no match, a new distribution is generated to replace it. The term with the smaller weight in the existing mixture distribution.
可将前述K个高斯分布按权值和方差之比从大到小排列,然后选择与分布均值最接近的高斯分布作为匹配的高斯分布,即:The aforementioned K Gaussian distributions can be arranged according to the ratio of weight and variance from large to small, and then the Gaussian distribution closest to the mean value of the distribution can be selected as the matching Gaussian distribution, namely:
其中,Mk,t为匹配系数,即Mk,t=1时的k值为最终选择的匹配的高斯模型的k值,Xt为时刻t时像素点(x,y)的像素值,μk,t为时刻t时第k个高斯分布的均值,σ为方差,λ为预设的系数。Among them, M k, t is the matching coefficient, that is, the k value when M k, t = 1 is the k value of the finally selected matching Gaussian model, X t is the pixel value of the pixel point (x, y) at time t, μ k,t is the mean value of the kth Gaussian distribution at time t, σ is the variance, and λ is the preset coefficient.
如果在K个分布中没有找到当前像素的匹配分布,那么可能性最小的分布将被新的分布替代。新的分布的均值设置为当前的像素值,具有较大的方差和较小的权值。If no matching distribution is found for the current pixel among the K distributions, the least likely distribution is replaced by a new distribution. The mean of the new distribution is set to the current pixel value, with larger variance and smaller weight.
然后可根据选中的高斯模型对t时刻的K个分布的权值进行调整,可通过公式:Then, according to the selected Gaussian model, the weights of K distributions at time t can be adjusted, and the formula can be used:
wk,t+1=(1-α)wk,t+αMk,t w k,t+1 =(1-α)w k,t +αM k,t
wk,t+1=wk,t+α(Mk,t-wk,t)w k,t+1 =w k,t +α(M k,t -w k,t )
对权值进行调整。其中α未预设的系数,Mk,t为前述的匹配系数,wk,t为时刻t时第k个高斯分布的权值。对权值进行调整后,权值的总和保持不变,仍然为1。更新过程相当于对匹配结果进行因果的二阶低通滤波,也相当于用过去数据的指数加窗估计当前权值。Adjust the weights. Where α is not a preset coefficient, M k,t is the aforementioned matching coefficient, w k,t is the weight of the kth Gaussian distribution at time t. After adjusting the weights, the sum of the weights remains the same and is still 1. The update process is equivalent to performing a causal second-order low-pass filter on the matching results, and is also equivalent to using the exponential windowing of the past data to estimate the current weight.
也就是说,对于没有选中的即未匹配的分布,权值保持不变;对于选中的即匹配的分布通过如下公式:That is to say, for the distribution that is not selected or not matched, the weight remains unchanged; for the distribution that is selected or matched, the following formula is used:
μt+1(x,y)=(1-α)u(x,y)+αIt(x,y);μ t+1 (x,y)=(1-α)u(x,y)+αI t (x,y);
β=αN(Xt,μk,σk);β=αN(X t ,μ k ,σ k );
对当前分布进行更新。Make an update to the current distribution.
对前述的混合高斯模型进行更新后,可通过计算前述的混合高斯模型中每个高斯分布的wk,t/σk,t,并对其进行排序,比值wk,t/σk,t越大,表示具有较大wk,t和较小的σk,t,因此排序越前的高斯分布,越适合描述背景。一般选取排序在前的M个高斯分布作为背景,M由下式求得:After updating the aforementioned mixed Gaussian model, by calculating w k,t /σ k,t of each Gaussian distribution in the aforementioned mixed Gaussian model, and sorting them, the ratio w k,t /σ k,t The larger the value, the larger w k,t and the smaller σ k,t , so the Gaussian distribution with higher ranking is more suitable for describing the background. Generally, the top M Gaussian distributions are selected as the background, and M is obtained by the following formula:
其中,阈值TR表示代表背景的分布的权值和在整体中所占的最小比例。M是能达到这一比例的“最好”的分布的数量,即前m个最可能的分布。Among them, the threshold T R represents the weight of the distribution representing the background and the minimum proportion it occupies in the whole. M is the number of "best" distributions that achieve this ratio, i.e. the top m most probable distributions.
通过将各像素点与上述确定的前m个高斯分布逐一匹配运算,直到找到匹配的则认为是背景点,若没有任何一个高斯分布与Xt匹配,则判定为运动前景。对图像帧的每个像素点实行相同的判定操作,从而通过混合高斯背景模型获取运动前景。By matching each pixel point with the first m Gaussian distributions determined above, until a match is found, it is considered as a background point. If no Gaussian distribution matches Xt , it is judged as a moving foreground point. The same judgment operation is performed on each pixel of the image frame, so as to obtain the moving foreground through the mixed Gaussian background model.
步骤S104,获取运动前景在图像帧中的像素坐标。Step S104, acquiring the pixel coordinates of the moving foreground in the image frame.
像素坐标即图像帧中像素点所处的位置。多个摄像头同时获取的图像帧有多个,运动前景在每个图像帧中可具有不同的像素坐标。The pixel coordinates are the positions of the pixels in the image frame. There are multiple image frames acquired by multiple cameras at the same time, and the moving foreground may have different pixel coordinates in each image frame.
步骤S106,根据像素坐标、多个摄像头的焦距和空间距离计算运动前景的三维空间坐标。Step S106, calculating the three-dimensional space coordinates of the moving foreground according to the pixel coordinates, focal lengths and space distances of multiple cameras.
在一个实施例中,摄像头的数量为2个,且水平设置。获取到的图像帧为同一时间由2个摄像头分别采集的左图像帧(left)和右图像帧(right)。在本实施例中,可通过双目摄像头采集图像帧。In one embodiment, the number of cameras is two, and they are arranged horizontally. The acquired image frames are the left image frame (left) and the right image frame (right) respectively collected by the two cameras at the same time. In this embodiment, image frames may be collected by a binocular camera.
根据像素坐标、多个摄像头的焦距和空间距离计算运动前景的三维空间坐标的步骤可具体为:The steps of calculating the three-dimensional spatial coordinates of the moving foreground according to the pixel coordinates, the focal lengths and the spatial distances of multiple cameras can be specifically:
根据公式:According to the formula:
Disparity=Xleft-Xright Disparity=X left -X right
计算左图像帧和右图像帧的视察。其中,Disparity为视差,Xleft为运动前景在左图像帧中的水平坐标,Xright为运动前景在右图像帧中的水平坐标;Compute the inspections for the left image frame and the right image frame. Wherein, Disparity is a parallax, X left is the horizontal coordinate of the moving foreground in the left image frame, and X right is the horizontal coordinate of the moving foreground in the right image frame;
根据公式:According to the formula:
计算运动前景的三维空间坐标;其中,(xc,yc,zc)即为运动前景的三维空间坐标,且xc和yc为可视平面坐标,zc为深度信息,B为两个摄像头之间的水平距离,f为摄像头的焦距,Y为运动前景在左图像帧和右图像帧中得垂直坐标(由于摄像头水平设置,因此左图像帧中像素点的Y值和右图像帧中像素点的Y值相同),Disparity为左图像帧和右图像帧的视差。Calculate the three-dimensional space coordinates of the moving foreground; among them, (x c , y c , z c ) are the three-dimensional space coordinates of the moving foreground, and x c and y c are the coordinates of the visual plane, z c is the depth information, and B is two The horizontal distance between two cameras, f is the focal length of the camera, and Y is the vertical coordinate of the moving foreground in the left image frame and the right image frame (because the camera is set horizontally, the Y value of the pixel in the left image frame and the right image frame The Y value of the middle pixel is the same), and Disparity is the disparity between the left image frame and the right image frame.
例如,如图2所示,L和R分别为水平设置的双目摄像头同时截取的左图像帧和右图像帧,Cleft和Cright分别为左右摄像头的相机光轴(穿过焦距垂直于相机镜面的轴线),B为摄像头之间的距离(基线距),fleft和fright分别为左右摄像机的焦距,通常情况下为方便计算,可将fleft和fright设为相等,均为f。(Xleft,Y)和(Y)分别为同一物体分别在左右图像帧上产生的投影的像素坐标,(xc,yc,zc)即计算得到该物体在三维空间中的实际坐标。For example, as shown in Figure 2, L and R are respectively the left image frame and the right image frame captured by the binocular camera set horizontally at the same time, and C left and C right are respectively the camera optical axes of the left and right cameras (through the focal length perpendicular to the camera mirror axis), B is the distance between the cameras (baseline distance), f left and f right are the focal lengths of the left and right cameras respectively, usually for the convenience of calculation, f left and f right can be set equal, both are f . (X left , Y) and ( Y) are the pixel coordinates of the projection of the same object on the left and right image frames respectively, and (x c , y c , z c ) are calculated to obtain the actual coordinates of the object in the three-dimensional space.
需要说明的是在其他实施例中,摄像头也可垂直放置。在摄像头垂直放置时,B即为摄像头之间的垂直距离,可将Xleft/Xright和Y互换即可得到运动前景的三维空间坐标。It should be noted that in other embodiments, the camera can also be placed vertically. When the cameras are placed vertically, B is the vertical distance between the cameras, and the three-dimensional space coordinates of the moving foreground can be obtained by exchanging X left / X right and Y.
在其他实施例中,还可通过空间中摆放的两个以上的摄像头采集图像帧。可在两个以上的摄像头中选取多组摄像头,每组摄像头的数目为两个。可通过每组摄像头同时采集的图像帧计算运动前景的三维空间坐标,然后将计算得到的每组摄像头对应的运动前景的三维空间坐标求取平均值,从而提高测量精度。In other embodiments, image frames may also be collected through more than two cameras placed in the space. Multiple groups of cameras can be selected from more than two cameras, and the number of cameras in each group is two. The three-dimensional space coordinates of the moving foreground can be calculated through the image frames simultaneously collected by each group of cameras, and then the calculated three-dimensional space coordinates of the moving foreground corresponding to each group of cameras are averaged, thereby improving the measurement accuracy.
步骤S108,根据三维空间坐标触发运动前景的异常事件。Step S108, triggering an abnormal event of a moving foreground according to the three-dimensional space coordinates.
运动前景的异常事件即运动前景进入到预设的危险区域中时触发的事件,可根据触发的事件发出相应的警报。The abnormal event of the moving foreground is an event triggered when the moving foreground enters a preset dangerous area, and a corresponding alarm may be issued according to the triggered event.
在一个实施例中,根据三维空间坐标触发运动前景的异常事件的步骤可具体为:判断三维空间坐标是否位于预设的危险区域,若是,则触发运动前景的异常事件。In one embodiment, the step of triggering the abnormal event of the moving foreground according to the three-dimensional space coordinates may be specifically: determining whether the three-dimensional space coordinates are located in a preset dangerous area, and if so, triggering the abnormal event of the moving foreground.
例如,可预先在图像帧的背景中将高压电线等危险设施的临近区域划定为危险区域(同样由三维空间坐标表示),若运动前景为人体图像,则检测到人体图像的三维空间坐标进入高压电线临近的危险区域时,则触发异常事件,从而对行人进行警示或通知相关人员进行处理。For example, in the background of the image frame, the vicinity of dangerous facilities such as high-voltage wires can be pre-delineated as a dangerous area (also represented by three-dimensional space coordinates). When the high-voltage power line is close to the dangerous area, an abnormal event is triggered to warn pedestrians or notify relevant personnel to deal with it.
进一步的,判断三维空间坐标是否位于预设的危险区域的步骤可具体为:获取图像帧对应的深度图像,深度图像为灰度图,其像素点的坐标对应三维空间坐标的可视平面坐标,其灰度值对应三维空间坐标的深度信息;通过深度图像判断三维空间坐标是否位于预设的危险区域。Further, the step of judging whether the three-dimensional space coordinates are located in the preset dangerous area may be specifically: acquiring the depth image corresponding to the image frame, the depth image is a grayscale image, and the coordinates of the pixels thereof correspond to the visual plane coordinates of the three-dimensional space coordinates, Its gray value corresponds to the depth information of the three-dimensional space coordinates; through the depth image, it is judged whether the three-dimensional space coordinates are located in the preset dangerous area.
例如,如图3所示,图3展示了根据图像帧中运动前景的三维空间坐标生成的深度图像。图3中,根据像素点的三维空间坐标中的可视平面坐标确定深度图像的像素坐标,然后将该像素坐标对应的灰度值设置为与可视平面坐标对应的深度信息。例如,若运动前景P的三维空间坐标为(xp,yp,zp),则在深度图像的像素点(xp,yp)处的灰度值为γzp,其中,γ为预设的系数,可根据zp所处的数值范围确定。例如,若获取到的所有运动前景的zp的取值范围为0至100,则γ可取值为255/100,即灰度值最小可取值为0,最大可取值255。For example, as shown in Fig. 3, Fig. 3 shows a depth image generated according to the three-dimensional space coordinates of the moving foreground in the image frame. In FIG. 3 , the pixel coordinates of the depth image are determined according to the visible plane coordinates in the three-dimensional space coordinates of the pixels, and then the gray value corresponding to the pixel coordinates is set as the depth information corresponding to the visible plane coordinates. For example, if the three-dimensional space coordinates of the moving foreground P are (x p , y p , z p ), then the gray value at the pixel point (x p , y p ) of the depth image is γz p , where γ is the preset The set coefficient can be determined according to the value range of z p . For example, if the acquired z p of all moving foregrounds ranges from 0 to 100, then γ can take a value of 255/100, that is, the minimum gray value can be 0, and the maximum gray value can be 255.
在本实施例中,触发运动前景的异常事件的步骤之前还可根据深度信息判断运动前景是否为人体手势图像,若是,则继续执行触发运动前景的异常事件的步骤。In this embodiment, before the step of triggering the abnormal event of the moving foreground, it is also possible to judge whether the moving foreground is a human gesture image according to the depth information, and if so, continue to execute the step of triggering the abnormal event of the moving foreground.
进一步的,根据深度信息判断运动前景是否为人体手势图像的步骤为:Further, the steps of judging whether the motion foreground is a human gesture image according to the depth information are:
根据公式:According to the formula:
计算运动前景的深度值,其中d(I,c)即为深度图像I中坐标c处像素点的深度值,u和v为在阈值范围内随机选取的任意两点的坐标,z为运动前景上的深度信息;获取预设的人体手势图像的训练分类器;根据运动前景的深度值以及训练分类器通过决策树判断运动前景是否为人体手势图像。Calculate the depth value of the moving foreground, where d(I,c) is the depth value of the pixel at coordinate c in the depth image I, u and v are the coordinates of any two points randomly selected within the threshold range, and z is the moving foreground Depth information on the above; obtain the training classifier of the preset human gesture image; judge whether the moving foreground is a human gesture image through a decision tree according to the depth value of the moving foreground and the training classifier.
在本实施例中,可遍历深度图像I中得每个像素点,然后通过上述公式计算每个像素点的深度值d,然后通过决策树根据遍历到的像素点的深度值d判断该像素点是否属于运动前景的边缘区域(即判断深度值d是否处于相应的阈值区间),从而可得到运动前景中的所有像素坐标在运动前景中所处的相对位置,例如,若像素点a对应边缘则可将该像素点的相对位置属性值设为1,若像素点b对应运动前景的内部深处(即非边缘),则可将该像素点的相对位置属性值设为0。最后可将所有像素坐标输入训练分类器,从而判断运动前景是否为人体手势图像,同样,也可获取运动前景中属于人体手势图像的像素坐标范围。In this embodiment, each pixel in the depth image I can be traversed, and then the depth value d of each pixel can be calculated by the above formula, and then the pixel can be judged according to the depth value d of the traversed pixel through the decision tree Whether it belongs to the edge area of the moving foreground (that is, to judge whether the depth value d is in the corresponding threshold interval), so that the relative positions of all pixel coordinates in the moving foreground in the moving foreground can be obtained. For example, if pixel a corresponds to the edge then The relative position attribute value of the pixel point can be set to 1, and if the pixel point b corresponds to the inner depth of the moving foreground (that is, not the edge), the relative position attribute value of the pixel point can be set to 0. Finally, all pixel coordinates can be input into the training classifier to judge whether the motion foreground is a human gesture image, and similarly, the range of pixel coordinates belonging to the human gesture image in the motion foreground can also be obtained.
训练分类器可预先通过训练样本生成。例如,可根据多幅具有人体手势图像的深度图像来生成训练分类器,从而得到训练分类器的分类核函数。The training classifier can be generated through training samples in advance. For example, a training classifier may be generated according to multiple depth images having human gesture images, so as to obtain a classification kernel function of the training classifier.
在一个实施例中,如图4所示,一种视频监控系统,包括多目摄像头102、运动前景提取装置104、坐标换算装置106以及异常事件触发装置108,其中:In one embodiment, as shown in FIG. 4 , a video surveillance system includes a multi-eye camera 102, a moving foreground extraction device 104, a coordinate conversion device 106, and an abnormal event triggering device 108, wherein:
多目摄像头102,用于采集图像帧。The multi-eye camera 102 is used to collect image frames.
运动前景提取装置104,用于根据图像帧提取运动前景。A moving foreground extracting device 104 is configured to extract a moving foreground according to image frames.
多目摄像头即具有多个摄像头的图像采集装置。多目摄像头可在同一时间通过其自带的多个摄像头对同一物体进行多角度的图像采集。A multi-camera is an image acquisition device with multiple cameras. The multi-camera can collect multi-angle images of the same object through its own multiple cameras at the same time.
多目摄像头采集到的图像的数据形式为连续的图像帧。运动前景即连续的图像帧中发生变化的像素区域。The data form of the images collected by the multi-camera is continuous image frames. A moving foreground is a region of pixels that changes in successive image frames.
在一个实施例中,运动前景提取装置104可用于根据混合高斯模型通过背景差分提取图像帧的运动前景。In one embodiment, the moving foreground extracting device 104 can be used to extract the moving foreground of the image frame by background difference according to the mixed Gaussian model.
在本实施例中,混合高斯模型为预先定义,为:In this embodiment, the mixed Gaussian model is pre-defined as:
其中,Xt为时刻t(由于摄像机在拍摄视频图像时,采样图像帧的采样频率为固定值,因此t也可以是帧数)时像素点(x,y)的像素值,K为预设的混合高斯模型的个数(通常为3至5),wk,t是预设的时刻t时第k个高斯分布的权值,μk,t是时刻t时第k个高斯分布的均值,∑k,t是时刻t时第k个高斯分布的协方差矩阵,N是高斯分布概率密度函数,为第k个高斯分布的方差,E为高斯分布的期望值。Among them, X t is the pixel value of the pixel point (x, y) at time t (since the sampling frequency of the sampling image frame is a fixed value when the camera is shooting video images, t can also be the number of frames), and K is the preset The number of mixed Gaussian models (usually 3 to 5), w k, t is the weight of the kth Gaussian distribution at the preset time t, μ k, t is the mean value of the kth Gaussian distribution at time t , ∑ k, t is the covariance matrix of the kth Gaussian distribution at time t, N is the probability density function of Gaussian distribution, is the variance of the kth Gaussian distribution, and E is the expected value of the Gaussian distribution.
在获取到图像帧后,运动前景提取装置104可用于根据当前时刻对高斯模型进行更新。可采用在线K均值算法来近似的对参数进行估计。在线K均值算法将当前时刻的像素与K个高斯分布分别进行匹配,如果匹配成功,则更新该分布的均值和方差,增大分布的权值;如果没有匹配,则产生一个新的分布去替换现有混合分布中的权值较小的项。After the image frame is acquired, the moving foreground extraction device 104 can be used to update the Gaussian model according to the current moment. The online K-means algorithm can be used to approximate the parameters. The online K-means algorithm matches the pixel at the current moment with K Gaussian distributions. If the matching is successful, the mean and variance of the distribution are updated, and the weight of the distribution is increased; if there is no match, a new distribution is generated to replace it. The term with the smaller weight in the existing mixture distribution.
运动前景提取装置104可用于将前述K个高斯分布按权值和方差之比从大到小排列,然后选择与分布均值最接近的高斯分布作为匹配的高斯分布,即:The moving foreground extraction device 104 can be used to arrange the aforementioned K Gaussian distributions according to the ratio of weight and variance from large to small, and then select the Gaussian distribution closest to the distribution mean as the matching Gaussian distribution, namely:
其中,Mk,t为匹配系数,即Mk,t=1时的k值为最终选择的匹配的高斯模型的k值,Xt为时刻t时像素点(x,y)的像素值,μk,t为时刻t时第k个高斯分布的均值,σ为方差,λ为预设的系数。Among them, M k, t is the matching coefficient, that is, the k value when M k, t = 1 is the k value of the finally selected matching Gaussian model, X t is the pixel value of the pixel point (x, y) at time t, μ k,t is the mean value of the kth Gaussian distribution at time t, σ is the variance, and λ is the preset coefficient.
如果在K个分布中没有找到当前像素的匹配分布,那么可能性最小的分布将被新的分布替代。新的分布的均值设置为当前的像素值,具有较大的方差和较小的权值。If no matching distribution is found for the current pixel among the K distributions, the least likely distribution is replaced by a new distribution. The mean of the new distribution is set to the current pixel value, with larger variance and smaller weight.
运动前景提取装置104还可用于根据选中的高斯模型对t时刻的K个分布的权值进行调整,可通过公式:The moving foreground extraction device 104 can also be used to adjust the weights of the K distributions at time t according to the selected Gaussian model, which can be passed through the formula:
wk,t+1=(1-α)wk,t+αMk,t w k,t+1 =(1-α)w k,t +αM k,t
wk,t+1=wk,t+α(Mk,t-wk,t)w k,t+1 =w k,t +α(M k,t -w k,t )
对权值进行调整。其中α未预设的系数,Mk,t为前述的匹配系数,wk,t为时刻t时第k个高斯分布的权值。对权值进行调整后,权值的总和保持不变,仍然为1。更新过程相当于对匹配结果进行因果的二阶低通滤波,也相当于用过去数据的指数加窗估计当前权值。Adjust the weights. Among them, α is not a preset coefficient, M k, t is the aforementioned matching coefficient, and w k, t is the weight of the kth Gaussian distribution at time t. After adjusting the weights, the sum of the weights remains the same and is still 1. The update process is equivalent to performing a causal second-order low-pass filter on the matching results, and is also equivalent to using the exponential windowing of the past data to estimate the current weight.
也就是说,对于没有选中的即未匹配的分布,权值保持不变;对于选中的即匹配的分布通过如下公式:That is to say, for the distribution that is not selected or not matched, the weight remains unchanged; for the distribution that is selected or matched, the following formula is used:
μt+1(x,y)=(1-α)u(x,y)+αIt(x,y);μ t+1 (x,y)=(1-α)u(x,y)+αI t (x,y);
β=αN(Xt,μk,σk);β=αN(X t ,μ k ,σ k );
对当前分布进行更新。Make an update to the current distribution.
运动前景提取装置104还可用于对前述的混合高斯模型进行更新后,通过计算前述的混合高斯模型中每个高斯分布的wk,t/σk,t,并对其进行排序,比值wk,t/σk,t越大,表示具有较大wk,t和较小的σk,t,因此排序越前的高斯分布,越适合描述背景。一般选取排序在前的M个高斯分布作为背景,M由下式求得:The moving foreground extraction device 104 can also be used to update the aforementioned mixed Gaussian model, by calculating w k,t /σ k,t of each Gaussian distribution in the aforementioned mixed Gaussian model, and sorting them, the ratio w k ,t /σ k,t is larger, it means that w k,t is larger and σ k,t is smaller, so the Gaussian distribution with higher ranking is more suitable for describing the background. Generally, the top M Gaussian distributions are selected as the background, and M is obtained by the following formula:
其中,阈值TR表示代表背景的分布的权值和在整体中所占的最小比例。M是能达到这一比例的“最好”的分布的数量,即前m个最可能的分布。Among them, the threshold T R represents the weight of the distribution representing the background and the minimum proportion it occupies in the whole. M is the number of "best" distributions that achieve this ratio, i.e. the top m most probable distributions.
运动前景提取装置104还可用于通过将各像素点与上述确定的前m个高斯分布逐一匹配运算,直到找到匹配的则认为是背景点,若没有任何一个高斯分布与Xt匹配,则判定为运动前景。对图像帧的每个像素点实行相同的判定操作,从而通过混合高斯背景模型获取运动前景。The moving foreground extraction device 104 can also be used to match each pixel point with the above-mentioned first m Gaussian distributions one by one until a match is found, then it is considered as a background point, if no Gaussian distribution matches Xt , it is determined as Movement prospect. The same judgment operation is performed on each pixel of the image frame, so as to obtain the moving foreground through the mixed Gaussian background model.
坐标换算装置106,用于获取所述运动前景在所述图像帧中的像素坐标,根据所述像素坐标、多目摄像头的焦距和空间距离计算所述运动前景的三维空间坐标。The coordinate conversion device 106 is configured to obtain the pixel coordinates of the moving foreground in the image frame, and calculate the three-dimensional space coordinates of the moving foreground according to the pixel coordinates, the focal length and the spatial distance of the multi-camera.
像素坐标即图像帧中像素点所处的位置。多目摄像头102同时获取的图像帧有多个,运动前景在每个图像帧中可具有不同的像素坐标。The pixel coordinates are the positions of the pixels in the image frame. There are multiple image frames acquired by the multi-eye camera 102 at the same time, and the moving foreground may have different pixel coordinates in each image frame.
在一个实施例中,多目摄像头102为水平设置的双目摄像头。多目摄像头102获取到的图像帧为同一时间由双目摄像头分别采集的左图像帧(left)和右图像帧(right)。In one embodiment, the multi-camera 102 is a binocular camera arranged horizontally. The image frames acquired by the multi-camera 102 are the left image frame (left) and the right image frame (right) respectively acquired by the binocular cameras at the same time.
如图5所示,其中,left和right分别为水平设置的双目摄像头的左右两个镜头,B为left和right两个镜头焦点之间的距离,也叫基线距。需要说明的是,left和right只是用于区分左右两个镜头,并没有对镜头的具体位置进行限定。As shown in Figure 5, where left and right are the left and right lenses of the binocular camera set horizontally, respectively, and B is the distance between the focal points of the left and right lenses, also called the baseline distance. It should be noted that left and right are only used to distinguish the left and right lenses, and do not limit the specific positions of the lenses.
在本实施例中,坐标换算装置106还可用于根据公式:In this embodiment, the coordinate conversion device 106 can also be used according to the formula:
Disparity=Xleft-Xright Disparity=X left -X right
计算左图像帧和右图像帧的视察。其中,Disparity为视差,Xleft为运动前景在左图像帧中的水平坐标,Xright为运动前景在右图像帧中的水平坐标。Compute the observations for the left image frame and the right image frame. Wherein, Disparity is the parallax, X left is the horizontal coordinate of the moving foreground in the left image frame, and X right is the horizontal coordinate of the moving foreground in the right image frame.
坐标换算装置106还可用于根据公式:Coordinate conversion means 106 can also be used according to the formula:
计算运动前景的三维空间坐标;其中,(xc,yc,zc)即为运动前景的三维空间坐标,且xc和yc为可视平面坐标,zc为深度信息,B为两个摄像头之间的水平距离,f为摄像头的焦距,Y为运动前景在左图像帧和右图像帧中得垂直坐标(由于摄像头水平设置,因此左图像帧中像素点的Y值和右图像帧中像素点的Y值相同),Disparity为左图像帧和右图像帧的视差。Calculate the three-dimensional space coordinates of the moving foreground; among them, (x c , y c , z c ) are the three-dimensional space coordinates of the moving foreground, and x c and y c are the coordinates of the visual plane, z c is the depth information, and B is two The horizontal distance between two cameras, f is the focal length of the camera, and Y is the vertical coordinate of the moving foreground in the left image frame and the right image frame (because the camera is set horizontally, the Y value of the pixel in the left image frame and the right image frame The Y value of the middle pixel is the same), and Disparity is the disparity between the left image frame and the right image frame.
例如,如图2所示,L和R分别为水平设置的双目摄像头同时截取的左图像帧和右图像帧,Cleft和Cright分别为左右摄像头的相机光轴(穿过焦距垂直于相机镜面的轴线),B为摄像头之间的距离(基线距),fleft和fright分别为左右摄像机的焦距,通常情况下为方便计算,可将fleft和fright设为相等,均为f。(Y)和(Y)分别为同一物体分别在左右图像帧上产生的投影的像素坐标,(xc,yc,zc)即计算得到该物体在三维空间中的实际坐标。For example, as shown in Figure 2, L and R are respectively the left image frame and the right image frame captured by the binocular camera set horizontally at the same time, and C left and C right are respectively the camera optical axes of the left and right cameras (through the focal length perpendicular to the camera mirror axis), B is the distance between the cameras (baseline distance), f left and f right are the focal lengths of the left and right cameras respectively, usually for the convenience of calculation, f left and f right can be set equal, both are f . ( Y) and ( Y) are the pixel coordinates of the projection of the same object on the left and right image frames respectively, and (x c , y c , z c ) are calculated to obtain the actual coordinates of the object in the three-dimensional space.
需要说明的是在其他实施例中,双目摄像头也可垂直设置。在摄像头垂直放置时,B即为摄像头之间的垂直距离,可将Xleft/Xright和Y互换即可得到运动前景的三维空间坐标。It should be noted that in other embodiments, the binocular cameras can also be arranged vertically. When the cameras are placed vertically, B is the vertical distance between the cameras, and the three-dimensional space coordinates of the moving foreground can be obtained by exchanging X left / X right and Y.
在其他实施例中,还可通过多目摄像头102的多个镜头采集图像帧。可将多目摄像头102的多个镜头划分为多组,每组的数目为两个。可通过每组镜头同时采集到的图像帧计算运动前景的三维空间坐标,并将计算得到的每组镜头对应的运动前景的三维空间坐标求取平均值,从而提高测量精度。In other embodiments, image frames may also be collected through multiple lenses of the multi-eye camera 102 . The multiple lenses of the multi-eye camera 102 can be divided into multiple groups, and the number of each group is two. The three-dimensional space coordinates of the moving foreground can be calculated through the image frames collected simultaneously by each group of shots, and the calculated three-dimensional space coordinates of the moving foreground corresponding to each group of shots are averaged, thereby improving the measurement accuracy.
异常事件触发装置108,用于根据三维空间坐标触发运动前景的异常事件。The abnormal event triggering device 108 is configured to trigger an abnormal event of the moving foreground according to the three-dimensional space coordinates.
运动前景的异常事件即运动前景进入到预设的危险区域中时触发的事件,可根据触发的事件发出相应的警报。The abnormal event of the moving foreground is an event triggered when the moving foreground enters a preset dangerous area, and a corresponding alarm may be issued according to the triggered event.
在一个实施例中,异常事件触发装置108可用于判断三维空间坐标是否位于预设的危险区域,若是,则触发运动前景的异常事件。In one embodiment, the abnormal event triggering device 108 can be used to determine whether the three-dimensional space coordinates are located in a preset dangerous area, and if so, trigger an abnormal event of the moving foreground.
例如,可预先在图像帧的背景中将高压电线等危险设施的临近区域划定为危险区域(同样由三维空间坐标表示),若运动前景为人体图像,则检测到人体图像的三维空间坐标进入高压电线临近的危险区域时,则触发异常事件,从而对行人进行警示或通知相关人员进行处理。For example, in the background of the image frame, the vicinity of dangerous facilities such as high-voltage wires can be pre-delineated as a dangerous area (also represented by three-dimensional space coordinates). When the high-voltage power line is close to the dangerous area, an abnormal event is triggered to warn pedestrians or notify relevant personnel to deal with it.
进一步的,异常事件触发装置108还可用于获取图像帧对应的深度图像,深度图像为灰度图,其像素点的坐标对应三维空间坐标的可视平面坐标,其灰度值对应三维空间坐标的深度信息;通过深度图像判断三维空间坐标是否位于预设的危险区域。Further, the abnormal event triggering device 108 can also be used to obtain the depth image corresponding to the image frame, the depth image is a grayscale image, the coordinates of its pixels correspond to the visual plane coordinates of the three-dimensional space coordinates, and its grayscale value corresponds to the coordinates of the three-dimensional space coordinates. Depth information; determine whether the three-dimensional space coordinates are located in the preset dangerous area through the depth image.
例如,如图3所示,图3展示了根据图像帧中运动前景的三维空间坐标生成的深度图像。图3中,根据像素点的三维空间坐标中的可视平面坐标确定深度图像的像素坐标,然后将该像素坐标对应的灰度值设置为与可视平面坐标对应的深度信息。例如,若运动前景P的三维空间坐标为(xp,yp,zp),则在深度图像的像素点(xp,yp)处的灰度值为γzp,其中,γ为预设的系数,可根据zp所处的数值范围确定。例如,若获取到的所有运动前景的zp的取值范围为0至100,则γ可取值为255/100,即灰度值最小可取值为0,最大可取值255。For example, as shown in Fig. 3, Fig. 3 shows a depth image generated according to the three-dimensional space coordinates of the moving foreground in the image frame. In FIG. 3 , the pixel coordinates of the depth image are determined according to the visible plane coordinates in the three-dimensional space coordinates of the pixels, and then the gray value corresponding to the pixel coordinates is set as the depth information corresponding to the visible plane coordinates. For example, if the three-dimensional space coordinates of the moving foreground P are (xp , y p , z p ), then the gray value at the pixel point (x p , y p ) of the depth image is γz p , where γ is the preset The coefficient of can be determined according to the value range of z p . For example, if the acquired z p of all moving foregrounds ranges from 0 to 100, then γ can take a value of 255/100, that is, the minimum gray value can be 0, and the maximum gray value can be 255.
在本实施例中,异常事件触发装置108还可用于根据深度信息判断运动前景是否为人体手势图像,若是,则执行触发运动前景的异常事件。In this embodiment, the abnormal event triggering device 108 can also be used to determine whether the moving foreground is a human gesture image according to the depth information, and if so, execute an abnormal event that triggers the moving foreground.
进一步的,异常事件触发装置108还可用于根据公式:Further, the abnormal event triggering device 108 can also be used according to the formula:
计算运动前景的深度值,其中d(I,c)即为深度图像I中坐标c处像素点的深度值,u和v为在阈值范围内随机选取的任意两点的坐标,z为运动前景上的深度信息;获取预设的人体手势图像的训练分类器;根据运动前景的深度值以及训练分类器通过决策树判断运动前景是否为人体手势图像。Calculate the depth value of the moving foreground, where d(I,c) is the depth value of the pixel at coordinate c in the depth image I, u and v are the coordinates of any two points randomly selected within the threshold range, and z is the moving foreground Depth information on the above; obtain the training classifier of the preset human gesture image; judge whether the moving foreground is a human gesture image through a decision tree according to the depth value of the moving foreground and the training classifier.
在本实施例中,异常事件触发装置108可用于可遍历深度图像I中得每个像素点,然后通过上述公式计算每个像素点的深度值d,然后通过决策树根据遍历到的像素点的深度值d判断该像素点是否属于运动前景的边缘区域(即判断深度值d是否处于相应的阈值区间),从而可得到运动前景中的所有像素坐标在运动前景中所处的相对位置,例如,若像素点a对应边缘则可将该像素点的相对位置属性值设为1,若像素点b对应运动前景的内部深处(即非边缘),则可将该像素点的相对位置属性值设为0。最后可将所有像素坐标输入训练分类器,从而判断运动前景是否为人体手势图像,同样,也可获取运动前景中属于人体手势图像的像素坐标范围。In this embodiment, the abnormal event triggering device 108 can be used to traverse each pixel in the depth image I, and then calculate the depth value d of each pixel through the above formula, and then use the decision tree to The depth value d judges whether the pixel belongs to the edge area of the moving foreground (that is, judges whether the depth value d is in the corresponding threshold range), so that the relative positions of all pixel coordinates in the moving foreground can be obtained, for example, If the pixel point a corresponds to the edge, the relative position attribute value of the pixel point can be set to 1; if the pixel point b corresponds to the inner depth of the moving foreground (that is, not the edge), the relative position attribute value of the pixel point can be set to is 0. Finally, all pixel coordinates can be input into the training classifier to judge whether the motion foreground is a human gesture image, and similarly, the range of pixel coordinates belonging to the human gesture image in the motion foreground can also be obtained.
训练分类器可预先通过训练样本生成。例如,可根据多幅具有人体手势图像的深度图像来生成训练分类器,从而得到训练分类器的分类核函数。The training classifier can be generated through training samples in advance. For example, a training classifier may be generated according to multiple depth images having human gesture images, so as to obtain a classification kernel function of the training classifier.
上述视频监控方法和装置,通过多目摄像头采集图像帧,并根据图像帧提取运动前景,然后将运动前景在图像帧中得像素坐标换算成其所处的实际位置的三维空间坐标,并根据运动前景所处的三维空间坐标触发异常事件,与传统技术相比,不仅可根据运动前景在二维平面上的位置触发异常事件,还可根据换算得到的运动前景的三维空间坐标中得深度信息(距离摄像头的距离)触发异常事件,使得异常事件的触发更加准确,从而提高了安全性。The above video surveillance method and device collects image frames through multi-eye cameras, extracts the moving foreground according to the image frames, then converts the pixel coordinates of the moving foreground in the image frames into the three-dimensional space coordinates of its actual position, and according to the motion The three-dimensional space coordinates of the foreground trigger abnormal events. Compared with the traditional technology, not only the abnormal events can be triggered according to the position of the moving foreground on the two-dimensional plane, but also the depth information can be obtained from the converted three-dimensional space coordinates of the moving foreground ( The distance from the camera) triggers abnormal events, which makes the triggering of abnormal events more accurate, thereby improving security.
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but should not be construed as limiting the patent scope of the present invention. It should be pointed out that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention should be based on the appended claims.
Claims (14)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210370526.XA CN103716579B (en) | 2012-09-28 | 2012-09-28 | Video monitoring method and system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210370526.XA CN103716579B (en) | 2012-09-28 | 2012-09-28 | Video monitoring method and system |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103716579A true CN103716579A (en) | 2014-04-09 |
| CN103716579B CN103716579B (en) | 2017-05-10 |
Family
ID=50409105
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201210370526.XA Expired - Fee Related CN103716579B (en) | 2012-09-28 | 2012-09-28 | Video monitoring method and system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN103716579B (en) |
Cited By (21)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104202533A (en) * | 2014-09-24 | 2014-12-10 | 中怡(苏州)科技有限公司 | Motion detection device and motion detection method |
| CN104902246A (en) * | 2015-06-17 | 2015-09-09 | 浙江大华技术股份有限公司 | Video monitoring method and device |
| CN104935893A (en) * | 2015-06-17 | 2015-09-23 | 浙江大华技术股份有限公司 | Monitoring method and device |
| CN104954747A (en) * | 2015-06-17 | 2015-09-30 | 浙江大华技术股份有限公司 | Video monitoring method and device |
| CN104966062A (en) * | 2015-06-17 | 2015-10-07 | 浙江大华技术股份有限公司 | Video monitoring method and device |
| CN105872477A (en) * | 2016-05-27 | 2016-08-17 | 北京旷视科技有限公司 | Video monitoring method and system |
| CN105979203A (en) * | 2016-04-29 | 2016-09-28 | 中国石油大学(北京) | Multi-camera cooperative monitoring method and device |
| WO2016149938A1 (en) * | 2015-03-26 | 2016-09-29 | 北京旷视科技有限公司 | Video monitoring method, video monitoring system and computer program product |
| CN106034222A (en) * | 2015-03-16 | 2016-10-19 | 深圳市贝尔信智能系统有限公司 | Stereometric object capturing method, apparatus and system thereof |
| CN106484108A (en) * | 2016-09-30 | 2017-03-08 | 天津大学 | Chinese characters recognition method based on double vision point gesture identification |
| CN107633215A (en) * | 2017-09-06 | 2018-01-26 | 南京小网科技有限责任公司 | The discriminating method of small micro- fuzzy object in a kind of high-altitude video monitoring |
| CN108156509A (en) * | 2017-12-28 | 2018-06-12 | 新华三云计算技术有限公司 | Video broadcasting method, device and user terminal |
| CN108363482A (en) * | 2018-01-11 | 2018-08-03 | 江苏四点灵机器人有限公司 | A method of the three-dimension gesture based on binocular structure light controls smart television |
| CN108921857A (en) * | 2018-06-21 | 2018-11-30 | 中国人民解放军61062部队科技装备处 | A kind of video image focus area dividing method towards monitoring scene |
| CN109858489A (en) * | 2019-01-15 | 2019-06-07 | 青岛海信网络科技股份有限公司 | A kind of alert method for early warning and equipment |
| CN109993935A (en) * | 2019-03-14 | 2019-07-09 | 华南理工大学 | A kind of device and method of construction machinery positioning and its safety zone monitoring |
| CN110770793A (en) * | 2018-12-29 | 2020-02-07 | 深圳市瑞立视多媒体科技有限公司 | An outlier processing method for 3D trajectory data and an optical motion capture method |
| US10671857B2 (en) | 2015-06-17 | 2020-06-02 | Zhejiang Dahua Technology Co., Ltd. | Methods and systems for video surveillance |
| CN114137517B (en) * | 2022-02-07 | 2022-05-10 | 北京中科蓝图科技有限公司 | Two-dimensional and three-dimensional integrated road detection method and device |
| CN116349750A (en) * | 2023-03-14 | 2023-06-30 | 贵州省茶叶研究所 | A kind of tea processing system and its processing method of self-control greening |
| CN117409340A (en) * | 2023-12-14 | 2024-01-16 | 上海海事大学 | UAV cluster multi-perspective fusion aerial photography port monitoring methods, systems and media |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107316434A (en) * | 2017-07-28 | 2017-11-03 | 惠州市伊涅科技有限公司 | Environment passes through quantity monitoring method |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1976445A (en) * | 2006-12-15 | 2007-06-06 | 上海鼎业电子科技有限公司 | Multi-camera monitoring system based on three-dimensional video frequency dynamic tracking and tracking method thereof |
| CN102592117A (en) * | 2011-12-30 | 2012-07-18 | 杭州士兰微电子股份有限公司 | Three-dimensional object identification method and system |
-
2012
- 2012-09-28 CN CN201210370526.XA patent/CN103716579B/en not_active Expired - Fee Related
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1976445A (en) * | 2006-12-15 | 2007-06-06 | 上海鼎业电子科技有限公司 | Multi-camera monitoring system based on three-dimensional video frequency dynamic tracking and tracking method thereof |
| CN102592117A (en) * | 2011-12-30 | 2012-07-18 | 杭州士兰微电子股份有限公司 | Three-dimensional object identification method and system |
Non-Patent Citations (2)
| Title |
|---|
| ANTONIO HERNANDEZ-VELA; NADEZHDA ZLATEVA; ALEXANDER MARINOV: "Graph Cuts Optimization for Multi-Limb Human Segmentation in Depth Maps", 《COMPUTER VISION AND PATTERN RECOGNITION, 2012 IEEE CONFERENCE ON》 * |
| C.STAUFFER; W. E. L. GRIMSON: "Adaptive background mixture models for real-time tracking", 《COMPUTER VISION AND PATTERN RECOGNITION, 1999.IEEE COMPUTER SOCIETY CONFERENCE ON.》 * |
Cited By (33)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104202533A (en) * | 2014-09-24 | 2014-12-10 | 中怡(苏州)科技有限公司 | Motion detection device and motion detection method |
| US10798366B2 (en) | 2014-09-24 | 2020-10-06 | Sercomm Corporation | Motion detection device and motion detection method |
| CN104202533B (en) * | 2014-09-24 | 2019-05-21 | 中磊电子(苏州)有限公司 | Motion detection device and movement detection method |
| CN106034222A (en) * | 2015-03-16 | 2016-10-19 | 深圳市贝尔信智能系统有限公司 | Stereometric object capturing method, apparatus and system thereof |
| US9792505B2 (en) | 2015-03-26 | 2017-10-17 | Beijing Kuangshi Technology Co., Ltd. | Video monitoring method, video monitoring system and computer program product |
| WO2016149938A1 (en) * | 2015-03-26 | 2016-09-29 | 北京旷视科技有限公司 | Video monitoring method, video monitoring system and computer program product |
| CN104935893A (en) * | 2015-06-17 | 2015-09-23 | 浙江大华技术股份有限公司 | Monitoring method and device |
| CN104954747A (en) * | 2015-06-17 | 2015-09-30 | 浙江大华技术股份有限公司 | Video monitoring method and device |
| CN104966062B (en) * | 2015-06-17 | 2021-03-23 | 浙江大华技术股份有限公司 | Video monitoring method and device |
| US10671857B2 (en) | 2015-06-17 | 2020-06-02 | Zhejiang Dahua Technology Co., Ltd. | Methods and systems for video surveillance |
| CN104902246A (en) * | 2015-06-17 | 2015-09-09 | 浙江大华技术股份有限公司 | Video monitoring method and device |
| CN104954747B (en) * | 2015-06-17 | 2020-07-07 | 浙江大华技术股份有限公司 | Video monitoring method and device |
| CN104935893B (en) * | 2015-06-17 | 2019-02-22 | 浙江大华技术股份有限公司 | Monitor method and apparatus |
| US11367287B2 (en) | 2015-06-17 | 2022-06-21 | Zhejiang Dahua Technology Co., Ltd. | Methods and systems for video surveillance |
| CN104966062A (en) * | 2015-06-17 | 2015-10-07 | 浙江大华技术股份有限公司 | Video monitoring method and device |
| CN105979203A (en) * | 2016-04-29 | 2016-09-28 | 中国石油大学(北京) | Multi-camera cooperative monitoring method and device |
| CN105872477A (en) * | 2016-05-27 | 2016-08-17 | 北京旷视科技有限公司 | Video monitoring method and system |
| CN106484108A (en) * | 2016-09-30 | 2017-03-08 | 天津大学 | Chinese characters recognition method based on double vision point gesture identification |
| CN107633215B (en) * | 2017-09-06 | 2021-03-02 | 南京小网科技有限责任公司 | Method for discriminating small and micro fuzzy target in high-altitude video monitoring |
| CN107633215A (en) * | 2017-09-06 | 2018-01-26 | 南京小网科技有限责任公司 | The discriminating method of small micro- fuzzy object in a kind of high-altitude video monitoring |
| CN108156509B (en) * | 2017-12-28 | 2021-06-08 | 新华三云计算技术有限公司 | Video playback method, device and user terminal |
| CN108156509A (en) * | 2017-12-28 | 2018-06-12 | 新华三云计算技术有限公司 | Video broadcasting method, device and user terminal |
| CN108363482A (en) * | 2018-01-11 | 2018-08-03 | 江苏四点灵机器人有限公司 | A method of the three-dimension gesture based on binocular structure light controls smart television |
| CN108921857A (en) * | 2018-06-21 | 2018-11-30 | 中国人民解放军61062部队科技装备处 | A kind of video image focus area dividing method towards monitoring scene |
| CN110770793A (en) * | 2018-12-29 | 2020-02-07 | 深圳市瑞立视多媒体科技有限公司 | An outlier processing method for 3D trajectory data and an optical motion capture method |
| CN110770793B (en) * | 2018-12-29 | 2023-04-14 | 深圳市瑞立视多媒体科技有限公司 | An outlier processing method for three-dimensional trajectory data and an optical motion capture method |
| CN109858489A (en) * | 2019-01-15 | 2019-06-07 | 青岛海信网络科技股份有限公司 | A kind of alert method for early warning and equipment |
| CN109993935A (en) * | 2019-03-14 | 2019-07-09 | 华南理工大学 | A kind of device and method of construction machinery positioning and its safety zone monitoring |
| CN109993935B (en) * | 2019-03-14 | 2022-03-29 | 华南理工大学 | Device and method for positioning construction machinery and monitoring safety area of construction machinery |
| CN114137517B (en) * | 2022-02-07 | 2022-05-10 | 北京中科蓝图科技有限公司 | Two-dimensional and three-dimensional integrated road detection method and device |
| CN116349750A (en) * | 2023-03-14 | 2023-06-30 | 贵州省茶叶研究所 | A kind of tea processing system and its processing method of self-control greening |
| CN117409340A (en) * | 2023-12-14 | 2024-01-16 | 上海海事大学 | UAV cluster multi-perspective fusion aerial photography port monitoring methods, systems and media |
| CN117409340B (en) * | 2023-12-14 | 2024-03-22 | 上海海事大学 | Unmanned aerial vehicle cluster multi-view fusion aerial photography port monitoring method, system and medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103716579B (en) | 2017-05-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103716579B (en) | Video monitoring method and system | |
| CA3094424C (en) | Safety monitoring and early-warning method for man-machine interaction behavior of underground conveyor belt operator | |
| CN104966062B (en) | Video monitoring method and device | |
| CN103824070B (en) | A kind of rapid pedestrian detection method based on computer vision | |
| CN104902246B (en) | Video monitoring method and device | |
| JP5603403B2 (en) | Object counting method, object counting apparatus, and object counting program | |
| CN104954747B (en) | Video monitoring method and device | |
| CN107657244B (en) | A multi-camera-based human fall behavior detection system and its detection method | |
| JP5180733B2 (en) | Moving object tracking device | |
| WO2014092552A2 (en) | Method for non-static foreground feature extraction and classification | |
| WO2018028103A1 (en) | Unmanned aerial vehicle power line inspection method based on characteristics of human vision | |
| CN104408746B (en) | A kind of passenger flow statistical system based on depth information | |
| KR101608889B1 (en) | Monitoring system and method for queue | |
| CN112633096B (en) | Passenger flow monitoring method and device, electronic equipment and storage medium | |
| JP2017174125A5 (en) | ||
| CN112235537A (en) | A kind of safety early warning method for on-site operation of substation | |
| WO2017183769A1 (en) | Device and method for detecting abnormal situation | |
| CN103761748A (en) | Method and device for detecting abnormal behaviors | |
| CN107396037B (en) | Video monitoring method and device | |
| CN106600628A (en) | Target object identification method and device based on infrared thermal imaging system | |
| KR20160109761A (en) | Method and System for Recognition/Tracking Construction Equipment and Workers Using Construction-Site-Customized Image Processing | |
| KR101030257B1 (en) | Pedestrian counting method and device using image of camera | |
| CN108111802B (en) | Video monitoring method and device | |
| KR101640527B1 (en) | Method and Apparatus for Monitoring Video for Estimating Size of Single Object | |
| CN119476963B (en) | Electric power operation safety risk identification method and system based on fine granularity detection |
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 | ||
| 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: 20170510 |