A real-time output method for e-sports competition results based on optical character recognition
Through optical character recognition technology, the accuracy and efficiency problems of e-sports competition data acquisition are solved, and a fast and high-accuracy data acquisition method is provided to help the development of the e-sports industry.
Patent Information
- Application Number
- CN202110524825.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-13
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-05-13
AI Technical Summary
Existing technology is difficult to quickly and accurately obtain key text data in e-sports matches in real time, resulting in high costs and low accuracy.
Using a method based on optical character recognition, the live video source is analyzed to obtain single-frame images, scene classification and key area cropping are performed, and morphological processing and convolutional neural network recognition are combined to correct the output data.
It achieves fast, high-accuracy, stable and automated e-sports competition data acquisition, facilitates e-sports media and enthusiasts to track, report and analyze, and promotes the development of the e-sports industry.
Smart Images

Figure CN113312990B
Abstract
Description
Technical Field
[0001] The present invention relates to a character recognition method, and in particular to a method for real-time output of e-sports game conditions based on optical character recognition. Background Art
[0002] With the rapid development of the e-sports industry, e-sports competitions have attracted more and more attention, even as much as traditional sports competitions. Therefore, the demand for the display and interpretation of e-sports competition data is becoming stronger and stronger. E-sports media, e-sports websites, e-sports clubs, etc. often need these data to report, display and analyze the competition in real time.
[0003] However, there are currently few ways to obtain data from e-sports competitions. According to current methods, if you really want to obtain real-time data during the game, you can only do so by watching it with your eyes and recording it manually. This is costly and inaccurate. Recently, some methods have emerged to extract e-sports competition data using computer vision technology, but due to the large number of e-sports competition scenes and changes, direct recognition and extraction using only visual technology often cannot achieve a relatively ideal accuracy rate. Summary of the invention
[0004] The technical problem to be solved by the embodiments of the present invention is to provide a method for real-time output of e-sports game conditions based on optical character recognition, which can quickly and accurately obtain key text data in e-sports games in real time.
[0005] In order to solve the above technical problems, an embodiment of the present invention provides a method for real-time output of e-sports game status based on optical character recognition, comprising the following steps:
[0006] S1: parse the live video source and obtain a single frame image of the video at a time interval of n;
[0007] S2: Classifying the game images by scene classification, capturing the key area of the single-frame image and comparing the similarity with the pre-saved scene area feature image, and identifying the scene where the single-frame image is located;
[0008] S3: determining the text key data area to be acquired according to the scene where the single frame image is located and cutting it;
[0009] S4: performing morphological processing on the text key area image;
[0010] S5: Predict the content of key text area images on the game screen to reduce invalid and erroneous data;
[0011] S6: cutting and segmenting the text in the key area of the game to extract individual characters;
[0012] S7: using a convolutional neural network to recognize the single character;
[0013] S8: According to the numerical type of each cropping area, the recognized output data is corrected and output.
[0014] Wherein, the step S2 specifically includes:
[0015] S21: Save various scene images during the game;
[0016] S22: Find the target area in each scene and save it as a screenshot;
[0017] S23: intercepting the key area of the single frame image, performing a similarity comparison with a pre-saved scene area feature image, calculating a Pearson correlation coefficient d, and determining the scene based on the Pearson correlation coefficient d.
[0018] Wherein, the step S4 specifically includes:
[0019] S41: performing smoothing filtering on the key area image;
[0020] S42: grayscale processing is performed on the key area;
[0021] S43: Perform binarization processing, divide the text key area image into a number of grids, accumulate the pixel grayscale values in each grid and calculate the average value as the binarization threshold.
[0022] Wherein, the step S5 specifically includes:
[0023] S51: accumulating pixels from the horizontal axis and the vertical axis of the image after the key area is binarized;
[0024] S52: Determine whether the image contains text based on the change characteristics of the accumulated value.
[0025] Wherein, the step S8 specifically includes:
[0026] S81: Use regular expressions to match the data. If the data does not match the format of the area, use the value of the same area in the previous frame for output;
[0027] S82: Match the data according to the growth rule of the values in the area. If they do not match, use the values of the same area in the previous frame for output.
[0028] The calculation method of the Pearson correlation coefficient d in step S2 is:
[0029]
[0030] Where N is the number of pixels in the area, X iis the i-th pixel value of the feature template image, is the mean value of all pixels in the feature template image, Y i is the i-th pixel value of the key area of the live frame, It is the mean value of all pixels in the key area of the live frame.
[0031] The implementation of the embodiments of the present invention has the following beneficial effects: the present invention provides the e-sports industry with a fast, highly accurate, stable, and automated method for acquiring e-sports game data, helping e-sports media, e-sports websites, e-sports clubs, etc. to more conveniently track, report, and analyze e-sports games, allowing e-sports enthusiasts, e-sports players, and e-sports related practitioners to obtain more detailed game data, thereby promoting the rapid development of the emerging industry of e-sports. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is the overall flow chart of the present invention;
[0033] Figure 2 This is a schematic diagram taking Moba games as an example;
[0034] Figure 3 This is a schematic diagram of the vertical axis cumulative statistics after the key area is binarized;
[0035] Figure 4 This is a schematic diagram of the horizontal axis cumulative statistics after the key area is binarized;
[0036] Figure 5 This is a schematic diagram of the convolutional neural network structure. DETAILED DESCRIPTION
[0037] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings.
[0038] like Figure 1 As shown, a method for real-time output of e-sports game status based on optical character recognition according to an embodiment of the present invention is implemented through the following steps.
[0039] S1. Obtain continuous single-frame images of the game video.
[0040] a) Obtain high-quality live video sources and parse the live video using video decoding technology.
[0041] b) Set a time interval parameter n, and obtain a single frame of the video at a time interval of n. Since the update frequency of the display data in the competition is often not very high, the time interval n can be appropriately increased according to the needs, leaving the program with more processing time and improving the real-time nature of the data.
[0042] S2. Classify the game scene images.
[0043] a) Save various scene images that should be present in the game, such as pre-match preparation scene, player role selection scene, game in progress scene, post-match analysis scene, etc.
[0044] b) Find the area with obvious features in each scene, take a screenshot and save it. Because the scenes of the same game are often relatively fixed, you can find the area that is visually different from other scenes and save it as the key area feature template image, such as Figure 2 The schematic diagram shown is a Moba game as an example.
[0045] c) Intercept the key area of the single-frame image obtained in the live broadcast, compare the similarity with the pre-saved scene area feature image, and calculate the Pearson correlation coefficient d. When the correlation coefficient d between the key area of the live broadcast image and the pre-saved scene key area reaches the threshold set after debugging, the live broadcast image is considered to be in a certain scene. If it is lower than the threshold, it is considered not to be in that scene.
[0046] Calculation formula
[0047]
[0048] Where N is the number of pixels in the area, X i is the i-th pixel value of the feature template image, is the mean value of all pixels in the feature template image, Y i is the i-th pixel value of the key area of the live frame, It is the mean value of all pixels in the key area of the live frame.
[0049] S3. Determine the text key data area that needs to be obtained in the single-frame image according to different scenes, and crop it.
[0050] S4. Perform morphological processing on the key text area image. Reducing background irrelevant features other than characters can reduce the complexity of subsequent recognition algorithms and improve recognition efficiency.
[0051] a) Perform smoothing filtering on the key area images to eliminate noise caused by image compression or complex background of e-sports images.
[0052] b) Grayscale the key areas.
[0053] c) Binarize the key areas. Due to the variety of changes in e-sports games, the grayscale values of the text content and the background are often close after grayscale processing, and it is difficult to achieve good results using traditional binarization. Traditional binarization is to set a threshold and mark the pixels with grayscale values above and below the threshold as 0 or 1. This method often has poor effects in the key areas of text in e-sports games. The image of the key area of the text to be processed can be divided into multiple small grids, generally divided into 2×2 or 3×3 grids (adjustable depending on the size of the area), and the grayscale values of the pixels in each small grid are accumulated and averaged as the binarization threshold in the small grid. Avoid using the same threshold for binarization of the entire area, which can easily cause the text outline to be lost when the background is changing.
[0054] S5. Predict the content of the key text area images in the game screen. Due to the variety of e-sports games, text data may not exist in the same scene and the same area. Ensuring that the image to be recognized contains characters can reduce the complexity of the subsequent recognition algorithm, improve recognition efficiency, and reduce invalid error data.
[0055] a) Accumulate pixels from the horizontal and vertical axes of the binary image of the key area. Due to the morphological characteristics of the characters, the accumulated value of the area containing the characters will be significantly higher than the background, such as Figure 3 shown.
[0056] b) Determine whether the image contains text based on the changing characteristics of the accumulated value.
[0057] By observing the change curve of the vertical cumulative value of pixels, we can see that the area containing characters generally presents multiple peaks of fixed width, and there are one or two clusters of slightly pointed areas in the peaks, which is due to the morphological characteristics of numbers and English characters. Non-character areas are often irregular pixel blocks, and the change curve of the vertical cumulative value generally does not have these characteristics. Therefore, the program can be used to simply predict whether there is text.
[0058] S6. Crop and segment the text in the key area of the game and extract individual characters.
[0059] a) In step S5a, we accumulate pixels in the horizontal and vertical axes of the image, and by analyzing the accumulated values, we can obtain the boundaries of the characters. The characters are cut and segmented according to the boundaries of the characters to form individual characters.
[0060] S7. Use convolutional neural network to recognize single optical characters extracted from the game footage.
[0061] a) Create a basic training data set. Since the characters that appear in e-sports competitions are often letters, numbers, and a small number of specific characters, and are often regular printed fonts, a mainstream font library can be used to generate a data set with 26 letters, 10 numbers, a small number of symbols, and specific characters.
[0062] b) Use convolutional neural network to train based on basic data sets to obtain pre-trained models. You can use a simple LeNet-5 network to fine-tune the network structure and train the data set, such as Figure 5 shown.
[0063] c) Capture the actual characters in the game screen and use the generated pre-trained model for fine-tuning training to obtain the recognition model parameters.
[0064] d) Use the trained model to recognize the single characters extracted in step S6
[0065] e) Concatenate individual character data to generate complete data.
[0066] S8. According to the numerical type of each cropping area, the recognized output data is corrected and output.
[0067] a) Use regular expressions to match the data. If the data does not match the format of the area, use the value of the same area in the previous frame for output.
[0068] For example, in Moba games, the KDA (Kill / Death / Assist) data area may be "10 / 1 / 1", but due to recognition errors, the recognition result is "101111". At this time, according to the regular expression "number / number / number" preset for the data, we can find that the data is abnormal. Combined with the preset regular matching rules of similar characters, such as "1" to " / ", try it. If there is only one solution after restoration, such as "10 / 1 / 1" in this case, use this solution as the error correction result. If there is no solution, such as the recognition result of "10111", the previous frame of data is used. If there are multiple solutions, such as "1011110", it can be restored to "10 / 11 / 0" or "10 / 1 / 10", and the previous frame of data is used.
[0069] b) Match the data according to the growth pattern of the values in the area. If they do not match, use the values of the same area in the previous frame for output.
[0070] For example, in MOBA games, KDA (Kill / Death / Assist) data is based on the game's design principles.
[0071] Usually, the number of kills, deaths, and assists will not exceed 100, and even more than 30 is very rare in a game. In addition, the data are all increasing, and there will be no significant increase or decrease. According to these rules, the results output in the previous step can be further corrected.
[0072] The above disclosure is only a preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A method for real-time output of e-sports competition status based on optical character recognition, characterized in that: The following steps are involved: S1: parse the live video source and obtain a single frame image of the video at a time interval of n; S2: Classifying the scene of the game screen, capturing the key area of the single frame image and comparing the similarity with the pre-saved scene area feature image, and identifying the scene where the single frame image is located, and also includes the steps of: S21: Save various scene images during the game; S22: Find the target area in each scene and save it as a screenshot; S23: intercepting a key area of the single-frame image, performing a similarity comparison with a pre-saved scene area feature image, calculating a Pearson correlation coefficient d, and determining the scene based on the Pearson correlation coefficient d; S3: determining the text key data area to be acquired according to the scene where the single frame image is located and cutting it; S4: performing morphological processing on the text key area image, including performing smoothing filtering processing on the key area image, performing image grayscale processing on the key area, performing binarization processing, dividing the text key area image into a number of grids, and accumulating and calculating the average value of the pixel grayscale values in each grid as the binarization threshold; S5: Predict the content of the key text area images on the game screen to reduce invalid error data, including the following steps: S51: accumulating pixels from the horizontal axis and the vertical axis of the image after the key area is binarized; S52: judging whether the image contains text according to the change characteristics of the accumulated value; S6: cutting and segmenting the text in the key area of the game to extract individual characters; S7: using a convolutional neural network to recognize the single character; S8: According to the numerical type of each cropping area, error correction is performed on the identified output data and the data is output, including the steps of: S81: Use regular expressions to match data. If the format does not match the area, use the value of the same area in the previous frame for output; S82: Match the data according to the growth rule of the values in the area. If they do not match, use the values of the same area in the previous frame for output.
2. The method for real-time output of e-sports competition status based on optical character recognition according to claim 1, characterized in that: The calculation method of the Pearson correlation coefficient d in step S2 is: Where N is the number of pixels in the area, is the i-th pixel value of the feature template image, is the mean value of all pixels of the feature template image, is the i-th pixel value of the key area of the live frame, It is the mean value of all pixels in the key area of the live frame.
