Concrete Application of Computer Virtual Image Technology in Modern Sports Training

The efficiency of basketball shooting training has always been an urgent problem to be solved in basketball sports. Applying computer virtual image technology to basketball sports training is the key to improve basketball shooting ability and improve the effect of basketball sports training. Therefore, based on the design of basketball shooting automatic recognition system based on the background difference method, this study puts forward the specific application of computer virtual image technology in modern sports training. By analyzing the techniques of image denoising, image detection, and image calibration, a goal detection algorithm for modern sports basketball shooting training is designed. Firstly, the camera is used for image capture, the RGB image is converted into gray image, and the median filter is used to suppress the noise in the image. Then, the background difference method is used to detect the moving region, and the background modeling is combined with the mean method. After obtaining the background reference model, the image is differentiated, the gray image after image difference is binarized, and then the binary image is postprocessed by morphological middle closure operation. Finally, the image calibration technology is used to extract the basketball feature information. Through the region segmentation algorithm, the basketball shooting part is segmented and judged, so as to realize the basketball shooting training goal detection. The experimental results show that the proposed method has a good effect on basketball shooting training goal detection and can effectively improve the detection accuracy and efficiency.


Introduction
e development of computer virtual image technology provides convenience for life. At present, computer virtual image technology is added to many devices in life [1][2][3]. With the rapid development of computer virtual image technology, moving target detection technology in video has been more and more widely used [4,5]. Especially, in the application of modern sports training in recent years, the image processing technology in video includes image acquisition, processing, and image secondary display. Similarly, with the rapid development of the times, more and more requirements for video processing applications have been put forward. Moving target detection work is involved in many engineering application projects, but the moving target has a certain degree of difficulty in moving target detection due to the strong time-varying speed and uncertain path [6,7]. Among them, the basketball special automatic test is an engineering application of sports target detection. e basketball special automatic test is one of the main content needed for the current sports professional basketball talent training test and basketball sports. Basketball goal recognition is the key technology of basketball special automatic test. Accurate and timely judgment of basketball goals has an important practical value.
At present, scholars in related fields have made some progress in basketball shooting detection. Yu and Liu [8] proposed an automatic feature detection method of the basketball shooting teaching image based on artificial intelligence. Starting from the decomposition of basketball shooting teaching actions, the practical attributes of basketball shooting teaching images are defined, and a standardized image detection environment based on artificial intelligence is constructed according to the essentials of basketball shooting actions. e feature of basketball shooting teaching image is extracted, the feature scale value of basketball shooting action is calculated, and the feature description principle of automatic detection is combined to complete the automatic detection of basketball shooting teaching image features. is method has certain validity. Yang et al. [9] proposed a three-dimensional multiviewpoint basketball player detection and location method based on probability occupancy. Combine player detection based on deep learning and player positioning based on occupancy rate to extract the characteristics of three-dimensional multiview basketball players. e Bayesian model of a new positioning algorithm is used to detect and locate basketball players' game images by using the foreground information of the fisheye camera. is method has high reliability.
Xie [10] designed an automatic shooting recognition system based on the background difference method. e design and application of the system are tested by experimental analysis, sampling survey, and data analysis. Firstly, the relevant information of the background difference method is collected, and the algorithm flow and modeling method of the background difference method are understood. Secondly, relevant tests are designed according to the characteristics of shooting. en, an automatic recognition system is designed for experimental research. By sampling 8 basketball players for data observation and analysis, the results are obtained. e accuracy of the basketball shooting automatic recognition system reaches 89%, which can basically meet the requirements. erefore, based on this research, this study puts forward the specific application of computer virtual image technology in modern sports training. Using computer virtual image technology, a goal detection algorithm for modern sports basketball shooting training is designed. e basketball shooting training images are captured and preprocessed, the background difference method is used to detect the motion area for background modeling, and the images are processed by difference and binarization before postprocessing. By extracting the basketball feature information, segmenting the basketball shooting part, and making judgments, the basketball shooting training goal detection is realized. e basketball shooting training goal detection effect of this method is better, and the detection accuracy and efficiency can be effectively improved.

Computer Virtual Image Technology
e number of virtual images from "brightest" to "darkest" is divided according to the gray level. e larger the dynamic range is, the richer the level can be represented and the wider the color space it contains. With the rapid development of computer technology, both software and hardware have developed to a very high level. However, for users who pursue higher quality, the development of computer is endless, especially, the requirements of image quality. In order to further improve the quality of some aspects of the virtual image and make it close to the real environment as much as possible, the computer virtual image technology is studied. e specific processing process is image denoising, image detection, and image calibration. e specific analysis is as follows.
2.1. Image Denoising Technology. Because the noise in different images has differences in characteristics and spectral distribution, different denoising methods are formed. e mean filtering method and the median filtering method are the two most typical denoising methods in the spatial domain.

Mean Filtering Method.
It uses the average brightness value or weighted value of all pixels in the neighborhood of gray jump points to replace the original jump pixel value, remove abnormal pixels, and realize image smoothing, so as to eliminate noise [11,12]. e mathematical form of mean filtering is as follows: where d i is the neighboring pixel value of the jumping pixel g(x, y), e i is the weighting coefficient of the neighboring pixel, that is, the template coefficient, and mn is the number of weighting coefficients, that is, the template size. If the neighborhood is larger, the image will be blurry accordingly. e average filter template is generally selected as the following size: e � 1 9 1 1 1 e position with an asterisk is the jumping pixel point, that is, the jumping point is at the center of the template. e equal weighting coefficient makes the pixels in the neighborhood play the same smoothing effect. Small amount of calculation and simplicity are the biggest characteristics of this filtering, but the smoothed image inevitably reduces the sharpness, especially the edges and details are the most obvious.

Median Filter.
It is a kind of the nonlinear smoothing filter, which can effectively suppress abrupt noise by using ranking statistical theory [13][14][15]. Working principles of the median filter are as follows: determine a pixel as the central position, sort the gray values of other surrounding pixels according to the size relationship, and take the intermediate value to replace the pixel value at the central position. A square neighborhood formed on the basis of the central pixel is called a window. e noise smoothing of the image is realized by moving the window. Median filtering algorithm can eliminate isolated noise points and reduce the fuzziness of the image.
In the one-dimensional case, if b 1 , b 2 , ..., b n is a set of original signal sequences and assuming that b 1 , b 2 , ..., b n is already an ordered sequence from large to small, then the median of this set of original signal sequences is defined as When there is a large isolated noise at the center of the slope change, the median filtering of this type of signal can completely eliminate the noise. When the noise is not isolated, but two consecutive equal values, the median filter can still completely filter out the noise in this case. At this point, the median filter has a much better effect than the neighborhood average smoothing.
In the two-dimensional case, the median filter takes the median value of the pixel gray value in the two-dimensional window as the new value at the center of the window, and its mathematical expression is Commonly used two-dimensional window shapes include cross window, X-shaped window, and square window. Commonly used processing windows for two-dimensional median filtering are shown in Figure 1.

Background Difference Method.
e background difference method uses the difference between the pixel gray corresponding to the current frame image and the background image to detect the moving target [16][17][18]. e operation flow of the background difference method is shown in Figure 2.
Assuming that the background frame image used in the background difference method is static, that is, the background frame will not change with the number of image frames, b(i, j) is used to represent the background image, μ(i, j, l) is defined as the image sequence, and (i, j) in the image sequence is set as the position coordinate of the image. Among them, l is the number of frames in the image sequence, and the gray value of the selected image in the image sequence is used to make the difference with the gray value in the background image, and a difference image μ d (i, j, l) moving target is expressed as

Interframe Difference Method.
e interframe difference method is a method to obtain the contour of the moving target by frame difference between two consecutive frames extracted from video sequence [19][20][21]. e operation flow of the interframe difference method is shown in Figure 3. e τ picture in the video sequence is recorded as frame σ, and the τ − 1 picture is regarded as frame σ − 1. e corresponding images are represented by H τ and H τ−1 , respectively, and the gray values of pixel points are represented by H τ (i, j) and H τ−1 (i, j), respectively.
e gray values of pixel points of two adjacent frames are subtracted to obtain the absolute value, and the two frames of differential images are expressed as 2.3. Image Calibration Technology. In order to obtain the size of the object and its corresponding position in the image from the video image, the relationship between the corresponding points in the object and the corresponding points in the image can be determined. e common method is image calibration technology [22][23][24]. e image calibration technology is divided into traditional camera calibration and camera self-calibration.
(1) e traditional camera calibration method has certain requirements for the camera model, and the size and shape of the calibration object should be processed under the known condition. e internal and external parameters of the camera model can be obtained by mathematical transformation and calculation. (2) e camera self-calibration method does not require a specific calibration object, but is calibrated according to the positional relationship between the surrounding image and the corresponding image captured during the movement of the camera. Camera self-calibration methods can be further divided into camera automatic visual calibration technology, using basic matrix and essential matrix self-calibration technology, etc. Self-calibration technology is very flexible, but immature. Because there are too many unknowns, it is difficult to get stable results.
ere are also differences in the selection of traditional camera calibration methods and camera self-calibration methods for different occasions. For example, for some occasions that require high accuracy and the parameters do not change frequently, traditional calibration techniques can be used. For communication, virtual reality, and other occasions where the accuracy is not high, the camera selfcalibration method can be used.

Goal Detection Algorithm in Modern Sports
Basketball Shooting Training rough the further study of computer virtual image technology, this study puts forward the goal detection algorithm of modern sports basketball shooting training. e algorithm implementation flow is shown in Figure 4.

Image Capture and Preprocessing.
In the process of basketball shooting training goal detection, the image capture position is very important. Whether the camera is installed properly directly affects the accuracy of detection. To this end, use the recorded TestOne video to detect and determine the installation position of the camera is set above the basket, and the camera installation position is directly opposite to the basket for image capture, which can completely capture the basketball goal process. Because the format of the video is RGB24, the color space parameters are not needed during the detection process, so after the image is acquired, the RGB image is converted to a grayscale image, thereby reducing the system memory usage and increasing the processing speed [25]. e image captured by the camera is easily disturbed and polluted by noise in the process of transmission, conversion, and storage, which will make the useful information in the image unable to be extracted. erefore, after capturing and converting the image, this paper uses the median filter [26,27] to suppress the noise in the image. In order to perform median filtering on a pixel point on an image, the pixel values of the desired pixel in the mask and its neighborhood must be sorted to determine the median, and the median is given to the pixel point, which is expressed as follows:

Background
Modeling. When using the background difference method to detect a moving area, the background reference model must first be prepared. Because the environment of the scene is relatively simple and the influence of other objective factors is small, this study adopts the mean value method for background modeling. e multiframe images captured by the camera in a period of time are accumulated, and then, the accumulated value is divided by the number of captured frames, and finally, the average value is obtained, and the obtained average value is used as the background reference model. e mathematical expression is expressed as where N is the number of frames to be averaged, (z n + z n−1 + ... + z n−N+1 ) is the continuous N frame image saved by the system including the current frame, and W n is the background model established by the system when the n frame image is collected. Due to the influence of the lighting changes in the scene and other factors and the background model updated according to the scene for a long time, it will cause the moving target to not be detected [28,29]. erefore, the obtained background model W n must be updated at regular intervals, and the update calculation formula is Formula (10) shows that the new background model is based on the background model W n−1 obtained in the previous calculation, and the current frame z n and z n−N frame are recursively obtained, thus realizing the update of the background model. Obviously, if the selected image frame N value (the more image frames) is larger, the background reference model W n obtained is closer to the real background in the scene.

Image Difference.
After the background modeling is completed, the foreground area is the area where the difference value of the current image minus the background image is greater than a specific threshold. Direct subtraction is generally good, but it is poor when the foreground and background are very similar, the noise is very loud, and there are shadows. At this time, the difference between the background area and the foreground area is relatively small, so it is difficult to select the threshold [30,31]. For this reason, after the reference model is obtained, the image in the video can be differentiated to obtain the moving area in the image and separate the background in the image. For grayscale images, the following formula is used to perform differential operations indirectly: where a(i, j) and b(i, j) are the gray value of the current image and the background image at the pixel point (i, j), respectively. is formula can alleviate the impact of a particularly large or small pixel gray value.

Binarization Processing.
After the image is differentiated, although some parameters of the image can be extracted, further processing of the image is required. In order to be able to quickly and accurately extract the position and appearance information of the basketball feature from the video image sequence, then it is necessary to binarize the gray image after image difference and to convert the gray image to binarization. First, a segmentation threshold value needs to be given, the gray value of the points in the grayscale image is compared with the given segmentation threshold value, and the grayscale image is converted into a binary image according to the result of the comparison. For this reason, the maximum interclass difference method [32,33] is used to extract the threshold value in the grayscale difference image.  en, the probabilities of regions V 0 and V 1 are, respectively, e average gray levels of regions V 0 and V 1 are, respectively, where U is the average gray level of the entire image: e total variance of the two regions is Let λ take values sequentially within the range of [0, L − 1] grayscale values so that the threshold λ, when the total variance ω 2 B of the two regions is the largest, is the optimal region segmentation threshold in the grayscale image.

Mathematical Morphology Processing.
After the gray image is processed by binarization, there will be many holes and gaps. In order to restore the basketball to its original shape and fill the hole, according to the effect of image difference and binarization, morphological closure operation [34][35][36] needs to be used for postprocessing of the binarized image. e closed operation can not only connect the disconnected adjacent targets in the binary image but also smooth the contour in the image.
First, the binary image is expanded, and then, the image is corroded. e definition is as follows: where β represents a structural element, α represents an image, and α · β represents β which performs a closed operation on the image α.
3.6. Basketball Feature Information Extraction. After the above steps and calculations and after the image is processed by mathematical morphology, the image calibration technology can be used to extract the basketball feature information. Basketball x min , x max y min , y max is the minimum and maximum pixel coordinates in the X, Y direction, and it is also the basis for calculating other feature information. e total number of diameter pixels in the direction is denoted by B P (X)andB P (Y), and the calculation method is e corresponding pixel in the image and the actual corresponding size of the object are mainly obtained through the calculation of the calibration coefficient B T , which is a very important parameter in identifying goals, and the calculation of the basketball diameter is mainly obtained through B T . Only when B T can be obtained accurately can we calculate some basketball parameters more accurately and judge basketball shots more accurately. In the image, a diameter line segment is marked in the basketball box, and two coordinate points (x 1 , y 1 )and(x 2 , y 2 ) are obtained at both ends of the line segment. e total number of pixels R P between the two points on the line segment can be obtained by the straight line calculation formula: e corresponding relationship between the length and the pixels established by the actual size of the basketball frame diameter L and the total number of pixels of the basketball frame diameter in the image is rough the above extraction and calculation of basketball feature information, the basketball position can be determined.

Judging the Goal Method.
e most important parameter for judging whether a basketball scores a goal is the actual size of the basketball diameter B R in the image when the basketball is shooting: e basketball shooting part is segmented by the area segmentation algorithm. When the basketball corresponding pixel is not detected in the basketball shooting and when the basketball shooting enters the basket, the total number of pixels in the X, Y direction of the basketball will be different. e ratio coefficient Q of the total number of pixels in this 6 Computational Intelligence and Neuroscience direction can be used to determine whether all basketball shots have entered the basket, which is expressed as e method to judge the goal is to compare and analyze the eigenvalues of basketball calculated above.
ere are three conditions to judge whether a goal is scored. If any of the conditions are not met, it will be deemed that the basketball is not scored, and the image will be captured again for detection.

Condition 1.
e calculated size of B P (Y) or B P (X) must be less than 24 cm. If it is larger than 25 cm, it means that the basketball is still above the ball frame and has not been put into the basketball frame.

Condition 2.
Comparing B P (Y) and B P (X), if the ratio coefficient of the two is Q > 1.1 or Q < 1.1, it is possible to detect only the noise in the image or only a part of the basketball, indicating that the basketball is not all above the basket.
Condition 3. If the above two conditions are met, compare B R with the diameter B T of the basketball goal obtained in the debugging process. When B R < B T , it is judged that the ball is scored, and R P is automatically incremented by 1.
In the detection, the basketball shooting is judged through these three conditions. If the goal is judged, it will be delayed by 0.3 ms. is is because, after the goal, it is still possible to detect the basketball judged as after the goal. en, the purpose of the delay is to wait for the previous one to pass through the basket, so as to avoid misjudgment.
rough the above analysis, the computer virtual image technology is used to collect the basketball shooting image, and the image preprocessing is completed by establishing the background reference model, image difference, binarization processing, and mathematical morphology processing. On this basis, the basketball characteristic information is proposed and the goal determination method is designed to realize the basketball shooting goal detection in modern sports training.

Set up the Experimental Environment.
In order to verify the effectiveness of the specific application of computer virtual image technology in modern sports training, simulation experiments are carried out in MATLAB. e operating environment is set in the GUIDE integrated environment of the MATLAB software GUI interface. In Intel Core i5-7200U@2.50 GHz CPU, 4G memory, Window 7 32 bit operating system, install this plug-in MCRInstaller.exe or MATLAB software and video decoder. In the process of basketball shooting, due to the fast movement of basketball, the basketball will hit the basket or backboard during the shooting process, causing the phenomenon of shooting jitter. For this reason, from the aspects of real-time, frame rate, and anti-shake, the camera model and CMOS sensor parameters are selected, as shown in Table 1.

Analysis of the Effect of Basketball Shooting Training Goal
Detection. According to the above simulation environment and parameter settings, a basketball shooting training goal detection simulation experiment is carried out. Using the proposed method, through the recorded shooting video TestOne (640 × 480), the 46th, 85 th , and 109th frames of basketball shooting training goal images are detected, and the basketball shooting training goal detection of the proposed method is obtained. e effect is shown in Figure 5.
According to Figure 5, the proposed method can effectively detect the basketball shooting training goal image, capture the goal track of the basketball shooting training image in frames 46, 85, and 109, and judge the basketball shooting training goal image. It can be seen that the basketball shooting training goal detection of the proposed method is better.

Analysis of the Accuracy of Goal Detection in Basketball
Shooting Training. In order to further verify the basketball shooting training goal detection accuracy of the proposed method, the detection accuracy is taken as the evaluation index. e higher the detection accuracy is, the higher the detection accuracy is. e calculation formula is as follows: where P z represents the number of correctly detected goals and P j represents the number of detected goals. e number of shots is set to 45. e methods of [8], the methods of [9], and the proposed methods are used to detect the basketball shooting training goal image, respectively. e comparison results of the detection accuracy of basketball shooting training goals of different methods are calculated according to formula (25), as shown in Figure 6. It can be seen from Figure 6 that when the number of shots is 40, the average detection accuracy of basketball shooting training goals of the methods of [8] is 81.2%, the average detection accuracy of basketball shooting training goals of the methods of [9] is 74.5%, and the average detection accuracy of basketball shooting training goals of the proposed method is as high as 92.8%. It can be seen that the accuracy of basketball shooting training goal detection of the proposed method is high, which can effectively improve the accuracy of basketball shooting training goal detection. e main reason is that this method uses the background difference of the basketball shooting image in advance to improve the accuracy of basketball shooting training goal detection.

Analysis of the Efficiency of Goal Detection in Basketball
Shooting Training. On this basis, the detection efficiency of the proposed method is verified. Taking the detection time as the evaluation index, the shorter the detection time, the higher the detection efficiency of the method. Using the Computational Intelligence and Neuroscience methods of [8], the methods of [9], and the proposed methods, the basketball shooting training goal images are detected, and the comparison results of the detection efficiency of basketball shooting training goals of different methods are obtained, as shown in Figure 7.
It can be seen from Figure 7 that, with the continuous increase of shooting times, the goal detection time of basketball shooting training with different methods increases.
When the number of shots reaches 45, the basketball shooting training goal detection time of the methods of [8] is 50 s and the basketball shooting training goal detection time of the methods of [9] is 37.5 s, while the basketball shooting training goal detection time of the proposed method is only 19.2 s. erefore, the basketball shooting training goal detection time of the proposed method is short, which can effectively improve the basketball shooting training goal     detection efficiency. e main reason is that this method accurately locates the goal position through image calibration, reduces the interference of background and other factors in the detection process, and improves the detection efficiency.

Conclusion
Taking basketball shooting training as the research object, this study completes the application research of computer virtual image technology in basketball shooting training from three aspects: image denoising, image detection, and image calibration. e experimental results show that this method gives full play to the advantages of computer virtual image technology, improves the accuracy and efficiency of goal detection in modern sports basketball shooting training, and has a good effect of goal detection in basketball shooting training. However, this method is only applied in basketball shooting training goal detection. e next research is to apply and analyze it in other aspects of basketball training or other sports, expand the algorithm, and further improve the application universality of the proposed method.

Data Availability
e raw data used to support the findings of the study can be obtained from the corresponding author upon request.