Tennis court type determination method and device based on visual algorithm, and storage medium

By using a clustering algorithm and LAB color space-based method, the color features of tennis courts are extracted, which solves the problem of dependence on high-performance hardware and large-scale training data in existing technologies and achieves efficient and stable court type recognition.

CN121033560BActive Publication Date: 2026-03-31SHENZHEN EMEET TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-30
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing tennis court type recognition technologies rely on high-performance GPUs or multi-core CPUs. When computing power is insufficient, the recognition speed decreases, and the model accuracy is affected by the size and quality of the training dataset, making it prone to misjudgment.

Method used

The main color tone of the site image is extracted using a pre-defined clustering algorithm, and then converted to the LAB color space to obtain the median of the blue-yellow axis and the green-red axis. The site type is determined by the target hue value, saturation value and median, reducing the dependence on hardware and training data.

Benefits of technology

It achieves efficient and stable site type recognition on ordinary computers without the need for high-performance GPUs or multi-core CPUs, thus reducing hardware requirements and improving recognition accuracy and environmental robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121033560B_ABST
    Figure CN121033560B_ABST
Patent Text Reader

Abstract

The application discloses a tennis court type determination method and device based on a visual algorithm and a storage medium, relates to the technical field of data processing, and comprises the following steps: acquiring a court image or a court video frame as a court picture; based on a preset clustering algorithm, extracting a main color tone of the court picture after preprocessing to obtain a target hue value and a target saturation value corresponding to the court picture; converting the court picture to a LAB color space to acquire a median of a blue-yellow axis and a median of a green-red axis in the LAB color space; and determining a court type based on the target hue value, the target saturation value, the median of the green-red axis and the median of the blue-yellow axis, so that efficient and stable tennis court type identification can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, device and storage medium for determining tennis court type based on a visual algorithm. Background Technology

[0002] Tennis courts are mainly classified into three types: hard, clay, and grass. Existing tennis court type recognition technologies are based on artificial neural network models, such as YOLO and other object detection models. These models are trained on large datasets of labeled court images to learn and distinguish the visual features of different courts, and then judge the court type in the input match images or video frames.

[0003] However, the operation of object detection models based on artificial neural networks, such as YOLO, is highly dependent on hardware configuration. They require high-performance GPUs or multi-core CPUs to ensure real-time recognition efficiency. If they are switched to run on a single CPU of an ordinary computer, the recognition speed will drop significantly due to insufficient computing power. In addition, the accuracy of the model is directly constrained by the size and quality of the training dataset. If the number of samples of a certain type of site in the dataset is insufficient or the scene coverage is incomplete, the model's recognition accuracy for that type of site will be significantly reduced, and misjudgments are likely to occur.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of this application is to provide a method, device and storage medium for determining tennis court type based on visual algorithms, aiming to solve the technical problem of how to improve the accuracy and environmental robustness of sports court type recognition.

[0006] To address the aforementioned problems, this application provides a method for determining tennis court types based on a visual algorithm. This method includes:

[0007] Acquire site images or video frames as site footage;

[0008] Based on a preset clustering algorithm, the main color tone of the preprocessed site image is extracted to obtain the target hue value and target saturation value corresponding to the site image.

[0009] Convert the scene image to the LAB color space and obtain the median of the blue-yellow axis and the median of the green-red axis in the LAB color space;

[0010] The site type is determined based on the target hue value, the target saturation value, the median of the green-red axis, and the median of the blue-yellow axis.

[0011] In one embodiment, the step of determining the site type based on the target hue value, the target saturation value, the median of the green-red axis, and the median of the blue-yellow axis includes:

[0012] The target hue value is compared with a preset hue range, and the hue of the tennis court is determined based on the comparison result.

[0013] The target saturation value is compared with a preset saturation range, and the saturation level of the tennis court is determined based on the comparison result.

[0014] The median of the green-red axis and the median of the blue-yellow axis are compared with a preset warm yellow threshold, and the color characteristics of the tennis court are determined based on the comparison results.

[0015] The site type is determined based on the hue, the saturation level, and the color characteristics.

[0016] In one embodiment, the step of determining the site type based on the hue, the saturation level, and the color characteristics includes:

[0017] If the hue is green and the saturation level is high saturation, then the field type is confirmed to be a grass field.

[0018] If the hue is orange-red and the color feature is red soil feature, then the site type is confirmed to be red soil site.

[0019] If the field type is neither the grassland field nor the red clay field, then the field type is determined to be a hard field.

[0020] In one embodiment, the step of extracting the main color tone of the preprocessed site image based on a preset clustering algorithm to obtain the target hue value and target saturation value corresponding to the site image includes:

[0021] The scene image is scaled up to a preset pixel size to obtain the preprocessed scene image;

[0022] Obtain the second hue value and the second saturation value of each pixel in the preprocessed site image;

[0023] Cluster analysis was performed on the second hue value and the second saturation value using the K-means clustering algorithm to obtain multiple clusters;

[0024] The target hue value and the target saturation value are determined based on the dominant hue corresponding to the target cluster containing the most pixels.

[0025] In one embodiment, the step of obtaining the second hue value and the second saturation value of each pixel in the preprocessed site image includes:

[0026] The preprocessed scene image is converted from the BGR color space to the HSV color space, and the first hue value and the first saturation value in the HSV color space are obtained.

[0027] Remove the hue and saturation channel values ​​corresponding to the white line and highlight area from the first hue and first saturation values ​​to obtain the second hue and second saturation values.

[0028] In one embodiment, the step of converting the scene image to the LAB color space and obtaining the median of the blue-yellow axis and the median of the green-red axis in the LAB color space includes:

[0029] The initial site image BGR data is acquired, and the BGR data is normalized and nonlinearly transformed to obtain LAB data.

[0030] Based on the channel start position and the preset data interval, determine the blue-yellow axis channel value and green-red axis channel value corresponding to each pixel;

[0031] The values ​​of each of the blue-yellow axis channel and the green-red axis channel are sorted, and the middle element is determined as the median of the blue-yellow axis and the median of the green-red axis.

[0032] In one embodiment, the method for determining tennis court type based on visual algorithms may further include:

[0033] The corresponding scoring data items and the target weights of the scoring data items are determined based on the venue type.

[0034] Based on the scoring data items and the weights, the player's score is determined for each of the aforementioned court types.

[0035] In one embodiment, before the step of determining the corresponding scoring data item and the target weight of the scoring data item based on the court type, the tennis court type determination method based on the vision algorithm further includes:

[0036] When the increase in the contribution of a technology-related scoring item is greater than or equal to the preset increase in the contribution, or when the difference in the contribution of scoring items after the new rule takes effect is greater than or equal to the preset contribution percentage, the weight adjustment is triggered.

[0037] Obtain a preset weight adjustment coefficient, and adjust the basic weights based on the weight adjustment coefficient.

[0038] Furthermore, to achieve the above objectives, this application also proposes a tennis court type determination device based on a visual algorithm, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the tennis court type determination method based on a visual algorithm as described above.

[0039] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the method for determining tennis court type based on visual algorithms as described above.

[0040] This application provides a method for determining tennis court types based on visual algorithms. It employs a pre-defined clustering algorithm to extract the dominant color tone from a pre-processed image, obtaining the target hue and saturation values. Quantitative indicators are used to distinguish color types and purity, providing a color category basis for court type judgment. The image is converted to the LAB color space, and the median values ​​of the green-red axis and blue-yellow axis are obtained. By quantifying the red-green and blue-yellow biases of the colors, further hue features are supplemented to form a multi-dimensional judgment basis. The court type is determined based on the target hue value, target saturation value, green-red axis median, and blue-yellow axis median. By clearly identifying the color characteristics of three types of courts, this method achieves efficient and stable court type recognition without requiring high-performance GPUs or multi-core CPUs or massive training data. Attached Figure Description

[0041] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0042] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0043] Figure 1 This is a first flowchart illustrating the method for determining tennis court type based on visual algorithms in this application.

[0044] Figure 2 A second flowchart illustrating the method for determining tennis court type based on visual algorithms provided in this application;

[0045] Figure 3 A schematic diagram illustrating the overall process of the vision algorithm-based tennis court type determination method of this application;

[0046] Figure 4 This is a schematic diagram of the hardware operating environment involved in the method for determining tennis court type based on visual algorithms in the embodiments of this application.

[0047] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0048] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0049] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0050] To achieve the above objectives, this application proposes a method for determining tennis court type based on a visual algorithm. The method includes: acquiring a court image or video frame as the court view; extracting the dominant color tone from the preprocessed court view using a preset clustering algorithm to obtain the target hue value and target saturation value corresponding to the court view; converting the court view to the LAB color space to obtain the median of the blue-yellow axis and the median of the green-red axis in the LAB color space; and determining the court type based on the target hue value, the target saturation value, the median of the green-red axis, and the median of the blue-yellow axis.

[0051] Tennis courts are mainly classified into three types: hard, clay, and grass. Existing tennis court type recognition technologies are based on artificial neural network models, such as YOLO and other object detection models. These models are trained on large datasets of labeled court images to learn and distinguish the visual features of different courts, and then judge the court type in the input match images or video frames.

[0052] However, the operation of object detection models based on artificial neural networks, such as YOLO, is highly dependent on hardware configuration. They require high-performance GPUs or multi-core CPUs to ensure real-time recognition efficiency. If they are switched to run on a single CPU of an ordinary computer, the recognition speed will drop significantly due to insufficient computing power. In addition, the accuracy of the model is directly constrained by the size and quality of the training dataset. If the number of samples of a certain type of site in the dataset is insufficient or the scene coverage is incomplete, the model's recognition accuracy for that type of site will be significantly reduced, and misjudgments are likely to occur.

[0053] This application provides a method for determining tennis court types based on visual algorithms. It employs a pre-defined clustering algorithm to extract the dominant color tone from a pre-processed image, obtaining the target hue and saturation values. Quantitative indicators are used to distinguish color types and purity, providing a color category basis for court type judgment. The image is converted to the LAB color space, and the median values ​​of the green-red axis and blue-yellow axis are obtained. By quantifying the red-green and blue-yellow biases of the colors, further hue features are supplemented to form a multi-dimensional judgment basis. The court type is determined based on the target hue value, target saturation value, green-red axis median, and blue-yellow axis median. By clearly identifying the color characteristics of three types of courts, this method achieves efficient and stable court type recognition without requiring high-performance GPUs or multi-core CPUs or massive training data.

[0054] It should be noted that the executing entity in this embodiment can be a computing service device with network communication and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or apparatus capable of performing the above functions. The following description uses a tennis court type determination device based on visual algorithms as an example to illustrate this embodiment and the subsequent embodiments.

[0055] Based on this, embodiments of this application provide a method for determining tennis court type based on a visual algorithm, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the method for determining tennis court type based on visual algorithms in this application.

[0056] In this embodiment, the tennis court type determination method based on visual algorithms is applied to the sending end, and the method includes steps S10~S40:

[0057] Step S10: Obtain a site image or site video frame as the site view.

[0058] In this embodiment, the court view can be a static image file of a tennis match or a dynamic video frame read from a tennis match video file.

[0059] For static image files, the binary stream of the file is read through file system interfaces, such as Windows API and Linux open() function, and parsed into a single pixel matrix, where the dimensions of a single pixel matrix are width × height × number of channels.

[0060] A video frame is a single frame extracted from a video file or video stream. Video decoding and frame extraction modules, such as FFmpeg and OpenCV's VideoCapture(), can be used to parse the compressed data stream of a video file and decompress it into a continuous sequence of raw video frames. A specific frame can be extracted as the scene image using frame indexing.

[0061] Optionally, when selecting a video frame, the target video frame can be located based on the frame index. The video metadata is parsed to obtain the total number of frames and determine the range of selectable frames. The sequence number of the target frame is passed through the API interface; for example, index=100 represents the 101st frame. The video read pointer jumps to the compressed data location corresponding to that frame. The read() method is called to read the pixel data of that frame. If the returned frame data is not empty, the frame is selected as the scene view; if the index exceeds the total number of frames, an empty frame is returned, which may trigger an index out-of-bounds warning.

[0062] Optionally, when selecting video frames, the target video frame can also be obtained by locating it based on the timestamp. When it is necessary to extract the frame at a certain moment in the video playback, first read the header data block of the video file. The header data contains basic video information, including frame rate information. Extract the time unit and frame interval information. During video encoding, the duration of each frame is recorded in time units and the conversion ratio between time units and actual seconds. For example, a video may record 1 frame lasting 3600 time units, and 1 second = 90000 time units, then the duration of a single frame = 3600 / 90000 = 0.04 seconds, and the frame rate = 1 / 0.04 = 25 FPS. The frame rate is obtained by calculating the frame rate as the total number of time units / the number of time units occupied by each frame. Convert the target time into a frame index, the conversion formula being index = time × frame rate, and then extract the video frame according to the above process of extracting frames by index.

[0063] Step S20: Based on a preset clustering algorithm, the main color tone of the preprocessed site image is extracted to obtain the target hue value and target saturation value corresponding to the site image.

[0064] In this embodiment, if the scene image is a local image file, a file parsing interface, such as the system-level fopen and image decoding library, is called to read pixel data and convert it into a two-dimensional pixel matrix in BGR format. If the scene image is a video file, the compressed stream is first parsed by a video decoding module, such as FFmpeg, and the target frame is extracted by frame index positioning or timestamp mapping. Frames with no obstructions and a horizontal viewing angle are selected and then converted into a BGR matrix.

[0065] The primary color tone of the court image is extracted based on a pre-defined clustering algorithm, and the tennis court type is determined by combining manually calibrated threshold rules. Specifically, the BGR matrix is ​​converted to the HSV color space, all pixels are traversed, and low-saturation pixels are filtered out. If S < 30%, they are considered as achromatic gray pixels and do not participate in the primary color tone calculation, while retaining the set of effective high-saturation pixels. K-Means clustering is performed on the effective pixel set, and the percentage of pixels in each cluster is counted. The cluster with the highest percentage of pixels is selected, and the average H value of all pixels in the cluster is calculated as the target hue value, and the average S value is calculated as the target saturation value.

[0066] Step S30: Convert the scene image to the LAB color space and obtain the median of the blue-yellow axis and the median of the green-red axis in the LAB color space.

[0067] It should be noted that the LAB color space is designed to more closely resemble human color perception. The LAB color space includes the L channel, the a channel (green-red axis), and the b channel (blue-yellow axis). The L channel represents the brightness of a pixel, with a value range of [0, 100], representing pure black to pure white. The a channel represents the range from green to red, with a value range of [-127, 127], with green as the negative axis and red as the positive axis. The b channel represents the range from blue to yellow, with a value range of [-127, 127], with blue as the negative axis and yellow as the positive axis.

[0068] In this embodiment, the image or video frame is converted from BGR to LAB color space, the blue-yellow axis channel data and green-red axis channel data are extracted, and the median is obtained to supplement the HSV dominant color analysis, which together constitute the basis for classification decision.

[0069] Step S40: Determine the site type based on the target hue value, the target saturation value, the median of the green-red axis, and the median of the blue-yellow axis.

[0070] In this embodiment, a feature threshold table for different site types is preset, and the results are output through multi-feature matching. The threshold table features are based on a large number of sample statistics, and the feature ranges for sites such as red soil, grass, and hard ground are preset. For example, red soil is a warm yellow tone with high saturation, with a target hue range of 10-30 and a saturation range of 60%-80%. Channels a and b are reddish-yellowish, both greater than 15. Grass is a yellowish-green tone with medium-high saturation, with a target hue range of 60-100 and a saturation range of 40%-60%. Channels a and b are greenish-yellowish, with channel a less than -10 and channel b reddish-yellowish, greater than 10. Hard ground is gray and light-colored with a saturation range of less than 40%, which is low saturation. Channels a and b are nearly neutral, between -5 and 5. By comparing the target hue value, target saturation value, median of the green-red axis, and median of the blue-yellow axis with the corresponding thresholds, the site type can be confirmed.

[0071] Specifically, please refer to Figure 2 Step S40 may include steps S41 to S44:

[0072] Step S41: Compare the target hue value with the preset hue range, and determine the hue of the tennis court based on the comparison result.

[0073] In this embodiment, a preset threshold and result mapping table is loaded, containing parameters required for three types of judgments. During the hue extraction stage, it is first determined whether the target hue value is within the valid range. The standard range for hue values ​​is 0°-360°. If it exceeds this range, a feature anomaly warning is triggered, and a backup H value is used, such as the H value of the secondary dominant hue, or the judgment is terminated. If it does not exceed the range, the preset hue interval table is traversed, and it is determined whether the target hue value falls within a certain interval. For example, if H_target=22°, falling within the 10°~30° interval, it is directly mapped to a warm yellow tone; if H_target=75°, falling within the 60°~100° interval, it is mapped to a yellow-green tone; if H_target=45°, falling within the 30°-60° interval, it is mapped to a neutral tone. The judgment result is stored in the site feature result set, and the matched interval parameters are recorded simultaneously.

[0074] Optionally, when the site's color tone is affected by lighting, resulting in blurred boundaries, such as red soil on a cloudy day with H_target=32°, which is close to the upper limit of the warm yellow range, distance-weighted fuzzy matching is used. For each preset interval, the difference between H_target and the interval's center value is calculated, and the weight corresponding to the difference is obtained. The smaller the difference, the higher the weight. Weight = 1 / distance. The interval with the highest weight is selected as the matching result.

[0075] Step S42: Compare the target saturation value with the preset saturation range, and determine the saturation level of the tennis court based on the comparison result.

[0076] In this embodiment, after obtaining the target saturation value, it can be directly divided by a threshold range. The unit of the target saturation value is confirmed to be consistent with the preset range, such as both being percentages, 0%~100%. The saturation value ranges are traversed in ascending order to determine the category of the target saturation value. For example, if S_target=25%, falling within 0%-30%, it is determined to be low saturation; if S_target=50%, falling within 30%-70%, it is determined to be medium saturation; if S_target=85%, falling within 70%-100%, it is determined to be high saturation.

[0077] Dynamic threshold adjustment is also possible to adapt to scenes with varying lighting conditions. For example, when a scene is affected by strong light or shadow, the overall saturation shifts. The preset range is dynamically adjusted through scene lighting compensation. The average brightness value L_avg is extracted from the L channel of the scene image to determine the lighting level. In strong light scenes, saturation tends to be too high, so the lower limit of the high saturation range is raised; in weak light scenes, saturation tends to be too low, so the upper limit of the low saturation range is raised. The adjusted range is then compared with the target saturation value. For example, in weak light, S_target=33%, the original range (30%-70%) is considered medium saturation, while the adjusted range (35%-70%) is considered low saturation. The basis for the dynamic adjustment is noted in the judgment result.

[0078] Step S43: Compare the median of the green-red axis and the median of the blue-yellow axis with a preset warm yellow threshold, and determine the color characteristics of the tennis court based on the comparison results.

[0079] In this embodiment, after obtaining the median of the green-red axis and the median of the blue-yellow axis, they are compared with a preset warm yellow threshold to determine whether they meet the warm yellow characteristic. Comparing the warm yellow threshold with the median of the green-red axis and the median of the yellow axis allows for simultaneous determination of whether the median of the blue-yellow axis and the median of the green-red axis meet the threshold requirements. If both are met, the warm yellow characteristic is determined to exist; alternatively, if only one of the median of the blue-yellow axis or the median of the green-red axis meets the threshold requirements, it is considered to have the warm yellow characteristic. When the warm yellow characteristic is considered to exist, the color characteristic is recorded as warm yellow; if it is not met, it is recorded as non-warm yellow, and the specific values ​​of the median of the green-red axis and the median of the blue-yellow axis are recorded.

[0080] Optionally, the presence of warm yellow characteristics can be determined by weighted scoring. When there are local non-warm yellow areas in the site, such as a small amount of withered grass in a red soil site, causing the median of the green-red axis and the median of the blue-yellow axis to be slightly lower than the threshold, a weighted scoring method is used to achieve fault tolerance. Scoring formulas are set for the median of the green-red axis and the median of the blue-yellow axis, respectively, and the score is calculated based on the difference from the threshold. For example: for the green-red axis median score, if the green-red axis median ≥ 15, 100 points are awarded; if the green-red axis median < 15, the score = 100 - (15 - green-red axis median) × 10; for the blue-yellow axis median score: if the blue-yellow axis median ≥ 15, 100 points are awarded; if the blue-yellow axis median < 15, the score = 100 - (15 - blue-yellow axis median) × 15.

[0081] The overall score is calculated as: median score of the green-red axis × first weight + median score of the blue-yellow axis × second weight. Since the blue-yellow axis channel is the core of the blue-yellow axis, and warm yellow is more sensitive to the blue-yellow axis data, a higher weight is assigned to the median of the blue-yellow axis. Therefore, the second weight is greater than the first weight. A threshold for the overall score is set. If the overall score is greater than or equal to the threshold, it is determined to have warm yellow characteristics; if it is equal to the threshold, it is determined to have non-warm yellow characteristics.

[0082] Step S44: Determine the site type based on the hue, the saturation level, and the color characteristics.

[0083] In this embodiment, non-numerical features are converted into numerical labels. For example, warm yellow hues are 1, yellow-green hues are 2, neutral hues are 3, and unknown hues are 0. Pre-established rules correspond to different site types with hue, saturation, and color features. The converted numerical labels are compared with these pre-defined rules to determine the site type.

[0084] Optionally, the site types in the rule base can be sorted by site type commonality or feature distinguishability. High-priority sites are matched first to reduce computational load. The sorted site types are then traversed to determine if the current feature combination meets the requirements.

[0085] Optionally, step S44 may include: if the hue is green and the saturation level is high saturation, then the field type is confirmed as a grass field; if the hue is orange-red and the color feature is red clay, then the field type is confirmed as a red clay field; if the field type is neither grass nor red clay, then the field type is determined to be a hard field. Specifically, the field type determination may be as follows: following the priority order from grass to red clay to hard field, the feature conditions are checked sequentially. If the preceding conditions are met, the result is directly locked without proceeding to subsequent determinations. Hue, saturation level, and color feature are converted into directly comparable condition values. For example, green corresponds to H=60°-100°, orange-red corresponds to H=0°-20°, and high saturation corresponds to S=70%-100%.

[0086] If the current feature is a green hue, a high saturation level, and a non-red clay color feature, the field type is confirmed as a grass field. All subsequent judgment processes are stopped, and the result is stored in the field type result cache, while the matching criteria are recorded. If any condition is not met, the grass field rule is not met, and the process proceeds to the next step of red clay field verification. The red clay field determination rule is that the hue is orange-red and the color feature includes red clay characteristics. If the current feature is hue = orange-red, saturation level = high saturation, and color feature = red clay, the field type is confirmed as a red clay field. If the field type meets neither the grass field rule nor the red clay field rule, it is directly classified as a hard field.

[0087] Please refer to Figure 3 , Figure 3 This paper presents a schematic diagram of the overall process for determining the type of sports field. The input is an image or video frame of a tennis match court. The input image is scaled to a specified size to unify subsequent analysis dimensions. The dominant hue of the image is extracted based on the HSV color space, and the medians of the a and b channels in the LAB color space are extracted. These medians reflect the color distribution characteristics of the image in the red-green and blue-yellow directions. The extraction steps for the dominant hue and color distribution features have no fixed order. After extracting these two types of features, they are input into a rule classifier. The rule classifier analyzes and judges the input features according to pre-defined rules that distinguish different field types based on these color features, and outputs the tennis court type. Through the extraction and rule-based classification of image color features, the identification of tennis court types is achieved.

[0088] In this embodiment, a preset clustering algorithm is used to extract the main color tone from the preprocessed image to obtain the target hue and saturation values. Quantitative indicators are used to distinguish color types and purity, providing a color category basis for determining the site type. The image is converted to the LAB color space and the median values ​​of the green-red axis and blue-yellow axis are obtained. By quantifying the red-green and blue-yellow biases of the colors, the hue features are further supplemented to form a multi-dimensional judgment basis. The site type is determined based on the target hue value, target saturation value, median values ​​of the green-red axis and blue-yellow axis. By clearly identifying the color characteristics of the three types of sites, efficient and stable site type identification can be achieved without the support of high-performance GPUs or massive training data.

[0089] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description and will not be repeated hereafter. Based on this, step S20 may include steps S21 to S24:

[0090] Step S21: Scale the scene image to a preset pixel size to obtain the preprocessed scene image.

[0091] In this embodiment, if the scene image is an image, the target image file is read, binary data is loaded into memory, and an image parsing library is called to parse the data structure. If the scene image is a video frame, the video stream is first read using a video decoding module, such as FFmpeg or OpenCV's VideoCapture, to separate the single-frame image data. Then, the pixel matrix structure of the frame is parsed, and the width and height of the original image are extracted from the parsed pixel matrix. Based on the preset ratio of the target width to the image width, a scaling ratio is determined, and the scene image is scaled based on this scaling ratio.

[0092] Step S22: Obtain the second hue value and the second saturation value of each pixel in the preprocessed site image.

[0093] In this embodiment, the image is converted from the BGR color space to the HSV color space, and the hue, saturation, and value of each pixel in the HSV color space are obtained. Hue (H) refers to the basic attribute of color, such as the color category of red, green, and blue; saturation (S) represents the vividness of the color, the higher the value, the more vivid the color, and the lower the value, the closer it is to gray; value (V) represents the brightness of the color, the higher the value, the brighter the color, and the lower the value, the darker the color.

[0094] In one feasible implementation, step S22 may include steps S221 to S222:

[0095] Step S221: Convert the preprocessed scene image from BGR color space to HSV color space, and obtain the first hue value and the first saturation value in the HSV color space.

[0096] In this embodiment, BGR format image or video frame data is read and parsed into a three-dimensional pixel matrix of width × height × 3. The first two dimensions correspond to the row and column positions of the pixels, and the third dimension corresponds to the three channels B, G, and R. Each pixel in the matrix is ​​traversed in row-first or column-first order to locate the three-dimensional coordinates of the currently processed pixel. From the three channel indices of the current pixel, the B value (corresponding to [i][j][0]), G value (corresponding to [i][j][1]), and R value (corresponding to [i][j][2]) are extracted respectively, and it is verified whether the three values ​​are within the range of 0-255. If they are outside the range, the data is judged as abnormal, the pixel conversion is terminated, and an error is marked.

[0097] The B, G, and R values ​​from 0 to 255 are converted to normalized values ​​from 0 to 1, and the largest value among the three channels is taken as the brightness V of the current pixel.

[0098] If the brightness V is zero, the pixel is pure black, and the saturation S is directly assigned a value of 0; if the brightness V is not zero, the saturation is obtained by dividing the difference between the maximum channel value and the minimum channel value by the brightness value.

[0099] If the normalized value of the red channel is equal to the lightness V, it means that the brightness of the current pixel is mainly contributed by the red channel, and the color is in the transition range from red to yellow. Calculate the first difference between the normalized values ​​of the green and blue channels. Divide this first difference by the difference between the largest and smallest channels obtained in the previous steps to obtain the hue value H of the current pixel. If the normalized value of the green channel is equal to the lightness V, it means that the brightness of the current pixel is mainly contributed by the green channel, and the color is in the transition range from yellow to green. Calculate the second difference between the normalized values ​​of the blue and red channels. Divide the second difference by the channel difference, and then add the result to a fixed value of 2 to obtain the H value of the current pixel. When the normalized value of the blue channel is equal to the lightness V, it means that the brightness of the current pixel is mainly contributed by the blue channel, and the color is in a large transition range from green to blue, then to purple, and finally to red. Calculate the third difference between the normalized values ​​of the red and green channels. Divide the third difference by the channel difference, and then add the result to a fixed value of 4 to obtain the H value of the current pixel.

[0100] Step S222: Remove the hue and saturation channel values ​​corresponding to the white line and highlight area from the first hue value and the first saturation value to obtain the second hue value and the second saturation value.

[0101] In this embodiment, the HSV characteristics of white lines and highlights are low saturation and high brightness. White lines, being nearly pure white, have extremely low saturation (S) and almost no color information, while their brightness (V) is extremely high, approaching maximum. Highlights, due to excessive light intensity, suffer from a loss of color information, resulting in a lower S and glaring brightness, leading to an extremely high V. By setting thresholds for S and V, these interfering areas are marked, and then inverted to obtain a mask of the effective areas to be retained, thereby removing white lines and highlights.

[0102] From the converted HSV 3D matrix, extract the S-channel and V-channel matrices in channel order. For each pixel value in the S-channel matrix, perform a threshold check. If the S-value of a pixel is less than a preset threshold, it is marked as 1, indicating that the location may be a white line or highlight area; if the S-value is greater than or equal to the threshold, it is marked as 0, indicating that the color saturation at that location is normal and not currently considered an interference area. Based on this check, generate a low-saturation region mask of the same size as the S-channel matrix. In the low-saturation region mask, 1 corresponds to areas with extremely low saturation in the image, and 0 corresponds to areas with normal saturation. For each pixel value in the V-channel matrix, perform a threshold check. If the V-value of a pixel is greater than a preset threshold, it is marked as 1, indicating that the location may be a white line or highlight area; if the V-value is less than or equal to the threshold, it is marked as 0, indicating that the brightness at that location is normal and not currently considered an interference area. Based on this check, generate a high-brightness region mask of the same size as the V-channel matrix. A pixel is identified as a white line or highlight region only when elements at the same position in both masks are both 1, meaning the pixel simultaneously satisfies S < threshold and V > threshold. This results in an interference region mask of the same size as the original image. A logical NOT operation is performed on each element in the interference region mask; the result is 0 for an element that was originally 1, and 1 for an element that was originally 0. This generates a valid two-dimensional region mask of the same size as the original image. In the valid two-dimensional region mask, positions of 1 correspond to the main area of ​​the site that needs to be retained, free from white lines and highlight interference, while positions of 0 correspond to the interference areas that need to be excluded.

[0103] The resulting effective area 2D mask is a row-column structured 2D matrix, where each element corresponds to the row and column number of the image. When filtering pixels subsequently, all pixels in the image need to be arranged as individual pixels, and the 2D matrix is ​​expanded into a 1D array in a fixed order to ensure that the validity marker of each pixel is consistent with the order of the subsequent pixel list. Using a row-first approach, all column pixels in the first row are traversed, then all column pixels in the second row are traversed, and so on, until all rows have been traversed. All 0 and 1 elements in the 2D matrix are arranged sequentially to form a 1D array of length W×H. The i-th element in the 1D array corresponds to the pixel in the (i / / W)-th row and (i%W)-th column of the original 2D matrix, resulting in a 1D array of length equal to the total number of pixels in the image. Each element in the 1D array is iterated over, and a logical check is performed to determine if it is greater than 0. If the element value is 1, it is converted to a Boolean value True; if the element value is 0, it is converted to a Boolean value False. All the results are arranged in their original order to form a 1D Boolean array of the same length as the 1D array. The 3D HSV image data is reconstructed into a 2D array, with each row representing the (H, S, V) value of a pixel. A generated Boolean mask is used to index the 2D array. A 1D Boolean array is passed as an index to the row dimension of the corresponding 2D array of the HSV image data. Rows corresponding to positions with a Boolean value of True are retained, while rows corresponding to positions with a Boolean value of False are discarded. The filtered rows are then arranged in their original order, forming a valid 2D array of filtered data containing only the color information of the main subject of the site.

[0104] Step S23: Perform cluster analysis on the second hue value and the second saturation value based on the K-means clustering algorithm to obtain multiple clusters.

[0105] Step S24: Determine the target hue value and the target saturation value based on the main color tone corresponding to the target cluster containing the most pixels.

[0106] In this embodiment, the dominant color tone is extracted using K-means clustering based on HSV pixel data. The number of clusters and stopping conditions are preset. For example, the effective pixels are divided into 3 color groups, and the calculation stops when a preset number of iterations is reached. From the list of effective pixel colors (i.e., the list corresponding to the second hue value and the second saturation value), 3 different pixels are randomly selected, and the hue, saturation, and brightness values ​​of the 3 pixels are used as the core of the 3 initial color groups.

[0107] Treat each pixel and the three color group cores as points in three-dimensional space. Calculate the straight-line distance from each pixel to each core; the closer the distance, the more similar the pixel's color is to the core color. Compare the distances of each pixel to the three cores and assign the pixel to the group containing the closest core. Repeat the above operation for all valid pixels to obtain a list of pixel groups. For all pixels within each group, calculate the average hue, average saturation, and average brightness. The new color formed by these three averages is the new core for that group. Calculate the straight-line distance between the new core and the old core for each group. If the core movement distance for all groups is less than a preset distance, it indicates that the core position has stabilized, the grouping result no longer changes, or the preset number of iterations has been completed. In this case, stop the iteration and use the current grouping result and the new core as the final result. If the stopping condition is not met, replace the old core with the new core and continue the iteration. Determine the number of pixels in each of the three final color groups; find the group with the largest number of pixels; the final core color of this group is the dominant color tone of the image.

[0108] In the third embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description and will not be repeated hereafter. Based on this, step S30 may include steps S31 to S33:

[0109] Step S31: Obtain the BGR data of the site image, and perform normalization and nonlinear transformation on the BGR data to obtain LAB data.

[0110] In this embodiment, the scene image is a BGR format pixel matrix, with each pixel containing three channel values: B (blue channel), G (green channel), and R (red channel), typically ranging from 0 to 255. Because BGR channels exhibit strong correlation, changes in brightness will simultaneously affect all three channels, making it impossible to directly and accurately describe the independent characteristics of color category and brightness. In contrast, the LAB color space completely separates brightness (L) from color (a, b), and the opposing dimensions of green and red versus blue and yellow in the a and b channels better align with the human eye's perception of color, supplementing the color bias intensity characteristics not covered by the HSV primary color.

[0111] First, the 0-255 values ​​of the B, G, and R channels are normalized to the 0-1 range. The normalization formula is: Normalized value = Original value / 255. Then, the X, Y, and Z tristimulus values ​​of each pixel are calculated using the CIE XYZ standard matrix, where X, Y, and Z correspond to the human eye's perceptual response to the three primary colors of red, green, and blue, respectively.

[0112] Secondly, nonlinear correction is applied to the tristimulus values ​​to eliminate the nonlinear perceptual bias of human eye regarding brightness, and the LAB three-channel values ​​are calculated. The X, Y, and Z values ​​of the standard white point are loaded from the color space configuration library. The white point is the XYZ value of standard white light defined by CIE. The actual X, Y, and Z values ​​of each pixel are divided by the corresponding white point value to obtain the relative values ​​after eliminating light source bias. This eliminates light source differences and unifies color data under different lighting conditions to the standard white light reference, resulting in the light source normalized relative stimulus value for each pixel. For each normalized pixel's x, y, and z values, substitute them into the piecewise function f(t) to obtain the corrected f(x), f(y), and f(z). If t > 0.008856, it represents a high stimulus value, such as the y value under strong light, and f(t) = the cube root of t (t^(1 / 3)), simulating the saturation characteristic of human eye perception of high stimuli. If t ≤ 0.008856, it represents a low stimulus value, such as the z value under weak light, and f(t) = 7.787×t + 16 / 116, avoiding the problem of human eye's insensitivity to low stimuli through linear compensation.

[0113] For each pixel, f(x), f(y), and f(z) are substituted into the LAB three-channel formula for calculation. For L channel data, L = 116 × f(y) - 16, where y is the normalized green stimulus value, and 116 and 16 are scaling factors to ensure that the L value falls within the range of 0 to 100. a = 500 × [f(x) - f(y)], where f(x) corresponds to the red stimulus correction value. When the difference is positive (f(x) > f(y)), the color is reddish; when the difference is negative, f(x) is reddish. <f (y)时,颜色偏绿;500是缩放系数,确保 a 值落在- 127~127 范围,便于量化色彩偏向程度。b="200×[f" (y) - f (z)],其中,f (z) 对应蓝刺激校正值,两者差值反映黄、蓝刺激的相对强弱,差值为正(f (y)>When the difference is positive (f(y) > f(z)), the color is yellowish; when the difference is negative (f(y) < f(z)), the color is bluish; 200 is the scaling factor to ensure that the b value also falls within the range of -127 to 127. The above scaling factors are all fixed scaling factors clearly defined when the CIE (International Commission on Illumination) formulated the LAB standard. By substituting into the LAB three-channel formula for calculation, the LAB three-channel values (L, a, b) of each pixel are obtained. The L-channel matrix describes the brightness at each position and is independent of color; the a-channel matrix describes the green-red bias at each position. The more positive the value, the more obvious the red bias, and the more negative the value, the more obvious the green bias; the b-channel matrix describes the blue-yellow bias at each position. The more positive the value, the more obvious the yellow bias, and the more negative the value, the more obvious the blue bias.

[0114] Step S32: Based on the channel starting position and the preset data interval, determine the blue-yellow axis channel values and green-red axis channel values corresponding to each pixel.

[0115] In this embodiment, the LAB pixel matrix is stored in memory in a continuous block manner, and its channel data follows a fixed layout. The L, a, and b values of each pixel are arranged in sequence, and there is a fixed interval between the same-channel values of adjacent pixels. For example, for an image with width × height of W × H, the total number of pixels is N = W × H, and each channel value occupies 4 bytes. Then: The address of the first pixel value of the a channel (green-red axis) = the starting address of the LAB matrix + 4 bytes (skipping the L value of the first pixel); The address of the first pixel value of the b channel (blue-yellow axis) = the starting address of the LAB matrix + 8 bytes (skipping the L and a values of the first pixel); The interval between the same-channel values of adjacent pixels = 12 bytes (each pixel contains 3 channels, 3 × 4 bytes = 12 bytes).

[0116] Read the starting address of the LAB matrix from memory. According to the channel order, calculate: The starting address of the a channel (Addr_a) = Addr_base + 4, and the starting address of the b channel (Addr_b) = Addr_base + 8; Starting from the starting address, traverse all pixels with a step of 12 bytes. Starting from Addr_a, offset 12 bytes each time and read a 4-byte floating-point value. Repeat N times (N = W × H) to obtain a one-dimensional array A = [a1, a2,..., an] containing all pixel a values; Starting from Addr_b, traverse in the same way with a step of 12 bytes and read the blue-yellow axis value of each pixel to obtain a one-dimensional array B = [b1, b2,..., bn].

[0117] Step S33: Sort the blue-yellow axis channel values and the green-red axis channel values respectively, and determine the middle position element as the blue-yellow axis median and the green-red axis median.

[0118] In this embodiment, the quicksort algorithm is applied to arrays A and B respectively. The middle element is located based on the parity of the array length. If the array length is odd, the middle position is (array length + 1) / 2; if the array length is even (e.g., N = 10000), the middle positions are array length / 2 and array length / 2 + 1. The median is then the average of the two elements. The resulting median along the green-red axis reflects the overall green-red bias of the field; the median along the blue-yellow axis reflects the overall blue-yellow bias of the field.

[0119] In the fourth embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description and will not be repeated hereafter. Based on this, the above-described method for determining tennis court type based on visual algorithms may include steps A10-A20:

[0120] Step A10: Determine the corresponding scoring data item and the target weight of the scoring data item based on the venue type.

[0121] Step A20: Based on the scoring data items and the weights, determine the player's score for each of the said field types.

[0122] In this embodiment, the physical characteristics of different court surfaces, such as ball speed, bounce, and friction, determine which scoring methods are more efficient. Scoring data items strongly correlated with court characteristics are selected from general tennis scoring dimensions. These scoring data items include general recurring items and court-specific items, forming a mapping table. The mapping table contains the scoring items corresponding to each court type and the weight corresponding to each scoring item. The final score for each player is calculated using the formula: Single-court score = Σ Original value of a certain data item for that court × Corresponding weight.

[0123] For example, the scoring data items for hard courts are service points won, return points won, break point percentage, and baseline points won; for clay courts, the scoring data items are break point percentage, rally points won, baseline points won, and second serve points won; and for grass courts, the scoring data items are service points won, net points won, short rally points won, and break point percentage.

[0124] Optionally, the actual percentage of each scoring item in the corresponding court can be statistically analyzed, such as 30% for long rallies on clay courts and 40% for serves on grass courts. The average contribution percentage of each scoring item in the historical data can be used as the base weight. The base weight can be adjusted based on rule changes and changes in player technique. For example, an increase in serve-and-volley players may lead to an increase in the contribution of net point percentage on grass courts, thus increasing its weight; adjustments to the serve rules may affect the contribution of serve point percentage, requiring a reassessment of the weight.

[0125] In one feasible implementation, prior to step A10, the following may also be included:

[0126] When the increase in the contribution of a technology-related scoring item is greater than or equal to the preset increase in the contribution, or when the difference in the contribution of scoring items after the new rule takes effect is greater than or equal to the preset contribution percentage of the scoring rate, a weight adjustment is triggered; a preset weight adjustment coefficient is obtained, and the basic weight is adjusted based on the weight adjustment coefficient.

[0127] In this implementation, the base weights are adjusted based on changes in athlete technique and rules to obtain the target weight. The initial base weights for each court are stored in a structured database, with fields including court type (hard court / clay / grass), scoring item ID (serve win rate / net win rate, etc.), base weight value, last adjustment time, and associated scoring item ID. Two types of adjustment trigger thresholds are preset: a technique change trigger threshold and a rule change trigger threshold. Meeting either threshold initiates the weight adjustment process. The weight adjustment process is initiated if the contribution increase of a technique-related scoring item over two consecutive seasons is greater than or equal to a preset contribution increase. Alternatively, the weight adjustment process is initiated if the difference in scoring item contribution within a preset number of matches after the rules take effect is greater than or equal to a preset scoring rate contribution percentage. A pre-set weight adjustment coefficient is used to control the magnitude of each weight adjustment. The target weight is calculated using the formula: New Weight = Base Weight × 1 + Impact Amount × Adjustment Coefficient.

[0128] This application provides a tennis court type determination device based on a vision algorithm, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the tennis court type determination method based on a vision algorithm in Embodiment 1 described above.

[0129] The following is for reference. Figure 4 The diagram illustrates a structural schematic of a tennis court type determination device based on a vision algorithm, suitable for implementing embodiments of this application. The tennis court type determination device based on a vision algorithm in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, personal digital assistants (PDAs), tablet computers (PADs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 4 The illustrated tennis court type determination device based on vision algorithms is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0130] like Figure 4 As shown, the vision algorithm-based tennis court type determination device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1002 or a program loaded from storage device 1003 into random access memory (RAM) 1004. The random access memory 1004 also stores various programs and data required for the operation of the vision algorithm-based tennis court type determination device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the vision-based tennis court type determination device to communicate wirelessly or wiredly with other devices to exchange data. Although a vision-based tennis court type determination device with various systems is shown in the figure, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems may be implemented alternatively.

[0131] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0132] The tennis court type determination device based on vision algorithms provided in this application, employing the tennis court type determination method based on vision algorithms in the above embodiments, can solve the technical problem of how to improve the accuracy and environmental robustness of sports court type identification. Compared with the prior art, the beneficial effects of the tennis court type determination device based on vision algorithms provided in this application are the same as those of the tennis court type determination method based on vision algorithms provided in the above embodiments, and other technical features in this tennis court type determination device based on vision algorithms are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0133] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0134] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0135] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the vision algorithm-based tennis court type determination method in the above embodiments.

[0136] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, radio frequency (RF), etc., or any suitable combination thereof.

[0137] The aforementioned computer-readable storage medium may be included in a tennis court type determination device based on a vision algorithm; or it may exist independently and not assembled into the tennis court type determination device based on a vision algorithm. The aforementioned computer-readable storage medium carries one or more programs that, when executed by the tennis court type determination device based on a vision algorithm, cause the tennis court type determination device based on a vision algorithm to: acquire a court image or court video frame as a court scene; extract the dominant color tone from the preprocessed court scene based on a preset clustering algorithm to obtain the target hue value and target saturation value corresponding to the court scene; convert the court scene to the LAB color space and obtain the median of the blue-yellow axis and the median of the green-red axis in the LAB color space; and determine the court type based on the target hue value, the target saturation value, the median of the green-red axis, and the median of the blue-yellow axis.

[0138] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the client computer, partially on the client computer, as a standalone software package, partially on the client computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the client computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0139] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0140] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0141] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described method for determining tennis court types based on vision algorithms. This method can solve the technical problem of how to improve the accuracy and environmental robustness of sports court type identification. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the method for determining tennis court types based on vision algorithms provided in the above embodiments, and will not be repeated here.

[0142] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.< / f>

Claims

1. A method for determining a tennis court type based on a vision algorithm, characterized by, The tennis court type determination method based on a visual algorithm comprises: obtaining a court image or a court video frame as a court picture; extracting a main color tone of the preprocessed court picture based on a preset clustering algorithm to obtain a target hue value and a target saturation value corresponding to the court picture; converting the court picture to a LAB color space to obtain a median of a blue-yellow axis and a median of a green-red axis in the LAB color space; determining a court type based on the target hue value, the target saturation value, the median of the green-red axis and the median of the blue-yellow axis; the step of determining the court type based on the target hue value, the target saturation value, the median of the green-red axis and the median of the blue-yellow axis comprises: comparing the target hue value with a preset color interval, and determining a color tone of the tennis court according to a comparison result; determining an average lightness value based on an L channel of the court picture, determining an illumination level based on the average lightness value, determining a saturation interval based on the illumination level, comparing the target saturation value with the saturation interval, and determining a saturation level of the tennis court according to a comparison result; comparing the median of the green-red axis and the median of the blue-yellow axis with a preset warm yellow threshold, and determining a color feature of the tennis court according to a comparison result, including: determining a green-red axis median score based on a preset green-red axis median score formula, determining a blue-yellow axis median score based on a blue-yellow axis median score formula, performing weighted calculation on the green-red axis median score and the blue-yellow axis median score to obtain a comprehensive score, and comparing the comprehensive score with the preset warm yellow threshold to obtain the color feature; if the color tone is a green tone and the saturation level is a high saturation, it is determined that the court type is a grass court; if the color tone is an orange-red tone and the color feature is a red soil feature, it is determined that the court type is a red soil court; and if the court type is neither the grass court nor the red soil court, it is determined that the court type is a hard court. 2.The visual algorithm-based tennis court type determination method of claim 1, wherein, The step of extracting a main color tone of the preprocessed court picture based on a preset clustering algorithm to obtain a target hue value and a target saturation value corresponding to the court picture comprises: scaling the court picture to a preset pixel size to obtain the preprocessed court picture; obtaining a second hue value and a second saturation value of each pixel in the preprocessed court picture; performing clustering analysis on the second hue value and the second saturation value based on a K-means clustering algorithm to obtain a plurality of clusters; determining the target hue value and the target saturation value according to a main color tone corresponding to a target cluster containing the most pixels. 3.The visual algorithm-based tennis court type determination method of claim 2, wherein, The step of obtaining a second hue value and a second saturation value of each pixel in the preprocessed court picture comprises: converting the preprocessed court picture from a BGR color space to an HSV color space to obtain a first hue value and a first saturation value in the HSV color space; Remove the hue value and the saturation value corresponding to the white line and the highlight area in the first hue value and the first saturation value, to obtain the second hue value and the second saturation value. 4.The visual algorithm-based tennis court type determination method of claim 1, wherein, The step of converting the field picture to the LAB color space to obtain the median of the blue-yellow axis and the median of the green-red axis in the LAB color space comprises: Obtain BGR data of an initial field picture, and perform normalization processing and nonlinear transformation on the BGR data to obtain LAB data; Based on the channel starting position and the preset data interval, determine the blue-yellow axis channel value and the green-red axis channel value corresponding to each pixel; Sort each of the blue-yellow axis channel value and the green-red axis channel value, and determine the middle position element as the median of the blue-yellow axis and the median of the green-red axis. 5.The visual algorithm-based tennis court type determination method of claim 1, wherein, The tennis court type determination method based on a visual algorithm further comprises: Determine the corresponding score data item based on the field type, and the target weight of the score data item; Determine the score of the player in each of the field types based on the score data item and the weight. 6.The visual algorithm-based tennis court type determination method of claim 5, wherein, Before the step of determining the corresponding score data item based on the field type, and the target weight of the score data item, the tennis court type determination method based on a visual algorithm further comprises: When the contribution degree increase of the technical related score item is greater than or equal to a preset contribution degree increase, or the difference in the contribution degree of the score item after the new rule takes effect is greater than or equal to a preset score rate contribution ratio, trigger weight adjustment; Obtain a preset weight adjustment coefficient, and adjust the basic weight based on the weight adjustment coefficient.

7. A tennis court type determining apparatus based on a vision algorithm, characterized by, The device comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the tennis court type determination method based on a visual algorithm according to any one of claims 1 to 6.

8. A storage medium, characterized by The storage medium is a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the tennis court type determination method based on a visual algorithm according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • A jaundice detection method and system based on visual recognition

    CN119784729A

  • Court area identification method and device, and storage medium

    CN120673022A