CN109030854B - A gait measurement method based on RGB images - Google Patents
A gait measurement method based on RGB images Download PDFInfo
- Publication number
- CN109030854B CN109030854B CN201810589119.5A CN201810589119A CN109030854B CN 109030854 B CN109030854 B CN 109030854B CN 201810589119 A CN201810589119 A CN 201810589119A CN 109030854 B CN109030854 B CN 109030854B
- Authority
- CN
- China
- Prior art keywords
- marker
- image
- athlete
- foreground
- abscissa
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01P—MEASURING LINEAR OR ANGULAR SPEED, ACCELERATION, DECELERATION, OR SHOCK; INDICATING PRESENCE, ABSENCE, OR DIRECTION, OF MOVEMENT
- G01P3/00—Measuring linear or angular speed; Measuring differences of linear or angular speeds
- G01P3/64—Devices characterised by the determination of the time taken to traverse a fixed distance
- G01P3/68—Devices characterised by the determination of the time taken to traverse a fixed distance using optical means, i.e. using infrared, visible, or ultraviolet light
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Image Analysis (AREA)
Abstract
本发明公开了一种基于RGB图像的步速测量方法,涉及步速测量方法领域;其包括如下步骤1:采集、预处理图像;步骤2:通过HOG特征检测获得运动员在图像中的位置,通过Grabcut算法获得标志物在图像中的位置;步骤3:根据运动员位置、标志物位置以及设定的阈值判断运动员是否均通过起点标志物和终点标志物,若是,则计算运动员通过起点标志物和终点标志物的时长并跳至步骤4,若否,则重复该步骤;步骤4:计算起点标志物和终点标志物的距离,结合运动员通过起点标志物和终点标志物的时长求解运动员步速;本发明实现了标志物的精确定位,解决了现有基于图像的步速测量方法中因缺少距离参照物导致的测量误差较大的问题,达到精确测量运动员步速的效果。
The invention discloses a pace measurement method based on RGB images, and relates to the field of pace measurement methods. The method includes the following steps: 1: collecting and preprocessing images; The Grabcut algorithm obtains the position of the marker in the image; Step 3: According to the athlete's position, the position of the marker and the set threshold, determine whether the athlete has passed the starting point marker and the ending point marker. The duration of the marker and skip to step 4, if not, repeat this step; Step 4: Calculate the distance between the starting point marker and the ending point marker, and solve the athlete's pace based on the duration of the athlete passing the starting point marker and the ending point marker; The invention realizes accurate positioning of markers, solves the problem of large measurement error caused by lack of distance reference objects in the existing image-based pace measurement methods, and achieves the effect of accurately measuring the pace of athletes.
Description
技术领域technical field
本发明涉及步速测量方法领域,尤其是一种基于RGB图像的步速测量方法。The invention relates to the field of pace measurement methods, in particular to a pace measurement method based on RGB images.
背景技术Background technique
行人速度测量在现实生活中有着重要的意义,体育田径赛事中的步速测量对于检测运动员的指标十分重要;步速测量方法可分为:一、基于传感器的步速测量,二、基于图像的步速测量;基于传感器的步速测量装置可以通过使用者身上的速度检测装置测量使用者的速度;基于传感器测量步速的方法有很多,Bishop使用两个安装在小腿部位的加速器计算步速,将倒立摆的姿势当做一个独立的跨步周期;Park使用手持设备估算步速,其要求参与者手持一个三轴加速器进行速度测量;Gomez使用一种可穿戴可视化的传感器设备,在用户眼镜上安装测试点,使用该设备计算使用者的步速;路永乐等人提出一种基于MEMS惯性传感器的人体多运动模式识别算法,选取MEMS加速度传感器的时域特征作为模式识别特征量,提取MEMS角速度传感器的时域特征作为二次识别的特征量实现步速检测;基于传感器的方法中,一方面由于测试者携带传感器,导致无法正常发挥,进而影响测试结果;另一方面由于传感器设备传输需要时间,导致无法实时测速。基于图像的方法测量步速也有很多,比如Gu等人使用一种可视化的方法,利用单个RGB相机追踪2D节点坐标以此估计步速;张佳佳等人使用Qualisys三维运动捕捉系统即8个摄像头和2块Kistler测力台同步采集健身竞走、普通健身走、跑步的运动学和动力学指标;秦剑杰等人运用三位摄像法,使用两台索尼HXR-NX100型摄像机,对前8名运动员在进行到第19圈时、距离终点线1km处的技术动作进行定点拍摄;王鹏等人采用APAS和Dartfish4.5对视频进行解析,使用日本松井秀治人体惯性参数模型,并选取19个关节点,数字化研究对象的一个复步,采用截断频率8Hz的低通数字滤波法平滑3D,用Dartfish软件处理比赛图像。Pedestrian speed measurement is of great significance in real life. The pace measurement in sports track and field events is very important to detect the indicators of athletes. The pace measurement methods can be divided into: 1. Sensor-based pace measurement, 2. Image-based pace measurement. Pace measurement; the sensor-based pace measurement device can measure the user's speed through the speed detection device on the user; there are many ways to measure the pace based on the sensor, Bishop uses two accelerators installed in the calf to calculate the pace, Think of the inverted pendulum pose as a separate stride cycle; Park estimates pace using a handheld device that requires participants to hold a three-axis accelerometer for speed measurements; Gomez uses a wearable visualization sensor device mounted on the user's glasses Test points, use the device to calculate the user's pace; Lu Yongle et al. proposed a multi-motion pattern recognition algorithm based on MEMS inertial sensors, selecting the time domain features of the MEMS acceleration sensor as the pattern recognition feature quantity, and extracting the MEMS angular velocity sensor. The time-domain feature of the sensor is used as a feature quantity for secondary identification to realize pace detection; in the sensor-based method, on the one hand, the tester carries the sensor, which causes it to fail to perform normally, which in turn affects the test result; This makes it impossible to measure the speed in real time. There are also many image-based methods to measure stride speed. For example, Gu et al. used a visual method to track 2D node coordinates with a single RGB camera to estimate stride speed; Zhang Jiajia et al. The Kistler force platform synchronously collected the kinematics and dynamics indicators of fitness race walking, general fitness walking and running; Qin Jianjie and others used the three-camera method and two Sony HXR-NX100 cameras to examine the top 8 athletes during their progress. On the 19th lap, the technical movements at 1km away from the finish line were filmed at a fixed point; Wang Peng et al. used APAS and Dartfish4.5 to analyze the video, used the Japanese human body inertial parameter model, and selected 19 joint points for digital research A compound step of the object, the 3D is smoothed by low-pass digital filtering with a cutoff frequency of 8 Hz, and the competition image is processed with Dartfish software.
虽然在步速测量方面已经取得了大量研究结果,但是基于图像的方法中图像中没有距离参照物,通过RGB图像中人的位置计算人实际通过的距离,得到的距离会受相机自身参数、图像质量等因素影响,导致步速测量结果误差大。因此需要一种高精度的基于图像的步速测量方法。Although a large number of research results have been achieved in the measurement of pace, there is no distance reference in the image in the image-based method. The actual distance passed by the person is calculated by the position of the person in the RGB image, and the obtained distance will be affected by the camera's own parameters, image Due to the influence of quality and other factors, the error of the pace measurement result is large. Therefore, there is a need for a high-accuracy image-based gait measurement method.
发明内容SUMMARY OF THE INVENTION
本发明的目的在于:本发明提供了一种基于RGB图像的步速测量方法,解决了现有基于图像的步速测量方法中图像中缺少距离参照物从而被多种因素影响导致测量结果误差大的问题。The purpose of the present invention is: the present invention provides a pace measurement method based on RGB images, which solves the problem that the lack of distance reference objects in the image in the existing image-based pace measurement method, which is influenced by various factors, leads to large errors in the measurement results The problem.
本发明采用的技术方案如下:The technical scheme adopted in the present invention is as follows:
一种基于RGB图像的步速测量方法,包括如下步骤:A method for measuring stride speed based on RGB images, comprising the following steps:
步骤1:采集、预处理图像;Step 1: Collect and preprocess images;
步骤2:通过HOG特征检测获得运动员在图像中的位置,通过Grabcut算法获得标志物在图像中的位置;Step 2: Obtain the position of the athlete in the image through HOG feature detection, and obtain the position of the marker in the image through the Grabcut algorithm;
步骤3:根据运动员位置、标志物位置以及设定的阈值判断运动员是否均通过起点标志物和终点标志物,若是,则计算运动员通过起点标志物和终点标志物的时长并跳至步骤4,若否,则重复该步骤;Step 3: Determine whether the athlete has passed the starting point marker and the ending point marker according to the athlete's position, the position of the marker and the set threshold value. No, repeat this step;
步骤4:基于步骤2计算起点标志物和终点标志物的距离,结合运动员通过起点标志物和终点标志物的时长求解运动员步速。Step 4: Calculate the distance between the starting point marker and the ending point marker based on step 2, and calculate the athlete's pace based on the duration of the athlete passing the starting point marker and the ending point marker.
优选地,所述步骤1包括如下步骤:Preferably, the step 1 includes the following steps:
步骤1.1:根据标志物的高度H与摄像头中标志物成像高度h确定摄像头与标志物的垂直距离D,计算公式如下:Step 1.1: Determine the vertical distance D between the camera and the marker according to the height H of the marker and the imaging height h of the marker in the camera. The calculation formula is as follows:
其中,f表示摄像头的焦距;Among them, f represents the focal length of the camera;
步骤1.2:根据摄像头与标志物的垂直距离安装固定摄像头进行图像采集;Step 1.2: Install a fixed camera for image acquisition according to the vertical distance between the camera and the marker;
步骤1.3:将采集的图像进行尺度变换、灰度化等操作获得预处理后的图像。Step 1.3: Perform scale transformation, grayscale and other operations on the collected image to obtain a preprocessed image.
优选地,所述步骤2中的通过HOG特征检测获得运动员在图像中的位置包括如下步骤:Preferably, obtaining the position of the athlete in the image through HOG feature detection in the step 2 includes the following steps:
步骤S2.1.1:使用HOG特征组成滑动窗,按照水平(x方向)向右和竖直(y方向)向上的方向,根据填充大小确定其步长后,对预处理后的图像进行特征提取,计算公式如下:Step S2.1.1: Use the HOG feature to form a sliding window, according to the horizontal (x direction) rightward and vertical (y direction) upward direction, after determining the step size according to the filling size, the feature extraction is performed on the preprocessed image, Calculated as follows:
G(xi,yi)=dx(xi,yi)+dy(xi,yi)G(x i ,y i )=d x (x i ,y i )+d y (x i ,y i )
dx(xi,yi)=I(xi+1,yi)-I(xi,yi)d x (x i ,y i )=I(x i +1,y i )-I(x i ,y i )
dy(xi,yi)=I(xi,yi+1)-I(xi,yi)d y (x i ,y i )=I(x i ,y i +1)-I(x i ,y i )
其中,I(xi,yi)表示输入图像第i个点的像素值,G(xi,yi)表示输入图像的梯度,dx(xi,yi)表示输入图像的水平梯度,dy(xi,yi)表示输入图像的垂直梯度;Among them, I(x i , y i ) represents the pixel value of the ith point of the input image, G(x i , y i ) represents the gradient of the input image, and d x (x i , y i ) represents the horizontal gradient of the input image , dy (x i , y i ) represents the vertical gradient of the input image;
步骤S2.1.2:将提取的特征输入到已训练的模型SVM中,获得该图像中运动员可能所在的区域的多个矩形框;Step S2.1.2: Input the extracted features into the trained model SVM, and obtain multiple rectangular frames of the area where the athlete may be located in the image;
步骤S2.1.3:通过非最大抑制NMS得到多个矩形框中的最优框即计算多个矩形框的交并比IOU,选择交并比IOU最小的矩形框作为最优框;Step S2.1.3: Obtain the optimal frame in multiple rectangular frames through non-maximum suppression NMS, that is, calculate the intersection ratio IOU of multiple rectangular frames, and select the rectangular frame with the smallest intersection ratio IOU as the optimal frame;
步骤S2.1.4:运动员检测:通过最优框的坐标,计算运动员位置的中心获得运动员在图像中的位置,计算公式如下:Step S2.1.4: Athlete detection: Calculate the center of the athlete's position through the coordinates of the optimal frame to obtain the athlete's position in the image. The calculation formula is as follows:
其中,(xi,yi)表示最优框顶点坐标,N表示顶点个数,xci表示运动员位置的横坐标,yci表示运动员位置的纵坐标。Among them, (x i , y i ) represents the vertex coordinates of the optimal frame, N represents the number of vertices, x ci represents the abscissa of the athlete's position, and y ci represents the ordinate of the athlete's position.
优选地,所述步骤2中的通过Grabcut算法获得标志物在图像中的位置包括如下步骤:Preferably, in the step 2, obtaining the position of the marker in the image by the Grabcut algorithm includes the following steps:
步骤S2.2.1:对预处理后的图像标注感兴趣区域即ROI;Step S2.2.1: mark the region of interest, ie ROI, on the preprocessed image;
步骤S2.2.2:使用Grabcut算法对ROI进行分割,获得source节点即前景标志、sink节点即背景标志以及前景图像像素点,建立包含所有ROI前景图像像素点的新图,其中前景指标志物;Step S2.2.2: Use the Grabcut algorithm to segment the ROI, obtain the source node that is the foreground sign, the sink node that is the background sign and the pixels of the foreground image, and create a new map containing all the pixels of the foreground image of the ROI, where the foreground refers to the marker;
步骤S2.2.3:经过多次迭代将与source节点连接的像素点作为前景,将与sink节点连接的像素点作为背景,完成图像前景和背景的分割,并通过公式获得前景图像的左上角坐标、宽度和高度,计算公式如下:Step S2.2.3: After multiple iterations, the pixels connected to the source node are used as the foreground, and the pixels connected to the sink node are used as the background to complete the segmentation of the image foreground and background, and obtain the upper left corner coordinates of the foreground image through the formula, The width and height are calculated as follows:
pick(x,y,w,h)pick(x, y, w, h)
其中,x表示前景图像的左上角横坐标,y表示前景图像的左上角纵坐标,w表示前景图像的宽度,h表示前景图像的高度;Among them, x represents the abscissa of the upper left corner of the foreground image, y represents the ordinate of the upper left corner of the foreground image, w represents the width of the foreground image, and h represents the height of the foreground image;
步骤S2.2.4:通过前景图像左上角的横坐标和其宽度计算标志物的横坐标,计算公式如下:Step S2.2.4: Calculate the abscissa of the marker through the abscissa of the upper left corner of the foreground image and its width. The calculation formula is as follows:
xbi=x+w/2 xbi = x+w/2
其中,xbi表示标志物的横坐标。Among them, xbi represents the abscissa of the marker.
优选地,所述步骤3包括如下步骤:Preferably, the step 3 includes the following steps:
步骤3.1:比较、分析运动员和标志物在图像中的相对位置,根据运动员的横坐标xci和标志物的横坐标xbi计算两者的差值,将差值与设定的阈值σ进行比较,将运动员前进方向第一个小于阈值的差值对应的位置作为计时点后,确定运动员通过第一个标志物即起点标志物和第二个标志物即终点标志物,并记录通过起点标志物和终点标志物的时间,计算公式如下:Step 3.1: Compare and analyze the relative positions of the athlete and the marker in the image, calculate the difference between the abscissa xci of the athlete and the abscissa xbi of the marker, and compare the difference with the set threshold σ , after taking the position corresponding to the first difference less than the threshold value in the forward direction of the athlete as the timing point, determine that the athlete passes the first marker, the starting point marker, and the second marker, the ending point marker, and record the passing of the starting point marker. and the time of the endpoint marker, the calculation formula is as follows:
其中,ti表示通过标志物的时间,ts表示通过起点标志物的时间,te表示通过终点标志物的时间,xci表示当前帧运动员的横坐标,xb1表示第一个标志物的横坐标,xb2表示第二个标志物的横坐标,σ表示设定的阈值;Among them, t i represents the time to pass the marker, ts represents the time to pass the starting point marker, t e represents the time to pass the end marker, x ci represents the abscissa of the athlete in the current frame, x b1 represents the time of the first marker abscissa, x b2 represents the abscissa of the second marker, σ represents the set threshold;
步骤3.2:计算通过起点标志物和终点标志物的时长tf:Step 3.2: Calculate the duration t f through the start and end markers:
其中,tp表示处理每一帧图片所需的时间。Among them, t p represents the time required to process each frame of pictures.
优选地,所述步骤4包括如下步骤:Preferably, the step 4 includes the following steps:
步骤4.1:根据摄像头与标志物的距离D,已知摄像头视场角θ,计算起点标志物和终点标志物的距离L,计算公式如下:Step 4.1: According to the distance D between the camera and the marker, and the camera's field of view angle θ is known, calculate the distance L between the starting point marker and the ending point marker. The calculation formula is as follows:
步骤4.2:根据起点标志物和终点标志物的距离L以及通过起点标志物和终点标志物的时长tf计算运动员的步速,计算公式如下:Step 4.2: Calculate the pace of the athlete according to the distance L between the starting point marker and the ending point marker and the duration tf passing through the starting point marker and the ending point marker. The calculation formula is as follows:
其中,λ表示普通运动员的步长。Among them, λ represents the stride length of the average athlete.
优选地,所述步长根据运动员身高计算,计算公式如下:Preferably, the step length is calculated according to the height of the athlete, and the calculation formula is as follows:
SG=λ*0.54+132SG=λ*0.54+132
其中,SG表示身高,单位为cm,λ表示普通运动员的步长。Among them, SG represents the height in cm, and λ represents the step length of an ordinary athlete.
优选地,所述设定的阈值σ计算公式如下:Preferably, the calculation formula of the set threshold σ is as follows:
其中,σ表示设定的阈值,Wf表示图像宽度的像素值,Wr表示相机镜头广度,v表示跑步速度,fps表示视频每秒帧数。Among them, σ represents the set threshold, W f represents the pixel value of the image width, W r represents the width of the camera lens, v represents the running speed, and fps represents the number of frames per second of the video.
综上所述,由于采用了上述技术方案,本发明的有益效果是:To sum up, due to the adoption of the above-mentioned technical solutions, the beneficial effects of the present invention are:
1.本发明通过Grabcut算法确定标志物在视频/图像中的位置,通过HOG特征检测图像中运动员的位置,根据运动员位置、标志物位置以及设定的阈值确定开始时间和结束时间即确定运动员通过标志物,获得通过标志物的时长,结合通过标志物的距离求解运动员的步速,解决了现有基于图像的步速测量方法中图像中缺少距离参照物从而被多种因素影响导致测量结果误差大的问题,达到了精确定位标志物,精确计算运动员步速的效果;1. the present invention determines the position of the marker in the video/image by the Grabcut algorithm, detects the position of the athlete in the image by the HOG feature, determines the start time and the end time according to the athlete's position, the position of the marker and the threshold value set, that is, determines that the athlete passes through. Marker, obtain the time of passing the marker, and solve the athlete's pace by combining the distance passing through the marker, which solves the problem of the lack of distance reference in the image in the existing image-based pace measurement method, which is affected by various factors and causes measurement error. A big problem, to achieve the effect of accurately positioning the marker and accurately calculating the pace of the athlete;
2.本发明需要克服HOG特征算法受运动员身高和体型影响,计算步速的时候根据身高计算步长,进一步减小测量误差;2. The present invention needs to overcome that the HOG feature algorithm is affected by the height and body shape of the athlete, and the step length is calculated according to the height when calculating the pace to further reduce the measurement error;
3.本发明合理设置运动员距离相机的垂直距离以及标志物之间的水平距离,避免因距离过远相机不能完全拍摄到标志物,测得运动员的瞬时速度导致误差较大的缺点;3. The present invention reasonably sets the vertical distance between the athlete and the camera and the horizontal distance between the markers, so as to avoid the disadvantage that the marker cannot be completely photographed by the camera because the distance is too far, and the instantaneous speed of the athlete is measured, resulting in a larger error;
4.本发明的测量对象为运动员,其的速度与一般测量对象相差较大,每一帧图像中运动员行进的距离跟速度有关,合理设置阈值,判断标志物位置和运动员位置的横坐标差值与阈值的大小,确定运动员通过标志物,从而计算对应的时间和距离,避免直接计算图像中人通过的距离受相机因素等影响导致测量误差大的缺点,精确定位标志物,利于提高步速计算的精度。4. The measurement object of the present invention is an athlete, and its speed differs greatly from the general measurement object, and the distance traveled by the athlete in each frame image is related to the speed, and the threshold is reasonably set to judge the abscissa difference between the position of the marker and the position of the athlete. With the size of the threshold, it is determined that the athlete passes the marker, so as to calculate the corresponding time and distance, avoiding the disadvantage of directly calculating the distance of the person passing in the image, which is affected by camera factors and causing large measurement errors, and accurately locating the marker is conducive to improving the calculation of pace. accuracy.
附图说明Description of drawings
本发明将通过例子并参照附图的方式说明,其中:The invention will be described by way of example and with reference to the accompanying drawings, in which:
图1是本发明的方法流程框图;Fig. 1 is the method flow chart of the present invention;
图2是本发明的方法流程图;Fig. 2 is the method flow chart of the present invention;
图3是本发明的成像原理图;Fig. 3 is the imaging principle diagram of the present invention;
图4是本发明的摄像头摆放示意图;Fig. 4 is the schematic diagram of camera placement of the present invention;
图5是本发明步速计算流程图;Fig. 5 is the flow chart of pace calculation of the present invention;
图6是本发明的运动员检测流程图;Fig. 6 is athlete detection flow chart of the present invention;
图7是本发明的标志物检测流程图。FIG. 7 is a flowchart of marker detection of the present invention.
具体实施方式Detailed ways
本说明书中公开的所有特征,或公开的所有方法或过程中的步骤,除了互相排斥的特征和/或步骤以外,均可以以任何方式组合。All features disclosed in this specification, or all disclosed steps in a method or process, may be combined in any way except mutually exclusive features and/or steps.
下面结合图1-7对本发明作详细说明。The present invention will be described in detail below with reference to FIGS. 1-7 .
本申请要解决的技术问题:通过HOG特征检测获得运动员在图像中的位置,通过Grabcut算法获得标志物在图像中的位置,根据获得的运动员位置和标志物位置,结合阈值判断运动员是否通过起点/终点标志物,获取通过起点标志物和终点标志物的时长,计算起点标志物和终点标志物的距离,从而求取运动员的步速;采用的技术方案步骤如下:步骤1:采集、预处理图像;步骤2:通过HOG特征检测获得运动员在图像中的位置,通过Grabcut算法获得标志物在图像中的位置;步骤3:根据运动员位置、标志物位置以及设定的阈值判断运动员是否均通过起点标志物和终点标志物,若是,则计算运动员通过起点标志物和终点标志物的时长并跳至步骤4,若否,则说明不能开始计时,需要重复步骤3直到其差值小于阈值,记录此时的时间作为起始或终点时间并计算时长;步骤4:基于步骤2计算起点标志物和终点标志物的距离,结合运动员通过起点标志物和终点标志物的时长求解运动员步速。其中,确定运动员通过起点标志物和终点标志物采用比较运动员位置和标志物位置的横坐标小于设定的阈值来确定,确定后分别记录对应的时间;测量过程中需要克服标志物的间距问题,保证摄像头的位置与标志物的垂直距离的合理性,避免运动员在图像中过小或者过大,需要合理设置相机与运动员的距离。The technical problem to be solved by this application: obtain the position of the athlete in the image through HOG feature detection, obtain the position of the marker in the image through the Grabcut algorithm, and judge whether the athlete passes the starting point/ End marker, obtain the duration of passing through the starting marker and the ending marker, calculate the distance between the starting marker and the ending marker, so as to obtain the athlete's pace; Step 2: Obtain the position of the athlete in the image through HOG feature detection, and obtain the position of the marker in the image through the Grabcut algorithm; Step 3: Determine whether the athlete has passed the starting point mark according to the position of the athlete, the position of the marker and the set threshold If it is, then calculate the duration of the athlete passing the starting point marker and the ending point marker and skip to step 4. If not, it means that the timing cannot be started, and step 3 needs to be repeated until the difference is less than the threshold, and record this time. Step 4: Calculate the distance between the starting point marker and the ending point marker based on step 2, and calculate the athlete's pace based on the time the athlete passes through the starting point marker and the ending point marker. Among them, it is determined that the athlete is determined by comparing the abscissa of the position of the athlete and the position of the marker by comparing the abscissa of the starting point marker and the ending point marker to be less than the set threshold, and the corresponding time is recorded after the determination; the distance between the markers needs to be overcome during the measurement process. To ensure the rationality of the vertical distance between the position of the camera and the marker, to avoid the athlete being too small or too large in the image, the distance between the camera and the athlete needs to be set reasonably.
实施例1Example 1
采集数据:通过多媒体设备获取运动员和标志物的图像/视频;Acquisition of data: acquisition of images/videos of athletes and markers through multimedia devices;
预处理:对采集的运动员和标志物的图像/视频进行尺度变换、灰度化等操作,去除光照、噪声的影响完成预处理;Preprocessing: perform scale transformation and grayscale operations on the collected images/videos of athletes and markers, and remove the influence of illumination and noise to complete the preprocessing;
特征提取:对运动员图像/视频使用HOG进行特征提取;对标志物图像/视频的RGB三通道建立模型GMM进行特征提取,标注感兴趣区域即ROI;GMM用于对前景和背景建模,在每次迭代时,其学习并创建新的像素分布,并且对前景和背景进行分类,分类的依据是上一次迭代中前景或背景像素值。Feature extraction: Use HOG for feature extraction on athlete images/videos; build a model GMM for the RGB three-channel of the marker images/videos for feature extraction, and mark the region of interest (ROI); GMM is used to model the foreground and background. At the next iteration, it learns and creates a new pixel distribution and classifies the foreground and background based on the foreground or background pixel values from the previous iteration.
分类:将提取的运动员图像/视频特征放入已训练的模型SVM中得到运动员的可能所在区域的多个矩形框,选择最优框计算运动员在图像中的位置;使用Grabcut算法对ROI进行分割,获得source节点即前景标志、sink节点即背景标志以及前景图像像素点,建立包含所有ROI前景图像像素点的新图,其中前景指标志物;多次迭代后完成图像前景和背景的精确分割,并计算标志物在图像中的位置;Classification: Put the extracted athlete image/video features into the trained model SVM to obtain multiple rectangular boxes of the possible area of the athlete, and select the optimal box to calculate the athlete's position in the image; use the Grabcut algorithm to segment the ROI, Obtain the source node that is the foreground sign, the sink node that is the background sign and the pixels of the foreground image, and create a new map containing all the pixels of the ROI foreground image, where the foreground refers to the marker; after several iterations, the accurate segmentation of the image foreground and background is completed, and Calculate the location of the marker in the image;
时间测量:通过比较运动员和标志物的相对位置,判断运动员通过标志物后记录通过其的时间,通过的第一个标志物为起点标志物,第二个标志物为终点标志物,判断运动员通过标志物是比较运动员位置横坐标与标志物位置横坐标差值与设定的阈值大小,比较的计算公式如下:Time measurement: By comparing the relative positions of the athlete and the marker, judging that the athlete passes the marker and recording the passing time, the first marker passed is the starting point marker, and the second marker is the end marker, and it is judged that the athlete has passed the marker The marker is to compare the difference between the abscissa of the athlete's position and the abscissa of the marker's position and the set threshold value. The calculation formula of the comparison is as follows:
其中,ti表示通过标志物的时间,ts表示通过起点标志物的时间,te表示通过终点标志物的时间,xci表示当前帧运动员的横坐标,xb1表示第一个标志物的横坐标,xb2表示第二个标志物的横坐标,σ表示设定的阈值;Among them, t i represents the time to pass the marker, ts represents the time to pass the starting point marker, t e represents the time to pass the end marker, x ci represents the abscissa of the athlete in the current frame, x b1 represents the time of the first marker abscissa, x b2 represents the abscissa of the second marker, σ represents the set threshold;
计算通过起点标志物和终点标志物的时长tf:Calculate the duration tf through the start and end markers:
其中,tp表示处理每一帧图片所需的时间。Among them, t p represents the time required to process each frame of pictures.
计算步速:根据通过起点标志物和终点标志物的时长以及起点标志物和终点标志物距离,根据公式计算步速:Calculate pace: Calculate pace according to the formula according to the duration of passing the starting point marker and the ending point marker and the distance between the starting point marker and the ending point marker:
其中,L表示起点标志物和终点标志物距离,tf表示通过起点标志物和终点标志物的时长,λ表示普通运动员的步长。Among them, L represents the distance between the starting point marker and the ending point marker, t f represents the time length of passing the starting point marker and the ending point marker, and λ represents the step length of an ordinary athlete.
实施例2Example 2
采集、预处理:Collection and preprocessing:
如图3所示的成像原理图:The imaging principle diagram shown in Figure 3:
步骤1.1:根据标志物的高度H与摄像头中标志物成像高度h确定摄像头与标志物的垂直距离D,计算公式如下:Step 1.1: Determine the vertical distance D between the camera and the marker according to the height H of the marker and the imaging height h of the marker in the camera. The calculation formula is as follows:
其中,f表示摄像头的焦距,其取值为45mm;标志物的高度H为0.75m;原始图像大小为1280×720、分辨率为300dpi即一英寸300像素,因此像素大小为:(300*2.54)/(1280*720)=0.0083cm/pixel;标志物在图像竖直方向占85个pixel,可获得标志物的成像高度h为0.7cm,由此可得摄像头与标志物的垂直距离D=4.9m;Among them, f represents the focal length of the camera, and its value is 45mm; the height H of the marker is 0.75m; the original image size is 1280×720, and the resolution is 300dpi, which is 300 pixels per inch, so the pixel size is: (300*2.54 )/(1280*720)=0.0083cm/pixel; the marker occupies 85 pixels in the vertical direction of the image, and the imaging height h of the marker can be obtained as 0.7cm, thus the vertical distance between the camera and the marker D= 4.9m;
步骤1.2:根据摄像头与标志物的垂直距离安装固定摄像头进行图像采集;Step 1.2: Install a fixed camera for image acquisition according to the vertical distance between the camera and the marker;
步骤1.3:将采集的图像进行尺度变换、灰度化等操作完成预处理。Step 1.3: Perform scale transformation, grayscale and other operations on the collected image to complete the preprocessing.
运动员检测:Athlete detection:
步骤S2.1.1:使用HOG特征组成滑动窗,按照水平(x方向)向右和竖直(y方向)向上的方向,根据填充大小确定其步长后,对预处理后的图像进行特征提取,计算公式如下:Step S2.1.1: Use the HOG feature to form a sliding window, according to the horizontal (x direction) rightward and vertical (y direction) upward direction, after determining the step size according to the filling size, the feature extraction is performed on the preprocessed image, Calculated as follows:
G(xi,yi)=dx(xi,yi)+dy(xi,yi)G(x i ,y i )=d x (x i ,y i )+d y (x i ,y i )
dx(xi,yi)=I(xi+1,yi)-I(xi,yi)d x (x i ,y i )=I(x i +1,y i )-I(x i ,y i )
dy(xi,yi)=I(xi,yi+1)-I(xi,yi)d y (x i ,y i )=I(x i ,y i +1)-I(x i ,y i )
其中,I(xi,yi)表示输入图像第i个点的像素值,G(xi,yi)表示输入图像的梯度,dx(xi,yi)表示输入图像的水平梯度,dy(xi,yi)表示输入图像的垂直梯度;按单个像素间隔为步长,像素间隔越小,图像遍历程度越广,进一步提高特征提取的准确性,图像填充padding为N,滑动窗的横向和纵向步长取值为N/2,图像扩大1.05倍,本实施例padding取8,横向步长和纵向步长取4;Among them, I(x i , y i ) represents the pixel value of the ith point of the input image, G(x i , y i ) represents the gradient of the input image, and d x (x i , y i ) represents the horizontal gradient of the input image , d y (x i , y i ) represents the vertical gradient of the input image; according to a single pixel interval as the step size, the smaller the pixel interval, the wider the image traversal degree, which further improves the accuracy of feature extraction, and the image padding is N, The horizontal and vertical steps of the sliding window are set to N/2, and the image is enlarged by 1.05 times. In this embodiment, the padding is set to 8, and the horizontal and vertical steps are set to 4;
步骤S2.1.2:将提取后的特征输入已训练的模型SVM中获得运动员可能所在区域的多个的矩形框;Step S2.1.2: Input the extracted features into the trained model SVM to obtain multiple rectangular boxes in the area where the athlete may be located;
步骤S2.1.3:通过非最大抑制(NMS)得到多个矩形框中最优框,即计算多个矩形框的交并比IOU,选择交并比IOU最小的矩形框作为最优框;Step S2.1.3: Obtain the optimal frame in multiple rectangular frames through non-maximum suppression (NMS), that is, calculate the intersection ratio IOU of multiple rectangular frames, and select the rectangular frame with the smallest intersection ratio IOU as the optimal frame;
步骤S2.1.4:运动员检测:通过最优框的坐标,计算运动员的中心获得运动员在图像中的位置,计算公式如下:Step S2.1.4: Athlete detection: Calculate the center of the athlete to obtain the position of the athlete in the image through the coordinates of the optimal frame. The calculation formula is as follows:
其中,(xi,yi)表示最优框顶点坐标,N表示顶点个数,xci表示运动员位置的横坐标,yci表示运动员位置的纵坐标。Among them, (x i , y i ) represents the vertex coordinates of the optimal frame, N represents the number of vertices, x ci represents the abscissa of the athlete's position, and y ci represents the ordinate of the athlete's position.
标志物检测:Marker detection:
步骤S2.2.1:对预处理后的图像标注感兴趣区域即ROI;Step S2.2.1: mark the region of interest, ie ROI, on the preprocessed image;
步骤S2.2.2:使用Grabcut算法对ROI进行分割,获得source节点即前景标志、sink节点即背景标志以及前景图像像素点,建立包含所有ROI前景图像像素点的新图,其中前景指标志物,Grabcut算法即对RGB三通道建立高斯混合模型GMM,GMM如下:Step S2.2.2: Use the Grabcut algorithm to segment the ROI, obtain the source node that is the foreground sign, the sink node that is the background sign, and the pixels of the foreground image, and create a new map containing all the pixels of the ROI foreground image, where the foreground refers to the marker, Grabcut The algorithm is to establish a Gaussian mixture model GMM for the RGB three channels. The GMM is as follows:
其中,N(x|μk,Σk)表示GMM的第k个元素,K为混合系数,其满足πk表示N(x|μk,Σk)的权重;GMM用于对前景和背景建模,在每次迭代时,其学习并创建新的像素分布,并且对前景和背景进行分类,分类的依据是上一次迭代中前景或背景像素值,Grabcut算法通过不断地迭代使前景图像更加精准。Among them, N(x|μ k ,Σ k ) represents the kth element of GMM, and K is the mixing coefficient, which satisfies π k represents the weight of N(x|μ k ,Σ k ); GMM is used to model the foreground and background, at each iteration, it learns and creates a new pixel distribution, and classifies the foreground and background, classification The basis is the foreground or background pixel value in the previous iteration, and the Grabcut algorithm makes the foreground image more accurate through continuous iteration.
步骤S2.2.3:经过多次迭代将与source节点连接的像素点作为前景,将与sink节点连接的像素点作为背景,完成图像前景和背景的分割,并通过公式获得前景图像的左上角坐标、宽度和高度,计算公式如下:Step S2.2.3: After multiple iterations, the pixels connected to the source node are used as the foreground, and the pixels connected to the sink node are used as the background to complete the segmentation of the image foreground and background, and obtain the upper left corner coordinates of the foreground image through the formula, The width and height are calculated as follows:
pick(x,y,w,h)pick(x, y, w, h)
其中,x表示前景图像的左上角横坐标,y表示前景图像的左上角纵坐标,w表示前景图像的宽度,h表示前景图像的高度;Among them, x represents the abscissa of the upper left corner of the foreground image, y represents the ordinate of the upper left corner of the foreground image, w represents the width of the foreground image, and h represents the height of the foreground image;
步骤S2.2.4:通过前景图像左上角的横坐标和其宽度计算标志物的横坐标,计算公式如下:Step S2.2.4: Calculate the abscissa of the marker through the abscissa of the upper left corner of the foreground image and its width. The calculation formula is as follows:
xbi=x+w/2 xbi = x+w/2
其中,xbi表示标志物的横坐标。Among them, xbi represents the abscissa of the marker.
确定运动员通过起点标志物和终点标志物并计算其时长:Determine how long the athlete passes the start and finish markers:
步骤3.1:比较、分析运动员和标志物在图像中的相对位置,根据运动员的横坐标和标志物的横坐标计算两者的差值,将差值与设定的阈值进行比较,若存在多个差值均小于阈值,则选取运动员前进方向第一个差值位置作为计时点,当两个标志物与运动员的横坐标差值均小于设定的阈值σ,则确定运动员通过第一个标志物即起点标志物和第二个标志物即终点标志物,并记录通过起点标志物和终点标志物的时间,计算公式如下:Step 3.1: Compare and analyze the relative positions of the athlete and the marker in the image, calculate the difference between the abscissa of the athlete and the abscissa of the marker, and compare the difference with the set threshold. If the difference is less than the threshold, the first difference position in the forward direction of the athlete is selected as the timing point. When the difference between the abscissas of the two markers and the athlete is less than the set threshold σ, it is determined that the athlete has passed the first marker. That is, the starting point marker and the second marker, the end point marker, and the time passing through the starting point marker and the end point marker is recorded. The calculation formula is as follows:
其中,ti表示通过标志物的时间,ts表示通过起点标志物的时间,te表示通过终点标志物的时间,xci表示当前帧运动员的横坐标,xb1表示第一个标志物的横坐标,xb2表示第二个标志物的横坐标,σ表示设定的阈值;设定的阈值σ可根据公式获得,具体计算公式如下:所述设定的阈值σ计算公式如下:Among them, t i represents the time to pass the marker, ts represents the time to pass the starting point marker, t e represents the time to pass the end marker, x ci represents the abscissa of the athlete in the current frame, x b1 represents the time of the first marker The abscissa, x b2 represents the abscissa of the second marker, σ represents the set threshold; the set threshold σ can be obtained according to the formula, and the specific calculation formula is as follows: The set threshold σ calculation formula is as follows:
其中,σ表示设定的阈值,Wf表示图像宽度的像素值,Wr表示相机镜头广度,v表示跑步速度,fps表示视频每秒帧数;Among them, σ represents the set threshold, W f represents the pixel value of the image width, W r represents the width of the camera lens, v represents the running speed, and fps represents the number of frames per second of the video;
本实施例中,计算阈值的参数均为已知或者根据实际情况给定,本申请将结合这些参数计算阈值,保证了阈值的设定的准确性;根据调研得知人百米赛跑的最快速度即v为10m/s,运动员竞走拍摄视频为25fps,拍摄相机在1280*720尺度下,图像宽度的像素值Wf为1280,镜头广度Wr为10m,因此由以上数据得出运动员在前进方向每一帧移动的最大像素值为51.2,所以设定的阈值为50,该阈值能有效地检测人是否通过标志物。In this embodiment, the parameters for calculating the threshold are all known or given according to the actual situation. This application will calculate the threshold in combination with these parameters to ensure the accuracy of the setting of the threshold; according to the investigation, the fastest speed of the 100-meter race is known. That is, v is 10m/s, the athlete’s walking video is 25fps, the camera is in the 1280*720 scale, the pixel value of the image width W f is 1280, and the lens width W r is 10m. Therefore, from the above data, it can be concluded that the athlete is in the forward direction. The maximum pixel value of each frame movement is 51.2, so the set threshold is 50, which can effectively detect whether a person passes through the marker.
步骤3.2:计算通过起点标志物和终点标志物的时长tf:Step 3.2: Calculate the duration t f through the start and end markers:
其中,tp表示处理每一帧图片所需的时间。Among them, t p represents the time required to process each frame of pictures.
计算步速:如图4所示:Calculate the pace: as shown in Figure 4:
步骤4.1:根据摄像头与标志物的距离D,已知摄像头视场角θ,计算标志物间的距离L,计算公式如下:Step 4.1: Calculate the distance L between the markers according to the distance D between the camera and the marker, and the camera's field of view angle θ is known. The calculation formula is as follows:
实际测量可得摄像头视场角θ=90°,由此可得L=9.8m;The actual measurement can get the camera's field of view angle θ=90°, which can be L=9.8m;
步骤4.2:根据步骤4.1得到的起点标志物和终点标志物的距离以及通过起点标志物和终点标志物的时长计算运动员的步速,计算公式如下:Step 4.2: Calculate the pace of the athlete according to the distance between the starting point marker and the ending point marker obtained in step 4.1 and the duration of the starting point marker and the ending point marker. The calculation formula is as follows:
其中,L表示标志间的距离,tf表示通过起点标志物和终点标志物的时长,λ表示普通运动员的步长。Among them, L represents the distance between the markers, t f represents the duration of passing the starting point marker and the ending point marker, and λ represents the step length of an ordinary athlete.
步长根据运动员身高计算,计算公式如下:The step length is calculated according to the height of the athlete, and the calculation formula is as follows:
SG=λ*0.54+132SG=λ*0.54+132
其中,SG表示身高,单位为cm,λ表示普通运动员的步长。Among them, SG represents the height in cm, and λ represents the step length of an ordinary athlete.
比如身高为178cm,其步长实际为85cm,计算值为85.18cm,该公式通过多名运动员人员进行实验,统计并分析得到的公式,精确度高。For example, the height is 178cm, the actual step length is 85cm, and the calculated value is 85.18cm. This formula is obtained through experiments by multiple athletes, statistics and analysis, and the accuracy is high.
综上,本发明通过Grabcut算法确定标志物在视频/图像中的位置,通过HOG特征检测图像中运动员的位置,根据运动员位置、标志物位置以及设定的阈值确定开始时间和结束时间即确定运动员通过标志物,获得通过标志物的时长,结合通过标志物的距离求解运动员的步速,解决了现有基于图像的步速测量方法中图像中缺少距离参照物从而被多种因素影响导致测量结果误差大的问题,达到了精确定位标志物,精确计算运动员步速的效果。To sum up, the present invention determines the position of the marker in the video/image through the Grabcut algorithm, detects the position of the athlete in the image through the HOG feature, and determines the start time and end time according to the athlete's position, the position of the marker and the set threshold, that is, the athlete is determined. Through the marker, the duration of passing the marker is obtained, and the athlete's pace is calculated based on the distance passing through the marker, which solves the problem of the lack of distance reference in the image in the existing image-based pace measurement method, which is affected by various factors. The problem of large error has achieved the effect of accurately positioning the marker and accurately calculating the pace of the athlete.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810589119.5A CN109030854B (en) | 2018-06-08 | 2018-06-08 | A gait measurement method based on RGB images |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810589119.5A CN109030854B (en) | 2018-06-08 | 2018-06-08 | A gait measurement method based on RGB images |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109030854A CN109030854A (en) | 2018-12-18 |
CN109030854B true CN109030854B (en) | 2020-11-10 |
Family
ID=64612527
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810589119.5A Active CN109030854B (en) | 2018-06-08 | 2018-06-08 | A gait measurement method based on RGB images |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109030854B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110349415B (en) * | 2019-06-26 | 2021-08-20 | 江西理工大学 | A method of vehicle speed measurement based on multi-scale transformation |
CN110991413B (en) * | 2019-12-20 | 2020-12-15 | 西南交通大学 | A running detection method based on ReID |
CN111274914B (en) * | 2020-01-13 | 2023-04-18 | 目骉资讯有限公司 | Horse speed calculation system and method based on deep learning |
CN112485461A (en) * | 2020-10-21 | 2021-03-12 | 国网电力科学研究院有限公司 | Power inspection robot speed detection system and method based on multi-vision markers |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103861265A (en) * | 2012-12-18 | 2014-06-18 | 卡西欧计算机株式会社 | Exercise support device, exercise support method, and exercise support program |
KR101633619B1 (en) * | 2016-03-23 | 2016-06-27 | 주식회사 토페스 | Method and apparatus for detecting velocity of vehicle using recognizing number of the vehicle of 2-dimensional image |
EP3040678A1 (en) * | 2014-12-29 | 2016-07-06 | Nuctech Company Limited | Photogrammetry system and photogrammetry method |
CN106447726A (en) * | 2016-08-23 | 2017-02-22 | 广西科技大学 | Method for vision detection on body position of athlete during climbing |
CN107315095A (en) * | 2017-06-19 | 2017-11-03 | 哈尔滨工业大学 | Many vehicle automatic speed-measuring methods with illumination adaptability based on Video processing |
-
2018
- 2018-06-08 CN CN201810589119.5A patent/CN109030854B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103861265A (en) * | 2012-12-18 | 2014-06-18 | 卡西欧计算机株式会社 | Exercise support device, exercise support method, and exercise support program |
EP3040678A1 (en) * | 2014-12-29 | 2016-07-06 | Nuctech Company Limited | Photogrammetry system and photogrammetry method |
KR101633619B1 (en) * | 2016-03-23 | 2016-06-27 | 주식회사 토페스 | Method and apparatus for detecting velocity of vehicle using recognizing number of the vehicle of 2-dimensional image |
CN106447726A (en) * | 2016-08-23 | 2017-02-22 | 广西科技大学 | Method for vision detection on body position of athlete during climbing |
CN107315095A (en) * | 2017-06-19 | 2017-11-03 | 哈尔滨工业大学 | Many vehicle automatic speed-measuring methods with illumination adaptability based on Video processing |
Non-Patent Citations (1)
Title |
---|
Accuracy and reliability of the RGB-D camera for measuring walking speed on a treadmill;B. Fosty等;《Gait & Posture》;20161231;第113-119页 * |
Also Published As
Publication number | Publication date |
---|---|
CN109030854A (en) | 2018-12-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109030854B (en) | A gait measurement method based on RGB images | |
JP4424869B2 (en) | Stride measuring device | |
CN102847291B (en) | System and method for measurement and analysis of behavior of golf club head in golf swing | |
CN109598242A (en) | A kind of novel biopsy method | |
CN110738154A (en) | pedestrian falling detection method based on human body posture estimation | |
CN106375706A (en) | Method and apparatus for velocity measurement of moving object by use of double pick-up heads, and terminal | |
KR101133736B1 (en) | Apparatus for swimmer's training using photographing image and a method for controlling it | |
CN109583373A (en) | A kind of pedestrian identifies implementation method again | |
CN107040713A (en) | Apparatus for determining motion vectors and its control method and picture pick-up device | |
JPH10334207A (en) | Human stream measuring instrument | |
Bachmann et al. | Motion capture from pan-tilt cameras with unknown orientation | |
KR101469099B1 (en) | Auto-Camera Calibration Method Based on Human Object Tracking | |
CN112597903B (en) | Electric power personnel safety state intelligent identification method and medium based on stride measurement | |
CN103096117A (en) | Video noise detecting method and device | |
Ivanova et al. | Video and sensor-based rope pulling detection in sport climbing | |
JP7198661B2 (en) | Object tracking device and its program | |
JP3891181B2 (en) | Method and apparatus for automatically calculating camera parameters | |
CN114419485A (en) | Camera-based intelligent vehicle speed measuring method and system, storage medium and computer equipment | |
KR100532058B1 (en) | Traffic information acquisition method and apparatus using camera calibration | |
Abd Shattar et al. | Experimental setup for markerless motion capture and landmarks detection using OpenPose during dynamic gait index measurement | |
JP3947456B2 (en) | Stride measuring device and stride measuring method | |
JP4101478B2 (en) | Human body end point detection method and apparatus | |
CN117333550A (en) | Badminton serve height violation identification method based on computer vision detection | |
Hild | Estimation of 3d motion trajectory and velocity from monocular image sequences in the context of human gait recognition | |
CN118275008A (en) | Stress analysis method and stress analysis device for moving object |
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 |