Bullet screen rendering test method and device
By capturing images at the same playback progress during video playback and comparing their similarity and pixel ratio, the misjudgment problem in existing bullet screen rendering tests is solved, achieving highly accurate bullet screen rendering tests.
Patent Information
- Application Number
- CN202111504390.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-10
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2041-12-10
AI Technical Summary
Existing methods for testing bullet screen rendering have issues with misjudgment, especially when applications iterate rapidly. Traditional image difference comparison methods cannot accurately determine the quality of bullet screen rendering.
By capturing images at the same playback progress during video playback, and using them in scenarios with and without bullet comments as baseline and test images, the similarity value is calculated. The similarity calculation and pixel ratio are combined to determine whether the bullet comments are rendered correctly.
The accuracy of bullet screen rendering tests has been improved, with a similarity value test accuracy of 90%, and an overall accuracy of 97% when combined with pixel ratio recognition.
Smart Images

Figure CN114185784B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software testing, and in particular to a method and apparatus for testing bullet screen rendering. Background Technology
[0002] The rendering capability of bullet comments is related to the performance of various terminal devices, and the requirements for compatibility testing are relatively high. In the case of rapid iteration of applications (APPs), smoke tests are generally used to ensure the quality of bullet comment rendering. Traditional bullet comment smoke tests can verify the quality of bullet comment rendering by comparing differences between images. However, due to the characteristics of bullet comments being published in real time and the varying density of bullet comments at different times, traditional image difference comparison methods can lead to a certain degree of misjudgment. Summary of the Invention
[0003] In view of this, a method, apparatus, computer device and computer-readable storage medium for testing bullet screen rendering are provided to solve the problem of certain misjudgments in existing bullet screen rendering testing methods.
[0004] This application provides a method for testing bullet screen rendering, the method comprising:
[0005] Play the test video with bullet comments;
[0006] When the video to be tested reaches a preset progress, a video frame is captured as a test image, and the video frame contains at least one bullet comment.
[0007] Calculate the similarity value between the test image and the reference image, wherein the reference image is a video frame that does not contain bullet comments, which is captured when the video to be tested is played to the preset progress.
[0008] If the similarity value is less than the first preset value, it is determined that the bullet screen has been rendered.
[0009] Optionally, calculating the similarity value between the test image and the reference image includes:
[0010] The test image and the reference image are processed to obtain the corresponding first grayscale image and second grayscale image;
[0011] Perform discrete cosine transform on the first grayscale image and the second grayscale image respectively to obtain the corresponding first discrete cosine transform image and second discrete cosine transform image;
[0012] The pixels in the first discrete cosine transform image and the second discrete cosine transform image are binarized respectively to obtain the corresponding first binarized image and second binarized image;
[0013] Calculate the similarity value between the first binarized image and the second binarized image.
[0014] Optionally, the step of performing grayscale processing on the test image and the reference image respectively to obtain the corresponding first grayscale image and second grayscale image includes:
[0015] The test image and the reference image are respectively reduced in size to obtain the corresponding first reduced image and second reduced image;
[0016] The first and second reduced images are processed into grayscale to obtain the corresponding first grayscale image and second grayscale image.
[0017] Optionally, the step of binarizing the pixel images in the first discrete cosine transform image and the second discrete cosine transform image to obtain the corresponding first binarized image and second binarized image includes:
[0018] The preset regions in the upper left corner of the first discrete cosine transform image and the second discrete cosine transform image are cropped respectively to obtain the corresponding first matrix image and second matrix image;
[0019] The first matrix image and the second matrix image are binarized to obtain the corresponding first binarized image and second binarized image.
[0020] Optionally, calculating the similarity value between the first binarized image and the second binarized image includes:
[0021] Calculate the Hamming distance between the first binarized image and the second binarized image, and determine the similarity value between the test image and the reference image based on the calculated Hamming distance.
[0022] Optionally, the method further includes:
[0023] If the similarity value is greater than or equal to the first preset value, the proportion of reserved pixels in the test image is calculated to obtain the first proportion, wherein the reserved pixels are pixels whose pixel values are within a preset range;
[0024] The first ratio and the preset ratio are used to determine whether the bullet screen has been rendered.
[0025] Optionally, determining whether the bullet comments have been rendered based on the first proportion and the preset proportion includes:
[0026] Calculate the proportion of reserved pixels in the reference image to obtain a second proportion, and use the second proportion as the preset proportion;
[0027] If the difference between the first percentage and the second percentage is greater than or equal to the second preset value, it is determined that the bullet screen has been rendered;
[0028] If the difference between the first percentage and the second percentage is less than the second preset value, it is determined that the bullet screen is not rendered.
[0029] Optionally, the method further includes:
[0030] Record the playback mode of the video to be tested, including full-screen mode, half-screen mode, landscape mode, and portrait mode;
[0031] After the step of extracting a video frame as a test image when the video to be tested reaches a preset progress, the method further includes:
[0032] When the playback mode of the video to be tested is half-screen mode, determine whether the playback mode of the video to be tested is landscape mode;
[0033] If the playback mode of the video to be tested is landscape mode, the test image is cropped using the first cropping method to obtain the cropped test image;
[0034] If the video to be tested is played in portrait mode, the test image is cropped using the second cropping method to obtain the cropped test image.
[0035] This application also provides a bullet screen rendering test device, the bullet screen rendering test device comprising:
[0036] The playback module is used to play the test video with bullet comments;
[0037] The capture module is used to capture a video frame as a test image when the video to be tested is played to a preset progress. The video frame contains at least one bullet screen.
[0038] The calculation module is used to calculate the similarity value between the test image and the reference image, wherein the reference image is a video frame without bullet comments that is captured when the video to be tested is played to the preset progress.
[0039] The determination module is used to determine that the bullet screen has been rendered if the similarity value is less than a first preset value.
[0040] This application also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.
[0041] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0042] This embodiment plays a test video with bullet comments; when the test video reaches a preset playback progress, a frame is captured as a test image, and the video frame contains at least one bullet comment; the similarity value between the test image and a reference image is calculated, where the reference image is a video frame captured when the test video reaches the preset playback progress that does not contain bullet comments; if the similarity value is less than a first preset value, it is determined that the bullet comments have been rendered. This embodiment improves the accuracy of the test by capturing images at the same playback progress during video playback, with and without bullet comments enabled, as the reference image and test image respectively, and then determining whether the bullet comments are rendered correctly based on the similarity value. Attached Figure Description
[0043] Figure 1 This is a schematic diagram of the environment for the bullet screen rendering test method according to an embodiment of this application;
[0044] Figure 2 This is a flowchart of one embodiment of the bullet screen rendering test method described in this application;
[0045] Figure 3 This is a detailed flowchart illustrating the steps for calculating the similarity value between the test image and the reference image in one embodiment of this application.
[0046] Figure 4 This is a detailed flowchart illustrating the steps of performing grayscale processing on the test image and the reference image respectively to obtain the corresponding first grayscale image and second grayscale image in one embodiment of this application.
[0047] Figure 5 This is a detailed flowchart illustrating the steps of binarizing pixel images in the first discrete cosine transform image and the second discrete cosine transform image to obtain the corresponding first binarized image and second binarized image in one embodiment of this application.
[0048] Figure 6 A flowchart illustrating another embodiment of the bullet screen rendering test method described in this application;
[0049] Figure 7 This is a detailed flowchart illustrating the steps of determining whether a bullet screen has been rendered based on the first ratio and the preset ratio in one embodiment of this application.
[0050] Figure 8 A flowchart illustrating another embodiment of the bullet screen rendering test method described in this application;
[0051] Figure 9 This is a program module diagram of one embodiment of the bullet screen rendering test device described in this application;
[0052] Figure 10 A schematic diagram of the hardware structure of a computer device for performing a bullet screen rendering test method provided in an embodiment of this application. Detailed Implementation
[0053] The advantages of this application are further illustrated below with reference to the accompanying drawings and specific embodiments.
[0054] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0055] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0056] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0057] In the description of this application, it should be understood that the numerical labels before the steps do not indicate the order of the steps, but are only used to facilitate the description of this application and to distinguish each step, and therefore should not be construed as a limitation of this application.
[0058] Figure 1This illustration schematically depicts an application environment diagram of the bullet screen rendering test method according to an embodiment of this application. In an exemplary embodiment, the system of this application environment may include a device under test 10 and a test device 20 equipped with testing tools. The device under test 10 and the test device 20 are connected wirelessly or via a wired connection. In this embodiment, the test device 20 executes automated test scripts using the installed testing tools to test the application under test (APP) installed on the device under test. Both the device under test 10 and the test device 20 can be mobile phones, iPads, tablets, etc.
[0059] See Figure 2 This is a flowchart illustrating a bullet screen rendering test method according to an embodiment of this application. It is understood that the flowchart in this method embodiment is not intended to limit the order of execution steps. As can be seen from the figure, the bullet screen rendering test method provided in this embodiment includes:
[0060] Step S20: Play the test video with bullet comments.
[0061] Specifically, when playing a test video with bullet comments, you need to first launch the video playback application (test application) that plays the test video, then enter the video playback page, and then you can play the test video. Understandably, the bullet comment button needs to be enabled while playing the test video so that bullet comments can be played simultaneously with the video playback.
[0062] In one embodiment, to facilitate the recording of playback of the video to be tested, the login operation of the application to be tested can be performed before playing the video to be tested.
[0063] Step S21: When the video to be tested reaches a preset progress, a video frame is captured as a test image, and the video frame contains at least one bullet comment.
[0064] Specifically, the preset progress can be flexibly set and adjusted according to actual needs. For example, if the preset progress is 20 seconds, it means that when the video to be tested plays to the 20th second, the current video frame needs to be captured and used as the test image. In this embodiment, since the bullet comment button is enabled when the test video is played, the captured video frame will contain at least one bullet comment.
[0065] It should be noted that a video is composed of a series of still images played in succession; these still images are called video frames.
[0066] Step S22: Calculate the similarity value between the test image and the reference image, wherein the reference image is a video frame without bullet comments that is captured when the video to be tested is played to the preset progress.
[0067] Specifically, the reference image is an image used for comparison with the test image. The reference image can be obtained by capturing the currently playing video frame when the video to be tested is played to the preset progress without the bullet screen button being turned on.
[0068] Understandably, the baseline image can be pre-captured or captured during the testing process.
[0069] As an example, when the benchmark image is captured during the test, after enabling the bullet screen playback mode, a screenshot command can be executed simultaneously when the video to be tested reaches the preset progress to capture the test image of the current video playback screen. Afterwards, the bullet screen playback mode can be turned off, and the video to be tested can be replayed until it reaches the preset progress again, at which point the screenshot command can be executed simultaneously to capture the current video playback screen to obtain the benchmark image.
[0070] The similarity value is used to characterize the similarity between the test image and the reference image.
[0071] In one exemplary implementation, see [reference] Figure 3 The calculation of the similarity value between the test image and the reference image may include:
[0072] Step S30: Perform grayscale processing on the test image and the reference image respectively to obtain the corresponding first grayscale image and second grayscale image.
[0073] Specifically, the grayscale processing involves converting the color (RGB) first video frame into a grayscale (GRAY) first video frame. In one embodiment, the grayscale processing of the image can be performed using the following grayscale algorithm:
[0074] GRAY = (Red + Green + Blue) / 3, where Red, Green, and Blue represent red, green, and blue pixels, respectively, and GRAY represents grayscale pixels.
[0075] It is understood that the above grayscale algorithm is exemplary, and other grayscale algorithms may be used in other implementations, which are not limited in this embodiment.
[0076] In this embodiment, a first grayscale image can be obtained by performing grayscale processing on the test image, and a second grayscale image can be obtained by performing grayscale processing on the reference image.
[0077] It should be noted that the reference image can also be pre-processed into grayscale to obtain the second grayscale image, without having to do so during the testing process.
[0078] In one exemplary implementation, see [reference] Figure 3 The step of performing grayscale processing on the test image and the reference image respectively to obtain the corresponding first grayscale image and second grayscale image may include:
[0079] Step S40: Reduce the size of the test image and the reference image respectively to obtain the corresponding first reduced image and second reduced image.
[0080] Specifically, to facilitate subsequent processing, an image downsizing algorithm can be used to first downsize the test image and the reference image to obtain the corresponding first downsized image and second downsized image. The image downsizing algorithm can be the nearest neighbor algorithm, the Bilinear algorithm, etc., and is not limited in this embodiment.
[0081] As an example, the test image and the reference image can be scaled down to 32x32 pixels.
[0082] Step S41: Perform grayscale processing on the first reduced image and the second reduced image to obtain the corresponding first grayscale image and second grayscale image.
[0083] Specifically, after the image reduction process is completed, the first reduced image and the second reduced image are then subjected to grayscale processing to obtain a first grayscale image and a second grayscale image.
[0084] Step S31: Perform discrete cosine transform on the first grayscale image and the second grayscale image respectively to obtain the corresponding first discrete cosine transform image and second discrete cosine transform image.
[0085] Specifically, the Discrete Cosine Transform (DCT) is a transform related to the Fourier Transform. It is similar to the Discrete Fourier Transform (DFT), but uses only real numbers. The DCT is equivalent to a DFT of approximately twice its length, performed on a real even function (because the Fourier transform of a real even function is still a real even function). In some variations, the input or output positions need to be shifted by half a unit (there are 8 standard types of DCT, 4 of which are common). DCT is mainly used for data or image compression, converting spatial signals to the frequency domain and exhibiting good decorrelation performance. The DCT transform itself is lossless, but it creates excellent conditions for subsequent quantization, Huffman coding, and other processes in image coding. Furthermore, because the DCT transform is symmetrical, we can use the inverse DCT transform after quantization and encoding to recover the original image information at the receiving end. The original image is subjected to Discrete Cosine Transform (DCT). After the transformation, the energy of the DCT coefficients is mainly concentrated in the upper left corner, and most of the other coefficients are close to zero. Therefore, DCT has the characteristics of being suitable for image compression.
[0086] In this embodiment, a first discrete cosine transform image can be obtained by performing DTC transformation on a first grayscale image, and a second discrete cosine transform image can be obtained by performing DTC transformation on a second grayscale image.
[0087] It should be noted that the second grayscale image can also be pre-transformed using DTC to obtain the second discrete cosine transform image, without needing to do so during the testing process.
[0088] In one exemplary implementation, see [reference] Figure 5 The step of binarizing the pixel images in the first discrete cosine transform image and the second discrete cosine transform image to obtain the corresponding first binarized image and second binarized image may include:
[0089] Step S50: Crop the preset regions in the upper left corner of the first discrete cosine transform image and the second discrete cosine transform image respectively to obtain the corresponding first matrix image and second matrix image.
[0090] Specifically, since the energy of the image coefficients obtained after discrete cosine transform is mainly concentrated in the upper left corner, with most other coefficients close to zero, in this embodiment, to save computational resources, a preset region in the upper left corner of the first and second discrete cosine transform images can be cropped to obtain the corresponding first and second matrix images.
[0091] The preset area can be flexibly set and adjusted according to the actual situation. For example, the preset area is an 8x8 pixel area, that is, the 8x8 pixel area in the upper left corner of the first discrete cosine transform image and the second discrete cosine transform image is cropped to obtain the corresponding first matrix image and second matrix image.
[0092] Step S51: Binarize the first matrix image and the second matrix image to obtain the corresponding first binarized image and second binarized image.
[0093] Specifically, after completing the image cropping process, the first matrix image and the second matrix image obtained from the cropping process are then binarized to obtain the corresponding first binarized image and second binarized image.
[0094] Step S32: Binarize the pixels in the first discrete cosine transform image and the second discrete cosine transform image respectively to obtain the corresponding first binarized image and second binarized image.
[0095] Specifically, binarization refers to setting the grayscale value of the pixels in the difference image to 0 or 255, which is the process of presenting the entire difference image with a clear black and white effect. In other words, the grayscale difference image with 256 brightness levels is obtained by selecting an appropriate threshold to obtain a binarized image that can still reflect the overall and local features of the image.
[0096] As an example, a threshold of 5 can be selected. That is, if the gray value of a pixel in the difference image is greater than or equal to 5, the gray value of that pixel can be assigned the value of 1; if the gray value of a pixel in the difference image is less than 5, the gray value of that pixel can be assigned the value of 0. After reassigning the gray values of all pixels in the difference image, a binarized image reflecting the overall and local features of the image can be obtained.
[0097] In one embodiment, the threshold can be determined by calculating the average value of all grayscale pixels in the image. That is, threshold = (pixel value of pixel 1 + pixel value of pixel 2 + ... + pixel value of pixel N) / N, where N is the number of pixels in the image. Therefore, during binarization, for pixels in the first discrete cosine transform image, if the pixel value is greater than the average value of all pixels in the image, the grayscale value of that pixel can be assigned as 1; if the pixel value is greater than or equal to the average value of all pixels in the image, the grayscale value of that pixel can be assigned as 0. Similarly, for pixels in the second discrete cosine transform image, if the pixel value is greater than the average value of all pixels in the image, the grayscale value of that pixel can be assigned as 1; if the pixel value is greater than or equal to the average value of all pixels in the image, the grayscale value of that pixel can be assigned as 0.
[0098] In this embodiment, a first binarized image can be obtained by binarizing the first discrete cosine transform image, and a second binarized image can be obtained by binarizing the second discrete cosine transform image.
[0099] It should be noted that the second discrete cosine transform image can also be binarized in advance to obtain a second binarized image, without having to do so during the testing process.
[0100] Step S33: Calculate the similarity value between the first binarized image and the second binarized image.
[0101] Specifically, after obtaining the first binarized image and the second binarized image, the similarity between the benchmark image and the test image can be obtained by calculating the similarity between these two binarized images.
[0102] In one exemplary embodiment, calculating the similarity value between the first binarized image and the second binarized image includes:
[0103] Calculate the Hamming distance between the first binarized image and the second binarized image, and determine the similarity value between the test image and the reference image based on the calculated Hamming distance.
[0104] Specifically, the Hamming distance is named after Richard Wesley Hamming. In information theory, the Hamming distance between two strings of equal length is the number of different characters at corresponding positions in the two strings. In other words, it is the number of characters that need to be replaced to transform one string into the other.
[0105] In this embodiment, after obtaining the Hamming distance, the similarity value can be further calculated.
[0106] As an example, assuming that the first binarized image and the second binarized image each contain 1000 binarized pixels, and the calculated Hamming distance is 500, then the similarity value = 500 / 1000 = 0.5 = 50%.
[0107] Step S23: If the similarity value is less than the first preset value, it is determined that the bullet screen has been rendered.
[0108] Specifically, the first preset value can be flexibly set and adjusted according to the actual situation. For example, if the first preset value is 85%, it means that when the similarity value between the test image and the reference image is less than 85%, it can be determined that the bullet screen is rendered normally; when the similarity value between the test image and the reference image is greater than or equal to 85%, it can be determined that the bullet screen is not rendered normally.
[0109] In one exemplary implementation, to improve test accuracy, see [reference needed]. Figure 6 The method further includes:
[0110] Step S60: If the similarity value is greater than or equal to the first preset value, calculate the proportion of reserved pixels in the test image to obtain the first proportion, wherein the reserved pixels are pixels whose pixel values are within a preset range.
[0111] Specifically, the preset range can be flexibly set and adjusted according to the actual situation. In practice, considering that most of the bullet screen rendering color is white, the preset range can be [200, 200, 200] to [255, 255, 255].
[0112] In one implementation, when calculating the percentage of retained pixels, the inRange algorithm can be used to filter out retained pixels from the image. Then, the percentage of retained pixels in all pixels contained in the image is calculated. For example, if 4,000 retained pixels are obtained and the image contains 5,000 pixels, the percentage is 4,000 / 5,000 = 0.8 = 80%.
[0113] Step S61: Determine whether the bullet screen has been rendered based on the first ratio and the preset ratio.
[0114] Specifically, the preset percentage can be flexibly set and adjusted according to actual conditions. In one embodiment, the preset percentage can be set based on the proportion of reserved pixels in the reference image, that is, the preset percentage is set to the proportion of reserved pixels in the reference image. In another embodiment, the preset percentage can also be directly set to a fixed value, for example, 80%.
[0115] In one embodiment, when the first percentage is greater than the preset percentage, it can be determined that the bullet screen has been rendered; when the first percentage is less than or equal to the preset percentage, it can be determined that the bullet screen has not been rendered.
[0116] In one exemplary implementation, see [reference] Figure 7 Determining whether the bullet comments have been rendered based on the first ratio and the preset ratio may include:
[0117] Step S70: Calculate the proportion of reserved pixels in the reference image to obtain a second proportion, and use the second proportion as the preset proportion.
[0118] Specifically, when calculating the percentage of retained pixels, the inRange algorithm can be used to filter out the retained pixels from the image. Then, the proportion of the retained pixels in all the pixels contained in the image is calculated. For example, if 4500 retained pixels are obtained and the image contains 5000 pixels, the percentage is 4500 / 5000 = 0.9 = 90%.
[0119] Step S71: If the difference between the first percentage and the second percentage is greater than or equal to the second preset value, then it is determined that the bullet screen has been rendered.
[0120] Step S72: If the difference between the first percentage and the second percentage is less than the second preset value, it is determined that the bullet screen is not rendered.
[0121] Specifically, the second preset value can also be set and adjusted according to the actual situation. For example, the second preset value is 5%.
[0122] In this embodiment, considering the possibility that there may be pixels with pixel values within the preset range in the image, and the influence of the number of bullet comments, after obtaining the first and second percentages of retained pixels in the reference image and the test image, it can be determined whether the test image has been rendered with bullet comments based on the reference image by judging whether the difference is greater than a second preset value. Specifically, if the difference is greater than or equal to the second preset value, it can be determined that the bullet comments have been rendered normally; if the difference is less than the second preset value, it can be determined that the bullet comments have not been rendered normally.
[0123] In one exemplary implementation, to eliminate the influence of factors other than the player on the test results, see [reference needed]. Figure 8 The method further includes:
[0124] Step S80: Record the playback mode of the video to be tested, including full-screen mode, half-screen mode, landscape mode and portrait mode.
[0125] Specifically, when playing the video to be tested through the player, the current playback mode of the video to be tested can be recorded at the same time.
[0126] After the step of extracting a video frame as a test image when the video to be tested reaches a preset progress, the method further includes:
[0127] Step S81: When the playback mode of the video to be tested is half-screen mode, determine whether the playback mode of the video to be tested is landscape mode.
[0128] Specifically, when the video to be tested is played in half-screen mode, since the video is generally played on half the screen, meaning the comments are only displayed on that half, the image needs to be cropped to extract the image containing the comments for subsequent similarity detection. However, the proportion of the screen containing the comments is generally different in landscape and portrait half-screen modes. Therefore, to better crop the image, it is necessary to further determine whether the current playback mode is landscape or portrait.
[0129] Understandably, when the playback mode is full-screen, there is no need to crop the images.
[0130] Step S82: If the playback mode of the video to be tested is landscape mode, the test image is cropped using the first cropping method to obtain the cropped test image.
[0131] Specifically, the first cropping method is set according to the actual situation; for example, the first cropping method is to crop to 1 / 3 of the screen height. After the image is cropped, the cropped image is used as the final test image for comparison.
[0132] It is understandable that if the test image has been cropped, then after obtaining the baseline image, the first cropping method should also be used to crop the baseline image, and the cropped baseline image should be used as the final baseline image for comparison.
[0133] Step S83: If the playback mode of the video to be tested is portrait mode, the test image is cropped using the second cropping method to obtain the cropped test image.
[0134] Specifically, the second cropping method is set according to the actual situation. For example, the second cropping method is to crop according to 1 / 2 of the screen height.
[0135] It is understandable that if the test image has been cropped, then after obtaining the baseline image, the second cropping method should also be used to crop the baseline image, and the cropped baseline image should be used as the final baseline image for comparison.
[0136] It should be noted that all the steps described above in this application can be implemented by having users pre-write automated test scripts and then executing those scripts.
[0137] Specifically, automated scripts for testing bullet screen rendering can be written using automated testing tools. In this embodiment, Appium is preferably used as the automated testing tool. Appium is an open-source automated testing tool used for automating the testing of native applications, mobile web applications, and hybrid applications on iOS phones, Android phones, and Windows desktop platforms. Furthermore, Appium is a cross-platform testing tool, allowing users to write test scripts for multiple platforms (iOS, Android, Windows) using the same API, enabling code reuse across iOS, Android, and Windows test suites. In this embodiment, the pytest framework can be used to write the automated scripts when using Appium. pytest is a mature, full-featured Python testing framework that is simple, flexible, easy to learn, well-documented, supports parameterization, allows fine-grained control over test cases, and supports both simple unit testing and complex functional testing.
[0138] It should be noted that "bullet comments" refer to comments that appear directly on the video. They can appear on the video in the form of scrolling, hovering, or even more special effects. They are short comments sent by people watching the video.
[0139] Among them, the bullet screen rendering test refers to testing whether bullet screens can be rendered normally in video playback applications (APPs).
[0140] A test case is a description of a specific software product testing task, embodying the test plan, methods, techniques, and strategies. Its content includes test objectives, test environment, input data, test steps, expected results, test scripts, etc., ultimately forming a document. Simply put, a test case is a set of test inputs, execution conditions, and expected results compiled for a specific goal to verify whether a particular software requirement is met.
[0141] This embodiment compares the similarity of images captured during video playback at the same playback progress, with and without bullet comments, as baseline and test images respectively. The similarity value is then used to determine whether bullet comments are rendered correctly, improving test accuracy. Furthermore, to further enhance accuracy, both similarity calculation and pixel proportion methods are combined. Experimental results show that the first-stage similarity value test achieves a 90% accuracy rate. Building upon this, a second-stage pixel proportion assessment is performed on the 10% of unrecognized images, resulting in the accurate recognition of 70% of the images. Therefore, in bullet comment recognition scenarios, combining the first and second-stage recognition schemes achieves an overall image recognition accuracy of 97%.
[0142] See Figure 9 The diagram shown is a program block diagram of an embodiment of the bullet screen rendering test device 90 of this application.
[0143] In this embodiment, the bullet screen rendering test device 90 includes a series of computer program instructions stored in a memory. When these computer program instructions are executed by a processor, the bullet screen rendering test functions of the various embodiments of this application can be implemented. In some embodiments, based on the specific operations implemented by each part of the computer program instructions, the bullet screen rendering test device 90 can be divided into one or more modules. Specifically, the modules that can be divided are as follows:
[0144] Playback module 91 is used to play the test video with bullet comments;
[0145] The capture module 92 is used to capture a video frame as a test image when the video to be tested is played to a preset progress. The video frame contains at least one bullet screen.
[0146] The calculation module 93 is used to calculate the similarity value between the test image and the reference image, wherein the reference image is a video frame without bullet comments that is captured when the video to be tested is played to the preset progress.
[0147] The determination module 94 is used to determine that the bullet screen has been rendered if the similarity value is less than a first preset value.
[0148] In an exemplary embodiment, the calculation module 93 is further configured to perform grayscale processing on the test image and the reference image respectively to obtain corresponding first grayscale images and second grayscale images; perform discrete cosine transform on the first grayscale images and the second grayscale images respectively to obtain corresponding first discrete cosine transform images and second discrete cosine transform images; perform binarization processing on the pixels in the first discrete cosine transform images and the second discrete cosine transform images respectively to obtain corresponding first binarized images and second binarized images; and calculate the similarity value between the first binarized images and the second binarized images.
[0149] In an exemplary embodiment, the calculation module 93 is further configured to reduce the size of the test image and the reference image respectively to obtain a corresponding first reduced image and a second reduced image; and to perform grayscale processing on the first reduced image and the second reduced image to obtain a corresponding first grayscale image and a second grayscale image.
[0150] In an exemplary embodiment, the calculation module 93 is further configured to crop a preset region in the upper left corner of the first discrete cosine transform image and the second discrete cosine transform image respectively to obtain a corresponding first matrix image and a second matrix image; and to perform binarization processing on the first matrix image and the second matrix image to obtain a corresponding first binarized image and a second binarized image.
[0151] In an exemplary embodiment, the calculation module 93 is further configured to calculate the Hamming distance between the first binarized image and the second binarized image, and determine the similarity value between the test image and the reference image based on the calculated Hamming distance.
[0152] In an exemplary embodiment, the calculation module 93 is further configured to calculate the proportion of reserved pixels in the test image if the similarity value is greater than or equal to the first preset value, and obtain a first proportion, wherein the reserved pixels are pixels whose pixel values are within a preset range.
[0153] The determination module 94 is also used to determine whether the bullet screen has been rendered based on the first ratio and the preset ratio.
[0154] In an exemplary embodiment, the determination module 94 is further configured to calculate the proportion of reserved pixels in the reference image to obtain a second proportion, and use the second proportion as the preset proportion; if the difference between the first proportion and the second proportion is greater than or equal to the second preset value, it is determined that the bullet screen has been rendered; if the difference between the first proportion and the second proportion is less than the second preset value, it is determined that the bullet screen has not been rendered.
[0155] In one exemplary embodiment, the bullet screen rendering test device 90 further includes a recording module.
[0156] The recording module is used to record the playback mode of the video to be tested, including full-screen mode, half-screen mode, landscape mode and portrait mode.
[0157] The determination module 94 is further configured to determine whether the playback mode of the video under test is landscape mode when the playback mode of the video under test is half-screen mode; if the playback mode of the video under test is landscape mode, the test image is cropped using a first cropping method to obtain a cropped test image; if the playback mode of the video under test is portrait mode, the test image is cropped using a second cropping method to obtain a cropped test image.
[0158] This embodiment compares the similarity of images captured during video playback at the same playback progress, with and without bullet comments, as baseline and test images respectively. The similarity value is then used to determine whether bullet comments are rendered correctly, improving test accuracy. Furthermore, to further enhance accuracy, both similarity calculation and pixel proportion methods are combined. Experimental results show that the first-stage similarity value test achieves a 90% accuracy rate. Building upon this, a second-stage pixel proportion assessment is performed on the 10% of unrecognized images, resulting in the accurate recognition of 70% of the images. Therefore, in bullet comment recognition scenarios, combining the first and second-stage recognition schemes achieves an overall image recognition accuracy of 97%.
[0159] Figure 10 This illustration schematically shows a hardware architecture diagram of a computer device 10 suitable for implementing a bullet screen rendering test method according to an embodiment of this application. In this embodiment, the computer device 10 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. For example, it may be a tablet computer, laptop computer, desktop computer, rack server, blade server, tower server, or cabinet server (including independent servers or server clusters composed of multiple servers), etc. Figure 10 As shown, the computer device 10 includes, but is not limited to, at least: a memory 120, a processor 121, and a network interface 122 that can communicate with each other via a system bus. Wherein:
[0160] The memory 120 includes at least one type of computer-readable storage medium, which can be volatile or non-volatile. Specifically, the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 120 may be an internal storage module of the computer device 10, such as the hard disk or memory of the computer device 10. In other embodiments, the memory 120 may also be an external storage device of the computer device 10, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on the computer device 10. Of course, the memory 120 may also include both the internal storage module and the external storage device of the computer device 10. In this embodiment, the memory 120 is typically used to store the operating system and various application software installed on the computer device 10, such as the program code for the bullet screen rendering test method. In addition, the memory 120 can also be used to temporarily store various types of data that have been output or will be output.
[0161] In some embodiments, processor 121 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other bullet screen rendering test chip. This processor 121 is typically used to control the overall operation of the computer device 10, such as performing control and processing related to data interaction or communication with the computer device 10. In this embodiment, processor 121 is used to run program code stored in memory 120 or process data.
[0162] Network interface 122 may include a wireless network interface or a wired network interface, which is typically used to establish a communication link between computer device 10 and other computer devices. For example, network interface 122 is used to connect computer device 10 to an external terminal via a network, establishing a data transmission channel and communication link between computer device 10 and the external terminal. The network may be an intranet, the Internet, Global System for Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, or other wireless or wired networks.
[0163] It should be pointed out that, Figure 10 Only computer devices with components 120 to 122 are shown; however, it should be understood that it is not required to implement all of the shown components, and more or fewer components may be implemented instead.
[0164] In this embodiment, the bullet screen rendering test method stored in memory 120 can be divided into one or more program modules and executed by one or more processors (processor 121 in this embodiment) to complete this application.
[0165] This application provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements the steps of the bullet screen rendering test method in the embodiment.
[0166] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device. Of course, the computer-readable storage medium can also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the computer-readable storage medium is typically used to store the operating system and various application software installed on the computer device, such as the program code of the bullet screen rendering test method in the embodiment. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or will be output.
[0167] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across at least two network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments of this application. Those skilled in the art can understand and implement this without any creative effort.
[0168] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software and a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0169] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for testing bullet screen rendering, characterized in that, The method includes: Play the test video with bullet comments; When the video to be tested reaches a preset progress, a video frame is captured as a test image, and the video frame contains at least one bullet comment. Calculate the similarity value between the test image and the reference image, wherein the reference image is a video frame that does not contain bullet comments, which is captured when the video to be tested is played to the preset progress. If the similarity value is less than the first preset value, it is determined that the bullet screen has been rendered; The calculation of the similarity value between the test image and the reference image includes: The test image and the reference image are processed to obtain the corresponding first grayscale image and second grayscale image; Perform discrete cosine transform on the first grayscale image and the second grayscale image respectively to obtain the corresponding first discrete cosine transform image and second discrete cosine transform image; The pixels in the first discrete cosine transform image and the second discrete cosine transform image are binarized respectively to obtain the corresponding first binarized image and second binarized image; Calculate the similarity value between the first binarized image and the second binarized image; The step of binarizing the pixel images in the first discrete cosine transform image and the second discrete cosine transform image to obtain the corresponding first binarized image and second binarized image includes: The preset regions in the upper left corner of the first discrete cosine transform image and the second discrete cosine transform image are cropped respectively to obtain the corresponding first matrix image and second matrix image; The first matrix image and the second matrix image are binarized to obtain the corresponding first binarized image and second binarized image; The method further includes: If the similarity value is greater than or equal to the first preset value, the proportion of reserved pixels in the test image is calculated to obtain the first proportion, wherein the reserved pixels are pixels whose pixel values are within a preset range; The first ratio and the preset ratio are used to determine whether the bullet screen has been rendered.
2. The bullet screen rendering test method according to claim 1, characterized in that, The step of performing grayscale processing on the test image and the reference image respectively to obtain the corresponding first grayscale image and second grayscale image includes: The test image and the reference image are respectively reduced in size to obtain the corresponding first reduced image and second reduced image; The first and second reduced images are processed into grayscale to obtain the corresponding first grayscale image and second grayscale image.
3. The bullet screen rendering test method according to claim 1, characterized in that, The calculation of the similarity value between the first binarized image and the second binarized image includes: Calculate the Hamming distance between the first binarized image and the second binarized image, and determine the similarity value between the test image and the reference image based on the calculated Hamming distance.
4. The bullet screen rendering test method according to claim 1, characterized in that, Determining whether the bullet comments have been rendered based on the first proportion and the preset proportion includes: Calculate the proportion of reserved pixels in the reference image to obtain a second proportion, and use the second proportion as the preset proportion; If the difference between the first percentage and the second percentage is greater than or equal to the second preset value, it is determined that the bullet screen has been rendered; If the difference between the first percentage and the second percentage is less than the second preset value, it is determined that the bullet screen is not rendered.
5. The bullet screen rendering test method according to any one of claims 1 to 3, characterized in that, The method further includes: Record the playback mode of the video to be tested, including full-screen mode, half-screen mode, landscape mode, and portrait mode; After the step of extracting a video frame as a test image when the video to be tested reaches a preset progress, the method further includes: When the playback mode of the video to be tested is half-screen mode, determine whether the playback mode of the video to be tested is landscape mode; If the playback mode of the video to be tested is landscape mode, the test image is cropped using the first cropping method to obtain the cropped test image; the first cropping method is to crop according to 1 / 3 of the screen height; If the playback mode of the video to be tested is portrait mode, the test image is cropped using the second cropping method to obtain the cropped test image; the second cropping method is to crop according to 1 / 2 of the screen height.
6. A bullet screen rendering testing device, characterized in that, The bullet screen rendering test device includes: The playback module is used to play the test video with bullet comments; The capture module is used to capture a video frame as a test image when the video to be tested is played to a preset progress. The video frame contains at least one bullet screen. The calculation module is used to calculate the similarity value between the test image and the reference image, wherein the reference image is a video frame without bullet comments that is captured when the video to be tested is played to the preset progress. The determination module is used to determine that the bullet screen has been rendered if the similarity value is less than a first preset value; The calculation of the similarity value between the test image and the reference image includes: The test image and the reference image are processed to obtain the corresponding first grayscale image and second grayscale image; Perform discrete cosine transform on the first grayscale image and the second grayscale image respectively to obtain the corresponding first discrete cosine transform image and second discrete cosine transform image; The pixels in the first discrete cosine transform image and the second discrete cosine transform image are binarized respectively to obtain the corresponding first binarized image and second binarized image; Calculate the similarity value between the first binarized image and the second binarized image; The step of binarizing the pixel images in the first discrete cosine transform image and the second discrete cosine transform image to obtain the corresponding first binarized image and second binarized image includes: The preset regions in the upper left corner of the first discrete cosine transform image and the second discrete cosine transform image are cropped respectively to obtain the corresponding first matrix image and second matrix image; The first matrix image and the second matrix image are binarized to obtain the corresponding first binarized image and second binarized image; This also includes: If the similarity value is greater than or equal to the first preset value, the proportion of reserved pixels in the test image is calculated to obtain the first proportion, wherein the reserved pixels are pixels whose pixel values are within a preset range; The first ratio and the preset ratio are used to determine whether the bullet screen has been rendered.
7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
9. A computer program product comprising computer instructions, characterized in that, When executed by a processor, the computer instructions implement the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
User interface automatic detection method and device
CN106502891A
Mobile application testing method and device, electronic equipment and storage medium
CN109800153A
Differential detection method and device for browser webpage and computer storage medium
CN109949295A