Badminton court line extraction method and system based on horizontal projection, and computer equipment

Through the horizontal projection method, a histogram of noise box removal is constructed and combined with online learning, the problem of inaccurate extraction of midfield lines and susceptible to noise is solved, and a high-accurate field line extraction is achieved.

CN120495966AInactive Publication Date: 2025-08-15QUANZHOU INST OF INFORMATION ENG
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510989463.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-17
Publication Date
2025-08-15
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing course line detection methods have problems such as inaccurate extraction and susceptibility to noise in badminton game videos. Especially when athletes, badminton nets, badminton and other objects are blocked, it is difficult to accurately detect badminton court lines.

Method used

The horizontal projection-based method is used to binarize and refine the badminton game video frame images, build a horizontal projection histogram that removes noise boxes, and build a model to identify the badminton court baseline through offline training combined with online learning. The K-means clustering algorithm and online learning are used to optimize the baseline position, and finally extract the field line based on the four corners of the baseline.

Benefits of technology

It effectively reduces noise interference in badminton courts, improves the accuracy of badminton court line extraction, and ensures that the field line can be accurately extracted in complex scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120495966A_ABST
    Figure CN120495966A_ABST
Patent Text Reader

Abstract

The invention provides a badminton court line extraction method and system based on horizontal projection, and computer equipment. The method comprises the following steps: binarizing and refining an input badminton game video frame image to obtain a refined image; performing horizontal projection on the refined image to obtain a first histogram; inputting the first histogram into a preset offline training model to extract two reference datum lines; optimizing the first histogram to obtain a second histogram; determining the positions of the two reference datum lines in the second histogram by utilizing online learning according to the positions and the box values of the two reference datum lines in the first histogram so as to obtain two target datum lines; determining four angular points of the two datum lines according to the two target datum lines; and extracting badminton court lines in the badminton game video frame image according to the four corner points and the proportion of the actual badminton court. According to the technical scheme, noise interference of the badminton court is effectively reduced, and the badminton court lines are accurately extracted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of sports video image processing, and in particular to a method, system, and computer equipment for extracting badminton court lines based on horizontal projection. Background Art

[0002] In sports video analysis, court line extraction is a key technology for achieving tactical analysis. Its core goal is to accurately detect badminton court lines from video footage containing complex elements such as athletes, spectators, and billboards for tactical analysis of badminton match videos.

[0003] The current mainstream method for extracting court lines is based on the Hough transform and its improved methods, but these methods have significant limitations in badminton match scenarios. Existing solutions use the Hough transform and support vector machines to detect court lines. Although this method can detect court lines in court footage, the detected court lines are not accurate and can only meet the basic requirements of court footage detection. Additionally, field line detection methods based on local precision extraction and gradient-based random Hough transforms can accurately detect straight lines on simple football fields, but their accuracy is limited when faced with complex scenes such as badminton match videos. While the multi-point random Hough transform is faster than the standard Hough transform and probabilistic Hough transform, it is susceptible to noise.

[0004] In summary, the existing court line detection method has the problem of inaccurate court line extraction and susceptibility to noise due to occlusion by objects such as players, badminton nets, and badmintons. Summary of the Invention

[0005] In view of this, it is necessary to propose a badminton court line extraction method, system, and computer equipment based on horizontal projection to improve the accuracy of badminton game video field line extraction.

[0006] In a first aspect, an embodiment of the present application provides a method for extracting badminton court lines based on horizontal projection, the method comprising: Binarizing and thinning the input badminton game video frame image to obtain a thinned image, wherein the thinned image is a binarized image of the badminton court; Performing horizontal projection on the refined image to obtain a first histogram, wherein the position corresponding to each box in the first histogram is represented by the row position of the horizontal line after the horizontal projection of the refined image, and the box value of each box is represented by the sum of the number of pixels in the corresponding row; Inputting the first histogram into a preset offline training model to extract two reference baselines, the two reference baselines being horizontal lines corresponding to the highest positions of pixels in the first histogram; Optimizing the first histogram to obtain a second histogram; Determining positions of the two reference baselines in the second histogram based on the positions and bin values of the two reference baselines in the first histogram using online learning to obtain two target baselines; According to the two target reference lines, four corner points of the two reference lines are determined; The badminton court line in the badminton game video frame image is extracted according to the four corner points and the proportion of the actual badminton court.

[0007] In a second aspect, an embodiment of the present application provides a badminton court line extraction system based on horizontal projection, the system comprising: An image preprocessing module is used to binarize and refine the input badminton match video frame image to obtain a refined image, wherein the refined image is a binarized image of the badminton court; a horizontal projection module, configured to perform horizontal projection on the refined image to obtain a first histogram, wherein the position corresponding to each box in the first histogram is represented by the row position of the horizontal line after the horizontal projection of the refined image, and the bin value of each box is represented by the sum of the number of pixels in the corresponding row; An offline training module, configured to input the first histogram into a preset offline training model to extract two reference baselines, the two reference baselines being horizontal lines corresponding to the highest position of the pixels in the first histogram; an optimization module, configured to optimize the first histogram to obtain a second histogram; an online learning module, which uses online learning to determine the positions of the two reference baselines in the second histogram according to the positions and bin values of the two reference baselines in the first histogram to obtain two target baselines; A corner point determination module, which determines four corner points of the two target reference lines based on the two target reference lines; The field line extraction module is used to extract the badminton court lines in the badminton game video frame image according to the four corner points and the proportion of the actual badminton court.

[0008] In a third aspect, an embodiment of the present application provides a computer device, comprising: Memory is used to store computer programs; The processor is used to execute the computer program to implement the above-mentioned badminton court line extraction method based on horizontal projection.

[0009] The above-mentioned badminton court line extraction method, system, and computer equipment based on horizontal projection convert badminton game video frame images into refined images and construct a horizontal projection histogram with noise boxes removed. The model for identifying the badminton court baseline is constructed through offline training combined with online learning, which effectively reduces the noise interference of the badminton court and improves the accuracy of badminton court line extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.

[0011] Figure 1 This is a flowchart of a badminton court line extraction method based on horizontal projection provided in an embodiment of the present application.

[0012] Figure 2 This is a flowchart of step S102 provided in an embodiment of the present application.

[0013] Figure 3 This is a flowchart of step S103 provided in an embodiment of the present application.

[0014] Figure 4 This is a flowchart of step S104 provided in an embodiment of the present application.

[0015] Figure 5 This is a flowchart of step S105 provided in an embodiment of the present application.

[0016] Figure 6 This is a flowchart of step S106 provided in an embodiment of the present application.

[0017] Figure 7 This is a flowchart of step S107 provided in an embodiment of the present application.

[0018] Figure 8 This is a flowchart of step S1071 provided in an embodiment of the present application.

[0019] Figure 9 This is a flowchart of step S1072 provided in an embodiment of the present application.

[0020] Figure 10 A schematic diagram of highlighting corner points in a refined image provided in an embodiment of the present application.

[0021] Figure 11 This is a schematic diagram of horizontal badminton court lines and intersection marks provided in an embodiment of the present application.

[0022] Figure 12 This is a schematic diagram of the badminton court lines in the video frame image and the actual badminton court lines provided in an embodiment of the present application.

[0023] Figure 13 A schematic structural diagram of a badminton court line extraction system based on horizontal projection provided in an embodiment of the present application.

[0024] Figure 14 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application.

[0025] Figure 15 This is a diagram showing the perspective correction effect of a badminton court based on homography transformation provided in an embodiment of the present application.

[0026] The realization of the objectives, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of this application more clear, the present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0028] The terms "first," "second," "third," "fourth," and the like (if any) in the specification and claims of this application and in the accompanying drawings are used to distinguish similar program objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate. In other words, the described embodiments are implemented according to an order other than that illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, may also encompass other content. For example, a process, method, system, product, or apparatus comprising a series of steps or units need not be limited to only those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.

[0029] It should be noted that the descriptions of "first", "second", etc. in this application are for descriptive purposes only and should not be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include one or more of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that ordinary technicians in this field can implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0030] Existing court line detection methods suffer from inaccurate court line extraction and susceptibility to noise due to occlusion by objects such as players, badminton nets, and badminton balls. This application proposes a badminton court line extraction method based on horizontal projection. By converting badminton match video frames into refined images and constructing a horizontal projection histogram with noise bins removed, a model for identifying badminton court baselines is constructed through offline training combined with online learning. This effectively reduces noise interference on the badminton court and improves the accuracy of badminton court line extraction.

[0031] Please see Figure 1 , which is a first flow chart of a method for extracting badminton court lines based on horizontal projection provided by an embodiment of the present application. The method for extracting badminton court lines based on horizontal projection specifically includes steps S101-S107.

[0032] Step S101 : binarizing and thinning the input badminton match video frame image to obtain a thinned image.

[0033] In step S101, the input homography-based color badminton match video frame is first binarized using HSV color space threshold segmentation (e.g., H∈[0,30], S∈[0,50], V∈[180,255]), separating the white court lines and the green field into a black and white pixel image. The binary image is then iteratively processed using the Zhang-Suen thinning algorithm, progressively removing edge pixels using an 8-neighborhood pixel judgment rule until the lines are simplified to a single-pixel skeleton, resulting in a thinned image. In this embodiment, the court lines in the thinned image are represented by white, and the green field is represented by black.

[0034] For details, please refer to Figure 15 In order to process the badminton game video frame images under various shooting angles, the image can be transformed to the horizontal direction through plane homography before applying binarization and thinning to the image. Planar homography is related to the transformation between two planes. The general form is defined as: The point [u, v] TThe position [x, y] projected onto another plane T .

[0035] Figure 15 The results in

[15] show that binarization and thinning of the image combined with homography can also detect court lines captured from different camera views. Figure 15 (a) in the figure shows the projection onto Figure 15 The horizontal direction in (b). Figure 15 (d) and Figure 15 (e) in Fig. 3 shows the extracted horizontal and vertical peak projections, respectively. Once the horizontal and vertical court lines are extracted, the court lines in the homography image and the original image can be extracted through subsequent steps.

[0036] Step S102: horizontally project the refined image to obtain a first histogram.

[0037] In step S102, the number of white pixels in each row of the refined image is first calculated to generate a one-dimensional array. This one-dimensional array is then represented using a histogram, resulting in a first histogram. The vertical axis corresponds to the image row number (rows 1 to M, from top to bottom), and the horizontal axis corresponds to the number of white pixels in each row (bin value). It is understood that in other embodiments, the court lines and green field can be represented using other colors. For example, if the court lines are represented in black and the field is represented in white, the number of black pixels can be counted. The first histogram can be obtained in the same manner using other colors.

[0038] Please see Figure 2 , which is a flow chart of step S102 provided in an embodiment of the present application. Horizontally projecting the refined image to obtain the first histogram includes steps S1021-S1022.

[0039] Step S1021 , counting the number of white pixels in each row of the thinned image.

[0040] In step S1021, when counting the number of white pixels in each row of the thinned image, the thinned image is first scanned row by row, starting from the first row to the last row of the image, and the number of white pixels in each row is counted in sequence. In this embodiment, the image is scanned from top to bottom.

[0041] Step S1022 , arranging the number of white pixels in each row in order of row numbers to obtain a first histogram.

[0042] In step S1022, the number of white pixels in each row is sorted by row number. This is done by storing the statistical results in a one-dimensional array of the same length as the number of image rows (e.g., 1080 rows). The array index directly corresponds to the row number, such as index 0 corresponds to row 1, and index 1079 corresponds to row 1080. The one-dimensional pixel array sorted by row number is mapped into a visual histogram, where the position of each bin in the first histogram corresponds to the row number of each image row, and the bin value of each bin corresponds to the number of white pixels in each image row. Taking a refined image with a resolution of 1920×1080 as an example, the first histogram contains 1080 bins; the bin position corresponds to the row number of each row, and the bin value corresponds to the number of white pixels in each horizontal row, i.e., bin value 0 corresponds to 0 pixel height, and bin value 200 corresponds to 200 pixel height.

[0043] Step S103: input the first histogram into a preset offline training model to extract two reference baselines.

[0044] In step S103, the preset offline training model used in this embodiment is a K-means machine learning algorithm model. After the first histogram is input into the model, the model will focus on the lower half of the court close to the camera because the court lines have higher resolution and more obvious features. The model performs cluster analysis on the data of the first histogram to find the pattern of data distribution and divide the data into different clusters. In this process, the model will identify the positions corresponding to the two maximum peaks in the histogram. Because the areas corresponding to these two maximum peak positions have relatively high resolution. The horizontal lines corresponding to the two maximum peak positions are determined to be the two court lines in the lower half of the court, and the horizontal lines corresponding to these two court lines are then determined as the two required reference baselines.

[0045] Please see Figure 3 , which is a flow chart of step S103 provided in an embodiment of the present application. Inputting the first histogram into a preset offline training model to extract two reference baselines includes steps S1031-S1032.

[0046] Step S1031 : Perform cluster analysis on the first histogram using a K-means clustering algorithm to identify the positions of the two maximum peaks in the histogram.

[0047] In step S1031, when using the K-means clustering algorithm to perform cluster analysis on the first histogram, the K value is set to 2 and the cluster center is initialized. The Euclidean distance from each sample point to the cluster center is iteratively calculated and assigned to the nearest cluster. The cluster center is then updated until convergence, and two clusters with higher resolution corresponding to the lower half of the court are obtained. In each cluster, the row number of the sample point with the largest bin value is selected, which is the peak position of the two clearest field line candidates. Among them, the sample point of the K-means clustering algorithm is a two-dimensional representation of each bin in the histogram, defined as: sample point Xi = [row number, bin value] = [i, H[i]]. Where i is the row index of the image, corresponding to the vertical axis position of the histogram; H[i] is the number of white pixels in the i-th row, corresponding to the horizontal axis height of the histogram. For example, if the number of white pixels in the 100th row of the histogram is 50, then the corresponding sample point is X 100 = [100,50].

[0048] Step S1032: Determine the horizontal lines corresponding to the positions of the two maximum peaks as two reference baselines.

[0049] In step S1032, after identifying the two largest peaks in the histogram, the horizontal field lines corresponding to these peaks are determined as two reference baselines. This is because in badminton match videos, the field lines in the lower half of the court, close to the camera and with high resolution, form significant peaks in the horizontal projection histogram and can therefore be identified first.

[0050] Step S104: Optimize the first histogram to obtain a second histogram.

[0051] Please see Figure 4 , which is a flow chart of step S104 provided in an embodiment of the present application. Optimizing the first histogram to obtain the second histogram includes steps S1041-S1043.

[0052] In step S104, optimizing the first histogram effectively removes its noise bins. Noise bins refer to pixels in the image that are unrelated to the badminton court lines and appear as irregular, interfering bins in the histogram. Typical sources of badminton court noise bins include reflections from the grid, light reflections, floor patterns, and camera shake.

[0053] Specifically, net line reflection refers to the grid structure of the badminton net forming periodic bright spots in the image, which produces pseudo peaks in the horizontal projection histogram; light reflection refers to the light spots formed by ceiling spotlights on the floor, which causes local pixels to be misjudged as white court lines; floor pattern refers to the PVC floor or wooden floor commonly used in badminton courts, which has anti-slip patterns, seams, brand logos, etc. on the surface, which are also easily misjudged as white court lines; camera shake refers to the motion blur generated when the broadcast lens moves, which causes burr-like noise pixels to appear on the edges of the field lines.

[0054] The specific steps for removing noise bins include first calculating the average of all bin values in the first histogram, then subtracting this average from each bin value, and setting the resulting negative bin values to zero. This eliminates noise bins that fall below the overall pixel count, enhancing noise suppression and retaining effective information. Optimizing the first histogram to remove noise bins can be applied to badminton video frames with complex factors such as different venues, varying lighting conditions, various floor patterns, and camera movement, ensuring accurate recognition of badminton strings.

[0055] Step S105 : using online learning to determine the positions of the two reference baselines in the second histogram based on the positions and bin values of the two reference baselines in the first histogram to obtain two target baselines.

[0056] In step S105, based on the two reference baselines obtained through offline training, a preset number of neighborhood boxes are searched on both sides with the two reference baselines as the search center in the second histogram. By calculating the absolute difference between the neighborhood box value and the two reference baselines, the box with the smallest difference is selected as the box corresponding to the target baseline.

[0057] Please see Figure 5 , which is a flowchart of step S1056 provided in an embodiment of the present application. Using online learning to determine the positions of the two reference baselines in the second histogram based on the positions and bin values of the two reference baselines in the first histogram to obtain the two target baselines includes steps S1051-S1054.

[0058] Step S1051: The boxes corresponding to the two reference baselines are used as search centers.

[0059] In step S1051, the positions of the two reference baselines determined in step S1032 are used as the search center of the second histogram. The center position is located at the field line features of the high-resolution area in the lower half of the court, which can effectively narrow the subsequent search range. For example, in a badminton game video, the field lines in the lower half are clearer when the camera is shooting from above. Using Y1 and Y2 obtained by offline training as the search starting point, the field line position of the current frame can be accurately located.

[0060] Step S1052: Search the second histogram for a preset number of boxes on both sides of the search center, wherein the preset number may be five, which is not limited here.

[0061] In step S1052, the search range is preset to five neighboring boxes on either side of the search center (i.e., Y1 ± 5 lines, Y2 ± 5 lines). This number is based on the potential shift of field lines within the video frame. For example, if Y1 = 200 lines, the actual search range is 195-205 lines. This limited range allows for the capture of field line position changes caused by slight camera shake or player movement, improving the algorithm's real-time performance. For example, in a doubles match, player occlusion may cause field line position shifts within a small range, and five neighboring boxes are sufficient to capture this shift.

[0062] Step S1053 : Determine two boxes whose box values corresponding to the two reference baselines are closest among the preset number of boxes as boxes of the two target baselines.

[0063] In step S1053, the absolute difference between the bin values of each bin and the offline training bin values (e.g., H1 = 50, H2 = 45) is calculated within the neighborhood bins, and the bin with the smallest difference is selected as the new baseline position. For example, if the bin value of row 198 within the Y1 search range is 48, with a difference of 2 from H1, and the bin value of row 202 is 40, with a difference of 10, row 198 is determined as the new Y1 position. This process quantifies the similarity of bin values to ensure that the new position still corresponds to an area with dense field line pixels. Even in the presence of partial occlusion, the most likely field line position can be selected based on the proximity of bin values.

[0064] Step S1054: determine two target reference lines based on the above box.

[0065] Step S106: determining the four corner points of the two target baselines based on the two target baselines.

[0066] In step S106, since the two baselines of the badminton court are horizontal in the image, their intersections with the vertical lines are the four corner points. These four corner points, located at the left and right ends of the Y1 and Y2 lines, are key feature points for field line extraction and will be used to calculate the court ratio and reconstruct the full field lines.

[0067] Please see Figure 6 , which is a flow chart of step S106 provided in an embodiment of the present application. Based on two target baselines, four corner points of the two baselines are determined, including steps S1061-S1063.

[0068] Step S1061: Perform morphological operations on the thinned image to generate a corner map.

[0069] In step S1061, a morphological corner detector is used to calculate the response value of each pixel under the four structural elements. If a pixel shows a significant change (such as a jump from 0 to 1 or 1 to 0) under the four structural elements of square, diamond, cross and X, it is determined to be a corner candidate. Finally, a corner map containing all corner candidates is generated, as shown in Figure 1. Figure 10 As shown, the corner points are highlighted.

[0070] Step S1062: Perform corner detection from the left or right side of the two target baselines of the corner map toward the center of the image.

[0071] Please combine Figure 6 and Figure 11 In step S1062, the region of interest (ROI) is defined: Based on the precise positions of baselines Y1 and Y2, the left and right ROIs are delineated within the image. For example, for row Y1 = 198, the left ROI is set to row 198 and columns 0-100, and the right ROI is set to row 198 and columns 500-600. The specific ranges are adjusted based on image resolution and are not limited here. The same applies to the left and right regions of row Y2 = 253. Within the ROI, the corner map is traversed to select corner points that simultaneously meet the following conditions: they are within ±2 pixels of row Y1 or Y2; their response values exceed a preset threshold (e.g., 0.7, which can be determined through offline training); and their spacing from adjacent corner points is greater than 5 pixels. Finally, a corner point is found on each side of Y1 and Y2, for a total of four corner points: P20, P24, P25, and P29.

[0072] Step S1063: Use circles to overlay the four detected corner points on the refined image.

[0073] In step S1063, the four corner points are marked with white circles with a radius of 3-5 pixels. The center of the circle corresponds to the coordinate of the corner point. For example, if the coordinates of corner point P25 are (x=500, y=198), a white circle with a center of (500, 198) and a radius of 4 pixels is drawn at this position. The marked corner point map is superimposed on the original thinned image to generate a visualization result, as shown in Figure 1. Figure 10 This step facilitates manual verification of the accuracy of corner point detection and provides intuitive reference points for subsequent scale calculation and field line reconstruction, ensuring that the four corner points are indeed located at the outermost edges of the baseline.

[0074] Step S107 : extracting the badminton court line in the badminton match video frame image according to the four corner points and the proportion of the actual badminton court.

[0075] In step S107, based on the four detected corner points, the coordinates of all field lines are derived using the proportional relationship between the standard dimensions of an actual badminton court and the image pixels. This step converts the pixel coordinates in the image into physical field line positions through geometric mapping, ensuring that the extracted field lines conform to the standards of a real badminton court.

[0076] Please see Figure 7 , which is a flow chart of step S107 provided in an embodiment of the present application. Extracting the badminton court line in the badminton game video frame image according to the four corner points and the proportion of the actual badminton court includes steps S1071-S1073.

[0077] Step S1071: Determine the horizontal line of the badminton court according to the four corner points.

[0078] Please refer to Figure 7 and Figure 12 In step S1071, for corner points P25 (x1, y1) and P29 (x2, y1) of line Y1, the coordinates of midpoint P27 are [(x1+x2) / 2, y1]. For corner points P20 (x3, y2) and P24 (x4, y2) of line Y2, the coordinates of midpoint P22 are [(x3+x4) / 2, y2]. For example, if the coordinates of P25 are (500, 198) and P29 are (700, 198), then the coordinates of P27 are (600, 198). Based on the coordinates of the two midpoints and the distance ratio, the vertical coordinates of the remaining horizontal lines of the badminton court are obtained, and then the equations of the remaining horizontal lines of the badminton court are obtained. The specific calculation process will be described in detail below.

[0079] Step S1072: determining a vertical line of the badminton court line according to the ratio of the horizontal line to the actual badminton court.

[0080] In step S1072, the corner points P25 and P29 of the Y1 line and the corner points P20 and P24 of the Y2 line are known, and the vertical line of the badminton court line is determined using geometric relationships. The specific calculation process will be described in detail below.

[0081] Please see Figure 8 , which is a flow chart of step S1071 provided in an embodiment of the present application. Determining the horizontal line of the badminton court line according to the four corner points includes steps S10711-S10712.

[0082] Step S10711, determining the coordinates of the midpoints of the two target reference lines based on the coordinates of the four corner points.

[0083] Please see Figure 11In step S10711, for the corner points P25 (x1, y1) and P29 (x2, y1) of the Y1 line, the coordinates of the midpoint P27 are [(x1+x2) / 2, y1]; for the corner points P20 (x3, y2) and P24 (x4, y2) of the Y2 line, the coordinates of the midpoint P22 are [(x3+x4) / 2, y2].

[0084] Step S10712: Determine a horizontal line based on the coordinates of the midpoint and the proportions of the actual badminton court.

[0085] Please see Figure 11 In step S10712, based on the coordinates of the midpoint P27 calculated in step S10711, the distance ratio between the actual court line and the court line in the image can be applied to obtain the vertical coordinates of P17, P12, P7, and P2, and then the equations of the remaining horizontal court lines can be obtained. The calculation formula is as follows: Please see Figure 9 , which is a flow chart of step S1072 provided in an embodiment of the present application. Determining the vertical line of the badminton court line according to the ratio of the horizontal line and the actual badminton court includes steps S10721-S10722.

[0086] Step S10721: determining the intersection of the badminton court's single side line and the horizontal line according to the ratio of the horizontal line to the actual badminton court.

[0087] In the image and The distances are mapped to 6.1m and 5.18m respectively in real size. Since the two corner points (P25 and P29) have been calculated The distance can be calculated by formula (5)-(7) The distance and coordinates of P26. Furthermore, the position of P28 can also be found.

[0088] Where P26.x is the horizontal coordinate of P26, is the distance from P25 to P29, It is the distance from P26 to P28.

[0089] Where P26.y is the ordinate of P26, and Y1.y is the ordinate of the court line Y1.

[0090] Step S10722: Obtain the vanishing points of the double-sided lines and the single-sided line of the badminton court based on the vertical line pairs between the intersection points and the vertical line pairs between the corner points, and determine the vertical lines.

[0091] Please see Figure 12 By solving the coordinates of P21 and P23 using formulas (8)-(11) and the coordinates of P26 and P28 in step S10721, we can calculate the vanishing points of the double-sided lines P0P25, P4P29, and the single-sided lines P1P26, P3P28. The double-sided line vanishing point V1 is obtained by intersecting the extended lines of the line pairs P25P20 and P29P24 and is used to determine the direction of the doubles sideline. The single-sided line vanishing point V2 is obtained by intersecting the extended lines of the line pairs P26P21 and P28P23 and is used to determine the direction of the singles sideline.

[0092] Where Y2.y is the ordinate of court line Y2. P22 and P27 are located halfway between Y2 and Y1, respectively. Based on the vanishing points of the bilateral and unilateral lines, the equations of all vertical lines on the badminton court can be determined.

[0093] Step S1073 , determining all intersection points of the badminton court line according to the horizontal line and the vertical line, and obtaining the badminton court line in the badminton game video frame image.

[0094] In step S1073, all intersection points that satisfy both the horizontal and vertical line equations are found. That is, the horizontal and vertical line equations are combined to calculate the coordinates of the intersection points. Finally, all intersection points are connected to form a complete badminton court line. Specifically, adjacent left and right intersection points on the same horizontal line, adjacent upper and lower intersection points on the same vertical line, and corresponding intersection points on the center line and front service line are connected to ensure compliance with badminton court rules.

[0095] Please see Figure 13 , which is a schematic diagram of the structure of a badminton court line extraction system based on horizontal projection provided by an embodiment of the present application. The present application also provides a badminton court line extraction system 1000 based on horizontal projection, a computer equipment training module 3, an optimization module 4, an online learning module 5, a corner point determination module 6, and a field line extraction module 7.

[0096] The image preprocessing module 1 is used to perform homography transformation, binarization and thinning on the badminton game video frame images under various shooting angles to obtain thinned images.

[0097] In this embodiment, the image preprocessing module 1 first performs a homography transformation on the input badminton match video frame image, and then binarizes and thins the homography-transformed image. Specifically, the image preprocessing module 1 first transforms the original image to the horizontal direction using a planar homography. Then, the homography image is segmented using an HSV color space threshold (e.g., H∈[0,30], S∈[0,50], V∈[180,255]) to separate the white court lines and the green field into a black and white pixel image. The binary image is then iteratively processed using the Zhang-Suen thinning algorithm, and edge pixels are removed in a round-by-round manner using an 8-neighborhood pixel judgment rule until the lines are simplified to a single-pixel skeleton, thereby obtaining a thinned image.

[0098] The horizontal projection module 2 is used to perform horizontal projection on the refined image to obtain a first histogram.

[0099] In this embodiment, the horizontal projection module 2 first calculates the sum of the number of white pixels in each row of the refined image to generate a one-dimensional array; and represents the one-dimensional array using a histogram, thereby obtaining a first histogram, wherein the vertical axis corresponds to the image row number and the horizontal axis corresponds to the number of white pixels in each row.

[0100] The offline training module 3 is used to input the first histogram into a preset offline training model to extract two reference baselines.

[0101] In this embodiment, the offline training module 3 uses a pre-set K-means machine learning algorithm model. After inputting the first histogram into the model, the module performs cluster analysis on the data in the first histogram, identifying patterns in the data distribution and dividing the data into clusters. The module then identifies the locations of the two maximum peaks in the histogram and determines the horizontal lines corresponding to these two maximum peaks as the two required reference baselines.

[0102] The optimization module 4 is configured to optimize the first histogram to obtain a second histogram.

[0103] In this embodiment, the optimization module 4 removes the noise bins of the first histogram. The specific steps include: first calculating the average value of all bin values of the first histogram, then subtracting the above average value from each bin value, and then setting the obtained negative bin values to zero, thereby obtaining a second histogram.

[0104] The online learning module 5 uses online learning to determine the positions of the two reference baselines in the second histogram according to the positions of the two reference baselines in the first histogram and the bin values to obtain two target baselines.

[0105] In this embodiment, the online learning module 5 first searches a preset number of neighborhood boxes on both sides with the two reference baselines as the search center in the second histogram, then calculates the absolute difference between the neighborhood box value and the two reference baselines, and selects the box with the smallest difference as the box corresponding to the target baseline.

[0106] The corner point determination module 6 determines the four corner points of the two target reference lines based on the two target reference lines.

[0107] In this embodiment, the corner point determination module 6 first performs morphological operations on the refined image to generate a corner point map, then performs corner point detection from the left or right side of the two target baselines of the corner point map toward the center of the image, and finally superimposes the four detected corner points on the refined image with circles to determine the four corner points.

[0108] The field line extraction module 7 is used to extract the badminton court lines in the badminton game video frame image according to the four corner points and the proportion of the actual badminton court.

[0109] In this embodiment, the field line extraction module 7 first determines the horizontal line of the badminton court line based on the four corner points, then determines the vertical line of the badminton court line based on the ratio of the horizontal line and the actual badminton court, and finally determines all the intersection points of the badminton court line based on the horizontal line and the vertical line to obtain the badminton court line in the badminton game video frame image.

[0110] Please see Figure 14 , which is a schematic diagram of the internal structure of the computer device provided in an embodiment of the present application.

[0111] like Figure 14 As shown, the computer device 100 includes a memory 901 and a processor 902. The processor 902 is configured to execute computer program instructions in the memory 901 to implement a badminton court line extraction method based on horizontal projection.

[0112] Memory 901 includes at least one type of readable storage medium, including flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), a magnetic storage device, a magnetic disk, an optical disk, and the like. In some embodiments, memory 901 may be an internal storage unit of a computer device, such as a hard disk of the computer device. In other embodiments, memory 901 may also be an external storage device of the computer device, such as a plug-in hard disk configured in the computer device, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, and the like. Furthermore, memory 901 may include both an internal storage unit of the computer device and an external storage device. Memory 901 can be used not only to store application software installed in the computer device and various data, such as the code for a badminton court line extraction method based on horizontal projection, but also to temporarily store data that has been output or is about to be output.

[0113] Furthermore, the computer device 100 also includes a bus 903. The bus 903 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 14 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0114] Furthermore, the computer device 100 may also include a display component 904. The display component 904 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an organic light-emitting diode (OLED) touchscreen. The display component 904 may also be appropriately referred to as a display device or a display unit, and is used to display information processed by the computer device 100 and to display a visual user interface.

[0115] Furthermore, the computer device 100 may further include a communication component 905. The communication component 905 may optionally include a wired communication component and / or a wireless communication component (such as a Wi-Fi communication component, a Bluetooth communication component, etc.), which is generally used to establish a communication connection between the computer device 100 and other computer devices.

[0116] Figure 14Only some components and a computer device 100 of a badminton court line extraction method based on horizontal projection are shown. It can be understood by those skilled in the art that Figure 14 The illustrated structure does not limit the computer device 100 , and the computer device 100 may include fewer or more components than shown in the figure, or combine some components, or arrange the components differently.

[0117] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0118] The computer program product includes one or more computer instructions. When loaded and executed on a computer, the computer program instructions fully or partially generate the processes or functions according to the embodiments of the present invention. The computer device may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium capable of computer storage or a data storage device such as a server or data center that integrates one or more available media. The available medium may be magnetic media (e.g., floppy disk, hard disk, magnetic tape), optical media (e.g., DVD), or semiconductor media (e.g., solid-state drive (SSD)).

[0119] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0120] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the unit is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0121] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of the solution of this embodiment according to actual needs.

[0122] In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist independently, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or software functional units.

[0123] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only storage medium (ROM, Read-Only Memory), random access storage medium (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.

[0124] In the above embodiment, a badminton court line extraction method, system, and computer device based on horizontal projection are used to convert the badminton game video frame image into a refined image and construct a horizontal projection histogram with noise boxes removed. A model for identifying the badminton court baseline is constructed through offline training combined with online learning, which effectively reduces the noise interference of the badminton court and accurately extracts the badminton court lines.

[0125] Obviously, those skilled in the art may make various modifications and variations to this application without departing from the spirit and scope of this application. Thus, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application is intended to include such modifications and variations.

[0126] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0127] The above examples are merely preferred embodiments of the present application and are not intended to limit the scope of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope of the present application.

Claims

1. A badminton court line extraction method based on horizontal projection, characterized in that: include: Binarizing and thinning the input badminton game video frame image to obtain a thinned image, wherein the thinned image is a binarized image of the badminton court; Performing horizontal projection on the refined image to obtain a first histogram, wherein the position corresponding to each box in the first histogram is represented by the row position of the horizontal line after the horizontal projection of the refined image, and the box value of each box is represented by the sum of the number of pixels in the corresponding row; Inputting the first histogram into a preset offline training model to extract two reference baselines, the two reference baselines being horizontal lines corresponding to the highest positions of pixels in the first histogram; Optimizing the first histogram to obtain a second histogram; Determining positions of the two reference baselines in the second histogram based on the positions and bin values of the two reference baselines in the first histogram using online learning to obtain two target baselines; Determining four corner points of the two target reference lines according to the two target reference lines; The badminton court line in the badminton game video frame image is extracted according to the four corner points and the proportion of the actual badminton court.

2. The badminton court line extraction method based on horizontal projection according to claim 1, characterized in that: Inputting the first histogram into a preset offline training model to extract two reference baselines includes: Performing cluster analysis on the first histogram using a K-means clustering algorithm to identify positions of two maximum peaks in the first histogram; The horizontal lines corresponding to the positions of the two maximum peaks are determined as the two reference baselines.

3. The badminton court line extraction method based on horizontal projection according to claim 1, characterized in that: Optimizing the first histogram to obtain a second histogram includes: Calculating the average of all first bin values in the first histogram; Subtract the mean value from all first bin values in the first histogram to obtain a difference; The first bin values whose differences are negative are all set to zero to obtain the second histogram.

4. The badminton court line extraction method based on horizontal projection according to claim 1, characterized in that: Determining the positions of the two reference baselines in the second histogram according to the positions and bin values of the two reference baselines in the first histogram using online learning to obtain two target baselines includes: The boxes corresponding to the two reference baselines are used as search centers; Searching for a preset number of boxes on both sides of the search center in the second histogram; Determine two boxes in a preset number of boxes that are closest to the box values corresponding to the two reference baselines as boxes corresponding to the two target baselines; The two target reference lines are determined according to the box.

5. The badminton court line extraction method based on horizontal projection according to claim 1, characterized in that: Determining the four corner points of the two target reference lines based on the two target reference lines includes: The four outermost corner points of the two target reference lines are obtained by using a preset morphological corner detector to detect the corner points of the two target reference lines from the left side or the right side of the thinned image to the center of the image.

6. The badminton court line extraction method based on horizontal projection according to claim 1, characterized in that: Extracting the badminton court line from the badminton game video frame image according to the four corner points and the proportion of the actual badminton court includes: Determine the horizontal line of the badminton court line according to the four corner points; Determine a vertical line of the badminton court line according to a ratio between the horizontal line and the actual badminton court; All intersection points of the badminton court line are determined according to the horizontal line and the vertical line to obtain the badminton court line in the badminton game video frame image.

7. The badminton court line extraction method based on horizontal projection according to claim 6, characterized in that: Determining the horizontal line of the badminton court line according to the four corner points includes: Determine the coordinates of the midpoints of the two target reference lines based on the coordinates of the four corner points; The horizontal line is determined according to the coordinates of the midpoint and the proportion of the actual badminton court.

8. The badminton court line extraction method based on horizontal projection according to claim 6, characterized in that: Determining the vertical line of the badminton court line according to the ratio of the horizontal line to the actual badminton court includes: Determine the intersection of a single side line of the badminton court and the horizontal line according to the ratio of the horizontal line to the actual badminton court; The vanishing points of the double-sided line and the single-sided line of the badminton court are obtained according to the vertical line pairs between the intersection points and the vertical line pairs between the corner points, and the vertical lines are determined.

9. A badminton court line extraction system based on horizontal projection, characterized in that: The system comprises: An image preprocessing module is used to binarize and refine the input badminton match video frame image to obtain a refined image, wherein the refined image is a binarized image of the badminton court; a horizontal projection module, configured to horizontally project the refined image to obtain a first histogram, wherein the position corresponding to each box in the first histogram is represented by the row position of the horizontal line after the horizontal projection of the refined image, and the bin value of each box is represented by the sum of the number of pixels in the corresponding row; An offline training module, configured to input the first histogram into a preset offline training model to extract two reference baselines, the two reference baselines being horizontal lines corresponding to the highest position of the pixels in the first histogram; an optimization module, configured to optimize the first histogram to obtain a second histogram; an online learning module, which uses online learning to determine the positions of the two reference baselines in the second histogram according to the positions and bin values of the two reference baselines in the first histogram to obtain two target baselines; a corner point determination module, which determines four corner points of the two target reference lines based on the two target reference lines; and The field line extraction module is used to extract the badminton court lines in the badminton game video frame image according to the four corner points and the proportion of the actual badminton court.

10. A computer device, characterized in that: The computer device comprises: memory for storing computer programs; and A processor, configured to execute the computer program to implement the badminton court line extraction method based on horizontal projection as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Self-adaptive extraction method of badminton field or tennis field in virtual advertising system during sports live broadcast

    CN102938074A

  • Camera self-calibration method and system based on badminton court side line detection

    CN117115273A

  • Method of capturing and reconstructing court lines

    TW201742006A