CN114820698A - Formation detection method and device for large-scale event moving phalanx - Google Patents
Formation detection method and device for large-scale event moving phalanx Download PDFInfo
- Publication number
- CN114820698A CN114820698A CN202210314674.3A CN202210314674A CN114820698A CN 114820698 A CN114820698 A CN 114820698A CN 202210314674 A CN202210314674 A CN 202210314674A CN 114820698 A CN114820698 A CN 114820698A
- Authority
- CN
- China
- Prior art keywords
- target
- image
- video frame
- target video
- diagonal
- 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
- 238000001514 detection method Methods 0.000 title claims abstract description 61
- 230000015572 biosynthetic process Effects 0.000 title claims abstract description 51
- 239000011159 matrix material Substances 0.000 claims abstract description 72
- 238000000034 method Methods 0.000 claims abstract description 56
- 230000033001 locomotion Effects 0.000 claims abstract description 46
- 230000000694 effects Effects 0.000 claims description 34
- 230000007613 environmental effect Effects 0.000 claims description 22
- 238000012545 processing Methods 0.000 claims description 21
- 238000004590 computer program Methods 0.000 claims description 17
- 230000003628 erosive effect Effects 0.000 claims description 7
- 230000009467 reduction Effects 0.000 claims description 6
- 230000011218 segmentation Effects 0.000 claims description 5
- 238000003384 imaging method Methods 0.000 abstract description 8
- 238000005755 formation reaction Methods 0.000 description 37
- 230000008569 process Effects 0.000 description 12
- 238000010586 diagram Methods 0.000 description 11
- 238000012937 correction Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 5
- 238000003491 array Methods 0.000 description 4
- 230000007547 defect Effects 0.000 description 3
- 238000011897 real-time detection Methods 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000005286 illumination Methods 0.000 description 2
- 230000000877 morphologic effect Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000007797 corrosion Effects 0.000 description 1
- 238000005260 corrosion Methods 0.000 description 1
- 238000006073 displacement reaction Methods 0.000 description 1
- 238000003708 edge detection Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000011946 reduction process Methods 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
- G06T5/30—Erosion or dilatation, e.g. thinning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/40—Image enhancement or restoration using histogram techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/80—Geometric correction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
- G06T7/246—Analysis of motion using feature-based methods, e.g. the tracking of corners or segments
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
- G06T7/269—Analysis of motion using gradient-based methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30196—Human being; Person
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Multimedia (AREA)
- Image Analysis (AREA)
Abstract
本发明提供一种大型活动的运动方阵的队形检测方法和装置,所述大型活动的运动方阵的队形检测方法,包括:获取目标环境下的目标运动方阵的目标视频;基于目标视频中的目标视频帧与对角灰度投影标准数组,生成所述目标视频帧对应的抖动因子;在抖动因子低于目标抖动阈值的情况下,基于所述目标视频帧,生成所述目标运动方阵的目标图像。本发明的大型活动的运动方阵的队形检测方法,基于目标视频中的目标视频帧与对角灰度投影标准数组,生成抖动因子,并基于抖动因子对目标视频帧进行筛选,以保留抖动幅度较低的目标视频帧,并对抖动幅度较低的目标视频帧进行处理,生成目标运动方阵的目标图像,有效提高了成像的清晰度,有助于提高检测结果。
The present invention provides a method and device for detecting the formation of a large-scale event moving square. The method for detecting the formation of a large-scale moving square includes: acquiring a target video of a target moving square in a target environment; The target video frame in the video and the diagonal grayscale projection standard array are used to generate the jitter factor corresponding to the target video frame; in the case where the jitter factor is lower than the target jitter threshold, the target motion is generated based on the target video frame. The target image of the square matrix. The method for detecting the formation of a large-scale moving square matrix of the present invention generates a jitter factor based on the target video frame in the target video and a standard array of diagonal grayscale projections, and screens the target video frame based on the jitter factor to preserve the jitter. A target video frame with a lower amplitude is processed, and a target video frame with a lower jitter amplitude is processed to generate a target image of the target moving square matrix, which effectively improves the imaging resolution and helps to improve the detection result.
Description
技术领域technical field
本发明涉及图像处理技术领域,尤其涉及一种大型活动的运动方阵的队形检测方法和装置。The invention relates to the technical field of image processing, and in particular, to a method and device for formation detection of a large-scale moving square matrix.
背景技术Background technique
大型活动中基于视频图像的运动方阵实时检测,主要为在室外场地中,通过架设在较高位置的全景相机捕捉视频图像,对面积较大的运动方阵队形进行实时检测。然而,相关技术中,由于拍摄设备(尤其是室外)容易受到强风或支撑架晃动等外界因素影响而产生抖动,从而造成视频画面的抖动和重影等问题,使画面中物体产生位置偏移和画面畸变,影响图像的清晰度,从而对检测结果造成影响。The real-time detection of moving squares based on video images in large-scale events is mainly to capture video images through panoramic cameras set up at high positions in outdoor venues, and to perform real-time detection of large-area moving squares. However, in the related art, since the photographing equipment (especially outdoors) is easily affected by external factors such as strong wind or shaking of the support frame, it will cause shaking, which will cause problems such as shaking and ghosting of the video picture, and cause the positional displacement of the objects in the picture. Picture distortion affects the clarity of the image, thus affecting the detection results.
发明内容SUMMARY OF THE INVENTION
本发明提供一种大型活动的运动方阵的队形检测方法和装置,用以解决现有技术中运动方阵的检测效果不佳的缺陷,提高检测效果。The invention provides a formation detection method and device for a large-scale moving square matrix, which are used to solve the defect of poor detection effect of the moving square matrix in the prior art and improve the detection effect.
本发明提供一种大型活动的运动方阵的队形检测方法,包括:The present invention provides a method for detecting the formation of a large-scale moving square matrix, comprising:
获取目标环境下的目标运动方阵的目标视频;Obtain the target video of the target moving square matrix in the target environment;
基于所述目标视频中的目标视频帧与对角灰度投影标准数组,生成所述目标视频帧对应的抖动因子;generating a jitter factor corresponding to the target video frame based on the target video frame and the diagonal grayscale projection standard array in the target video;
在所述抖动因子低于目标抖动阈值的情况下,基于所述目标视频帧,生成所述目标运动方阵的目标图像。In the case where the jitter factor is lower than a target jitter threshold, a target image of the target motion square matrix is generated based on the target video frame.
根据本发明提供的一种大型活动的运动方阵的队形检测方法,所述基于所述目标视频中的目标视频帧与对角灰度投影标准数组,生成所述目标视频帧对应的抖动因子,包括:According to a method for detecting the formation of a large-scale moving square matrix provided by the present invention, the jitter factor corresponding to the target video frame is generated based on the target video frame in the target video and the diagonal grayscale projection standard array. ,include:
基于所述目标视频帧的目标区域,生成所述目标区域的第一对角灰度投影数组,所述目标区域不包括所述运动方阵的特征;Based on the target area of the target video frame, a first diagonal grayscale projection array of the target area is generated, and the target area does not include the feature of the motion square;
基于所述第一对角灰度投影数组和所述对角灰度投影标准数组,生成所述抖动因子。The dithering factor is generated based on the first diagonal grayscale projection array and the diagonal grayscale projection criterion array.
根据本发明提供的一种大型活动的运动方阵的队形检测方法,所述基于所述第一对角灰度投影数组和所述对角灰度投影标准数组,生成所述抖动因子,包括:According to a method for detecting the formation of a large-scale moving square matrix provided by the present invention, the dithering factor is generated based on the first diagonal grayscale projection array and the diagonal grayscale projection standard array, including: :
应用公式:Apply the formula:
生成所述抖动因子,其中,θ为所述抖动因子,所述Gr_bi(m)为所述对角灰度投影标准数组中第m个位置的对角灰度投影标准值,所述Gr_ci(m)为所述第一对角灰度投影数组中第m个位置的第一对角灰度投影值,d为所述目标区域的边长。Generate the dither factor, where θ is the dither factor, the Gr_bi(m) is the diagonal grayscale projection standard value of the mth position in the diagonal grayscale projection standard array, and the Gr_ci(m ) is the first diagonal grayscale projection value of the mth position in the first diagonal grayscale projection array, and d is the side length of the target area.
根据本发明提供的一种大型活动的运动方阵的队形检测方法,所述基于所述目标视频帧,生成所述目标运动方阵的目标图像,包括:According to a method for detecting the formation of a large-scale activity moving square matrix provided by the present invention, the generating a target image of the target moving square matrix based on the target video frame includes:
将所述目标视频帧与所述目标背景模型进行帧差运算,生成第一图像;performing frame difference operation on the target video frame and the target background model to generate a first image;
对所述第一图像进行二值化处理和降噪处理,生成第三图像;performing binarization processing and noise reduction processing on the first image to generate a third image;
基于所述第三图像提取所述目标视频帧中的前景图像,并基于所述前景图像生成所述目标运动方阵的目标图像。A foreground image in the target video frame is extracted based on the third image, and a target image of the target motion square matrix is generated based on the foreground image.
根据本发明提供的一种大型活动的运动方阵的队形检测方法,所述基于所述前景图像生成所述目标运动方阵的目标图像,包括:According to a method for detecting the formation of a large-scale activity moving square matrix provided by the present invention, the generating the target image of the target moving square matrix based on the foreground image includes:
将所述前景图像转换为目标格式,生成第四图像;converting the foreground image into a target format to generate a fourth image;
对所述第四图像进行基于目标阴影阈值的阴影区域分割处理和腐蚀膨胀处理,生成所述目标运动方阵的目标图像。Performing shadow region segmentation processing and erosion expansion processing based on the target shadow threshold on the fourth image to generate a target image of the target movement square matrix.
根据本发明提供的一种大型活动的运动方阵的队形检测方法,在所述获取目标环境下的目标运动方阵的目标视频之前,所述方法还包括:According to a method for detecting the formation of a large-scale activity moving square array provided by the present invention, before the acquisition of the target video of the target moving square array in the target environment, the method further includes:
获取所述目标环境下,第一目标时间段内的多帧环境背景图像;acquiring multiple frames of environmental background images within the first target time period under the target environment;
基于所述多帧环境背景图像,生成目标背景模型;generating a target background model based on the multi-frame environment background images;
基于所述目标背景模型,生成所述目标背景模型对应的对角灰度投影标准数组。Based on the target background model, a standard array of diagonal grayscale projections corresponding to the target background model is generated.
本发明还提供一种大型活动的运动方阵的队形检测装置,包括:The present invention also provides a formation detection device for a large-scale activity moving square, including:
第一获取模块,用于获取目标环境下的目标运动方阵的目标视频;The first acquisition module is used to acquire the target video of the target motion square matrix under the target environment;
第一生成模块,用于基于所述目标视频中的目标视频帧与对角灰度投影标准数组,生成所述目标视频帧对应的抖动因子;a first generation module, configured to generate a jitter factor corresponding to the target video frame based on the target video frame and the diagonal grayscale projection standard array in the target video;
第二生成模块,用于在所述抖动因子低于目标抖动阈值的情况下,基于所述目标视频帧,生成所述目标运动方阵的目标图像。A second generating module, configured to generate a target image of the target motion square matrix based on the target video frame when the jitter factor is lower than the target jitter threshold.
本发明还提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上述任一种所述大型活动的运动方阵的队形检测方法的步骤。The present invention also provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, when the processor executes the program, the large-scale activities as described above are implemented by the processor. The steps of the formation detection method of the moving phalanx.
本发明还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一种所述大型活动的运动方阵的队形检测方法。The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the formation detection method for a large-scale activity moving square array as described above.
本发明还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如上述任一种所述大型活动的运动方阵的队形检测方法。The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the formation detection method for a large-scale activity moving square array as described above.
本发明提供的大型活动的运动方阵的队形检测方法和装置,基于目标视频中的目标视频帧与对角灰度投影标准数组,生成抖动因子,并基于抖动因子对目标视频帧进行筛选,以保留抖动幅度较低的目标视频帧,并对抖动幅度较低的目标视频帧进行处理,生成目标运动方阵的目标图像,克服了其他灰度投影法易受局部运动影响的缺陷,实现了对运动状态下的目标视频帧的有效抖动检测,显著提高了视频帧抖动检测的快速性和实时性,提高了目标图像的成像效果,从而有助于提高检测结果的准确性和精确性。The method and device for detecting the formation of a large-scale moving square matrix provided by the present invention generate a dither factor based on the target video frame in the target video and a standard array of diagonal grayscale projections, and screen the target video frame based on the dither factor, In order to retain the target video frame with low jitter amplitude, and process the target video frame with low jitter amplitude, the target image of the target motion square matrix is generated, which overcomes the defect that other grayscale projection methods are easily affected by local motion, and realizes the The effective jitter detection of target video frames in a moving state significantly improves the rapidity and real-time performance of video frame jitter detection, and improves the imaging effect of target images, thereby helping to improve the accuracy and precision of detection results.
附图说明Description of drawings
为了更清楚地说明本发明或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are of the present invention. For some embodiments of the present invention, for those of ordinary skill in the art, other drawings can also be obtained from these drawings without any creative effort.
图1是本发明提供的大型活动的运动方阵的队形检测方法的流程示意图之一;Fig. 1 is one of the schematic flow charts of the formation detection method of the large-scale activity moving square matrix provided by the present invention;
图2是本发明提供的大型活动的运动方阵的队形检测方法的流程示意图之二;Fig. 2 is the second schematic flow chart of the formation detection method of the large-scale activity moving square matrix provided by the present invention;
图3是本发明提供的大型活动的运动方阵的队形检测方法的原理示意图之一;Fig. 3 is one of the principle schematic diagrams of the formation detection method of the large-scale activity moving square matrix provided by the present invention;
图4是本发明提供的大型活动的运动方阵的队形检测方法的原理示意图之二;Fig. 4 is the second principle schematic diagram of the formation detection method of the large-scale activity moving square matrix provided by the present invention;
图5是本发明提供的大型活动的运动方阵的队形检测方法的原理示意图之三;5 is the third schematic diagram of the principle diagram of the formation detection method of the large-scale activity moving square array provided by the present invention;
图6是本发明提供的大型活动的运动方阵的队形检测方法的原理示意图之四;6 is the fourth schematic diagram of the formation detection method of the large-scale activity moving square array provided by the present invention;
图7是本发明提供的大型活动的运动方阵的队形检测方法的原理示意图之五;7 is the fifth schematic diagram of the formation detection method of the large-scale activity moving square array provided by the present invention;
图8是本发明提供的大型活动的运动方阵的队形检测方法的原理示意图之六;8 is the sixth schematic diagram of the principle diagram of the formation detection method of the large-scale activity moving square array provided by the present invention;
图9是本发明提供的大型活动的运动方阵的队形检测装置的结构示意图;9 is a schematic structural diagram of a formation detection device for a large-scale event moving square array provided by the present invention;
图10是本发明提供的电子设备的结构示意图。FIG. 10 is a schematic structural diagram of an electronic device provided by the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合本发明中的附图,对本发明中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention. , not all examples. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
下面结合图1至图6描述本发明的大型活动的运动方阵的队形检测方法。The formation detection method of the large-scale moving square array of the present invention will be described below with reference to FIGS. 1 to 6 .
该大型活动的运动方阵的队形检测方法的执行主体可以为服务器,或者为用户的终端,如手机或电脑等。The execution body of the method for detecting the formation of a large-scale moving square matrix may be a server, or a user's terminal, such as a mobile phone or a computer.
如图1所示,该大型活动的运动方阵的队形检测方法包括:步骤110、步骤120和步骤130。As shown in FIG. 1 , the method for detecting the formation of the large-scale moving square matrix includes:
步骤110、获取目标环境下的目标运动方阵的目标视频;
在该步骤中,目标环境为目标运动方阵所在的场景。In this step, the target environment is the scene where the target movement square is located.
目标运动方阵为多个运动方阵中需进行检测的方阵。The target moving square is a square that needs to be detected among the multiple moving squares.
目标视频为包括目标运动方阵的实时视频流,目标视频中可以包括多帧图像,该图像中包括目标运动方阵。The target video is a real-time video stream including the target moving square, and the target video may include multiple frames of images, and the image includes the target moving square.
例如,在运动会中,目标环境即为运动场的环境,运动方阵即为运动员所组成的运动方阵。For example, in a sports meeting, the target environment is the environment of the sports field, and the sports square is the sports square composed of athletes.
可以理解的是,运动方阵可以处于运动状态。It can be understood that the moving square can be in a moving state.
目标视频可以通过图像传感器进行采集,其中,图像传感器可以为全景相机或其他图像传感器,本申请不做限定。The target video may be collected by an image sensor, where the image sensor may be a panoramic camera or other image sensor, which is not limited in this application.
在实际执行过程中,需要将图像传感器架设于较高的位置,以保证能采集整个目标运动方阵的图像。In the actual implementation process, the image sensor needs to be set up in a high position to ensure that the image of the entire target moving square can be collected.
在一些实施例中,在步骤110之后,该方法还可以包括:对目标视频的每一帧视频帧进行畸变矫正。In some embodiments, after
在该实施例中,畸变矫正包括径向畸变和切向畸变。In this embodiment, the distortion correction includes radial distortion and tangential distortion.
可以通过公式:You can use the formula:
其中(x2+y2=r2); where (x 2 +y 2 =r 2 );
进行径向畸变矫正,Perform radial distortion correction,
其中,(x′、y′)表示目标视频中每一帧视频帧的畸变后的像素点坐标,(x,y)表示矫正畸变后的像素点坐标,k1、k2和k3是由图像传感器标定得到的畸变参数。Among them, (x', y') represents the distorted pixel coordinates of each video frame in the target video, (x, y) represents the corrected and distorted pixel coordinates, and k1, k2 and k3 are calibrated by the image sensor. The resulting distortion parameters.
可以通过公式:You can use the formula:
其中(x2+y2=r2); where (x 2 +y 2 =r 2 );
进行切向畸变矫正,tangential distortion correction,
其中,(x′、y′)表示目标视频中每一帧视频帧的畸变后的像素点坐标,(x,y)表示矫正畸变后的像素点坐标,p1和p3是由图像传感器标定得到的畸变参数。Among them, (x', y') represents the distorted pixel coordinates of each video frame in the target video, (x, y) represents the corrected and distorted pixel coordinates, and p1 and p3 are calibrated by the image sensor. Distortion parameter.
需要说明的是,畸变参数可由通过对图像传感器进行标定所得到。It should be noted that the distortion parameter can be obtained by calibrating the image sensor.
在实际执行过程中,可在步骤110之前,优先对图像传感器进行标定,以获取图像传感器的畸变参数和内参矩阵。In the actual execution process, prior to step 110, the image sensor may be calibrated preferentially to obtain the distortion parameter and the internal parameter matrix of the image sensor.
在该实施例中,通过对目标视频进行畸变矫正,可以避免在使用全景相机进行图像采集过程中,所造成的画面畸变,有助于提高成像的效果和成像的真实性。In this embodiment, by performing distortion correction on the target video, it is possible to avoid picture distortion caused during the image acquisition process using the panoramic camera, which helps to improve the imaging effect and the imaging authenticity.
在获取目标视频后,可将目标视频存储于本地服务器或云端服务器中,在需要是进行调取即可。After acquiring the target video, the target video can be stored in the local server or the cloud server, and can be retrieved when needed.
步骤120、基于目标视频中的目标视频帧与对角灰度投影标准数组,生成目标视频帧对应的抖动因子;Step 120, based on the target video frame and the diagonal grayscale projection standard array in the target video, generate the corresponding jitter factor of the target video frame;
在该步骤中,目标视频帧为需要进行检测的视频帧。In this step, the target video frame is the video frame that needs to be detected.
目标视频帧可以为目标视频中的任意一张图像帧。The target video frame can be any image frame in the target video.
对角灰度投影标准数组为图像在未发生抖动的情况下的对角灰度投影数值,也即对角灰度投影值的初始值。The diagonal grayscale projection standard array is the diagonal grayscale projection value of the image without dithering, that is, the initial value of the diagonal grayscale projection value.
对角灰度投影标准数组为在进行检测之前,提前确定的数值,本发明将在后续实施例中,对角灰度投影标准数组的确定步骤进行详细说明,在此先不做赘述。The diagonal grayscale projection standard array is a value determined in advance before detection. The present invention will describe the steps of determining the diagonal grayscale projection standard array in detail in subsequent embodiments, which will not be repeated here.
抖动因子用于表征目标视频的抖动程度。The jitter factor is used to characterize the jitter degree of the target video.
可以理解的是,受外界环境因素的影响,同一目标视频中的不同视频帧,可能具有不同的抖动程度。It can be understood that, affected by external environmental factors, different video frames in the same target video may have different degrees of jitter.
在该实施例中,基于目标视频中的目标视频帧以及对角灰度投影标准数组,可以确定目标视频帧对应的抖动因子。In this embodiment, the jitter factor corresponding to the target video frame can be determined based on the target video frame in the target video and the diagonal grayscale projection standard array.
下面对该步骤的具体实现方式进行说明。The specific implementation manner of this step will be described below.
在一些实施例中,步骤120可以包括:In some embodiments, step 120 may include:
基于目标视频帧的目标区域,生成目标区域的第一对角灰度投影数组,目标区域不包括运动方阵的特征;Based on the target area of the target video frame, a first diagonal grayscale projection array of the target area is generated, and the target area does not include the feature of the moving square;
基于第一对角灰度投影数组和对角灰度投影标准数组,生成抖动因子。A dithering factor is generated based on the first diagonal grayscale projection array and the diagonal grayscale projection criterion array.
在该实施例中,目标区域为目标视频帧中的除运动方阵区域外的任意区域,目标区域的数量可以为一个或者多个。In this embodiment, the target area is any area in the target video frame except the moving square matrix area, and the number of target areas may be one or more.
目标区域可以基于用户自定义。The target area can be customized based on the user.
例如,可以将目标区域设置为目标视频帧四个角上的正方形区域,各正方形区域的边长为d;或者将目标区域设置为目标视频帧上任意两个角上的正方形区域;或者将目标区域设置为目标视频帧上任意一个角上的正方形区域。For example, the target area can be set as a square area on the four corners of the target video frame, and the side length of each square area is d; or the target area can be set as a square area on any two corners of the target video frame; or the target The area is set to a square area on either corner of the target video frame.
通过选择目标视频帧四个角上的正方形区域,可以避免因视频帧中部位置的体积较大的运动方阵的运动而给抖动检测带来影响。By selecting the square areas on the four corners of the target video frame, it is possible to avoid the influence on the shake detection caused by the movement of the large moving square matrix in the middle of the video frame.
第一对角灰度投影数组为目标视频中的目标视频帧所对应的实际对角灰度投影值。The first diagonal grayscale projection array is the actual diagonal grayscale projection value corresponding to the target video frame in the target video.
第一对角灰度投影数组可以用Gr表示,其中,第一对角灰度投影数组的数量与目标区域的数量一致。The first diagonal grayscale projection array may be represented by Gr, wherein the number of the first diagonal grayscale projection array is consistent with the number of target regions.
例如,在将目标视频帧四个角上的正方形区域确定为目标区域的情况下,计算出目标视频帧的四个目标区域的第一对角灰度投影数组,分别用Gr_c1、Gr_c2、Gr_c3和Gr_c4表示。其中,Gr_c1用于表征目标视频左上角区域对角灰度投影数组,Gr_c2用于表征目标视频右上角区域对角灰度投影数组,Gr_c3用于表征目标视频右下角区域对角灰度投影数组,Gr_c4用于表征目标视频左下角区域对角灰度投影数组。For example, in the case of determining the square area on the four corners of the target video frame as the target area, calculate the first diagonal grayscale projection array of the four target areas of the target video frame, using Gr_c1, Gr_c2, Gr_c3 and Gr_c4 representation. Among them, Gr_c1 is used to characterize the diagonal grayscale projection array of the upper left corner of the target video, Gr_c2 is used to characterize the diagonal grayscale projection array of the upper right corner of the target video, and Gr_c3 is used to characterize the diagonal grayscale projection array of the lower right corner of the target video. Gr_c4 is used to characterize the diagonal grayscale projection array in the lower left corner of the target video.
然后分别计算当前目标视频帧的四个目标区域的第一对角灰度投影数组与对角灰度投影标准数组之间的加权差方因子。Then, the weighted variance factors between the first diagonal grayscale projection array and the diagonal grayscale projection standard array of the four target regions of the current target video frame are calculated respectively.
在一些实施例中,可选择四个目标区域的加权差方因子中的最大值作为抖动因子θ,以反应最真实的晃动情况。In some embodiments, the maximum value among the weighted variance factors of the four target regions can be selected as the jitter factor θ to reflect the most real shaking situation.
也即,That is,
θmax=max(θ1,θ2,θ3,θ4);θ max = max(θ 1 , θ 2 , θ 3 , θ 4 );
其中,θmax为抖动因子,θ1,θ2,θ3,θ4分别四个目标区域所对应的加权差方因子。Among them, θ max is the jitter factor, and θ 1 , θ 2 , θ 3 , and θ 4 are the weighted variance factors corresponding to the four target regions, respectively.
可以理解的是,在对角灰度投影标准数组为多组的情况下,分别将第一对角灰度投影数组与各对角灰度投影标准数组进行计算,并将得到的多个抖动因子中的最大值作为最终的抖动因子。It can be understood that in the case where the diagonal grayscale projection standard arrays are multiple groups, the first diagonal grayscale projection array and each diagonal grayscale projection standard array are calculated respectively, and the obtained multiple dither factors are calculated. The maximum value in is used as the final jitter factor.
例如,在对角灰度投影标准数组为1000组的情况下,则分别将第一对角灰度投影数组与1000组对角灰度投影标准数组进行计算,并选择最大值作为抖动因子。For example, in the case of 1000 sets of diagonal grayscale projection standard arrays, the first diagonal grayscale projection array and 1000 sets of diagonal grayscale projection standard arrays are calculated respectively, and the maximum value is selected as the dithering factor.
在一些实施例中,基于第一对角灰度投影数组和对角灰度投影标准数组,生成抖动因子,包括:In some embodiments, the dithering factor is generated based on the first diagonal grayscale projection array and the diagonal grayscale projection criterion array, including:
应用公式:Apply the formula:
生成抖动因子,其中,θ为抖动因子,Gr_bi(m)为目标区域i所对应的对角灰度投影标准数组中第m个位置的对角灰度投影标准值,Gr_ci(m)为目标区域i所对应的第一对角灰度投影数组中第m个位置的第一对角灰度投影值,d为目标区域的边长,“?m≤d-1:2d-m-1”用于确定公式中分母位置处的m的取值,具体为:在m≤d-1时,分母“m+1”中的m=d-1;否则,分母“m+1”中的m=2d-m-1。Generate a dither factor, where θ is the dither factor, Gr_bi(m) is the diagonal grayscale projection standard value of the mth position in the diagonal grayscale projection standard array corresponding to the target area i, and Gr_ci(m) is the target area. The first diagonal grayscale projection value of the mth position in the first diagonal grayscale projection array corresponding to i, d is the side length of the target area, "?m≤d-1:2d-m-1" uses To determine the value of m at the denominator position in the formula, specifically: when m≤d-1, m=d-1 in the denominator "m+1"; otherwise, m=d in the denominator "m+1" 2d-m-1.
在得到抖动因子后,即可执行步骤130。After the jitter factor is obtained,
发明人在研发过程中发现,相关技术中,存在基于特征点匹配的方法以及基于光流的方法检测抖动,但均依赖于检测出的特征点,通常会涉及非常大的计算量,且特征点检测的好坏也会影响光流算法的准确性,并且画面中物体的移动也会使得光流算法产生错误的估计,从而造成最终显示的图像效果不佳。During the research and development process, the inventor found that in the related art, there are methods based on feature point matching and methods based on optical flow to detect jitter, but both rely on the detected feature points, which usually involve a very large amount of calculation, and the feature points The quality of detection will also affect the accuracy of the optical flow algorithm, and the movement of objects in the picture will also cause the optical flow algorithm to produce wrong estimates, resulting in poor final image quality.
而在本申请中,通过提取目标视频帧的目标区域(如目标视频帧的四个角)进行抖动检测,可以有效避免受局部运动的影响(如受目标视频帧中央运动方阵的影响),适用于动态拍摄环境。In this application, by extracting the target area of the target video frame (such as the four corners of the target video frame) for jitter detection, the influence of local motion (such as the influence of the central motion square of the target video frame) can be effectively avoided, Suitable for dynamic shooting environments.
除此之外,选取抖动程度最大的值作为整个目标视频帧的抖动程度,可以有效避免目标视频帧中的运动目标对抖动检测的干扰。In addition, selecting the value with the largest jitter degree as the jitter degree of the entire target video frame can effectively avoid the interference of the moving objects in the target video frame to the jitter detection.
步骤130、在抖动因子低于目标抖动阈值的情况下,基于目标视频帧,生成目标运动方阵的目标图像。
在该步骤中,目标抖动阈值为图像在近似认为于静止状态下的最大抖动值。In this step, the target jitter threshold is the maximum jitter value at which the image is approximately considered to be in a static state.
在抖动因子低于目标抖动阈值的情况下,则该抖动因子对应的目标视频帧可近似认为是静止的。When the jitter factor is lower than the target jitter threshold, the target video frame corresponding to the jitter factor can be approximately considered to be still.
目标图像为对原始图像进行处理后的,包括目标运动方阵中的运动行人以及行人的阴影的图像。The target image is an image of the moving pedestrian and the shadow of the pedestrian in the target moving square matrix after processing the original image.
目标图像用于表征目标运动方阵的实时状态。The target image is used to characterize the real-time state of the target moving matrix.
在该实施例中,在目标视频帧的抖动因子低于目标抖动阈值的情况下,则近似认为该目标视频帧为非抖动的,则对该目标视频帧进行下一步的处理。In this embodiment, when the jitter factor of the target video frame is lower than the target jitter threshold, it is approximately considered that the target video frame is non-jitter, and the next step is performed on the target video frame.
在另一些实施例中,在目标视频帧的抖动因子不低于目标抖动阈值的情况下,则认为该目标视频帧的抖动程度较大,则跳过该抖动因子对应的目标视频帧,检测下一帧视频帧。In other embodiments, if the jitter factor of the target video frame is not lower than the target jitter threshold, it is considered that the jitter degree of the target video frame is relatively large, the target video frame corresponding to the jitter factor is skipped, and the next A frame of video frame.
下面,对本步骤中目标图像的生成方式进行具体说明。Next, the generation method of the target image in this step will be described in detail.
在一些实施例中,步骤130还可以包括:In some embodiments,
将目标视频帧与目标背景模型进行帧差运算,生成第一图像;Perform a frame difference operation on the target video frame and the target background model to generate a first image;
对第一图像进行二值化处理和降噪处理,生成第三图像;Perform binarization processing and noise reduction processing on the first image to generate a third image;
基于第三图像提取目标视频帧中的前景图像,并基于前景图像生成目标运动方阵的目标图像。The foreground image in the target video frame is extracted based on the third image, and the target image of the target motion square matrix is generated based on the foreground image.
在该实施例中,前景图像包括目标运动方阵中的运动行人以及目标运动方阵中的运动行人在地面上的投影。In this embodiment, the foreground image includes moving pedestrians in the target movement square and projections of the moving pedestrians in the target movement square on the ground.
在实际执行过程中,对于未发生抖动的目标视频帧,可先进行前景区域粗粒度检测。In the actual execution process, for the target video frame without jitter, the coarse-grained detection of the foreground area can be performed first.
例如,如图4所示,将目标视频帧与目标背景模型进行帧差运算,以生成第一图像。For example, as shown in FIG. 4 , a frame difference operation is performed between the target video frame and the target background model to generate the first image.
其中,目标背景模型为提前建立的模型,将在后续实施例中对目标背景模型的建立步骤进行说明,在此先不做赘述。The target background model is a model established in advance, and the steps for establishing the target background model will be described in subsequent embodiments, which will not be described here.
接着对帧差后的结果首先进行二值化处理,再进行降噪处理,消除第一图像的噪声和较小运动物体入侵干扰的影响,以生成第三图像,如图5所示,该第三图像用于表征目标视频帧中的运动方阵的轮廓特征;Then, the result after the frame difference is first subjected to binarization processing, and then noise reduction processing is performed to eliminate the noise of the first image and the influence of the intrusion interference of small moving objects, so as to generate a third image, as shown in FIG. The three images are used to characterize the contour features of the moving square in the target video frame;
其中,降噪处理可以包括腐蚀与膨胀的基本形态学操作。Among them, the noise reduction process can include basic morphological operations of erosion and expansion.
然后,基于第三图像提取目标视频帧中处于第三图像对应的轮廓内的前景图像,基于前景区域生成目标图像,如图8所示。Then, a foreground image in the target video frame within the contour corresponding to the third image is extracted based on the third image, and a target image is generated based on the foreground area, as shown in FIG. 8 .
此时的前景区域将会包含方阵中的行人以及行人的阴影,如图6所示。The foreground area at this time will contain pedestrians and their shadows in the square matrix, as shown in Figure 6.
根据本发明实施例提供的大型活动的运动方阵的队形检测方法,通过结合背景建模法与帧差法进行运动目标检测,从而实现了细节上的改进。According to the method for detecting the formation of a large-scale moving square array provided by the embodiment of the present invention, the moving target detection is performed by combining the background modeling method and the frame difference method, thereby realizing the improvement in detail.
在一些实施例中,基于前景图像生成目标运动方阵的目标图像,还可以包括:In some embodiments, generating the target image of the target motion square matrix based on the foreground image may further include:
将前景图像转换为目标格式,生成第四图像;Convert the foreground image to the target format to generate a fourth image;
对第四图像进行基于目标阴影阈值的阴影区域分割处理和腐蚀膨胀处理,生成目标运动方阵的目标图像。The fourth image is subjected to shadow region segmentation and erosion expansion processing based on the target shadow threshold to generate a target image of the target movement square matrix.
在该实施例中,还可以对通过前景区域粗粒度检测后的前景图像进行色彩空间转换和方阵区域精细检测,以消除前景区域的阴影,使前景的提取更加精确。In this embodiment, color space conversion and square matrix area fine detection can also be performed on the foreground image after the coarse-grained detection of the foreground area, so as to eliminate the shadow of the foreground area and make the foreground extraction more accurate.
其中,目标阴影阈值可以基于用户自定义。Among them, the target shadow threshold can be user-defined.
例如,对第三图像进行RGB色彩空间到HSV色彩空间的转换,生成第四图像。其中,HSV色彩空间包括色彩(H),饱和度(S)和亮度(V)。For example, the third image is converted from the RGB color space to the HSV color space to generate the fourth image. Among them, the HSV color space includes color (H), saturation (S) and brightness (V).
通过转换为HSV色彩空间,可以基于亮度值有效区分第三图像中前景区域中的方阵区域与阴影区域。如图7所示,二者在亮度值(V空间)的区别较明显。By converting to the HSV color space, the square matrix area and the shadow area in the foreground area in the third image can be effectively distinguished based on the luminance value. As shown in Figure 7, the difference between the two in luminance value (V space) is obvious.
利用第三图像在HSV色彩空间的分布特性,在对第三图像做RBG颜色空间到HSV颜色空间的转换生成第四图像后,对第四图像中的前景区域内图像在亮度V空间设定阈值进行阴影区域的分割,分割后再进行腐蚀膨胀操作,从而得到消除阴影干扰后的目标图像,如图8所示。Using the distribution characteristics of the third image in the HSV color space, after the third image is converted from the RBG color space to the HSV color space to generate the fourth image, the threshold value is set for the image in the foreground area in the fourth image in the brightness V space The shadow area is segmented, and then the erosion and expansion operation is performed to obtain the target image after the shadow interference is eliminated, as shown in Figure 8.
在该实施例中,结合畸变矫正和腐蚀膨胀等方法,克服了室外自然条件下抖动、光照、阴影等干扰的影响,最终实现基于视频帧的运动方阵队形实时检测。In this embodiment, combined with methods such as distortion correction and corrosion expansion, the influence of disturbances such as jitter, illumination, and shadow under natural outdoor conditions is overcome, and the real-time detection of moving square formations based on video frames is finally realized.
在一些实施例中,该方法还可以包括:每隔第三目标时间段更新目标阴影阈值。In some embodiments, the method may further include: updating the target shadow threshold every third target time period.
例如,还可以利用前景区域(方阵和阴影区域)在亮度空间V上的数值分布,由先验知识确定阴影区域的像素点数值在V空间的值域在50-100之间,则取V空间数值分布的10-200的区间,利用最小二乘法拟合曲线,取波谷的最小值作为分割阴影区域的目标阴影阈值Ψ,同时也每隔第三目标时间段更新目标阴影阈值Ψ。For example, the value distribution of the foreground area (square matrix and shadow area) in the brightness space V can also be used, and the value of the pixel point in the shadow area is determined by prior knowledge in the range of 50-100 in the V space, then take V In the interval of 10-200 of the spatial value distribution, the least squares method is used to fit the curve, and the minimum value of the trough is taken as the target shadow threshold Ψ for dividing the shadow area, and the target shadow threshold Ψ is also updated every third target time period.
将亮度空间V对应的图像像素点值低于目标阴影阈值Ψ的值全部置为0,再依次进行腐蚀与膨胀的基本形态学操作,消除图像噪声的影响,然后提取出更为精细的前景区域,以及目标图像。Set the image pixel values corresponding to the brightness space V lower than the target shadow threshold Ψ to 0, and then perform the basic morphological operations of erosion and expansion in turn to eliminate the influence of image noise, and then extract a finer foreground area. , and the target image.
根据本发明实施例提供的大型活动的运动方阵的队形检测方法,通过“自适应“的目标阴影阈值更新方式,实时更新目标阴影阈值,可以基于不同时间下的光照强度,及时将目标阴影阈值调整为最佳阈值,从而避免了固定阈值带来的无法在自然光照强度发生变化时仍然保持最好效果的情况,也消除了室外自然环境中图像阴影易受光照强度变化的影响的问题,使得可以适应长时间室外自然条件下的运动方阵队形检测,有助于提高阴影区域的分割效果,从而提高目标图像的成像效果,进而提升检测效果。According to the method for detecting the formation of a large-scale moving square array provided by the embodiment of the present invention, the target shadow threshold is updated in real time through the "adaptive" target shadow threshold update method, and the target shadow can be updated in time based on the light intensity at different times. The threshold is adjusted to the optimal threshold, which avoids the situation that the fixed threshold cannot maintain the best effect when the natural light intensity changes, and also eliminates the problem that the shadow of the image in the outdoor natural environment is easily affected by the change of light intensity. It can adapt to the detection of moving square formations under natural outdoor conditions for a long time, which helps to improve the segmentation effect of the shadow area, thereby improving the imaging effect of the target image, thereby improving the detection effect.
在本步骤中,通过对目标视频帧进行多次处理,可以有效对其进行降噪,并消除阴影干扰,从而得到清晰的目标图像,有助于提高检测结果的准确性。In this step, by performing multiple processing on the target video frame, noise reduction can be effectively performed, and shadow interference can be eliminated, thereby obtaining a clear target image, which helps to improve the accuracy of the detection result.
如图2所示,在一些实施例中,在步骤130中,在确定抖动因子低于目标抖动阈值之后,该方法还可以包括:As shown in FIG. 2, in some embodiments, in
获取目标视频帧对应的清晰度;Obtain the resolution corresponding to the target video frame;
在清晰度不低于清晰度阈值的情况下,基于目标视频帧,生成目标运动方阵的目标图像。A target image of the target motion square matrix is generated based on the target video frame when the resolution is not lower than the resolution threshold.
在清晰度低于清晰度阈值的情况下,则检测下一帧目标视频帧的抖动因子。When the resolution is lower than the resolution threshold, the jitter factor of the next target video frame is detected.
在该实施例中,清晰度阈值为图像在近似认为清晰的状态下的清晰度的最小值。In this embodiment, the sharpness threshold is the minimum value of the sharpness of the image in a state approximately considered sharp.
清晰度阈值可以基于用户自定义。The sharpness threshold can be customized based on the user.
在实际执行过程中,可采用Laplacian梯度函数对目标视频帧的清晰度进行评价。In the actual execution process, the Laplacian gradient function can be used to evaluate the clarity of the target video frame.
具体可通过公式:Specifically, the formula can be used:
确定,其中,M、N分别代表目标视频帧的宽和高,T是给定的边缘检测阈值,z(x,y)是像素点(x,y)处Laplacian算子的卷积。Determine, where M and N represent the width and height of the target video frame, respectively, T is the given edge detection threshold, and z(x,y) is the convolution of the Laplacian operator at the pixel point (x,y).
Laplacian算子矩阵定义如以下公式:The Laplacian operator matrix is defined as the following formula:
可以理解的是,对于已经转为灰度图的目标视频帧,输入该卷积的目标视频帧的图像越清晰,Laplacian梯度函数值越大。It can be understood that, for the target video frame that has been converted to a grayscale image, the clearer the image of the target video frame input to the convolution is, the larger the Laplacian gradient function value is.
在得到目标视频帧对应的清晰度Ωt后,将该清晰度与清晰度阈值Ω进行比较,在Ωt≥Ω的情况下,则确定该目标视频帧是清晰的,则基于该目标视频帧,生成所述目标运动方阵的目标图像。After obtaining the definition Ω t corresponding to the target video frame, compare the definition with the definition threshold Ω, in the case of Ω t ≥Ω, it is determined that the target video frame is clear, then based on the target video frame , and generate the target image of the target motion square matrix.
在另一些实施例中,在Ωt<Ω的情况下,则确定该目标视频帧是不清晰的,则跳过该目标视频帧,检测下一帧视频帧的抖动因子。In other embodiments, in the case of Ω t <Ω, it is determined that the target video frame is unclear, the target video frame is skipped, and the jitter factor of the next video frame is detected.
在该实施例中,通过检测目标视频帧的清晰度,在满足抖动因子低于目标抖动阈值的基础上,对不满足清晰度要求的目标视频帧进行跳过,可以避免因相机抖动、过曝等情况对方阵检测造成影响,从而提高成像的清晰度,以提高检测结果的准确性。In this embodiment, by detecting the clarity of the target video frame, on the basis that the jitter factor is lower than the target jitter threshold, the target video frame that does not meet the definition requirement is skipped, so as to avoid camera shake and overexposure. In other cases, the detection of the square array is affected, so as to improve the clarity of the imaging and improve the accuracy of the detection results.
根据本发明实施例提供的大型活动的运动方阵的队形检测方法,基于目标视频中的目标视频帧与对角灰度投影标准数组,生成抖动因子,并基于抖动因子对目标视频帧进行筛选,以保留抖动幅度较低的目标视频帧,并对抖动幅度较低的目标视频帧进行处理,生成目标运动方阵的目标图像,克服了其他灰度投影法易受局部运动影响的缺陷,实现了对运动状态下的目标视频帧的有效抖动检测,显著提高了视频帧抖动检测的快速性和实时性,提高了目标图像的成像效果,从而有助于提高检测结果的准确性和精确性。According to the method for detecting the formation of a large-scale moving square matrix provided by the embodiment of the present invention, based on the target video frame in the target video and the diagonal grayscale projection standard array, a jitter factor is generated, and the target video frame is screened based on the jitter factor. , in order to retain the target video frame with low jitter amplitude, and process the target video frame with low jitter amplitude to generate the target image of the target motion square matrix, which overcomes the defect that other grayscale projection methods are easily affected by local motion, and realizes the It can effectively detect the jitter of the target video frame in the moving state, significantly improve the rapidity and real-time performance of the video frame jitter detection, and improve the imaging effect of the target image, thereby helping to improve the accuracy and precision of the detection result.
下面通过具体实施例,对目标背景模型的生成步骤进行说明。The steps of generating the target background model will be described below through specific embodiments.
在一些实施例中,在步骤110之前,该方法还包括:In some embodiments, prior to step 110, the method further includes:
获取目标环境下,第一目标时间段内的多帧环境背景图像;Obtain multiple frames of environmental background images within the first target time period under the target environment;
基于多帧环境背景图像,生成目标背景模型;Generate a target background model based on multiple frames of environmental background images;
基于目标背景模型,生成目标背景模型对应的对角灰度投影标准数组。Based on the target background model, a standard array of diagonal grayscale projections corresponding to the target background model is generated.
在该实施例中,第一目标时间段可以基于用户自定义。In this embodiment, the first target time period may be user-defined.
环境背景图像为与目标视频相同的背景图像。The ambient background image is the same background image as the target video.
环境背景图像可以由图像传感器采集,如通过全景相机进行采集。The background image of the environment can be acquired by an image sensor, such as by a panoramic camera.
环境背景图像的数量可以基于用户自定义,如设置为1000帧。The number of ambient background images can be customized based on the user, such as set to 1000 frames.
在采集到环境背景图像后,可优先对环境背景图像进行畸变矫正,具体实现方式与上述实施例相同,在此不做赘述。After the environmental background image is collected, distortion correction may be performed on the environmental background image preferentially, and the specific implementation method is the same as that in the above-mentioned embodiment, and details are not described here.
例如,在实际执行过程中,可首先使用高斯背景模型对连续的前1000帧环境背景图像进行建模,以生成目标背景模型。For example, in the actual execution process, a Gaussian background model can be used to model the continuous first 1000 frames of environment background images to generate a target background model.
在生成目标背景模型后,可将目标背景模型保存于本地服务器或云端服务器中,在需要是进行调用即可。After generating the target background model, you can save the target background model in the local server or cloud server, and call it when needed.
下面对基于目标背景模型,生成目标背景模型对应的对角灰度投影标准数组的具体执行方式进行说明。The specific implementation manner of generating the diagonal grayscale projection standard array corresponding to the target background model based on the target background model will be described below.
首先将每一帧环境背景图像转为灰度图,取背景模型图像的左上、左下、右上和右下四个角分别取四块相同大小的边长为d的正方形区域作为目标区域,以避免未来画面中部位置的体积较大的运动目标给抖动检测带来影响。First, convert each frame of the environmental background image into a grayscale image, and take four square areas of the same size with a side length of d from the upper left, lower left, upper right and lower right corners of the background model image as the target area to avoid In the future, the larger moving object in the middle of the screen will affect the shake detection.
需要说明的是,本实施例中的目标区域需与上述实施例中所提取的目标视频帧中的目标区域的位置和数量保持一致。It should be noted that, the target area in this embodiment needs to be consistent with the position and quantity of the target area in the target video frame extracted in the above embodiment.
分别对四个目标区域进行直方图均衡化处理。Histogram equalization processing is performed on the four target regions respectively.
具体可通过公式:Specifically, the formula can be used:
进行直方图均衡化处理,其中,f是单调非线性映射,GI代表环境背景图像I中像素点的灰度值,L表示灰度级数,In是环境背景图像中像素点的个数,HI表示环境背景图像I的灰度直方图分布,u表示灰度值。Perform histogram equalization processing, where f is a monotonic nonlinear mapping, G I represents the gray value of the pixels in the environmental background image I, L represents the gray level, and I n is the number of pixels in the environmental background image. , H I represents the gray histogram distribution of the environmental background image I, and u represents the gray value.
L通常取256。L usually takes 256.
在进行直方图均衡化处理后,接着对经过直方图均衡化后的四个区域进行灰度投影,以生成灰度投影数组标准值。After the histogram equalization process is performed, then grayscale projection is performed on the four regions after the histogram equalization, so as to generate a grayscale projection array standard value.
如图3所示,其中,灰度投影数组标准值用于表征当前环境背景图像四角区域在横纵方向上的综合灰度信息。As shown in FIG. 3 , the standard value of the grayscale projection array is used to represent the comprehensive grayscale information in the horizontal and vertical directions of the four corner areas of the current environmental background image.
在一些实施例中,可以通过公式:In some embodiments, the formula can be used:
计算出环境背景图像的灰度均值,其中,I_mean表示环境背景图像中像素点的灰度值,表示环境背景图像中像素点(x,y)的灰度值,d表示每一个目标区域的边长,In是环境背景图像中像素点的个数。Calculate the gray mean value of the environmental background image, where I_mean represents the gray value of the pixel in the environmental background image, Represents the gray value of the pixel ( x , y) in the environmental background image, d represents the side length of each target area, and In is the number of pixels in the environmental background image.
在得到环境背景图像的灰度均值后,基于灰度均值,通过公式:After obtaining the gray mean value of the environmental background image, based on the gray mean value, the formula is:
即可计算得到各目标区域对应的对角灰度投影数组标准值;Then the standard value of the diagonal grayscale projection array corresponding to each target area can be calculated;
其中,Gr_b1代表环境背景图像左上角区域的对角灰度投影数组第k个位置的标准值,d表示目标区域的边长,表示环境背景图像中像素点(i,j)的灰度值。Among them, Gr_b1 represents the standard value of the k-th position of the diagonal grayscale projection array in the upper left corner of the environmental background image, d represents the side length of the target area, Represents the gray value of the pixel point (i, j) in the background image of the environment.
可以理解的是,Gr_b2代表环境背景图像右上角区域的对角灰度投影数组第k个位置的标准值,Gr_b3代表环境背景图像右下角区域的对角灰度投影数组第k个位置的标准值,Gr_b4代表环境背景图像左下角区域的对角灰度投影数组第k个位置的标准值。It can be understood that Gr_b2 represents the standard value of the kth position of the diagonal grayscale projection array in the upper right corner of the environmental background image, and Gr_b3 represents the standard value of the kth position of the diagonal grayscale projection array in the lower right corner of the environmental background image. , Gr_b4 represents the standard value of the kth position of the diagonal grayscale projection array in the lower left corner of the ambient background image.
在得到对角灰度投影标准数组后,可将对角灰度投影标准数组进行保存,以用于后续实际检测过程中的计算。After the diagonal grayscale projection standard array is obtained, the diagonal grayscale projection standard array can be saved for subsequent calculation in the actual detection process.
在一些实施例中,可每隔第二目标时间段t1,更新目标背景模型,以避免室外环境易受太阳光照的影响,而造成的背景亮度等信息的变化。In some embodiments, the target background model may be updated every second target time period t1 to avoid changes in information such as background brightness caused by the outdoor environment being easily affected by sunlight.
在该实施例中,通过结合畸变矫正和直方图均衡化等方法,有利于克服室外自然条件下抖动、光照以及阴影等干扰的影响。In this embodiment, by combining methods such as distortion correction and histogram equalization, it is beneficial to overcome the influence of disturbances such as jitter, illumination, and shadow under natural outdoor conditions.
根据本发明实施例提供的运动方针的对象检测方法,基于第一目标时间段内的多帧环境背景图像生成对角灰度投影标准数组,用于后续目标视频帧的抖动检测,灵活性高且检测准确度高。According to the object detection method of the motion policy provided by the embodiment of the present invention, a diagonal grayscale projection standard array is generated based on the multi-frame environmental background images in the first target time period, which is used for the jitter detection of subsequent target video frames, with high flexibility and high flexibility. High detection accuracy.
下面对本发明提供的大型活动的运动方阵的队形检测装置进行描述,下文描述的大型活动的运动方阵的队形检测装置与上文描述的大型活动的运动方阵的队形检测方法可相互对应参照。The following describes the formation detection device for a large-scale event moving phalanx provided by the present invention. The formation detection device for a large-scale event moving phalanx described below and the above-described large-scale event movement phalanx formation detection method can be used. refer to each other.
如图9所示,该大型活动的运动方阵的队形检测装置,包括:第一获取模块910、第一生成模块920和第二生成模块930。As shown in FIG. 9 , the apparatus for detecting the formation of the large-scale moving square matrix includes: a first acquiring
第一获取模块910,用于获取目标环境下的目标运动方阵的目标视频;The
第一生成模块920,用于基于目标视频中的目标视频帧与对角灰度投影标准数组,生成目标视频帧对应的抖动因子;The
第二生成模块930,用于在抖动因子低于目标抖动阈值的情况下,基于目标视频帧,生成目标运动方阵的目标图像。The
根据本发明实施例提供的运动方针的对象检测装置,基于目标视频中的目标视频帧与对角灰度投影标准数组,生成抖动因子,并基于抖动因子对目标视频帧进行筛选,以保留抖动幅度较低的目标视频帧,并对抖动幅度较低的目标视频帧进行处理,生成目标运动方阵的目标图像,有效提高了成像的清晰度,有助于提高检测结果。According to the object detection apparatus for a motion policy provided by an embodiment of the present invention, a jitter factor is generated based on a target video frame in a target video and a standard array of diagonal grayscale projections, and the target video frame is screened based on the jitter factor to preserve the jitter amplitude lower target video frame, and process the target video frame with lower jitter amplitude to generate target image of target moving square matrix, which effectively improves the clarity of imaging and helps to improve detection results.
在一些实施例中,第一生成模块920,用于:In some embodiments, the
基于目标视频帧的目标区域,生成目标区域的第一对角灰度投影数组;Based on the target area of the target video frame, a first diagonal grayscale projection array of the target area is generated;
基于第一对角灰度投影数组和对角灰度投影标准数组,生成抖动因子。A dithering factor is generated based on the first diagonal grayscale projection array and the diagonal grayscale projection criterion array.
在一些实施例中,第一生成模块920,用于:应用公式:In some embodiments, the
生成抖动因子,其中,θ为抖动因子,Gr_bi(m)为对角灰度投影标准数组中第m个位置的对角灰度投影标准值,Gr_ci(m)为第一对角灰度投影数组中第m个位置的第一对角灰度投影值,d为目标区域的边长。Generate a dither factor, where θ is the dither factor, Gr_bi(m) is the standard value of the diagonal grayscale projection at the mth position in the standard array of diagonal grayscale projections, and Gr_ci(m) is the first diagonal grayscale projection array The first diagonal grayscale projection value of the mth position in , and d is the side length of the target area.
在一些实施例中,第二生成模块930,用于:In some embodiments, the
将目标视频帧与目标背景模型进行帧差运算,生成第一图像;Perform a frame difference operation on the target video frame and the target background model to generate a first image;
对第一图像进行二值化处理和降噪处理,生成第三图像;Perform binarization processing and noise reduction processing on the first image to generate a third image;
基于第三图像提取目标视频帧中的前景图像,并基于前景图像生成目标运动方阵的目标图像。The foreground image in the target video frame is extracted based on the third image, and the target image of the target motion square matrix is generated based on the foreground image.
在一些实施例中,第二生成模块930,用于:In some embodiments, the
将前景图像转换为目标格式,生成第四图像;Convert the foreground image to the target format to generate a fourth image;
对第四图像进行基于目标阴影阈值的阴影区域分割处理和腐蚀膨胀处理,生成目标运动方阵的目标图像。The fourth image is subjected to shadow region segmentation and erosion expansion processing based on the target shadow threshold to generate a target image of the target movement square matrix.
在一些实施例中,该装置还包括:In some embodiments, the apparatus further includes:
第二获取模块,用于在获取目标环境下的目标运动方阵的目标视频之前,获取目标环境下,第一目标时间段内的多帧环境背景图像;The second acquisition module is used to acquire multiple frames of environmental background images in the first target time period under the target environment before acquiring the target video of the target motion square matrix in the target environment;
第三生成模块,用于基于多帧环境背景图像,生成目标背景模型;The third generation module is used to generate the target background model based on the multi-frame environment background images;
第四生成模块,用于基于目标背景模型,生成目标背景模型对应的对角灰度投影标准数组。The fourth generation module is used for generating a standard array of diagonal grayscale projections corresponding to the target background model based on the target background model.
图10示例了一种电子设备的实体结构示意图,如图10所示,该电子设备可以包括:处理器(processor)1010、通信接口(Communications Interface)1020、存储器(memory)1030和通信总线1040,其中,处理器1010,通信接口1020,存储器1030通过通信总线1040完成相互间的通信。处理器1010可以调用存储器1030中的逻辑指令,以执行大型活动的运动方阵的队形检测方法,该方法包括:获取目标环境下的目标运动方阵的目标视频;基于所述目标视频中的目标视频帧与对角灰度投影标准数组,生成所述目标视频帧对应的抖动因子;在所述抖动因子低于目标抖动阈值的情况下,基于所述目标视频帧,生成所述目标运动方阵的目标图像。FIG. 10 illustrates a schematic diagram of the physical structure of an electronic device. As shown in FIG. 10 , the electronic device may include: a processor (processor) 1010, a communication interface (Communications Interface) 1020, a memory (memory) 1030, and a
此外,上述的存储器1030中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。In addition, the above-mentioned logic instructions in the
另一方面,本发明还提供一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,计算机能够执行上述各方法所提供的大型活动的运动方阵的队形检测方法,该方法包括:获取目标环境下的目标运动方阵的目标视频;基于所述目标视频中的目标视频帧与对角灰度投影标准数组,生成所述目标视频帧对应的抖动因子;在所述抖动因子低于目标抖动阈值的情况下,基于所述目标视频帧,生成所述目标运动方阵的目标图像。In another aspect, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer When executing, the computer can execute the formation detection method of the large-scale activity moving square provided by the above methods, the method includes: acquiring the target video of the target moving square in the target environment; based on the target video in the target video frame and diagonal grayscale projection standard array to generate the jitter factor corresponding to the target video frame; when the jitter factor is lower than the target jitter threshold, based on the target video frame, generate the target motion square matrix. target image.
又一方面,本发明还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现以执行上述各提供的大型活动的运动方阵的队形检测方法,该方法包括:获取目标环境下的目标运动方阵的目标视频;基于所述目标视频中的目标视频帧与对角灰度投影标准数组,生成所述目标视频帧对应的抖动因子;在所述抖动因子低于目标抖动阈值的情况下,基于所述目标视频帧,生成所述目标运动方阵的目标图像。In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored, the computer program being implemented by a processor to execute the formation of the large-scale activity moving square arrays provided above A detection method, the method comprising: acquiring a target video of a target motion square matrix under a target environment; generating a jitter factor corresponding to the target video frame based on the target video frame and the diagonal grayscale projection standard array in the target video; In the case where the jitter factor is lower than a target jitter threshold, a target image of the target motion square matrix is generated based on the target video frame.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed over multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and certainly can also be implemented by hardware. Based on this understanding, the above-mentioned technical solutions can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products can be stored in computer-readable storage media, such as ROM/RAM, magnetic A disc, an optical disc, etc., includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform the methods described in various embodiments or some parts of the embodiments.
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that it can still be The technical solutions described in the foregoing embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210314674.3A CN114820698B (en) | 2022-03-28 | 2022-03-28 | Formation detection method and device for sports formations in large-scale activities |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210314674.3A CN114820698B (en) | 2022-03-28 | 2022-03-28 | Formation detection method and device for sports formations in large-scale activities |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114820698A true CN114820698A (en) | 2022-07-29 |
CN114820698B CN114820698B (en) | 2025-04-01 |
Family
ID=82531310
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210314674.3A Active CN114820698B (en) | 2022-03-28 | 2022-03-28 | Formation detection method and device for sports formations in large-scale activities |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114820698B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102202164A (en) * | 2011-05-20 | 2011-09-28 | 长安大学 | Motion-estimation-based road video stabilization method |
CN102930559A (en) * | 2012-10-23 | 2013-02-13 | 华为技术有限公司 | Image processing method and device |
CN103955930A (en) * | 2014-04-28 | 2014-07-30 | 中国人民解放军理工大学 | Motion parameter estimation method based on gray integral projection cross-correlation function characteristics |
US20180027161A1 (en) * | 2014-05-06 | 2018-01-25 | Urugus S.A. | Imaging device for scenes in apparent motion |
CN108492287A (en) * | 2018-03-14 | 2018-09-04 | 罗普特(厦门)科技集团有限公司 | A kind of video jitter detection method, terminal device and storage medium |
CN111741186A (en) * | 2020-06-11 | 2020-10-02 | 浙江大华技术股份有限公司 | Video jitter detection method, device and system |
-
2022
- 2022-03-28 CN CN202210314674.3A patent/CN114820698B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102202164A (en) * | 2011-05-20 | 2011-09-28 | 长安大学 | Motion-estimation-based road video stabilization method |
CN102930559A (en) * | 2012-10-23 | 2013-02-13 | 华为技术有限公司 | Image processing method and device |
CN103955930A (en) * | 2014-04-28 | 2014-07-30 | 中国人民解放军理工大学 | Motion parameter estimation method based on gray integral projection cross-correlation function characteristics |
US20180027161A1 (en) * | 2014-05-06 | 2018-01-25 | Urugus S.A. | Imaging device for scenes in apparent motion |
CN108492287A (en) * | 2018-03-14 | 2018-09-04 | 罗普特(厦门)科技集团有限公司 | A kind of video jitter detection method, terminal device and storage medium |
CN111741186A (en) * | 2020-06-11 | 2020-10-02 | 浙江大华技术股份有限公司 | Video jitter detection method, device and system |
Non-Patent Citations (1)
Title |
---|
路霄汉等: "一种快速消除鬼影的目标检测算法", 计算机应用与软件, vol. 36, no. 10, 12 October 2019 (2019-10-12), pages 101 - 106 * |
Also Published As
Publication number | Publication date |
---|---|
CN114820698B (en) | 2025-04-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20220222786A1 (en) | Image processing method, smart device, and computer readable storage medium | |
US11538175B2 (en) | Method and apparatus for detecting subject, electronic device, and computer readable storage medium | |
WO2022000397A1 (en) | Low-illumination image enhancement method and apparatus, and computer device | |
US20170365046A1 (en) | Algorithm and device for image processing | |
CN108694705A (en) | A kind of method multiple image registration and merge denoising | |
US9202263B2 (en) | System and method for spatio video image enhancement | |
CN110839129A (en) | Image processing method, device and mobile terminal | |
CN110619593A (en) | Double-exposure video imaging system based on dynamic scene | |
CN107133923B (en) | A non-blind deblurring method for blurred images based on adaptive gradient sparse model | |
WO2020231016A1 (en) | Image optimization method, apparatus, device and storage medium | |
CN110599433A (en) | Double-exposure image fusion method based on dynamic scene | |
US11983853B1 (en) | Techniques for generating training data for machine learning enabled image enhancement | |
CN110838088B (en) | Multi-frame noise reduction method and device based on deep learning and terminal equipment | |
KR101023944B1 (en) | Image processing apparatus and method | |
CN112330546B (en) | Image enhancement method and related products | |
WO2023273868A1 (en) | Image denoising method and apparatus, terminal, and storage medium | |
WO2014070489A1 (en) | Recursive conditional means image denoising | |
CN114511487B (en) | Image fusion method and device, computer readable storage medium, and terminal | |
CN112581904B (en) | A Moiré Compensation Method for Brightness Grayscale Image of OLED Screen | |
CN115439384B (en) | A ghost-free multi-exposure image fusion method and device | |
CN107392879B (en) | A low-illumination surveillance image enhancement method based on reference frames | |
CN113706393A (en) | Video enhancement method, device, equipment and storage medium | |
Yu et al. | Image and video dehazing using view-based cluster segmentation | |
CN109886906B (en) | Detail-sensitive real-time low-light video enhancement method and system | |
Fu et al. | Raw image based over-exposure correction using channel-guidance strategy |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |