# Research on Sports Video Image Based on Clustering Extraction

Authors: Jun Ma
Journal: Mathematical Problems in Engineering
 (2021)

---

## Abstract

Today, with the continuous sports events, the major sports events are also loved by the majority of the audience, so the analysis of the video data of the games has higher research value and application value. This paper takes the video of volleyball, tennis, baseball, and water polo as the research background and analyses the video images of these four sports events. Firstly, image graying, image denoising, and image binarization are used to preprocess the images of the four sports events. Secondly, feature points are used to detect the four sports events. According to the characteristics of these four sports events, SIFT algorithm is adopted to detect the good performance of SIFT feature points in feature matching. According to the simulation experiment, it can be seen that the SIFT algorithm can effectively detect football and have good anti-interference. For sports recognition, this document adopts the frame cross-sectional cumulative algorithm. Through simulation experiments, it can be seen that the grouping algorithm can achieve a recognition rate of more than 80% for sporting events, so it can be seen that the recognition algorithm is suitable for recognizing sports events videos.


---

## Body

## 1. Introduction

In recent years, with the improvement of peopleʼs living standards, more and more attention has been paid to sports and video processing has been gradually deepened in the field of sports. A large number of sports and national fitness information, as well as video and image forms, are stored in various fitness guidance systems. In order to better promote public fitness and facilitate learning and viewing, image segmentation motion video player has become a hot topic of digital image processing. To overcome the slow split, irregular movement, and susceptible to the influence of light of the shortcomings of the moving object, the researcher based clustering presents a motion video sequence moving foreground object extraction algorithm. Experiments show that the algorithm is effective, simple, workable, and has less calculation, and the effect is satisfactory.Motion video object exercise posture has relatively random and blurred image change tendency, and the divided region is not easily determined. Moving video images may present segmentation exercise posture, unnecessary region of the object, pixel area divides into foreground and background, and extracts the movement of the object. Launched in 2000, with an increase in MPEG-4 video content semantic search feature, you can split the background and foreground images into different semantic objects. Coding efficiency is improved, but the noise in the encoding process is not quickly eliminated. Temporal segmentation and frequency domain are the first segmentation method for segmentation of moving video images presented specifically. After a lot of experiments, both methods can not accurately describe the attitude of the object, and the image segmentation is not clear. Therefore, research on sports video images based on clustering extraction has greatly changed sports videos and will help make better use of sports video analysis and images.As research deepens, sports video image segmentation technology has made great strides. In 2009, David and Zhang Shensheng used a binary grouping method, which showed a good recognition rate in various images and achieved good results in the experiment. However, there are also some weaknesses in the method. The result is not obvious when the brightness of the object surface is affected by many lighting factors, such as dimming reflection, high light reflection, and fuzzy texture. Fan Cuihong proposed a segmentation method of video moving objects based on regional differences. The RGB space of video image is transformed into HSV space. The closed contour of moving object is extracted by chroma, saturation, and brightness. According to the moving area, background area, and occlusion area of video, the edge of moving object is detected by edge detection operator, and finally the moving object in video is segmented. Experiments show that the improved algorithm can improve the segmentation accuracy and meet the real-time requirements. Ouyang Yi proposed a method based on Markov chain Monte Carlo (MCMC) to track human posture in monocular video images. Firstly, the projection maps of human appearance in basic human motion database acquired by motion capture equipment were clustered under different perspectives. Using HOG to detect human body in monocular video images can segment the position of human limbs more accurately. Finally, the appearance model of the three-dimensional human posture reasoning algorithm is used to analyze each frame, and then the time-constrained analysis model is used to track the target. Constraint graph-driven MCMC and basic action library are combined to construct a model for video data modeling, and the model is applied to data driven online behavior recognition to improve human pose modeling ability. Zhang Jiawen et al. proposed a convenient and practical method for human motion tracking and motion reconstruction in video and initially achieved the goal of obtaining human motion data from video resources such as video surveillance and video recordings. This paper is a useful attempt to track and acquire human motion in monocular video, and some satisfactory preliminary research results have been achieved. In the last part of this paper, the author puts forward his own opinions on the problems of human motion tracking and motion reconstruction methods and their further improvement. Wu Tianai, Yang Ling, and others have proposed a moving human body detection algorithm based on space-time combination in color environment. The algorithm combines temporal segmentation with spatial segmentation to obtain the moving human body with precise edges and eliminates the shadow of the moving human body. The experimental results show that the above algorithm can detect the moving human body from the color image sequence in real time and effectively, eliminate the shadow of the moving human body, and finally detect the moving human body is the color. With more and more people researching sports video images, many achievements have been made in recent years.Because of the complexity of the algorithm and the great difference between the segmentation results and the reality, the application of the segmentation results is limited. The main reason is that the change of the blur factor of the image, the uncertainty of the segmentation, and the time-consuming information loss. This loss is often due to the boundary information generated in the classification process. Clustering extraction as a clustering method has been successfully applied in many research classifications. Liu Guodong et al. proposed a threshold adaptive online clustering color background reconstruction algorithm and objectively evaluated the reconstructed color background. Finally, the background subtraction method was used to extract moving objects. Jiang Yuan et al. put forward that clustering is an important tool for data mining. According to the similarity of data, the database is divided into several categories, in which the data should be as similar as possible. Based on possibilistic C-mode clustering, the main tone and subtone were selected to describe the features of video images so that the key frames of video could be extracted directly without shot segmentation. Experiments show that this method can effectively extract the most representative key frames according to the complexity of video content and has high timeliness. Leskovec et al. proposed the K_SC clustering algorithm for topic time series in 2010, which has high accuracy and can better describe the inherent trend of topic development. However, the K_SC algorithm is highly sensitive to the center of the initial class matrix and has high time complexity, which makes it difficult to apply in the actual high-dimensional large data sets.Due to the advantages of the cluster extraction algorithm [1], cluster extraction has been used as a classification tool in many areas of clustering research, and good results have been achieved. The extraction algorithm proposed sequential cross-sections of cross-based video frames that form moving foreground objects. The simulation experiment is performed under the simulation environment of MATLAB 2014 B. The experiment proves that the algorithm is efficient, simple, and feasible, with fewer calculations and can have more satisfactory results. Due to the inherent noise in the original frame, it is necessary to reduce the noise in the original video sequence to improve the accuracy and efficiency of moving objects in video segmentation, to reduce noise, and to enhance the effect of calculating the frame difference. This algorithm uses the most common square median filter module for preprocessing, which is fast and feasible, can reduce the loss of image details, optimize image quality, and be suitable for the next segment. It can also better protect the edges of the image and effectively remove noise. Research on sports video images based on clustering extraction and these fast 3D camera modeling broadcast court network sports videos, deep learning models and transfer learning sports videos, mixed reality systems, and hyperparameter optimization based on convolutional neural networks. In comparison with the sports video summary scene classification algorithm based on classification and transfer learning, the clustering extraction algorithm can be more convenient, fast, safe, and reliable.


## 2. Proposed Method

### 2.1. Binary Processing Based on Sports Video Image

Among many image segmentation methods, binarization is a simple and effective method. The purpose of image binarization [2] is to separate the moving object and background from the image and to provide a basis for subsequent classification, detection, and recognition. Typically, the method of threshold segmentation [3] is used for binarization. Its principle is to select an appropriate threshold to determine whether each pixel in the image belongs to the target or the background by making use of the difference between the object and the background in the image so as to get the target to be detected.Set the input image asfx,y and the output image as fbx,y, then(1)fbx,y=1,fx,y≥T,0,fx,y<T,where T represents the threshold of the binarization process. In actual processing, 255 is used to represent the background and 0 is used to represent the moving target. The process of binarization is relatively simple. The key problem is the selection method of binarization. In this paper, the OTSU algorithm [4] is used to improve the selection of binarization image threshold.


### 2.2. Morphological Processing of Sports Video Image

The binary image has some misjudgement points; that is, there are a small number of “burrs” or “holes,” which requires further refinement. In order to get more accurate segmentation results, this paper chooses appropriate structural elements and uses mathematical morphology to filter the corrosion and expansion. In fact, it uses image open and close operation.In corrosion operation, the result of etching a binary image is to narrow the edge of the image and shrink inward, which seems to be eroded by the surface. Its principle is to define a subimage whose size is negligible and relative to the image to be processed as a structural element. Typically, a 2∗ 2 or 3 ∗ 3 pixel size template is selected, which specifies a pixel in the template as the origin and assigns a value (1 or 0) to each position in the template. The structure elements are used to scan the image to be processed point by point and perform matching operations. Whenever a subimage identical to the structural element is found (no matching of the zero pixels in the structural element), the location of the corresponding pixel in the subimage corresponding to the original position of the structural element is marked. The set of all such pixels is the result of the corroded operation of the binary image, which is defined as formula (2)IfI is the image to be corroded and B is the selected structure “probe,” then the definition of target image I corroded by probe B [5] is as follows:(2)IΘB=x|Bx⊇I.Among them,X represents the displacement of set translation, Θ represents the operator of corrosion operation, and Bx represents the translation of structural elements.Morphological corrosion means that every time the translation structural element detects the image to be processed; if a subimage identical to the structural element is found, the location of the pixels in the subimage and the origin of the structural element is marked. The set of all the marked pixels is the result of corrosion. In fact, in the image to be processed, the original pixels of the subimage with exactly the same shape of the structural elements are marked and retained. Expansion operation corresponds to corrosion operation. Expansion processing of a binary image often enlarges the edge of the image. Therefore, if there are black spots in the white foreground area of the image or two white areas are blocked by very thin black lines, then the black pore in the corroded image will be filled into a white image block which is similar to the surrounding image block, and the two image blocks which are not connected by themselves will also become a complete connected block. The principle of image expansion is to define a subimage whose size is negligible relative to the image to be processed as a structural element. Typically, a template with 2 × 2 or 3 × 3 pixel size is selected to specify a pixel in the template as the origin. And a value (1 or 0) is assigned to each position in the template, the image is scanned to be processed point by point, and matching operation is performed by using structural elements. Whenever a pixel point intersecting with the structural element is found (only one position in the structural element and the image to be processed are foreground points), the point of the image to be processed relative to the original of the structural element is marked as foreground points. The set of all these marker points is the result of image expansion. The definition of image expansion is as formula (3).IfI is the source image to be processed and B is the selected structural element, then the mathematical definition of the expansion of the target image I by the structural element B is as follows:(3)I⊕B=x|x=i+b,i∈I,b∈B=∪b∈BIb.Among them,i + B denotes that I is translated by vector b, x denotes the two-dimensional value after operation, and ⊕ is the symbol of expansion operation.The meaning of morphological dilation is that as long as the intersection point with the structural element is not empty in the image, the pixels corresponding to the original position of the structural element in the image to be processed are marked. The set of all the symbolic conditions is the result of the dilation operation.Corrosion and expansion operations have different effects. Expansion can connect two separate regions and make two isolated “islands” connected. Corrosion can eliminate the pore in the image, make the original isolated “island” disappear in the image, and play the role of filtering noise.


### 2.3. Feature Point Detection

In feature point detection [6], what kind of feature is used to describe objects is an important part of feature matching. Whether the feature selection is appropriate or not is the decisive factor affecting the success or failure of the next matching work. In this paper, we use feature points, but there is no definite concept at present. Generally speaking, we represent points with feature properties in images, such as extreme points, points with zero second derivative, intersection points of lines, and lines in images. The feature points represent the important local feature information in the image, which effectively reduces the image information and plays a great role in the analysis and understanding of the image. Using feature points for image matching can enhance the validity and reliability of image matching.


#### 2.3.1. Harris Feature Point Detection

The core idea of the Harris feature point detection algorithm is to use small windows to judge the gray level change by moving on the image. If the gray level changes obviously in the process of moving, there will be feature points in the window.If the gray level does not change or does not change in one direction, there is no feature point in the window. By constructing a mathematical model, the problem can be expressed as follows:(4)Eu,v=∑x,ywx,yIx+u,y+u−Ix,y2.In formula (4), u,v represents window translation transformation, Eu,v is gray level change, wx,y is window function, and Ix,y is image gray level. The window function is Gauss function as follows:(5)wx,y=12πσ2e−x2+y2/2σ2.This function can be understood as calculating the weight of gray level in the window, which changes with the direction from the center point to the edge smaller and smaller, so as to eliminate the influence of noise on it.The Taylor expansion for formula (10) can be expressed as follows:(6)Eu,v=∑x,ywx,yIxu+Iyv+ou2,v22.M is the partial derivative sparse matrix and it is expressed as(7)Eu,v≅u,vMuv.In this formula,Ix is the difference in direction x, Iy is the difference in direction y, and M is the partial derivative sparse matrix and is expressed as follows:(8)M=∑x,ywx,yIx2IxIYIxIyIy2.For Harris feature point monitoring, the size of two eigenvectors ofM matrix can be used. The two eigenvalues represent two directions of the fastest and slowest change, respectively. Both of them are large and can be judged as characteristics. One is the edge, and the other is the edge. Both of them are small and flat areas without change. So, we can express the problem as follows:(9)R=detM−ktrM2,where detM is the determinant of a matrix M which is the product of two eigenvalues, trM is the trace of a matrix M which is the sum of two eigenvalues, and k is a constant. From the analysis, it can be seen that the judgment of Harris feature points is related to the value R. When the value R is larger and positive, it can be judged as the feature point. When the value R is larger and negative, it can be judged as the edge, and when the value R is smaller, it can be judged as the flat area without change. In practical applications, the horizontal and vertical difference operators are used to evaluate the matrix M of the pixels, and then the Gauss filter is used to determine the feature points directly by R. The algorithm is simple, efficient, insensitive to illumination changes, and has rotation invariance. However, it does not have scale invariance; when the threshold is too large, the sensitivity of focus detection is not enough and the number of feature points is too small, and false feature points are easy to appear when the threshold is too large.


#### 2.3.2. ORB Feature Point Detection

ORB feature point detection [7, 8] is a SIFT algorithm for extracting and describing image features. FAST (Features from Accelerated Segment Test) is used to extract feature points. In the algorithm based on image feature detection and matching, through the GLAMpoints paper, we can learn the exact matching points greedily learned. And through the feature detection and description of image matching, we can learn from manual design to deep learning. It is best to talk about key point detectors and descriptors based on random samples through RSKDD-Net. The core idea of the FAST algorithm is as follows: for a pixel, a circular region is constructed with the center of the pixel, and the gray value of the pixel in the center of the circle is compared with that of all the pixels in the circle. When the pixel value of enough points is larger or smaller than that of the center of a circle, the pixel is considered to be a feature point. It can be expressed as follows:(10)D=∑circlepIx−Ip>ε.In formula (10), Ix is the gray value of any point in the circle, Ip is the gray value of the central pixel, and ε is the set thresholds. If the D value is greater than the set threshold, the corner can be judged.In view of the fact that FAST features do not satisfy scale changes, the ORB algorithm establishes scale pyramids, similar to the SIFT algorithm in building scale pyramids. For each layer of image, FAST feature points are extracted. Finally, the extracted features are regarded as a set of features extracted from all layers, so as to meet the scale invariance. Aiming at the problem that FAST feature points have no direction, the ORB algorithm gives the gray centroid position in the neighborhood whereR is the center of feature points and the direction of gray centroid is the direction of feature points, and then the formula for calculating centroid C is as follows:(11)mpq=∑x,y∈rxpyqIx,y,C=m10m01,m00m00.In formula (11), Ix,y is the gray value of the neighboring pixel, and the direction of the vector OC¯ of the feature point O and the center of mass C is as follows:(12)θ=arctanm01m10.Since FAST feature is only an algorithm for feature detection and does not involve the formation of feature descriptors, the ORB algorithm uses Rbrief algorithm for feature description. The Rbrief algorithm is that the descriptor generated by the Brief algorithm [9] adds rotation angle information. The Brief algorithm takes n pairs of pixels randomly around the position of the extracted feature points to form an image block and then compares the two pixels in the image block, the result of which is expressed by 0 or 1. A series of binary digit strings with length n are generated, and the generated binary digit strings are the Brief descriptors of the feature points. In order to enhance the descriptorʼs robustness to noise and illumination, the image block is smoothed by Gauss filtering. The gray level of 5 ∗ 5 neighborhood of a point in its 31 ∗ 31 neighborhood is compared with that of point pair. The comparison criterion of the ORB algorithm after Gaussian smoothing of image blocks can be expressed as follows:(13)τp;x,y≔1,px<py,0,px≥py.In formula (13), the average gray levels of the two pairs of pixels X and Y in the image block p are, respectively, px and py. The generated binary digit string can be represented as follows:(14)fnp=∑1≤i≤n2i−1τp;x,y.In formula (14), n can generally be taken as 128, 256, and 512. It can be seen that the Brief descriptor does not have rotation invariance. In order to describe the direction of the generated feature points using the descriptor, ORB improves the Brief descriptor. Let the original Brief algorithm represent a 2 ∗ n matrix by selecting n pairs of points around the feature points:(15)S=x1,…,xny1,…,yn.According to the angleθ between FAST feature points and centroid, the rotation matrix Rθ is constructed, and then the corresponding direction of rotation of the point set matrix can be expressed as follows:(16)Sθ=RθS.At this time, the original Brief descriptor can be expressed as follows:(17)gnp,θ≔fnp|xi,yi∈Sθ.In order to ensure the separability of feature point descriptors, the ORB algorithm improves the original Brief algorithm by using statistical principles, namely, Rbrief algorithm. Each point is arranged in columns according to the binary digits taken above, and the matrixQ is generated. The average value of Q of each column is calculated. The first column in the matrix R is rearranged according to the distance from the draw value to 0.5. The correlation between Q of all the columns and all the columns in the matrix R is calculated. If the result is less than the set threshold, put the column in the matrix R, until 256 columns in R stop. The feature points extracted by the ORB algorithm and the descriptors generated by the ORB algorithm are fast and have good rotation invariance. However, when adapting to scale change, the effect is general. Because its descriptor is binary digit string, the matching process is not stable enough, which will cause some difficulties in matching.


#### 2.3.3. SIFT Feature Point Detection

The SIFT algorithm [10] is a computer vision feature extraction algorithm which satisfies our needs very well. The feature extracted by this algorithm is a scale rotation invariant, so it has excellent robustness and is convenient for feature matching. The main idea of SIFT is to collect images in continuous scale, find extremum points in continuous scale space, remove unstable extremum points, and extract and acquire local features of rotation and scale invariance around stable extremum points. Finally, 128-dimensional descriptors are generated.SIFT features have the following advantages: strong robustness and good adaptability to geometric deformation, image noise, and brightness change. An image can generate a large number of SIFT feature points, which are rich in data. The local invariant features corresponding to the two images have good repeatability. Firstly, we consider the scale invariance of SIFT features. In order to adapt to scale transformation, feature points need to be detected in all image scales. Therefore, it is necessary to establish the scale space, and the Gaussian kernel function [11] is the only smoothing function in the scale space, so the Gaussian kernel function can be used to build the scale space. The scale transformation of an image can be expressed as follows:(18)Lx,y,σ=Gx,y,σ∗Ix,y,where Ix,y is expressed as an image, x,y,σ is a Gaussian kernel function, and Lx,y,σ is an image in different scales, and it is a scale space. The Gauss kernel function can be expressed as follows:(19)Gx,y,σ=12πσ2e−x2+y2/2σ2,σ≥0.In order to improve the reliability and stability of feature points, the preliminary identified feature points are screened. The screening steps are divided into two steps. The first step is to remove the low contrast points, i.e., some noise-sensitive points, and Taylor expansion is carried out for equation (21):(20)Dx=D+∂DT∂xx+12xT∂2D∂x2x.Seeking extreme points,(21)x^=−∂2D−1∂x2∂D∂x.In formula (21), x^ is the position of the extreme point and x is the offset of the extreme point. Dx^ can be used as a basis for judgment. Generally, feature points of Dx^ less than 0.3 are removed. The second step is to remove the edge response. The points at the edge are very sensitive to noise, and the Gauss difference function has a large principal curvature for a peak across the edge, so the SIFT algorithm excludes the edge response by calculating the principal curvature. The principal curvature can be calculated by a 2 ∗ 2 Hessian matrix H as follows:(22)H=DxxDxyDxyDyy.Since the principal curvature is proportional to the eigenvalue of matrixH, if the two eigenvalues of matrix H are, respectively, α or β, then there are(23)TrH2DetH<r+12r.In formula (23), TrH is the trace of matrix H, DetH is the determinant of matrix H, and r is the constant which is generally taken as 10 to determine whether the principal curvature is in a certain range.After the stable feature points are selected, the appropriate descriptor is generated for the feature. In order to make the descriptor rotate invariant, the gradient modulus and direction can be expressed as follows:(24)mx,y=Lx+1,y−Lx−1,y2+Lx,y+1−Lx,y−12,θx,y=αtan2Lx,y+1−Lx,y−1Lx+1,y−Lx−1,y.In formula (24), L is expressed as the scale of each point. The gradient value of each point represents the main direction of the neighborhood gradient and takes the main direction as the direction of the feature point. After determining the main direction, the position, scale, and direction of each feature point have been reflected. At this point, a descriptor is generated for each feature point. To solve the gradient value on the image smoothed by the corresponding Gauss feature points, each feature point can generate a 128-dimensional descriptor, that is, a 128-dimensional feature vector. In order to remove the influence of illumination changes, the feature vector can be normalized and SIFT features can be extracted.


### 2.4. Cluster Analysis Method

Cluster analysis is a method of quantitative classification with mathematical tools. Cluster analysis algorithm [12] is a typical unsupervised learning algorithm and one of the important algorithms of data mining. It is mainly used to study classification problems; that is, similar data are automatically divided into the same category. When using the clustering algorithm, we usually analyze the similarity relationship between data to group data and divide data into different classes. The greater the similarity between similar data, the smaller the similarity between different classes of data; that is, the greater the difference, the better the classification effect.


#### 2.4.1. Clustering Algorithm Based on Cumulative Frame Difference Intersection

The basic idea of the clustering algorithm based on the intersection of the cumulative frame difference is based on the calculation of the cumulative frame difference and cross and cluster the two cumulative frame differences so that the changing area can accurately converge to the foreground edge, and then the area binarizes the mask to obtain a differential image frame that is to ensure the real-time performance, and greatly improve the segmentation effect. It is also suitable for sports video sequences with fast-moving objects. The main steps of the algorithm are as follows:(1)
After the median filtering, the image processing sequence difference between adjacent frames and frame interval difference is as follows:If the current image framen can be expressed as f (k), the frame image k+1 and k+2 can be expressed as f (k + 1) and f (k + 2), and the interframe difference of the adjacent difference categories can be expressed as follows:(25)fk+1x,y−fkx,y,fr+1x,y−frx,y.The cumulative results of then frames are as follows:(26)D1=∑r=1kfr+1x,y−frx,y=E∪N1,D2=∑k=1kfk+2x,y−fkx,y=F∪N2,whereE and F are the change areas in the cumulative results and N1 and N2 are noise.(2)
By intersecting the two cumulative frame differences, the pixels belonging to the change area in the two cumulative results can be effectively concentrated around the foreground contour, thereby obtaining an ideal moving foreground contour.(27)D1∩D2=A∪N1∩B∪N2=EF∪EN2∪FN1∪N1N2.SinceEN2 and FN1 are clustering of moving regions and noises, formula (5) can be rewritten as follows:(28)D1∩D2=AB+N.(3)
For further clustering method to remove background pixels, clustering step procedure is described as follows:Step 1.
Randomly determine two points and set 5∗ 5 and cycle number 1P as the centers.Step 2.
For each pixel in a rectangular window,(29)D1=1NK2∑N1∩N2∪EF∩EN1xi−x−yi−y.Step 3.
Compare the distanceD1 with the threshold Di. If Di≤D1, binning of pixels moved to the edge of the moving foreground object. Otherwise, the pixel will be merged into the background noise edge pixel.Step 4.
Move the rectangular window from the horizontal and vertical directions, increase the number of pixels and follow Step 2 until all the binning classes they belong to, that is, the number of cycles reaches the specified number, and the cluster ends.


## 2.1. Binary Processing Based on Sports Video Image

Among many image segmentation methods, binarization is a simple and effective method. The purpose of image binarization [2] is to separate the moving object and background from the image and to provide a basis for subsequent classification, detection, and recognition. Typically, the method of threshold segmentation [3] is used for binarization. Its principle is to select an appropriate threshold to determine whether each pixel in the image belongs to the target or the background by making use of the difference between the object and the background in the image so as to get the target to be detected.Set the input image asfx,y and the output image as fbx,y, then(1)fbx,y=1,fx,y≥T,0,fx,y<T,where T represents the threshold of the binarization process. In actual processing, 255 is used to represent the background and 0 is used to represent the moving target. The process of binarization is relatively simple. The key problem is the selection method of binarization. In this paper, the OTSU algorithm [4] is used to improve the selection of binarization image threshold.


## 2.2. Morphological Processing of Sports Video Image

The binary image has some misjudgement points; that is, there are a small number of “burrs” or “holes,” which requires further refinement. In order to get more accurate segmentation results, this paper chooses appropriate structural elements and uses mathematical morphology to filter the corrosion and expansion. In fact, it uses image open and close operation.In corrosion operation, the result of etching a binary image is to narrow the edge of the image and shrink inward, which seems to be eroded by the surface. Its principle is to define a subimage whose size is negligible and relative to the image to be processed as a structural element. Typically, a 2∗ 2 or 3 ∗ 3 pixel size template is selected, which specifies a pixel in the template as the origin and assigns a value (1 or 0) to each position in the template. The structure elements are used to scan the image to be processed point by point and perform matching operations. Whenever a subimage identical to the structural element is found (no matching of the zero pixels in the structural element), the location of the corresponding pixel in the subimage corresponding to the original position of the structural element is marked. The set of all such pixels is the result of the corroded operation of the binary image, which is defined as formula (2)IfI is the image to be corroded and B is the selected structure “probe,” then the definition of target image I corroded by probe B [5] is as follows:(2)IΘB=x|Bx⊇I.Among them,X represents the displacement of set translation, Θ represents the operator of corrosion operation, and Bx represents the translation of structural elements.Morphological corrosion means that every time the translation structural element detects the image to be processed; if a subimage identical to the structural element is found, the location of the pixels in the subimage and the origin of the structural element is marked. The set of all the marked pixels is the result of corrosion. In fact, in the image to be processed, the original pixels of the subimage with exactly the same shape of the structural elements are marked and retained. Expansion operation corresponds to corrosion operation. Expansion processing of a binary image often enlarges the edge of the image. Therefore, if there are black spots in the white foreground area of the image or two white areas are blocked by very thin black lines, then the black pore in the corroded image will be filled into a white image block which is similar to the surrounding image block, and the two image blocks which are not connected by themselves will also become a complete connected block. The principle of image expansion is to define a subimage whose size is negligible relative to the image to be processed as a structural element. Typically, a template with 2 × 2 or 3 × 3 pixel size is selected to specify a pixel in the template as the origin. And a value (1 or 0) is assigned to each position in the template, the image is scanned to be processed point by point, and matching operation is performed by using structural elements. Whenever a pixel point intersecting with the structural element is found (only one position in the structural element and the image to be processed are foreground points), the point of the image to be processed relative to the original of the structural element is marked as foreground points. The set of all these marker points is the result of image expansion. The definition of image expansion is as formula (3).IfI is the source image to be processed and B is the selected structural element, then the mathematical definition of the expansion of the target image I by the structural element B is as follows:(3)I⊕B=x|x=i+b,i∈I,b∈B=∪b∈BIb.Among them,i + B denotes that I is translated by vector b, x denotes the two-dimensional value after operation, and ⊕ is the symbol of expansion operation.The meaning of morphological dilation is that as long as the intersection point with the structural element is not empty in the image, the pixels corresponding to the original position of the structural element in the image to be processed are marked. The set of all the symbolic conditions is the result of the dilation operation.Corrosion and expansion operations have different effects. Expansion can connect two separate regions and make two isolated “islands” connected. Corrosion can eliminate the pore in the image, make the original isolated “island” disappear in the image, and play the role of filtering noise.


## 2.3. Feature Point Detection

In feature point detection [6], what kind of feature is used to describe objects is an important part of feature matching. Whether the feature selection is appropriate or not is the decisive factor affecting the success or failure of the next matching work. In this paper, we use feature points, but there is no definite concept at present. Generally speaking, we represent points with feature properties in images, such as extreme points, points with zero second derivative, intersection points of lines, and lines in images. The feature points represent the important local feature information in the image, which effectively reduces the image information and plays a great role in the analysis and understanding of the image. Using feature points for image matching can enhance the validity and reliability of image matching.


### 2.3.1. Harris Feature Point Detection

The core idea of the Harris feature point detection algorithm is to use small windows to judge the gray level change by moving on the image. If the gray level changes obviously in the process of moving, there will be feature points in the window.If the gray level does not change or does not change in one direction, there is no feature point in the window. By constructing a mathematical model, the problem can be expressed as follows:(4)Eu,v=∑x,ywx,yIx+u,y+u−Ix,y2.In formula (4), u,v represents window translation transformation, Eu,v is gray level change, wx,y is window function, and Ix,y is image gray level. The window function is Gauss function as follows:(5)wx,y=12πσ2e−x2+y2/2σ2.This function can be understood as calculating the weight of gray level in the window, which changes with the direction from the center point to the edge smaller and smaller, so as to eliminate the influence of noise on it.The Taylor expansion for formula (10) can be expressed as follows:(6)Eu,v=∑x,ywx,yIxu+Iyv+ou2,v22.M is the partial derivative sparse matrix and it is expressed as(7)Eu,v≅u,vMuv.In this formula,Ix is the difference in direction x, Iy is the difference in direction y, and M is the partial derivative sparse matrix and is expressed as follows:(8)M=∑x,ywx,yIx2IxIYIxIyIy2.For Harris feature point monitoring, the size of two eigenvectors ofM matrix can be used. The two eigenvalues represent two directions of the fastest and slowest change, respectively. Both of them are large and can be judged as characteristics. One is the edge, and the other is the edge. Both of them are small and flat areas without change. So, we can express the problem as follows:(9)R=detM−ktrM2,where detM is the determinant of a matrix M which is the product of two eigenvalues, trM is the trace of a matrix M which is the sum of two eigenvalues, and k is a constant. From the analysis, it can be seen that the judgment of Harris feature points is related to the value R. When the value R is larger and positive, it can be judged as the feature point. When the value R is larger and negative, it can be judged as the edge, and when the value R is smaller, it can be judged as the flat area without change. In practical applications, the horizontal and vertical difference operators are used to evaluate the matrix M of the pixels, and then the Gauss filter is used to determine the feature points directly by R. The algorithm is simple, efficient, insensitive to illumination changes, and has rotation invariance. However, it does not have scale invariance; when the threshold is too large, the sensitivity of focus detection is not enough and the number of feature points is too small, and false feature points are easy to appear when the threshold is too large.


### 2.3.2. ORB Feature Point Detection

ORB feature point detection [7, 8] is a SIFT algorithm for extracting and describing image features. FAST (Features from Accelerated Segment Test) is used to extract feature points. In the algorithm based on image feature detection and matching, through the GLAMpoints paper, we can learn the exact matching points greedily learned. And through the feature detection and description of image matching, we can learn from manual design to deep learning. It is best to talk about key point detectors and descriptors based on random samples through RSKDD-Net. The core idea of the FAST algorithm is as follows: for a pixel, a circular region is constructed with the center of the pixel, and the gray value of the pixel in the center of the circle is compared with that of all the pixels in the circle. When the pixel value of enough points is larger or smaller than that of the center of a circle, the pixel is considered to be a feature point. It can be expressed as follows:(10)D=∑circlepIx−Ip>ε.In formula (10), Ix is the gray value of any point in the circle, Ip is the gray value of the central pixel, and ε is the set thresholds. If the D value is greater than the set threshold, the corner can be judged.In view of the fact that FAST features do not satisfy scale changes, the ORB algorithm establishes scale pyramids, similar to the SIFT algorithm in building scale pyramids. For each layer of image, FAST feature points are extracted. Finally, the extracted features are regarded as a set of features extracted from all layers, so as to meet the scale invariance. Aiming at the problem that FAST feature points have no direction, the ORB algorithm gives the gray centroid position in the neighborhood whereR is the center of feature points and the direction of gray centroid is the direction of feature points, and then the formula for calculating centroid C is as follows:(11)mpq=∑x,y∈rxpyqIx,y,C=m10m01,m00m00.In formula (11), Ix,y is the gray value of the neighboring pixel, and the direction of the vector OC¯ of the feature point O and the center of mass C is as follows:(12)θ=arctanm01m10.Since FAST feature is only an algorithm for feature detection and does not involve the formation of feature descriptors, the ORB algorithm uses Rbrief algorithm for feature description. The Rbrief algorithm is that the descriptor generated by the Brief algorithm [9] adds rotation angle information. The Brief algorithm takes n pairs of pixels randomly around the position of the extracted feature points to form an image block and then compares the two pixels in the image block, the result of which is expressed by 0 or 1. A series of binary digit strings with length n are generated, and the generated binary digit strings are the Brief descriptors of the feature points. In order to enhance the descriptorʼs robustness to noise and illumination, the image block is smoothed by Gauss filtering. The gray level of 5 ∗ 5 neighborhood of a point in its 31 ∗ 31 neighborhood is compared with that of point pair. The comparison criterion of the ORB algorithm after Gaussian smoothing of image blocks can be expressed as follows:(13)τp;x,y≔1,px<py,0,px≥py.In formula (13), the average gray levels of the two pairs of pixels X and Y in the image block p are, respectively, px and py. The generated binary digit string can be represented as follows:(14)fnp=∑1≤i≤n2i−1τp;x,y.In formula (14), n can generally be taken as 128, 256, and 512. It can be seen that the Brief descriptor does not have rotation invariance. In order to describe the direction of the generated feature points using the descriptor, ORB improves the Brief descriptor. Let the original Brief algorithm represent a 2 ∗ n matrix by selecting n pairs of points around the feature points:(15)S=x1,…,xny1,…,yn.According to the angleθ between FAST feature points and centroid, the rotation matrix Rθ is constructed, and then the corresponding direction of rotation of the point set matrix can be expressed as follows:(16)Sθ=RθS.At this time, the original Brief descriptor can be expressed as follows:(17)gnp,θ≔fnp|xi,yi∈Sθ.In order to ensure the separability of feature point descriptors, the ORB algorithm improves the original Brief algorithm by using statistical principles, namely, Rbrief algorithm. Each point is arranged in columns according to the binary digits taken above, and the matrixQ is generated. The average value of Q of each column is calculated. The first column in the matrix R is rearranged according to the distance from the draw value to 0.5. The correlation between Q of all the columns and all the columns in the matrix R is calculated. If the result is less than the set threshold, put the column in the matrix R, until 256 columns in R stop. The feature points extracted by the ORB algorithm and the descriptors generated by the ORB algorithm are fast and have good rotation invariance. However, when adapting to scale change, the effect is general. Because its descriptor is binary digit string, the matching process is not stable enough, which will cause some difficulties in matching.


### 2.3.3. SIFT Feature Point Detection

The SIFT algorithm [10] is a computer vision feature extraction algorithm which satisfies our needs very well. The feature extracted by this algorithm is a scale rotation invariant, so it has excellent robustness and is convenient for feature matching. The main idea of SIFT is to collect images in continuous scale, find extremum points in continuous scale space, remove unstable extremum points, and extract and acquire local features of rotation and scale invariance around stable extremum points. Finally, 128-dimensional descriptors are generated.SIFT features have the following advantages: strong robustness and good adaptability to geometric deformation, image noise, and brightness change. An image can generate a large number of SIFT feature points, which are rich in data. The local invariant features corresponding to the two images have good repeatability. Firstly, we consider the scale invariance of SIFT features. In order to adapt to scale transformation, feature points need to be detected in all image scales. Therefore, it is necessary to establish the scale space, and the Gaussian kernel function [11] is the only smoothing function in the scale space, so the Gaussian kernel function can be used to build the scale space. The scale transformation of an image can be expressed as follows:(18)Lx,y,σ=Gx,y,σ∗Ix,y,where Ix,y is expressed as an image, x,y,σ is a Gaussian kernel function, and Lx,y,σ is an image in different scales, and it is a scale space. The Gauss kernel function can be expressed as follows:(19)Gx,y,σ=12πσ2e−x2+y2/2σ2,σ≥0.In order to improve the reliability and stability of feature points, the preliminary identified feature points are screened. The screening steps are divided into two steps. The first step is to remove the low contrast points, i.e., some noise-sensitive points, and Taylor expansion is carried out for equation (21):(20)Dx=D+∂DT∂xx+12xT∂2D∂x2x.Seeking extreme points,(21)x^=−∂2D−1∂x2∂D∂x.In formula (21), x^ is the position of the extreme point and x is the offset of the extreme point. Dx^ can be used as a basis for judgment. Generally, feature points of Dx^ less than 0.3 are removed. The second step is to remove the edge response. The points at the edge are very sensitive to noise, and the Gauss difference function has a large principal curvature for a peak across the edge, so the SIFT algorithm excludes the edge response by calculating the principal curvature. The principal curvature can be calculated by a 2 ∗ 2 Hessian matrix H as follows:(22)H=DxxDxyDxyDyy.Since the principal curvature is proportional to the eigenvalue of matrixH, if the two eigenvalues of matrix H are, respectively, α or β, then there are(23)TrH2DetH<r+12r.In formula (23), TrH is the trace of matrix H, DetH is the determinant of matrix H, and r is the constant which is generally taken as 10 to determine whether the principal curvature is in a certain range.After the stable feature points are selected, the appropriate descriptor is generated for the feature. In order to make the descriptor rotate invariant, the gradient modulus and direction can be expressed as follows:(24)mx,y=Lx+1,y−Lx−1,y2+Lx,y+1−Lx,y−12,θx,y=αtan2Lx,y+1−Lx,y−1Lx+1,y−Lx−1,y.In formula (24), L is expressed as the scale of each point. The gradient value of each point represents the main direction of the neighborhood gradient and takes the main direction as the direction of the feature point. After determining the main direction, the position, scale, and direction of each feature point have been reflected. At this point, a descriptor is generated for each feature point. To solve the gradient value on the image smoothed by the corresponding Gauss feature points, each feature point can generate a 128-dimensional descriptor, that is, a 128-dimensional feature vector. In order to remove the influence of illumination changes, the feature vector can be normalized and SIFT features can be extracted.


## 2.3.1. Harris Feature Point Detection

The core idea of the Harris feature point detection algorithm is to use small windows to judge the gray level change by moving on the image. If the gray level changes obviously in the process of moving, there will be feature points in the window.If the gray level does not change or does not change in one direction, there is no feature point in the window. By constructing a mathematical model, the problem can be expressed as follows:(4)Eu,v=∑x,ywx,yIx+u,y+u−Ix,y2.In formula (4), u,v represents window translation transformation, Eu,v is gray level change, wx,y is window function, and Ix,y is image gray level. The window function is Gauss function as follows:(5)wx,y=12πσ2e−x2+y2/2σ2.This function can be understood as calculating the weight of gray level in the window, which changes with the direction from the center point to the edge smaller and smaller, so as to eliminate the influence of noise on it.The Taylor expansion for formula (10) can be expressed as follows:(6)Eu,v=∑x,ywx,yIxu+Iyv+ou2,v22.M is the partial derivative sparse matrix and it is expressed as(7)Eu,v≅u,vMuv.In this formula,Ix is the difference in direction x, Iy is the difference in direction y, and M is the partial derivative sparse matrix and is expressed as follows:(8)M=∑x,ywx,yIx2IxIYIxIyIy2.For Harris feature point monitoring, the size of two eigenvectors ofM matrix can be used. The two eigenvalues represent two directions of the fastest and slowest change, respectively. Both of them are large and can be judged as characteristics. One is the edge, and the other is the edge. Both of them are small and flat areas without change. So, we can express the problem as follows:(9)R=detM−ktrM2,where detM is the determinant of a matrix M which is the product of two eigenvalues, trM is the trace of a matrix M which is the sum of two eigenvalues, and k is a constant. From the analysis, it can be seen that the judgment of Harris feature points is related to the value R. When the value R is larger and positive, it can be judged as the feature point. When the value R is larger and negative, it can be judged as the edge, and when the value R is smaller, it can be judged as the flat area without change. In practical applications, the horizontal and vertical difference operators are used to evaluate the matrix M of the pixels, and then the Gauss filter is used to determine the feature points directly by R. The algorithm is simple, efficient, insensitive to illumination changes, and has rotation invariance. However, it does not have scale invariance; when the threshold is too large, the sensitivity of focus detection is not enough and the number of feature points is too small, and false feature points are easy to appear when the threshold is too large.


## 2.3.2. ORB Feature Point Detection

ORB feature point detection [7, 8] is a SIFT algorithm for extracting and describing image features. FAST (Features from Accelerated Segment Test) is used to extract feature points. In the algorithm based on image feature detection and matching, through the GLAMpoints paper, we can learn the exact matching points greedily learned. And through the feature detection and description of image matching, we can learn from manual design to deep learning. It is best to talk about key point detectors and descriptors based on random samples through RSKDD-Net. The core idea of the FAST algorithm is as follows: for a pixel, a circular region is constructed with the center of the pixel, and the gray value of the pixel in the center of the circle is compared with that of all the pixels in the circle. When the pixel value of enough points is larger or smaller than that of the center of a circle, the pixel is considered to be a feature point. It can be expressed as follows:(10)D=∑circlepIx−Ip>ε.In formula (10), Ix is the gray value of any point in the circle, Ip is the gray value of the central pixel, and ε is the set thresholds. If the D value is greater than the set threshold, the corner can be judged.In view of the fact that FAST features do not satisfy scale changes, the ORB algorithm establishes scale pyramids, similar to the SIFT algorithm in building scale pyramids. For each layer of image, FAST feature points are extracted. Finally, the extracted features are regarded as a set of features extracted from all layers, so as to meet the scale invariance. Aiming at the problem that FAST feature points have no direction, the ORB algorithm gives the gray centroid position in the neighborhood whereR is the center of feature points and the direction of gray centroid is the direction of feature points, and then the formula for calculating centroid C is as follows:(11)mpq=∑x,y∈rxpyqIx,y,C=m10m01,m00m00.In formula (11), Ix,y is the gray value of the neighboring pixel, and the direction of the vector OC¯ of the feature point O and the center of mass C is as follows:(12)θ=arctanm01m10.Since FAST feature is only an algorithm for feature detection and does not involve the formation of feature descriptors, the ORB algorithm uses Rbrief algorithm for feature description. The Rbrief algorithm is that the descriptor generated by the Brief algorithm [9] adds rotation angle information. The Brief algorithm takes n pairs of pixels randomly around the position of the extracted feature points to form an image block and then compares the two pixels in the image block, the result of which is expressed by 0 or 1. A series of binary digit strings with length n are generated, and the generated binary digit strings are the Brief descriptors of the feature points. In order to enhance the descriptorʼs robustness to noise and illumination, the image block is smoothed by Gauss filtering. The gray level of 5 ∗ 5 neighborhood of a point in its 31 ∗ 31 neighborhood is compared with that of point pair. The comparison criterion of the ORB algorithm after Gaussian smoothing of image blocks can be expressed as follows:(13)τp;x,y≔1,px<py,0,px≥py.In formula (13), the average gray levels of the two pairs of pixels X and Y in the image block p are, respectively, px and py. The generated binary digit string can be represented as follows:(14)fnp=∑1≤i≤n2i−1τp;x,y.In formula (14), n can generally be taken as 128, 256, and 512. It can be seen that the Brief descriptor does not have rotation invariance. In order to describe the direction of the generated feature points using the descriptor, ORB improves the Brief descriptor. Let the original Brief algorithm represent a 2 ∗ n matrix by selecting n pairs of points around the feature points:(15)S=x1,…,xny1,…,yn.According to the angleθ between FAST feature points and centroid, the rotation matrix Rθ is constructed, and then the corresponding direction of rotation of the point set matrix can be expressed as follows:(16)Sθ=RθS.At this time, the original Brief descriptor can be expressed as follows:(17)gnp,θ≔fnp|xi,yi∈Sθ.In order to ensure the separability of feature point descriptors, the ORB algorithm improves the original Brief algorithm by using statistical principles, namely, Rbrief algorithm. Each point is arranged in columns according to the binary digits taken above, and the matrixQ is generated. The average value of Q of each column is calculated. The first column in the matrix R is rearranged according to the distance from the draw value to 0.5. The correlation between Q of all the columns and all the columns in the matrix R is calculated. If the result is less than the set threshold, put the column in the matrix R, until 256 columns in R stop. The feature points extracted by the ORB algorithm and the descriptors generated by the ORB algorithm are fast and have good rotation invariance. However, when adapting to scale change, the effect is general. Because its descriptor is binary digit string, the matching process is not stable enough, which will cause some difficulties in matching.


## 2.3.3. SIFT Feature Point Detection

The SIFT algorithm [10] is a computer vision feature extraction algorithm which satisfies our needs very well. The feature extracted by this algorithm is a scale rotation invariant, so it has excellent robustness and is convenient for feature matching. The main idea of SIFT is to collect images in continuous scale, find extremum points in continuous scale space, remove unstable extremum points, and extract and acquire local features of rotation and scale invariance around stable extremum points. Finally, 128-dimensional descriptors are generated.SIFT features have the following advantages: strong robustness and good adaptability to geometric deformation, image noise, and brightness change. An image can generate a large number of SIFT feature points, which are rich in data. The local invariant features corresponding to the two images have good repeatability. Firstly, we consider the scale invariance of SIFT features. In order to adapt to scale transformation, feature points need to be detected in all image scales. Therefore, it is necessary to establish the scale space, and the Gaussian kernel function [11] is the only smoothing function in the scale space, so the Gaussian kernel function can be used to build the scale space. The scale transformation of an image can be expressed as follows:(18)Lx,y,σ=Gx,y,σ∗Ix,y,where Ix,y is expressed as an image, x,y,σ is a Gaussian kernel function, and Lx,y,σ is an image in different scales, and it is a scale space. The Gauss kernel function can be expressed as follows:(19)Gx,y,σ=12πσ2e−x2+y2/2σ2,σ≥0.In order to improve the reliability and stability of feature points, the preliminary identified feature points are screened. The screening steps are divided into two steps. The first step is to remove the low contrast points, i.e., some noise-sensitive points, and Taylor expansion is carried out for equation (21):(20)Dx=D+∂DT∂xx+12xT∂2D∂x2x.Seeking extreme points,(21)x^=−∂2D−1∂x2∂D∂x.In formula (21), x^ is the position of the extreme point and x is the offset of the extreme point. Dx^ can be used as a basis for judgment. Generally, feature points of Dx^ less than 0.3 are removed. The second step is to remove the edge response. The points at the edge are very sensitive to noise, and the Gauss difference function has a large principal curvature for a peak across the edge, so the SIFT algorithm excludes the edge response by calculating the principal curvature. The principal curvature can be calculated by a 2 ∗ 2 Hessian matrix H as follows:(22)H=DxxDxyDxyDyy.Since the principal curvature is proportional to the eigenvalue of matrixH, if the two eigenvalues of matrix H are, respectively, α or β, then there are(23)TrH2DetH<r+12r.In formula (23), TrH is the trace of matrix H, DetH is the determinant of matrix H, and r is the constant which is generally taken as 10 to determine whether the principal curvature is in a certain range.After the stable feature points are selected, the appropriate descriptor is generated for the feature. In order to make the descriptor rotate invariant, the gradient modulus and direction can be expressed as follows:(24)mx,y=Lx+1,y−Lx−1,y2+Lx,y+1−Lx,y−12,θx,y=αtan2Lx,y+1−Lx,y−1Lx+1,y−Lx−1,y.In formula (24), L is expressed as the scale of each point. The gradient value of each point represents the main direction of the neighborhood gradient and takes the main direction as the direction of the feature point. After determining the main direction, the position, scale, and direction of each feature point have been reflected. At this point, a descriptor is generated for each feature point. To solve the gradient value on the image smoothed by the corresponding Gauss feature points, each feature point can generate a 128-dimensional descriptor, that is, a 128-dimensional feature vector. In order to remove the influence of illumination changes, the feature vector can be normalized and SIFT features can be extracted.


## 2.4. Cluster Analysis Method

Cluster analysis is a method of quantitative classification with mathematical tools. Cluster analysis algorithm [12] is a typical unsupervised learning algorithm and one of the important algorithms of data mining. It is mainly used to study classification problems; that is, similar data are automatically divided into the same category. When using the clustering algorithm, we usually analyze the similarity relationship between data to group data and divide data into different classes. The greater the similarity between similar data, the smaller the similarity between different classes of data; that is, the greater the difference, the better the classification effect.


### 2.4.1. Clustering Algorithm Based on Cumulative Frame Difference Intersection

The basic idea of the clustering algorithm based on the intersection of the cumulative frame difference is based on the calculation of the cumulative frame difference and cross and cluster the two cumulative frame differences so that the changing area can accurately converge to the foreground edge, and then the area binarizes the mask to obtain a differential image frame that is to ensure the real-time performance, and greatly improve the segmentation effect. It is also suitable for sports video sequences with fast-moving objects. The main steps of the algorithm are as follows:(1)
After the median filtering, the image processing sequence difference between adjacent frames and frame interval difference is as follows:If the current image framen can be expressed as f (k), the frame image k+1 and k+2 can be expressed as f (k + 1) and f (k + 2), and the interframe difference of the adjacent difference categories can be expressed as follows:(25)fk+1x,y−fkx,y,fr+1x,y−frx,y.The cumulative results of then frames are as follows:(26)D1=∑r=1kfr+1x,y−frx,y=E∪N1,D2=∑k=1kfk+2x,y−fkx,y=F∪N2,whereE and F are the change areas in the cumulative results and N1 and N2 are noise.(2)
By intersecting the two cumulative frame differences, the pixels belonging to the change area in the two cumulative results can be effectively concentrated around the foreground contour, thereby obtaining an ideal moving foreground contour.(27)D1∩D2=A∪N1∩B∪N2=EF∪EN2∪FN1∪N1N2.SinceEN2 and FN1 are clustering of moving regions and noises, formula (5) can be rewritten as follows:(28)D1∩D2=AB+N.(3)
For further clustering method to remove background pixels, clustering step procedure is described as follows:Step 1.
Randomly determine two points and set 5∗ 5 and cycle number 1P as the centers.Step 2.
For each pixel in a rectangular window,(29)D1=1NK2∑N1∩N2∪EF∩EN1xi−x−yi−y.Step 3.
Compare the distanceD1 with the threshold Di. If Di≤D1, binning of pixels moved to the edge of the moving foreground object. Otherwise, the pixel will be merged into the background noise edge pixel.Step 4.
Move the rectangular window from the horizontal and vertical directions, increase the number of pixels and follow Step 2 until all the binning classes they belong to, that is, the number of cycles reaches the specified number, and the cluster ends.


## 2.4.1. Clustering Algorithm Based on Cumulative Frame Difference Intersection

The basic idea of the clustering algorithm based on the intersection of the cumulative frame difference is based on the calculation of the cumulative frame difference and cross and cluster the two cumulative frame differences so that the changing area can accurately converge to the foreground edge, and then the area binarizes the mask to obtain a differential image frame that is to ensure the real-time performance, and greatly improve the segmentation effect. It is also suitable for sports video sequences with fast-moving objects. The main steps of the algorithm are as follows:(1)
After the median filtering, the image processing sequence difference between adjacent frames and frame interval difference is as follows:If the current image framen can be expressed as f (k), the frame image k+1 and k+2 can be expressed as f (k + 1) and f (k + 2), and the interframe difference of the adjacent difference categories can be expressed as follows:(25)fk+1x,y−fkx,y,fr+1x,y−frx,y.The cumulative results of then frames are as follows:(26)D1=∑r=1kfr+1x,y−frx,y=E∪N1,D2=∑k=1kfk+2x,y−fkx,y=F∪N2,whereE and F are the change areas in the cumulative results and N1 and N2 are noise.(2)
By intersecting the two cumulative frame differences, the pixels belonging to the change area in the two cumulative results can be effectively concentrated around the foreground contour, thereby obtaining an ideal moving foreground contour.(27)D1∩D2=A∪N1∩B∪N2=EF∪EN2∪FN1∪N1N2.SinceEN2 and FN1 are clustering of moving regions and noises, formula (5) can be rewritten as follows:(28)D1∩D2=AB+N.(3)
For further clustering method to remove background pixels, clustering step procedure is described as follows:Step 1.
Randomly determine two points and set 5∗ 5 and cycle number 1P as the centers.Step 2.
For each pixel in a rectangular window,(29)D1=1NK2∑N1∩N2∪EF∩EN1xi−x−yi−y.Step 3.
Compare the distanceD1 with the threshold Di. If Di≤D1, binning of pixels moved to the edge of the moving foreground object. Otherwise, the pixel will be merged into the background noise edge pixel.Step 4.
Move the rectangular window from the horizontal and vertical directions, increase the number of pixels and follow Step 2 until all the binning classes they belong to, that is, the number of cycles reaches the specified number, and the cluster ends.


## 3. Experiments

In this document, the experimental platform configuration is based on a 64 bit flagship version of the Win7 operating system, 8 G physical memory, a 2.2 GHz quad-core Intel Core I5-5200U CPU, and MATLAB 2014b-based simulation software.In order to reflect the universality of the experiment, the material used in this document comes from the network and not from a dedicated video library. The sports video used in the simulation experiment comes from sports gates of large gates. The video frame rate is 5 frames per second, and the output image resolution is 480 × 360. Tennis, volleyball, water polo, and baseball were selected as the four sports videos. In this article, the SIFT algorithm is used to derive the characteristics of the sport, and then the cumulative cross-sectional algorithm is used to identify sports, as shown in Figure1.Figure 1
Four kinematic video frames.


## 4. Discussion

Before the simulation experiment, it is necessary to preprocess the actual video object to improve the video frame characteristics. Firstly, all four types of motion video frames are gray, as shown in Figure2.Figure 2
Grayscale of video frame image.In the image processing process, the presence of noise is inevitable. In this article, denaturing is also required in the preprocessing process. This document enhances traditional filter average processing, saves processing time efficiently, and improves processing results, which are useful for detecting and tracking images in the later stages of football. In this paper, we simulate and analyze the noise added to the gray image and use the traditional median filter and the improved median filter, respectively, to avoid the noise influence in the process of processing, as shown in Figure3.Figure 3
Video frame image noise and filtering.After filtering, we edge the image with the result of filtering. After gray level processing, there are 256 gray levels. By choosing appropriate threshold, the gray level of the gray image can be divided into two parts, and then the binarization of the image can be obtained. It keeps the region of interest in the image to the greatest extent and shields all the irrelevant information as shown in Figure4.Figure 4
Two values.After the preprocessing results, the first step is to carry out simulation experiments on sports detection. The processed video frame images are recognized, and the accuracy and recognition rate of the four kinds of motion are compared, respectively, as shown in Table1.Table 1
Motion recognition rates.
Volleyball (%)Tennis (%)Baseball (%)Water polo (%)Accuracy86.591.287.483.2Recognition rate82.393.488.484.3From this table, we can see that tennis has the highest recognition rate, while the rest of the sports are relatively low, which may be related to the video background.


## 5. Conclusions

In recent years, with the improvement of peopleʼs living standards, more and more attention has been paid to sports. The research of video data processing has high theoretical significance and commercial value. In this paper, four kinds of sports videos are analyzed, and four kinds of sports images are extracted. After image graying, image denoising, and image binarization, a detection method based on SIFT feature points is designed. In the simulation experiment, image preprocessing, sports item detection, and sports item recognition are analyzed, respectively. By comparing the accuracy and recognition rate of these four sports, we can conclude that the recognition rate is more than 80%. It can be seen that the recognition rate is still very high, and the tennis recognition rate is the highest. This shows that the SIFT algorithm and cumulative cross-section grouping algorithm proposed in this paper are suitable for sports video recognition.



---

*Source: 9996782-2021-06-14.xml*