# Swimming Movement Guidance Training System Based on OpenCL Technology

Authors: Xiaopeng Tian
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

In order to improve the physical quality and even ability of swimmers, this study built OpenCL technology for the swimming movement design system of swimmers, so as to design a series of movements. Combined with the capture system, this paper captures and processes the athletes’ movements, obtains the key position information, and calculates the accurate data. It can provide effective guidance for accurately positioning athletes’ swimming movements, enable users to have a clearer understanding of their own movements, improve users’ movements, and enhance the system operation effect. According to the technology and application requirements of virtual swimming training simulator, the overall design scheme of the device is determined. From the point of view of ensuring the comfort and safety of simulated virtual swimming, the design, installation, and strength verification of the supporting structure are carried out. Hardware design and selection shall be carried out according to the requirements of head position detection and virtual environment presentation, including the design of positioning ball set, camera selection, and VR head display selection. The software functions of head position detection program and virtual scene program are designed according to the requirements of natural human-computer interaction. The designed swimming guidance training system has complete functions and stable operation and can be used as an auxiliary tool for swimming training.


---

## Body

## 1. Introduction

Swimming is valued by the state, and swimmers in the swimming field have higher requirements for posture. But in the actual swimming process, it is difficult to achieve their own positioning. In this paper, a guidance system is built for the swimming movements of swimmers to cover the swimming movements and monitor the movements of swimmers [1]. Through real-time motion capture, the motion is transmitted to the computer through the sensor to process the data and give correct instructions to the athlete, as shown in Figure 1. In this paper, the system adopts OpenCL technology to accelerate the system and optimizes the algorithm in the image processing technology to ensure the image processing quality and improve the application effect of the system [2]. And carry out experiments to ensure the effective coverage of the system for swimmers, provide accurate positioning guarantee for their movement rhythm and amplitude, and provide effective guidance for accurately locating swimming movement problems of athletes, so that users can have a clearer understanding of their movements and improve user actions to improve system performance. According to the technical and application requirements of the virtual swimming training simulation device, the overall design scheme of the device is determined. At present, human motion analysis based on vision is still a challenging subject in computer vision. The core problem in motion analysis is human posture estimation. The task of human posture estimation is to identify the human body and locate the joint points of human parts through computer image processing algorithm. Its applications include human behavior understanding, human re recognition, human-computer interaction, health monitoring, and motion capture [3]. Artificial intelligence technology has gone deep into sports training projects. Professional guidance and artificial intelligence-assisted training make the training process of athletes more scientific. By collecting a large number of athletes’ training data and using computer technology for visual analysis, athletes can comprehensively master their own growth process. The rapid development of the new generation of information technology represented by Internet technology, big data technology, cloud storage technology, virtual reality technology, etc., and the cross integration between different disciplines have led to the continuous development and innovation of a new round of scientific and technological revolution and industrial revolution. The emergence of a series of scientific and technological products and new models has made human life more convenient and intelligent in the new era [4].Figure 1
Swimming movement guidance training system.


## 2. Research on Pose Detection Method

In the virtual swimming training simulation device, accurate and real-time detection of the position and posture of the set pieces can make the virtual swimming scene change according to the user’s movement and head rotation, which is the key step to realize natural human-computer interaction [5]. The essence of pose detection is to obtain the corresponding relationship between the spatial coordinates of feature points and the image coordinates and then solve the conversion matrix between the object coordinate system and the camera coordinate system [6]. Among them, the acquisition of the image coordinates of feature points and the determination of the corresponding relationship are the focus of this research. The main content of this chapter is to introduce the basic principle of pose solution and camera calibration method and introduce in detail the positioning ball image recognition method and feature point image coordinate calculation method used in this topic.


### 2.1. Principle of Pose Solution

#### 2.1.1. Camera Model

The most basic pinhole model in the camera model includes four coordinate systems:(1)
Object coordinate systemOw is a user-defined three-dimensional coordinate system(2)
The camera coordinate systemOe is a rectangular coordinate system established with the camera optical center as the origin and the optical axis as the Z axis(3)
The image physical coordinate systemo is a planar two-dimensional coordinate system established with the principal point (the intersection of the optical axis and the imaging plane) as the origin, and its x and y axes are parallel to the x and y axes of the camera coordinate system, respectively(4)
The image pixel coordinate systemo is a planar two-dimensional coordinate system established with the upper left corner of the image as the origin. Its u and v axes are parallel to the x and y axes of the image physical coordinate system [7]. Different from the other three coordinate systems, the coordinates in the image pixel coordinate system are in pixelsThe conversion relationship between the four coordinate systems based on the camera pinhole model is described as follows:(1)
From Object Coordinate Systemowto Camera Coordinate Systemo. According to the coordinate conversion principle, the conversion from the object system xw,yw,zw to the camera system coordinates xc,yc,zc can be completed through the rotation matrix R and the translation vector t, as shown in the following formula:(1)xcyczc=r11r12r13r21r22r23r31r32r33xwywzw+t1t2t3=Rxwywzw+t.Secondly, the coordinates and matrix form are shown in the following formula:(2)xcyczc1=Rt0T1xwywzw1.(2)
Coordinate Conversion from Camera Coordinate SystemOcto Image Physical Coordinate System 0. The projection of any point p in the 3D scene on the camera imaging plane is p [8]. According to the similar triangle principle, it can be seen that there is a relationship between the camera system coordinates xc,yc,zc of point p and the image physical system coordinates x,y of point P as shown in the following formula:(3)x=fxczc,y=fyczc.Secondly, the coordinates and matrix form are shown in the following formula:(4)zcxy1=f0000f000010xcyczc1.(3)
Coordinate Conversion from Image Physical Coordinate System 0 to Image Pixel Coordinate SystemOi. The main point is theoretically located at the center of the image, but due to the defects of camera manufacturing technology, the main point often deviates from the center of the image [9]. Similarly, due to the manufacturing process deviation, the actual pixels are often not square, and there are scale differences in the u and v directions. Assuming that the coordinates of the main point in the image pixel coordinate system Oi are cx,cy, and the physical lengths of each pixel in the u,v directions are k,l, respectively, the conversion relationship between the image physical coordinates x,y and the image pixel coordinates u,v is shown in the following equation:(5)u=xk+cx,v=yl+cy.Its homogeneous coordinates and matrix form are shown in the following formula:(6)uv1=1k0cx01lcy001xy1.Combining the above equations (2), (4) ,and (6), the conversion relationship between the object system coordinates xw,yw,zw of point P and the image pixel coordinates u,v of its image point is obtained as follows:
(7)zcuv1=fx0cx00fycy00010Rt0T1xwywzw1,wherefx and fy are the focal length in pixels, and cx and cy are used as internal parameters of the camera.


#### 2.1.2. PnP Problems

PnP is a classical problem in the field of computer vision, the calibration of camera external parameters. Assuming that there aren different P points, according to the internal parameter matrix and distortion parameters obtained from camera calibration, as well as the object system coordinates xw,yw,zw and image coordinates u,v of N groups of P points, n groups of conversion formulas can be listed [10]. To solve the PnP problem, the relative pose of the object coordinate system ow and the camera coordinate system OE is determined from the conversion formula of n2<n<6, that is, the external parameter matrices R and t. Solving the PnP problem can effectively solve the pose of objects based on a single image, avoiding the problem of determining the corresponding relationship between image points in the pose solution method based on multiple images [11]. PnP (Perspective-n-Point) is a method for solving 3D to 2D point-to-point motion. The purpose is to solve the pose of the camera coordinate system relative to the world coordinate system. It describes how to estimate the pose of the camera when the coordinates of a 3D point (relative to the world coordinate system) and the pixel coordinates of these points are known (that is, to solve the rotation matrix and translation vector from the world coordinate system to the camera coordinate system). It is quite a wide range of vision-based pose solving methods. This subject plans to adopt the re projection algorithm realized by OpenCV, obtain the coordinates of the feature point object system through the positioning ball group measurement, obtain the camera internal parameters and distortion parameter matrix through the camera calibration, and obtain the feature point image coordinates through the image processing method. Finally, combined with the above known information, the relative position and orientation ph2c of the positioning ball group in the camera coordinate system in each moving image is solved [12].


### 2.2. Camera Calibration Method

Camera calibration is the process of obtaining camera internal parameters and distortion parameters. The commonly used calibration methods can be divided into traditional camera calibration methods and camera self-calibration methods. Among them, the traditional camera calibration method uses the known scene structure information for calibration. Usually, the high-precision known structure information is provided by the precision calibration block, which is often difficult to achieve in practical applications. Therefore, although the traditional method has high calibration accuracy, it is difficult to apply [13]. The camera self-calibration method is calibrated by the corresponding relationship between image points. Because it does not need calibration blocks, it has the advantages of flexibility and convenience compared with the traditional methods; however, its calibration process is complex, and the nonlinear method is used for calibration, which has low accuracy and insufficient robustness. After the camera calibration is completed, the re projection error is often used as the evaluation standard of the final calibration effect. The re projection error considers not only the calculation error of homography matrix, but also the measurement error of image points. In the homography transformation from the object plane to the image plane as shown in Figure 2, x is a point in the object plane, x′ is the corresponding point of x in the image plane, and the relationship between them should meets the relationship shown in the following equation [14].
(8)x′=Hx,Figure 2
Plane homography transformation.whereH is a plane homography matrix.Then, the form of re projection error is shown in the formula:(9)ε=d2x，x^+d2x′，x∧′subjecttox∧′=H^x,^wherex^ is the estimated value of x, x^ is the estimated value of x′, and H^ is the estimated value of H. In the process of camera calibration, since the mark points on the chessboard calibration board are standard points formulated strictly according to the size, it can be considered that x is absolutely accurate, and the estimation x^ of x is itself, so the re projection error degenerates into a unilateral transformation error under the strong constraint condition x=x^, as shown in the following equation.
(10)ε=d2x′,x∧′=d2x′,H^x.


## 2.1. Principle of Pose Solution

### 2.1.1. Camera Model

The most basic pinhole model in the camera model includes four coordinate systems:(1)
Object coordinate systemOw is a user-defined three-dimensional coordinate system(2)
The camera coordinate systemOe is a rectangular coordinate system established with the camera optical center as the origin and the optical axis as the Z axis(3)
The image physical coordinate systemo is a planar two-dimensional coordinate system established with the principal point (the intersection of the optical axis and the imaging plane) as the origin, and its x and y axes are parallel to the x and y axes of the camera coordinate system, respectively(4)
The image pixel coordinate systemo is a planar two-dimensional coordinate system established with the upper left corner of the image as the origin. Its u and v axes are parallel to the x and y axes of the image physical coordinate system [7]. Different from the other three coordinate systems, the coordinates in the image pixel coordinate system are in pixelsThe conversion relationship between the four coordinate systems based on the camera pinhole model is described as follows:(1)
From Object Coordinate Systemowto Camera Coordinate Systemo. According to the coordinate conversion principle, the conversion from the object system xw,yw,zw to the camera system coordinates xc,yc,zc can be completed through the rotation matrix R and the translation vector t, as shown in the following formula:(1)xcyczc=r11r12r13r21r22r23r31r32r33xwywzw+t1t2t3=Rxwywzw+t.Secondly, the coordinates and matrix form are shown in the following formula:(2)xcyczc1=Rt0T1xwywzw1.(2)
Coordinate Conversion from Camera Coordinate SystemOcto Image Physical Coordinate System 0. The projection of any point p in the 3D scene on the camera imaging plane is p [8]. According to the similar triangle principle, it can be seen that there is a relationship between the camera system coordinates xc,yc,zc of point p and the image physical system coordinates x,y of point P as shown in the following formula:(3)x=fxczc,y=fyczc.Secondly, the coordinates and matrix form are shown in the following formula:(4)zcxy1=f0000f000010xcyczc1.(3)
Coordinate Conversion from Image Physical Coordinate System 0 to Image Pixel Coordinate SystemOi. The main point is theoretically located at the center of the image, but due to the defects of camera manufacturing technology, the main point often deviates from the center of the image [9]. Similarly, due to the manufacturing process deviation, the actual pixels are often not square, and there are scale differences in the u and v directions. Assuming that the coordinates of the main point in the image pixel coordinate system Oi are cx,cy, and the physical lengths of each pixel in the u,v directions are k,l, respectively, the conversion relationship between the image physical coordinates x,y and the image pixel coordinates u,v is shown in the following equation:(5)u=xk+cx,v=yl+cy.Its homogeneous coordinates and matrix form are shown in the following formula:(6)uv1=1k0cx01lcy001xy1.Combining the above equations (2), (4) ,and (6), the conversion relationship between the object system coordinates xw,yw,zw of point P and the image pixel coordinates u,v of its image point is obtained as follows:
(7)zcuv1=fx0cx00fycy00010Rt0T1xwywzw1,wherefx and fy are the focal length in pixels, and cx and cy are used as internal parameters of the camera.


### 2.1.2. PnP Problems

PnP is a classical problem in the field of computer vision, the calibration of camera external parameters. Assuming that there aren different P points, according to the internal parameter matrix and distortion parameters obtained from camera calibration, as well as the object system coordinates xw,yw,zw and image coordinates u,v of N groups of P points, n groups of conversion formulas can be listed [10]. To solve the PnP problem, the relative pose of the object coordinate system ow and the camera coordinate system OE is determined from the conversion formula of n2<n<6, that is, the external parameter matrices R and t. Solving the PnP problem can effectively solve the pose of objects based on a single image, avoiding the problem of determining the corresponding relationship between image points in the pose solution method based on multiple images [11]. PnP (Perspective-n-Point) is a method for solving 3D to 2D point-to-point motion. The purpose is to solve the pose of the camera coordinate system relative to the world coordinate system. It describes how to estimate the pose of the camera when the coordinates of a 3D point (relative to the world coordinate system) and the pixel coordinates of these points are known (that is, to solve the rotation matrix and translation vector from the world coordinate system to the camera coordinate system). It is quite a wide range of vision-based pose solving methods. This subject plans to adopt the re projection algorithm realized by OpenCV, obtain the coordinates of the feature point object system through the positioning ball group measurement, obtain the camera internal parameters and distortion parameter matrix through the camera calibration, and obtain the feature point image coordinates through the image processing method. Finally, combined with the above known information, the relative position and orientation ph2c of the positioning ball group in the camera coordinate system in each moving image is solved [12].


## 2.1.1. Camera Model

The most basic pinhole model in the camera model includes four coordinate systems:(1)
Object coordinate systemOw is a user-defined three-dimensional coordinate system(2)
The camera coordinate systemOe is a rectangular coordinate system established with the camera optical center as the origin and the optical axis as the Z axis(3)
The image physical coordinate systemo is a planar two-dimensional coordinate system established with the principal point (the intersection of the optical axis and the imaging plane) as the origin, and its x and y axes are parallel to the x and y axes of the camera coordinate system, respectively(4)
The image pixel coordinate systemo is a planar two-dimensional coordinate system established with the upper left corner of the image as the origin. Its u and v axes are parallel to the x and y axes of the image physical coordinate system [7]. Different from the other three coordinate systems, the coordinates in the image pixel coordinate system are in pixelsThe conversion relationship between the four coordinate systems based on the camera pinhole model is described as follows:(1)
From Object Coordinate Systemowto Camera Coordinate Systemo. According to the coordinate conversion principle, the conversion from the object system xw,yw,zw to the camera system coordinates xc,yc,zc can be completed through the rotation matrix R and the translation vector t, as shown in the following formula:(1)xcyczc=r11r12r13r21r22r23r31r32r33xwywzw+t1t2t3=Rxwywzw+t.Secondly, the coordinates and matrix form are shown in the following formula:(2)xcyczc1=Rt0T1xwywzw1.(2)
Coordinate Conversion from Camera Coordinate SystemOcto Image Physical Coordinate System 0. The projection of any point p in the 3D scene on the camera imaging plane is p [8]. According to the similar triangle principle, it can be seen that there is a relationship between the camera system coordinates xc,yc,zc of point p and the image physical system coordinates x,y of point P as shown in the following formula:(3)x=fxczc,y=fyczc.Secondly, the coordinates and matrix form are shown in the following formula:(4)zcxy1=f0000f000010xcyczc1.(3)
Coordinate Conversion from Image Physical Coordinate System 0 to Image Pixel Coordinate SystemOi. The main point is theoretically located at the center of the image, but due to the defects of camera manufacturing technology, the main point often deviates from the center of the image [9]. Similarly, due to the manufacturing process deviation, the actual pixels are often not square, and there are scale differences in the u and v directions. Assuming that the coordinates of the main point in the image pixel coordinate system Oi are cx,cy, and the physical lengths of each pixel in the u,v directions are k,l, respectively, the conversion relationship between the image physical coordinates x,y and the image pixel coordinates u,v is shown in the following equation:(5)u=xk+cx,v=yl+cy.Its homogeneous coordinates and matrix form are shown in the following formula:(6)uv1=1k0cx01lcy001xy1.Combining the above equations (2), (4) ,and (6), the conversion relationship between the object system coordinates xw,yw,zw of point P and the image pixel coordinates u,v of its image point is obtained as follows:
(7)zcuv1=fx0cx00fycy00010Rt0T1xwywzw1,wherefx and fy are the focal length in pixels, and cx and cy are used as internal parameters of the camera.


## 2.1.2. PnP Problems

PnP is a classical problem in the field of computer vision, the calibration of camera external parameters. Assuming that there aren different P points, according to the internal parameter matrix and distortion parameters obtained from camera calibration, as well as the object system coordinates xw,yw,zw and image coordinates u,v of N groups of P points, n groups of conversion formulas can be listed [10]. To solve the PnP problem, the relative pose of the object coordinate system ow and the camera coordinate system OE is determined from the conversion formula of n2<n<6, that is, the external parameter matrices R and t. Solving the PnP problem can effectively solve the pose of objects based on a single image, avoiding the problem of determining the corresponding relationship between image points in the pose solution method based on multiple images [11]. PnP (Perspective-n-Point) is a method for solving 3D to 2D point-to-point motion. The purpose is to solve the pose of the camera coordinate system relative to the world coordinate system. It describes how to estimate the pose of the camera when the coordinates of a 3D point (relative to the world coordinate system) and the pixel coordinates of these points are known (that is, to solve the rotation matrix and translation vector from the world coordinate system to the camera coordinate system). It is quite a wide range of vision-based pose solving methods. This subject plans to adopt the re projection algorithm realized by OpenCV, obtain the coordinates of the feature point object system through the positioning ball group measurement, obtain the camera internal parameters and distortion parameter matrix through the camera calibration, and obtain the feature point image coordinates through the image processing method. Finally, combined with the above known information, the relative position and orientation ph2c of the positioning ball group in the camera coordinate system in each moving image is solved [12].


## 2.2. Camera Calibration Method

Camera calibration is the process of obtaining camera internal parameters and distortion parameters. The commonly used calibration methods can be divided into traditional camera calibration methods and camera self-calibration methods. Among them, the traditional camera calibration method uses the known scene structure information for calibration. Usually, the high-precision known structure information is provided by the precision calibration block, which is often difficult to achieve in practical applications. Therefore, although the traditional method has high calibration accuracy, it is difficult to apply [13]. The camera self-calibration method is calibrated by the corresponding relationship between image points. Because it does not need calibration blocks, it has the advantages of flexibility and convenience compared with the traditional methods; however, its calibration process is complex, and the nonlinear method is used for calibration, which has low accuracy and insufficient robustness. After the camera calibration is completed, the re projection error is often used as the evaluation standard of the final calibration effect. The re projection error considers not only the calculation error of homography matrix, but also the measurement error of image points. In the homography transformation from the object plane to the image plane as shown in Figure 2, x is a point in the object plane, x′ is the corresponding point of x in the image plane, and the relationship between them should meets the relationship shown in the following equation [14].
(8)x′=Hx,Figure 2
Plane homography transformation.whereH is a plane homography matrix.Then, the form of re projection error is shown in the formula:(9)ε=d2x，x^+d2x′，x∧′subjecttox∧′=H^x,^wherex^ is the estimated value of x, x^ is the estimated value of x′, and H^ is the estimated value of H. In the process of camera calibration, since the mark points on the chessboard calibration board are standard points formulated strictly according to the size, it can be considered that x is absolutely accurate, and the estimation x^ of x is itself, so the re projection error degenerates into a unilateral transformation error under the strong constraint condition x=x^, as shown in the following equation.
(10)ε=d2x′,x∧′=d2x′,H^x.


## 3. Swimming Image Processing Application

The extraction and synthesis of key technology action pictures are aimed at analyzing the technical advantages and disadvantages of the observation object from the perspective of key actions. For the 3D modeling of the observed object, aiming at the swimming posture information, the image processing method is studied to lay the foundation for the next chapter [15].


### 3.1. Analysis of Key Information during Turning

A certain distance should be reserved before swimming turns to facilitate adjustment of movements. The deceleration caused by nonstandard actions and other factors will greatly affect the turning effect, so it is also important to analyze the breaststroke action before turning [16], through the angle between knee joint, hip joint, trunk body, and horizontal plane. From these three angles, we can determine the rhythm of the swimmers’ turning process and whether the body position at each stage is correct and then give targeted optimization opinions. For the region image, it is necessary to determine the hue value range according to the color model, as shown in Table 1.Table 1
Range of color hue values.
ColorHue valueH rangeYellow30-50Green70-90Blue100-122Purple150-170After positioning the color, calculate the coordinate system according to its spherical center point, as shown in Table2.Table 2
Object coordinate system of feature points.
ColorX coordinate/mmY coordinate/mmZ coordinate/mmGreen0-380Yellow35.8312.660Purple-17.9112.66-31.03Blue-17.9112.66-31.03


### 3.2. Analysis and Research of Image Processing in the Field of Swimming

In order to obtain the swimmer’s posture information, it is necessary to process the image. Image processing is a technology for analyzing, processing, and processing images to meet the needs of key information extraction and positioning [17]. From the origin, image processing is actually an application of signal processing in the field of digital images, because most of the images at this stage are stored in digital form. After studying the main flow of image processing, the main flow of image processing in this system is determined: first, the image gray is removed, then the noise is removed, and finally the edge is detected. After the processing of component method, the image with R matrix, G matrix, and B matrix as gray value is obtained [18]. Gaussian filtering is also a typical linear smoothing filtering method, which has good performance in eliminating Gaussian noise. Therefore, Gaussian filtering is also widely used in all kinds of image processing to remove noise. Gaussian filtering is a kind of linear smoothing filtering, which is suitable for eliminating Gaussian noise and is widely used in the noise reduction process of image processing. In layman’s terms, Gaussian filtering is a process of weighted averaging of the entire image. The value of each pixel is obtained by weighted averaging of itself and other pixel values in its neighborhood. Gaussian filtering is actually a weighted average of each pixel in the field. The filtered value of each pixel is jointly determined by the points in the field with it as the central point, that is, each point is weighted and averaged to obtain the value of the point [19]. The Gaussian kernel for image convolution by Gaussian filter is usually a 3∗3 or 5∗5 Gaussian template. The commonly used Gaussian template is shown in Figure 3.Figure 3
Common templates for Gaussian filtering.According to the content of Figure3, the position parameters in each template are calculated by Gaussian function, and the calculation formula is as follows:
(11)Gx,y=12πσ2ex2+y2/2σ2.x2 and y2 in the formula represent the distance, that is, the distance between a pixel and the center point in the field. In the formula, O represents the standard deviation [20]. It can be seen from the formula that the smoothing effect changes with the size of the standard deviation. The larger the standard deviation, the better the smoothing effect. The smaller the standard deviation, the more general the smoothing effect.


## 3.1. Analysis of Key Information during Turning

A certain distance should be reserved before swimming turns to facilitate adjustment of movements. The deceleration caused by nonstandard actions and other factors will greatly affect the turning effect, so it is also important to analyze the breaststroke action before turning [16], through the angle between knee joint, hip joint, trunk body, and horizontal plane. From these three angles, we can determine the rhythm of the swimmers’ turning process and whether the body position at each stage is correct and then give targeted optimization opinions. For the region image, it is necessary to determine the hue value range according to the color model, as shown in Table 1.Table 1
Range of color hue values.
ColorHue valueH rangeYellow30-50Green70-90Blue100-122Purple150-170After positioning the color, calculate the coordinate system according to its spherical center point, as shown in Table2.Table 2
Object coordinate system of feature points.
ColorX coordinate/mmY coordinate/mmZ coordinate/mmGreen0-380Yellow35.8312.660Purple-17.9112.66-31.03Blue-17.9112.66-31.03


## 3.2. Analysis and Research of Image Processing in the Field of Swimming

In order to obtain the swimmer’s posture information, it is necessary to process the image. Image processing is a technology for analyzing, processing, and processing images to meet the needs of key information extraction and positioning [17]. From the origin, image processing is actually an application of signal processing in the field of digital images, because most of the images at this stage are stored in digital form. After studying the main flow of image processing, the main flow of image processing in this system is determined: first, the image gray is removed, then the noise is removed, and finally the edge is detected. After the processing of component method, the image with R matrix, G matrix, and B matrix as gray value is obtained [18]. Gaussian filtering is also a typical linear smoothing filtering method, which has good performance in eliminating Gaussian noise. Therefore, Gaussian filtering is also widely used in all kinds of image processing to remove noise. Gaussian filtering is a kind of linear smoothing filtering, which is suitable for eliminating Gaussian noise and is widely used in the noise reduction process of image processing. In layman’s terms, Gaussian filtering is a process of weighted averaging of the entire image. The value of each pixel is obtained by weighted averaging of itself and other pixel values in its neighborhood. Gaussian filtering is actually a weighted average of each pixel in the field. The filtered value of each pixel is jointly determined by the points in the field with it as the central point, that is, each point is weighted and averaged to obtain the value of the point [19]. The Gaussian kernel for image convolution by Gaussian filter is usually a 3∗3 or 5∗5 Gaussian template. The commonly used Gaussian template is shown in Figure 3.Figure 3
Common templates for Gaussian filtering.According to the content of Figure3, the position parameters in each template are calculated by Gaussian function, and the calculation formula is as follows:
(11)Gx,y=12πσ2ex2+y2/2σ2.x2 and y2 in the formula represent the distance, that is, the distance between a pixel and the center point in the field. In the formula, O represents the standard deviation [20]. It can be seen from the formula that the smoothing effect changes with the size of the standard deviation. The larger the standard deviation, the better the smoothing effect. The smaller the standard deviation, the more general the smoothing effect.


## 4. Analysis and Evaluation of Swimming Movements

This chapter captures the swimming before turning. In this process, the information of key positions includes knee joint, hip joint, and the angle between the trunk and the horizontal plane. Through the observation of these three angles, we can determine whether the swimmer’s movement before turning is standard and then determine whether the speed decreases. The original intention of the system design proposed in this paper is to improve the standard of athletes’ turning movements. In order to achieve this goal, it is necessary to compare the movements of the observed with the standard movements. Therefore, it is necessary to compare both the standard data and the comparison algorithm [21]. Then, combined with their own understanding of swimming, a comparison algorithm is designed to let the observed clearly understand the problems and standard degree of their own actions. At the end of this chapter, the algorithm is implemented by an example.


### 4.1. Application of Image Processing Algorithm in Swimming Detection

#### 4.1.1. Sobel Operator

Sobel operator belongs to discrete difference operator. As a common method of edge detection, Sobel operator convolutes all pixels of the image through the kernel of the operator. The cores here are mainly two templates of3∗3. Two sets of values can be obtained by plane convolution between the horizontal and vertical matrix templates and the points in the image, which are the horizontal and vertical brightness difference values, respectively. For the processed image, select the appropriate threshold to extract the edge. The implementation in this example is as follows: the image before processing is represented by C. The transverse test results are represented by Gx, and the longitudinal test results are represented by Gy. Formula (12) and formula (13) represent Gx and Gy, respectively.
(12)Gx=−10+1−20+2−10+1∗C4−1,(13)Gy=+1+2+1000−1−2−1∗C4−2.For the pixel points traversed horizontally and vertically, the final value of the point can be obtained through the following formula:(14)G=Gx2+Gy2.After studying Sobel operator, it is found that the main advantage of using Sobel operator for edge detection in the swimming field is that the processing speed is faster. The disadvantage is that the template with only two directions can only detect edges in two directions, namely, the vertical direction and the horizontal direction. The Sobel operator does not strictly distinguish the subject and the background of the image. In other words, the Sobel operator is not processed based on the grayscale of the image. Since the Sobel operator does not strictly simulate the human visual physiological characteristics, the extracted image contour sometimes is not satisfactory. At this time, Sobel operator edge detection cannot achieve the desired effect for the pose processing scene with high accuracy requirements. At the same time, pixels with gray value greater than the threshold are regarded as edge points in this way. Some noise points with large gray value, such as large water waves, may also be judged as edges [22]. In order to test the edge detection performance of Sobel operator in swimming scene, MATLAB is used to detect the following pictures.It can be seen from the results that there are many misjudgments about edges detected by Sobel operator, which are mainly reflected in the following three aspects:(1)
Water waves are often detected as edges(2)
The edge of the swimmer’s swimsuit is misjudged as nonedge(3)
Too much internal information of the target will have a certain impact on the follow-up experiments


#### 4.1.2. Canny Operator

Canny operator is a multilevel edge detection algorithm. The significance of Canny operator is to find the optimal edge of the image. The principle is as follows: firstly, the image is denoised. The purpose of denoising is that many noises belong to high-frequency signals, which will lead to misjudgment in edge detection. Although Gaussian filtering can reduce the probability of misjudgment, the edge information of the image may also belong to high-frequency signals, so it is also very important not to judge the edge as noise. Here, the grasp of the scale lies in the selection of an appropriate Gaussian blur radius [23]. The template is used to calculate each pixel, then the nonmaximum value is suppressed, and finally the double threshold detection is performed. The original graph processed by Canny operator obtains the research results. It can be seen from the results that Canny operator is more accurate and precise for human body edge detection. Only the edge of the foot cannot be accurately identified due to the large spray, and the spray part still detects the edge, but has little impact.


### 4.2. Detection of Key Information

After edge detection, in order to get the position information of key points, the system chooses to carry out Hough line detection on the image after edge detection. The purpose is to obtain the coordinates of the key position. The included angle of a key position can be determined by three coordinates. Hough transform is an algorithm that image processing must come into contact with. It detects objects with a specific shape through a voting algorithm. This process obtains a set conforming to the specific shape in a parameter space by calculating the local maximum value of the cumulative result. The Hough transform method can detect shapes such as circles, lines, ellipses, etc. In the lane line detection, one of the solutions initially considered is to use the Hough transform to detect the straight line for lane line extraction. Hoff line detection uses the duality of lines and points to detect. In line detection, the points in the parameter space correspond to the lines in the image space one by one. Similarly, the points in the image space correspond to the lines in the parameter space one by one. In the coordinate system, a line can be expressed asy=kx+b, K is the slope, and B is the intercept, both of which are constants [24]. The parameters of all straight lines passing through point Mx1,y1 satisfy the equation, that is, the point determines a group of straight lines. If the equation is rewritten as b=−kx,+y1, it represents a straight line in the parameter space, as shown in Figure 4.Figure 4
Mapping diagram of rectangular coordinate system and parameter space 1.IfBx2,y2 and a point are added to the line y=kx+b,Bx2,y2 also corresponds to a line in the parameter space, as shown in Figure 5.Figure 5
Mapping diagram of rectangular coordinate system and parameter space 2.In practical application, the image space is shown in Figure6. If multiple pixel points in the source image form a straight line, the curve mapped to the parameter space can intersect at one point, and the intersection of the curve can be detected in the parameter space to determine the straight line.Figure 6
Mapping diagram of rectangular coordinate system and parameter space 3.After the original image is detected, the parameter space image is obtained. The linear direction is discretized, the directionR is obtained, and the results are obtained by statistical selection. The coordinates of the key position can be selected, and then, the key position information can be calculated according to the nearby coordinates. After the operation, the action information of the swimmer’s key position can be obtained. After the action continuous frames are processed, the continuous information can be obtained, as shown in Figure 7.Figure 7
Key information of breaststroke movement of an athlete.


### 4.3. Design and Application of Swimming Motion Evaluation Algorithm

The original intention of the system design proposed in this paper is to improve the swimmer s’ turning movements. In the process of improving the swimming movements, athletes need to first locate their own problems and then improve to the standard movements. The evaluation algorithm is added in the improvement process. After in-depth study of the key information in the swimming process, the following motion evaluation algorithm is designed. The action evaluation algorithm mainly includes two contents:(1)
Give users suggestions on optimizing the action standardization(2)
Quantifying the user’s actionsThe evaluation of the above two points is based on the comparison between the action of the observer and the standard action. The observation index is to analyze the accuracy of the athletes’ swimming rhythm and observe whether the athletes’ actions are standard [25]. Therefore, the order of importance of the three aspects of the evaluation system is as follows: whether the action cycle is standard, the proportion of standard action time, and whether the action amplitude is standard. The weights of these three points are defined as 50%, 30%, and 20%, respectively. Therefore, the comprehensive score formula is as follows:
(15)CS=P+50%+Tps∗30%+Aps∗20%,where CS is the comprehensive score,P is the score of the standard part of the action cycle, Tps is the score of the proportion of the standard action time, and Aps is the score of the standard part of the action. The obtained formula is as follows:
(16)P=e−x−282/50∗100.Establish the amount data of the standard action, calculate the information of each key position through the above method, then adjust the cycle of each breaststroke action to the action cycle of the observer, and average the key information calculated in these 23 frames, that is, obtain the curve as shown in Figure8. According to the proportion of standard action time and the scores of each link, the comprehensive scores of athletes are obtained.Figure 8
Comparison diagram of breaststroke action and standard action of an athlete.


## 4.1. Application of Image Processing Algorithm in Swimming Detection

### 4.1.1. Sobel Operator

Sobel operator belongs to discrete difference operator. As a common method of edge detection, Sobel operator convolutes all pixels of the image through the kernel of the operator. The cores here are mainly two templates of3∗3. Two sets of values can be obtained by plane convolution between the horizontal and vertical matrix templates and the points in the image, which are the horizontal and vertical brightness difference values, respectively. For the processed image, select the appropriate threshold to extract the edge. The implementation in this example is as follows: the image before processing is represented by C. The transverse test results are represented by Gx, and the longitudinal test results are represented by Gy. Formula (12) and formula (13) represent Gx and Gy, respectively.
(12)Gx=−10+1−20+2−10+1∗C4−1,(13)Gy=+1+2+1000−1−2−1∗C4−2.For the pixel points traversed horizontally and vertically, the final value of the point can be obtained through the following formula:(14)G=Gx2+Gy2.After studying Sobel operator, it is found that the main advantage of using Sobel operator for edge detection in the swimming field is that the processing speed is faster. The disadvantage is that the template with only two directions can only detect edges in two directions, namely, the vertical direction and the horizontal direction. The Sobel operator does not strictly distinguish the subject and the background of the image. In other words, the Sobel operator is not processed based on the grayscale of the image. Since the Sobel operator does not strictly simulate the human visual physiological characteristics, the extracted image contour sometimes is not satisfactory. At this time, Sobel operator edge detection cannot achieve the desired effect for the pose processing scene with high accuracy requirements. At the same time, pixels with gray value greater than the threshold are regarded as edge points in this way. Some noise points with large gray value, such as large water waves, may also be judged as edges [22]. In order to test the edge detection performance of Sobel operator in swimming scene, MATLAB is used to detect the following pictures.It can be seen from the results that there are many misjudgments about edges detected by Sobel operator, which are mainly reflected in the following three aspects:(1)
Water waves are often detected as edges(2)
The edge of the swimmer’s swimsuit is misjudged as nonedge(3)
Too much internal information of the target will have a certain impact on the follow-up experiments


### 4.1.2. Canny Operator

Canny operator is a multilevel edge detection algorithm. The significance of Canny operator is to find the optimal edge of the image. The principle is as follows: firstly, the image is denoised. The purpose of denoising is that many noises belong to high-frequency signals, which will lead to misjudgment in edge detection. Although Gaussian filtering can reduce the probability of misjudgment, the edge information of the image may also belong to high-frequency signals, so it is also very important not to judge the edge as noise. Here, the grasp of the scale lies in the selection of an appropriate Gaussian blur radius [23]. The template is used to calculate each pixel, then the nonmaximum value is suppressed, and finally the double threshold detection is performed. The original graph processed by Canny operator obtains the research results. It can be seen from the results that Canny operator is more accurate and precise for human body edge detection. Only the edge of the foot cannot be accurately identified due to the large spray, and the spray part still detects the edge, but has little impact.


## 4.1.1. Sobel Operator

Sobel operator belongs to discrete difference operator. As a common method of edge detection, Sobel operator convolutes all pixels of the image through the kernel of the operator. The cores here are mainly two templates of3∗3. Two sets of values can be obtained by plane convolution between the horizontal and vertical matrix templates and the points in the image, which are the horizontal and vertical brightness difference values, respectively. For the processed image, select the appropriate threshold to extract the edge. The implementation in this example is as follows: the image before processing is represented by C. The transverse test results are represented by Gx, and the longitudinal test results are represented by Gy. Formula (12) and formula (13) represent Gx and Gy, respectively.
(12)Gx=−10+1−20+2−10+1∗C4−1,(13)Gy=+1+2+1000−1−2−1∗C4−2.For the pixel points traversed horizontally and vertically, the final value of the point can be obtained through the following formula:(14)G=Gx2+Gy2.After studying Sobel operator, it is found that the main advantage of using Sobel operator for edge detection in the swimming field is that the processing speed is faster. The disadvantage is that the template with only two directions can only detect edges in two directions, namely, the vertical direction and the horizontal direction. The Sobel operator does not strictly distinguish the subject and the background of the image. In other words, the Sobel operator is not processed based on the grayscale of the image. Since the Sobel operator does not strictly simulate the human visual physiological characteristics, the extracted image contour sometimes is not satisfactory. At this time, Sobel operator edge detection cannot achieve the desired effect for the pose processing scene with high accuracy requirements. At the same time, pixels with gray value greater than the threshold are regarded as edge points in this way. Some noise points with large gray value, such as large water waves, may also be judged as edges [22]. In order to test the edge detection performance of Sobel operator in swimming scene, MATLAB is used to detect the following pictures.It can be seen from the results that there are many misjudgments about edges detected by Sobel operator, which are mainly reflected in the following three aspects:(1)
Water waves are often detected as edges(2)
The edge of the swimmer’s swimsuit is misjudged as nonedge(3)
Too much internal information of the target will have a certain impact on the follow-up experiments


## 4.1.2. Canny Operator

Canny operator is a multilevel edge detection algorithm. The significance of Canny operator is to find the optimal edge of the image. The principle is as follows: firstly, the image is denoised. The purpose of denoising is that many noises belong to high-frequency signals, which will lead to misjudgment in edge detection. Although Gaussian filtering can reduce the probability of misjudgment, the edge information of the image may also belong to high-frequency signals, so it is also very important not to judge the edge as noise. Here, the grasp of the scale lies in the selection of an appropriate Gaussian blur radius [23]. The template is used to calculate each pixel, then the nonmaximum value is suppressed, and finally the double threshold detection is performed. The original graph processed by Canny operator obtains the research results. It can be seen from the results that Canny operator is more accurate and precise for human body edge detection. Only the edge of the foot cannot be accurately identified due to the large spray, and the spray part still detects the edge, but has little impact.


## 4.2. Detection of Key Information

After edge detection, in order to get the position information of key points, the system chooses to carry out Hough line detection on the image after edge detection. The purpose is to obtain the coordinates of the key position. The included angle of a key position can be determined by three coordinates. Hough transform is an algorithm that image processing must come into contact with. It detects objects with a specific shape through a voting algorithm. This process obtains a set conforming to the specific shape in a parameter space by calculating the local maximum value of the cumulative result. The Hough transform method can detect shapes such as circles, lines, ellipses, etc. In the lane line detection, one of the solutions initially considered is to use the Hough transform to detect the straight line for lane line extraction. Hoff line detection uses the duality of lines and points to detect. In line detection, the points in the parameter space correspond to the lines in the image space one by one. Similarly, the points in the image space correspond to the lines in the parameter space one by one. In the coordinate system, a line can be expressed asy=kx+b, K is the slope, and B is the intercept, both of which are constants [24]. The parameters of all straight lines passing through point Mx1,y1 satisfy the equation, that is, the point determines a group of straight lines. If the equation is rewritten as b=−kx,+y1, it represents a straight line in the parameter space, as shown in Figure 4.Figure 4
Mapping diagram of rectangular coordinate system and parameter space 1.IfBx2,y2 and a point are added to the line y=kx+b,Bx2,y2 also corresponds to a line in the parameter space, as shown in Figure 5.Figure 5
Mapping diagram of rectangular coordinate system and parameter space 2.In practical application, the image space is shown in Figure6. If multiple pixel points in the source image form a straight line, the curve mapped to the parameter space can intersect at one point, and the intersection of the curve can be detected in the parameter space to determine the straight line.Figure 6
Mapping diagram of rectangular coordinate system and parameter space 3.After the original image is detected, the parameter space image is obtained. The linear direction is discretized, the directionR is obtained, and the results are obtained by statistical selection. The coordinates of the key position can be selected, and then, the key position information can be calculated according to the nearby coordinates. After the operation, the action information of the swimmer’s key position can be obtained. After the action continuous frames are processed, the continuous information can be obtained, as shown in Figure 7.Figure 7
Key information of breaststroke movement of an athlete.


## 4.3. Design and Application of Swimming Motion Evaluation Algorithm

The original intention of the system design proposed in this paper is to improve the swimmer s’ turning movements. In the process of improving the swimming movements, athletes need to first locate their own problems and then improve to the standard movements. The evaluation algorithm is added in the improvement process. After in-depth study of the key information in the swimming process, the following motion evaluation algorithm is designed. The action evaluation algorithm mainly includes two contents:(1)
Give users suggestions on optimizing the action standardization(2)
Quantifying the user’s actionsThe evaluation of the above two points is based on the comparison between the action of the observer and the standard action. The observation index is to analyze the accuracy of the athletes’ swimming rhythm and observe whether the athletes’ actions are standard [25]. Therefore, the order of importance of the three aspects of the evaluation system is as follows: whether the action cycle is standard, the proportion of standard action time, and whether the action amplitude is standard. The weights of these three points are defined as 50%, 30%, and 20%, respectively. Therefore, the comprehensive score formula is as follows:
(15)CS=P+50%+Tps∗30%+Aps∗20%,where CS is the comprehensive score,P is the score of the standard part of the action cycle, Tps is the score of the proportion of the standard action time, and Aps is the score of the standard part of the action. The obtained formula is as follows:
(16)P=e−x−282/50∗100.Establish the amount data of the standard action, calculate the information of each key position through the above method, then adjust the cycle of each breaststroke action to the action cycle of the observer, and average the key information calculated in these 23 frames, that is, obtain the curve as shown in Figure8. According to the proportion of standard action time and the scores of each link, the comprehensive scores of athletes are obtained.Figure 8
Comparison diagram of breaststroke action and standard action of an athlete.


## 5. Construction of Swimming Guidance System

The method of detecting breaststroke action in the previous chapter is extended to detecting breaststroke turning action. After detecting breaststroke turning action, the details of turning action are analyzed, standard action data are established, and comparison algorithm is designed [26]. A turning motion guidance system based on OpenCL technology is established to facilitate users to use the system and improve the real-time feedback ability of the system. OpenCL defines two different programming models: task parallelism and data parallelism. In the data parallel mode, computing data is divided and allocated to different computing units for simultaneous computing, which is suitable for computing tasks with independent data. Task parallelism refers to the fact that each step of the computing step has a front-to-back dependency, which makes it impossible for us to execute the computing tasks in parallel. Therefore, we can only parallelize the data of each step and then perform asynchronous/synchronous serial execution of the entire process. In order to coordinate the sequence of the entire process, OpenCL provides an event mechanism for process synchronization control.


### 5.1. Key Information Detection during Turning

The turning action in this chapter refers to the stage from the time when both hands touch the wall to the time when both feet leave the wall, such as Canny operator edge detection and Hoff line detection, to detect the breaststroke turning action of an athlete. Figure9 is obtained. After the position of power, the goal of each stage, and the information of key nodes in the process of turning are clear, the evaluation algorithm of breaststroke turning can be designed.Figure 9
Key information of turning movement.


### 5.2. Design and Application of Turning Motion Evaluation Algorithm

From the target and key node information pursued at each stage of the turning process, the breaststroke turning motion evaluation algorithm is similar to the breaststroke motion evaluation algorithm, but the difference lies in the data of the standard motion. Therefore, the comprehensive scoring link formula is consistent with the breaststroke action evaluation algorithm. In order to judge whether the athletes’ turning movements are standard or not, it is necessary to clarify two points: first is the standard movement data; second is the algorithm of comparison with standard data. Select eight athletes and observe their action cycles to obtain the standard data curve as shown in Figure10.Figure 10
Comparison diagram of turning action and standard action.After analyzing the athletes’ movements, the scores of the swimmers’ strokes are evaluated, and the data of each link are substituted into the following formula:(17)CS=p∗50%+Tps∗30%+Aps∗20%CS=e−30−282/25∗100∗50%+1−830∗100∗30%+1−85.47−62.3862.38∗100∗20%CS=43.The comprehensive scores are as follows: the swimmer’s turning action score is low. In order not to strike the athletes’ psychology, the difficulty of the scoring system can be adjusted. By adjusting the variance of the Gaussian function and the definition of nonstandard actions, the range of standard actions can be expanded. For example, the difficulty can be reduced, and the score can be increased from 5% to 10%. In order to optimize swimmers’ movements, it is necessary to establish a library of optimization suggestions, which can be set in advance according to different conditions of swimmers.


### 5.3. Construction of Turning Motion Guidance System Based on OpenCL Technology

OpenCL is an open computing language. It is mainly designed for parallel computing on heterogeneous computing platforms. Most heterogeneous computing platforms have at least two computing devices in the same operating system. The instruction set and hardware architecture of these devices are widely different. Heterogeneous computing platforms have a wide range of applications, among which the most famous combination is the combination of processor and graphics card, namely, CPU and GPU. The reason why CPUs and GPUs are so different is that they are designed for two different application scenarios. The CPU needs strong versatility to handle various data types and at the same time requires logical judgment, which will introduce a large number of branch jumps and interrupt processing. These all make the internal structure of the CPU extremely complex. GPUs, on the other hand, face large-scale data of highly uniform types, independent of each other, and a pure computing environment that does not need to be interrupted.


#### 5.3.1. Hardware Level

In terms of hardware, it combines programmable logic embedded dual core cortex-a9 hard core processor, which is the latest processor in the field and can fully meet the flexibility of design. DE10-Nano is also equipped with high-speed DDR3 memory, digital simulation function, Ethernet, and other application functions.


#### 5.3.2. Software Level

(1)
Set up the working environment of OpenCL. Unzip the board level support package of DE10-Nano to the specified location. In order for the compiler to find the location of the DE10-Nano device, you need to create a new variable in the system environment variable. Then, in order for the windows system to find the relevant compilation commands of OpenCL, you need to conFigure the SDK with relevant environment variables. After configuring environment variables, it is necessary to verify the availability of heterogeneous systems to ensure the availability of heterogeneous platforms(2)
Write the source program. OpenCL programs are divided into host programs and kernel programs. The host program mainly provides the relevant environment and parameters to allow the kernel code to run in the device(3)
Download the Linux image of OpenCL BSP with DE10-Nano on the official website, burn it to the SD card, and then boot the development board through the SD card. After the development board is connected and powered on, ensure that the IP address of the development board is in the same network segment as the PC compiling the code and then copy the compiled code to the development board. After entering the development board, initialize the runtime mechanism of OpenCL and finally run the host program. Hosts is a system file without an extension. Its basic function is to establish an associated “database” between some commonly used URL domain names and their corresponding IP addresses. When a user enters a URL that needs to log in in the browser, the system will automatically first find the corresponding IP address from the Hosts file. Once found, the system will open the corresponding web page immediately. If not found, the system will submit the URL to the DNS domain name resolution server for IP address resolution. If it is found to be a blocked IP or domain name, this page will be blocked from openingThis system is used to analyze the breaststroke turning movement of an athlete who has been trained for four years. After inputting the breaststroke turning movement video of the athlete, display the results on the screen connected to the development board. The results are more targeted to point out the problems of the athlete, and the suggestions given are also more targeted. Therefore, this system has a good effect in practical application.


## 5.1. Key Information Detection during Turning

The turning action in this chapter refers to the stage from the time when both hands touch the wall to the time when both feet leave the wall, such as Canny operator edge detection and Hoff line detection, to detect the breaststroke turning action of an athlete. Figure9 is obtained. After the position of power, the goal of each stage, and the information of key nodes in the process of turning are clear, the evaluation algorithm of breaststroke turning can be designed.Figure 9
Key information of turning movement.


## 5.2. Design and Application of Turning Motion Evaluation Algorithm

From the target and key node information pursued at each stage of the turning process, the breaststroke turning motion evaluation algorithm is similar to the breaststroke motion evaluation algorithm, but the difference lies in the data of the standard motion. Therefore, the comprehensive scoring link formula is consistent with the breaststroke action evaluation algorithm. In order to judge whether the athletes’ turning movements are standard or not, it is necessary to clarify two points: first is the standard movement data; second is the algorithm of comparison with standard data. Select eight athletes and observe their action cycles to obtain the standard data curve as shown in Figure10.Figure 10
Comparison diagram of turning action and standard action.After analyzing the athletes’ movements, the scores of the swimmers’ strokes are evaluated, and the data of each link are substituted into the following formula:(17)CS=p∗50%+Tps∗30%+Aps∗20%CS=e−30−282/25∗100∗50%+1−830∗100∗30%+1−85.47−62.3862.38∗100∗20%CS=43.The comprehensive scores are as follows: the swimmer’s turning action score is low. In order not to strike the athletes’ psychology, the difficulty of the scoring system can be adjusted. By adjusting the variance of the Gaussian function and the definition of nonstandard actions, the range of standard actions can be expanded. For example, the difficulty can be reduced, and the score can be increased from 5% to 10%. In order to optimize swimmers’ movements, it is necessary to establish a library of optimization suggestions, which can be set in advance according to different conditions of swimmers.


## 5.3. Construction of Turning Motion Guidance System Based on OpenCL Technology

OpenCL is an open computing language. It is mainly designed for parallel computing on heterogeneous computing platforms. Most heterogeneous computing platforms have at least two computing devices in the same operating system. The instruction set and hardware architecture of these devices are widely different. Heterogeneous computing platforms have a wide range of applications, among which the most famous combination is the combination of processor and graphics card, namely, CPU and GPU. The reason why CPUs and GPUs are so different is that they are designed for two different application scenarios. The CPU needs strong versatility to handle various data types and at the same time requires logical judgment, which will introduce a large number of branch jumps and interrupt processing. These all make the internal structure of the CPU extremely complex. GPUs, on the other hand, face large-scale data of highly uniform types, independent of each other, and a pure computing environment that does not need to be interrupted.


### 5.3.1. Hardware Level

In terms of hardware, it combines programmable logic embedded dual core cortex-a9 hard core processor, which is the latest processor in the field and can fully meet the flexibility of design. DE10-Nano is also equipped with high-speed DDR3 memory, digital simulation function, Ethernet, and other application functions.


### 5.3.2. Software Level

(1)
Set up the working environment of OpenCL. Unzip the board level support package of DE10-Nano to the specified location. In order for the compiler to find the location of the DE10-Nano device, you need to create a new variable in the system environment variable. Then, in order for the windows system to find the relevant compilation commands of OpenCL, you need to conFigure the SDK with relevant environment variables. After configuring environment variables, it is necessary to verify the availability of heterogeneous systems to ensure the availability of heterogeneous platforms(2)
Write the source program. OpenCL programs are divided into host programs and kernel programs. The host program mainly provides the relevant environment and parameters to allow the kernel code to run in the device(3)
Download the Linux image of OpenCL BSP with DE10-Nano on the official website, burn it to the SD card, and then boot the development board through the SD card. After the development board is connected and powered on, ensure that the IP address of the development board is in the same network segment as the PC compiling the code and then copy the compiled code to the development board. After entering the development board, initialize the runtime mechanism of OpenCL and finally run the host program. Hosts is a system file without an extension. Its basic function is to establish an associated “database” between some commonly used URL domain names and their corresponding IP addresses. When a user enters a URL that needs to log in in the browser, the system will automatically first find the corresponding IP address from the Hosts file. Once found, the system will open the corresponding web page immediately. If not found, the system will submit the URL to the DNS domain name resolution server for IP address resolution. If it is found to be a blocked IP or domain name, this page will be blocked from openingThis system is used to analyze the breaststroke turning movement of an athlete who has been trained for four years. After inputting the breaststroke turning movement video of the athlete, display the results on the screen connected to the development board. The results are more targeted to point out the problems of the athlete, and the suggestions given are also more targeted. Therefore, this system has a good effect in practical application.


## 5.3.1. Hardware Level

In terms of hardware, it combines programmable logic embedded dual core cortex-a9 hard core processor, which is the latest processor in the field and can fully meet the flexibility of design. DE10-Nano is also equipped with high-speed DDR3 memory, digital simulation function, Ethernet, and other application functions.


## 5.3.2. Software Level

(1)
Set up the working environment of OpenCL. Unzip the board level support package of DE10-Nano to the specified location. In order for the compiler to find the location of the DE10-Nano device, you need to create a new variable in the system environment variable. Then, in order for the windows system to find the relevant compilation commands of OpenCL, you need to conFigure the SDK with relevant environment variables. After configuring environment variables, it is necessary to verify the availability of heterogeneous systems to ensure the availability of heterogeneous platforms(2)
Write the source program. OpenCL programs are divided into host programs and kernel programs. The host program mainly provides the relevant environment and parameters to allow the kernel code to run in the device(3)
Download the Linux image of OpenCL BSP with DE10-Nano on the official website, burn it to the SD card, and then boot the development board through the SD card. After the development board is connected and powered on, ensure that the IP address of the development board is in the same network segment as the PC compiling the code and then copy the compiled code to the development board. After entering the development board, initialize the runtime mechanism of OpenCL and finally run the host program. Hosts is a system file without an extension. Its basic function is to establish an associated “database” between some commonly used URL domain names and their corresponding IP addresses. When a user enters a URL that needs to log in in the browser, the system will automatically first find the corresponding IP address from the Hosts file. Once found, the system will open the corresponding web page immediately. If not found, the system will submit the URL to the DNS domain name resolution server for IP address resolution. If it is found to be a blocked IP or domain name, this page will be blocked from openingThis system is used to analyze the breaststroke turning movement of an athlete who has been trained for four years. After inputting the breaststroke turning movement video of the athlete, display the results on the screen connected to the development board. The results are more targeted to point out the problems of the athlete, and the suggestions given are also more targeted. Therefore, this system has a good effect in practical application.


## 6. Conclusion and Prospect

### 6.1. Conclusion

This system is put forward under the condition that the popularization rate of scientific training auxiliary equipment in the field of domestic swimming training is not high and the turning technology of domestic athletes is generally backward. It is intended to quantify the swimming movement, so that athletes can more conveniently optimize their technical movements, and then promote the country to a higher level in the competitive sports of swimming. Starting from the goal, because the turning movement has a great impact on the competition results, and breaststroke has a wide coverage of the crowd, this paper takes the breaststroke turning as the starting point of this system. In this paper, the appropriate image processing method is selected through the experimental method. After using the above methods to analyze the breaststroke and turning movements of the athlete, the data are collected into a chart, the change trend of each index and the logic driving its change are analyzed in detail, the standard action model is constructed, and the athlete’s action is compared with the standard action. Then, the motion evaluation algorithm is designed. Through this algorithm, athletes can get targeted motion optimization suggestions and comprehensive evaluation scores. The purpose of using OpenCL technology on the FPGA system is to reduce the threshold for users to use the system by strengthening the portability of the system and helping the popularization of the system. First, the DE10-Nano development board is used to connect the system hardware. Then, at the software level, the OpenCL working environment is built to complete the preparation of host code and kernel code. After compilation, it is copied to the development board and run.


### 6.2. Prospect

The original intention of this system is to improve the standard of swimmers’ movements scientifically and conveniently. Science means that the evaluation of swimmers’ movements is accurate, and the suggestions given are highly targeted.At the level of promoting scientificity(1)
The standard action data of the system still needs to be optimized. In the future, we can observe the movements of more professional athletes and then continuously optimize the standard data according to the algorithm(2)
Introduce more dimension data. Although these three angles can locate the important attitude information of the observer, they are still not comprehensive. In the future, more angles can be added or included angles that can show more information can be found to build more comprehensive and detailed posture information(3)
The algorithm for optimizing standard data needs to be further improved. The logic of the existing algorithm is to constantly average the posture data of high-level athletes with the standard action. In the future, we can consider adding weights of different athletes, that is, to enhance the impact of the posture data of top athletes on the standard action data(4)
The anti-interference ability of image processing still needs to be improved. Due to the complex underwater environment, the water quality may be turbid, the light may be weak, and the athletes’ movement range may lead to more bubbles or even interference from other swimmers. At this time, the image processing algorithm needs to be further improved to obtain accurate dataAt the convenience level(1)
Further optimize the degree of automation of the system. The existing system is unable to recognize the swimming pose for the time being. In the future, we will consider adding in-depth learning technology to allow the system to judge the user’s swimming pose according to the user’s actions and complete the selection and solution of key information(2)
As an app, it is carried into a waterproof smart phone. The popularity of existing smart phones is high. In the future, with the improvement of technology, the waterproof performance of mobile phones will also be improved. When waterproof smart phones are common, they can be considered to be carried into smart phones as apps


## 6.1. Conclusion

This system is put forward under the condition that the popularization rate of scientific training auxiliary equipment in the field of domestic swimming training is not high and the turning technology of domestic athletes is generally backward. It is intended to quantify the swimming movement, so that athletes can more conveniently optimize their technical movements, and then promote the country to a higher level in the competitive sports of swimming. Starting from the goal, because the turning movement has a great impact on the competition results, and breaststroke has a wide coverage of the crowd, this paper takes the breaststroke turning as the starting point of this system. In this paper, the appropriate image processing method is selected through the experimental method. After using the above methods to analyze the breaststroke and turning movements of the athlete, the data are collected into a chart, the change trend of each index and the logic driving its change are analyzed in detail, the standard action model is constructed, and the athlete’s action is compared with the standard action. Then, the motion evaluation algorithm is designed. Through this algorithm, athletes can get targeted motion optimization suggestions and comprehensive evaluation scores. The purpose of using OpenCL technology on the FPGA system is to reduce the threshold for users to use the system by strengthening the portability of the system and helping the popularization of the system. First, the DE10-Nano development board is used to connect the system hardware. Then, at the software level, the OpenCL working environment is built to complete the preparation of host code and kernel code. After compilation, it is copied to the development board and run.


## 6.2. Prospect

The original intention of this system is to improve the standard of swimmers’ movements scientifically and conveniently. Science means that the evaluation of swimmers’ movements is accurate, and the suggestions given are highly targeted.At the level of promoting scientificity(1)
The standard action data of the system still needs to be optimized. In the future, we can observe the movements of more professional athletes and then continuously optimize the standard data according to the algorithm(2)
Introduce more dimension data. Although these three angles can locate the important attitude information of the observer, they are still not comprehensive. In the future, more angles can be added or included angles that can show more information can be found to build more comprehensive and detailed posture information(3)
The algorithm for optimizing standard data needs to be further improved. The logic of the existing algorithm is to constantly average the posture data of high-level athletes with the standard action. In the future, we can consider adding weights of different athletes, that is, to enhance the impact of the posture data of top athletes on the standard action data(4)
The anti-interference ability of image processing still needs to be improved. Due to the complex underwater environment, the water quality may be turbid, the light may be weak, and the athletes’ movement range may lead to more bubbles or even interference from other swimmers. At this time, the image processing algorithm needs to be further improved to obtain accurate dataAt the convenience level(1)
Further optimize the degree of automation of the system. The existing system is unable to recognize the swimming pose for the time being. In the future, we will consider adding in-depth learning technology to allow the system to judge the user’s swimming pose according to the user’s actions and complete the selection and solution of key information(2)
As an app, it is carried into a waterproof smart phone. The popularity of existing smart phones is high. In the future, with the improvement of technology, the waterproof performance of mobile phones will also be improved. When waterproof smart phones are common, they can be considered to be carried into smart phones as apps



---

*Source: 9097029-2022-09-14.xml*