A white screen detection method, device, equipment and medium
By acquiring the RGBA data of the page image and extracting the target foreground and transparent pixels, the problem of universality and accuracy of existing white screen detection methods is solved, and white screen detection under various backgrounds is realized.
Patent Information
- Application Number
- CN202210832435.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-14
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-07-14
AI Technical Summary
Existing white screen detection methods have low versatility and accuracy, making it difficult to effectively detect white screen anomalies under various backgrounds.
By acquiring the RGBA data of the page image, the target foreground pixels and transparent pixels are extracted, and the white screen detection result is determined based on these pixels, taking into account the color value and transparency information of the image.
It improves the versatility and accuracy of white screen detection, and can effectively detect white screen anomalies on transparent backgrounds and solid color backgrounds of various colors.
Smart Images

Figure CN115222693B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a white screen detection method and device, equipment and medium. BACKGROUND
[0002] When an application program or a web program opens a page, abnormality may occur due to various factors, one of which is white screen. This kind of abnormality is difficult to reproduce by technical means, and is usually accidental. It is also difficult for R&D to perceive the white screen problem from the user.
[0003] In the related art, white screen can be checked by the proportion of white pixels. However, this method can only detect pages with white background, and the detection scene has great limitations, low universality and low accuracy. SUMMARY
[0004] To solve the above technical problems, the present disclosure provides a white screen detection method, device, equipment and medium.
[0005] The present disclosure provides a white screen detection method, which comprises the following steps:
[0006] obtaining a page image of a page to be detected;
[0007] determining RGBA data of the page image;
[0008] extracting target foreground pixel points and transparent pixel points of the page image based on the RGBA data;
[0009] determining a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points.
[0010] The present disclosure also provides a white screen detection device, which comprises:
[0011] a obtaining module configured to obtain a page image of a page to be detected;
[0012] a data module configured to determine RGBA data of the page image;
[0013] an extracting module configured to extract target foreground pixel points and transparent pixel points of the page image based on the RGBA data;
[0014] a detection module configured to determine a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points.
[0015] The embodiment of the present disclosure further provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used for reading the executable instructions from the memory and executing the instructions to realize the white screen detection method provided by the embodiment of the present disclosure.
[0016] The embodiment of the present disclosure further provides a computer readable storage medium, which stores a computer program for executing the white screen detection method provided by the embodiment of the present disclosure.
[0017] The technical solution provided by the embodiment of the present disclosure has the following advantages compared with the prior art: the white screen detection scheme provided by the embodiment of the present disclosure acquires a page image of a to-be-tested page; determines RGBA data of the page image; extracts target foreground pixel points and transparent pixel points of the page image based on the RGBA data; and determines a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points. By acquiring the RGBA data of the page image of the to-be-tested page and determining the white screen detection result based on the foreground pixel points and the transparent pixel points extracted from the RGBA data, the color value and the transparency information of the image are considered simultaneously during the white screen detection, the white screen detection in a transparent background and a pure color background of various colors is realized, the universality of the white screen detection is improved, and the accuracy of the white screen detection is further improved. BRIEF DESCRIPTION OF DRAWINGS
[0018] The above and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, same or similar reference numerals represent same or similar elements. It should be understood that the drawings are schematic, and the original and elements are not necessarily drawn according to the scale.
[0019] Figure 1 A flowchart of a white screen detection method provided by the embodiment of the present disclosure is shown in the figure;
[0020] Figure 2 A flowchart of another white screen detection method provided by the embodiment of the present disclosure is shown in the figure;
[0021] Figure 3 A structure diagram of a white screen detection device provided by the embodiment of the present disclosure is shown in the figure;
[0022] Figure 4 A structure diagram of an electronic device provided by the embodiment of the present disclosure is shown in the figure. DETAILED DESCRIPTION
[0023] Embodiments of the present disclosure will be described below in greater detail with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be interpreted as being limited to the embodiments set forth herein; rather, these embodiments are provided so as to facilitate more complete and thorough comprehension of the present disclosure. It is understood that the drawings and embodiments of the present disclosure are merely for exemplary purposes and should not be used to limit the scope of protection of the present disclosure.
[0024] It should be understood that each step recited in the method embodiments of the present disclosure can be performed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0025] As used herein, the term "comprising" and variations thereof, are intended to mean "including but not limited to". The term "based on" is intended to mean "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Related terms are to be construed accordingly.
[0026] It should be noted that the terms "first", "second", and the like in the present disclosure are merely used to distinguish different devices, modules or units, and do not imply the order or interdependence of the functions performed by these devices, modules or units.
[0027] It should be noted that the terms "one", "multiple" in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that "one" or "multiple" should be understood as "one or more" unless otherwise explicitly stated in the context.
[0028] The names of the messages or information exchanged between the devices in the embodiments of the present disclosure are merely for illustrative purposes and are not intended to limit the scope of the messages or information.
[0029] Figure 1 A flowchart of a white screen detection method according to an embodiment of the present disclosure is shown in FIG. 1. The method can be performed by a white screen detection device, which can be implemented by software and / or hardware and can be integrated in an electronic device. As shown in FIG. 1, the method includes the following steps. Figure 1
[0030] Step 101: Obtain a page image of a page to be tested.
[0031] The to-be-tested page can be a page in an application program or an Internet web page, and the page image can be an image obtained by taking a screenshot of the screen when the to-be-tested page is displayed on the current device.
[0032] In some embodiments, obtaining the page image of the to-be-tested page can include taking a screenshot of the to-be-tested page by a system screenshot component to obtain the page image. The system screenshot component can be a screenshot component of an operating system of the current device. After the to-be-tested page is displayed, the white screen detection apparatus can call the system screenshot component to take a screenshot of the to-be-tested page to obtain the page image. The system screenshot component is used to obtain the page image, which avoids the limitation on the to-be-tested page and improves the versatility.
[0033] Optionally, when the to-be-tested page is a page of an application program, a screenshot module of the application program can also be called to take a screenshot of the to-be-tested page to obtain the page image; and when the to-be-tested page is a web page, a web snapshot interface can also be called to take a screenshot of the to-be-tested page to obtain the page image.
[0034] Step 102, determining RGBA data of the page image.
[0035] The RGBA data can include Red (red), Green (green), Blue (blue) and Alpha channel data. Each pixel point in the page image has the above four data. RGB represents the color value of the color space. The Alpha channel can be an inherent attribute of the image, which is used to record the transparency information of the image. The Alpha channel can be represented by a percentage, an integer or a real number from 0 to 255. When represented by a percentage, if the value of the Alpha channel of a pixel point is 0%, it is completely transparent (that is, invisible), and a value of 100% means a completely opaque.
[0036] In some embodiments, determining the RGBA data of the page image can include converting the page image into a bitmap context and extracting the RGBA data of each pixel point from the bitmap context.
[0037] The bitmap context can be used to draw an image into a bitmap object, and can store image information and image state. A bitmap, also known as a dot matrix image or raster image, is composed of individual points of pixels.
[0038] After obtaining the page image of the page to be detected, the white screen detection apparatus can first convert the page image into a bitmap context, and then obtain the RGBA data of each pixel point of the page image based on the bitmap context. Optionally, the white screen detection apparatus can also parse the page image through a parser to obtain the RGBA data of each pixel point.
[0039] In step 103, the target foreground pixel points and the transparent pixel points of the page image are extracted based on the RGBA data.
[0040] The target foreground pixel points can be pixel points including main features in the page image, for example, the pixel points where a house is located are foreground pixel points in a page image including a house and a white background. In the embodiments of the present disclosure, the target foreground pixel points include first foreground pixel points or second foreground pixel points. The transparent pixel points can be pixel points whose Alpha channel values represent transparency in the page image.
[0041] In some embodiments, the target foreground pixel points include the first foreground pixel points, and the extraction of the foreground pixel points of the page image based on the RGBA data can include: determining the color values of each pixel point in the page image based on the RGBA data; determining target color values whose color value proportions are greater than a preset threshold, and determining the pixel points corresponding to the color values other than the target color values as the first foreground pixel points.
[0042] The color values can represent the RGB data in the RGBA data, and the transparent pixel points are assigned black color in the color values. The preset threshold can be a proportion threshold set for the color value proportion, and the color value proportion can be a proportion of the pixel points of a color value to the total number of pixel points, which can be set according to actual conditions, for example, the preset threshold can be set to 50%. The first foreground pixel points can be foreground pixel points determined based on the color values of the page image, which focuses on the color values and converts transparency in the transparency information to black color in the color values.
[0043] Specifically, when extracting the foreground pixel points of the page image, the white screen detection apparatus can first determine the color values of each pixel point in the page image based on the RGBA data, assign the transparent pixel points to black color in the color values, determine the proportion of the pixel points of each color value to the total number of pixel points, i.e., the color value proportion, compare each color value proportion with the preset threshold, determine the target color values whose color value proportions are greater than the preset threshold, and the pixel points of the target color values are background pixel points, at this time, the color value of the background pixel points is a pure color, and the pixel points corresponding to the color values other than the target color values in the page image are determined as the first foreground pixel points. For example, assuming that the preset threshold is 50% and the color value proportion of black color is greater than 50%, the pixel points corresponding to the color values other than black color are determined as the first foreground pixel points.
[0044] In some embodiments, the target foreground pixel point comprises a second foreground pixel point, and the extracting foreground pixel points of the page image based on the RGBA data can comprise: determining a background pixel point of the page image based on the color value in the RGBA data; comparing each pixel point of the page image with the RGBA data of the background pixel point to obtain a comparison result; and determining the pixel points with different comparison results as the second foreground pixel points.
[0045] The background pixel point can be an initial background pixel point determined based on the color value of the page image. Alternatively, the background pixel point can also be a pixel point corresponding to preset RGBA data, for example, the background pixel point can be a pixel point corresponding to red RGB and 100% value of the Alpha channel. The second foreground pixel point can be a foreground pixel point determined based on the color value and the value of the Alpha channel of the page image, in which case the transparency information represented by the Alpha channel is considered.
[0046] Specifically, when extracting the foreground pixel points of the page image, the white screen detection device can obtain the preset RGBA data and determine the corresponding pixel point as the initial background pixel point at this time, or determine the background pixel point based on the color value in the RGBA data. For details, refer to the above-mentioned determination of the pixel point corresponding to the target color value as the initial background pixel point at this time. Then, the RGBA data of each pixel point of the page image can be compared with the RGBA data of the initial background pixel point, in which case the data of the four channels of RGBA are compared when comparing, and it is determined whether they are the same to obtain a comparison result. If the RGBA data of a pixel point and the RGBA data of the initial background pixel point are the same, the comparison result is the same. If the RGBA data of a pixel point and the RGBA data of the initial background pixel point are different, the comparison result is different. The pixel points of the page image that are different from the RGBA data of the initial background pixel point are determined as the second foreground pixel points, in which case the difference means that at least one of the data of the four channels of RGBA is different.
[0047] It can be understood that the first foreground pixel point is a pixel point different from the RGB data of the background pixel point, and the transparency information is not considered, while the second foreground pixel point is a pixel point different from the RGBA data of the background pixel point, and the transparency information is considered. Therefore, the second foreground pixel point and the first foreground pixel point are different in the case of the same background pixel point.
[0048] In the above scheme, when extracting the foreground pixel points of the page image, the color value and the color value plus the transparency information can be used to determine, which not only considers the case of a pure color background of a color, but also considers the case of a transparent background, thereby improving the universality of subsequent white screen detection.
[0049] Step 104, determining the white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points.
[0050] In the embodiments of the present disclosure, after extracting the target foreground pixel points and the transparent pixel points of the page image, the white screen detection device can determine the white screen detection result according to the number of target foreground pixel points, the number of transparent pixel points and the number of total pixel points.
[0051] For example, Figure 2 The flowchart of another white screen detection method provided by the embodiments of the present disclosure is shown in Figure 2 As shown, in a possible implementation, determining the white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points can include the following steps:
[0052] Step 201, determining whether the white screen detection result of the page image is white screen based on the first pixel points, if yes, executing step 202; otherwise, executing step 205.
[0053] The first pixel points can be target foreground pixel points or transparent pixel points, and the target foreground pixel points include first foreground pixel points or second foreground pixel points.
[0054] Specifically, the white screen detection device can first determine whether the white screen detection result of the page image is white screen based on the first pixel points. Specifically, when the first pixel points are the first foreground pixel points or the second foreground pixel points, if the ratio of the first foreground pixel points or the second foreground pixel points to the total pixel points is less than the foreground threshold, the white screen detection result of the page image is white screen, and then step 202 is executed; if the ratio of the first foreground pixel points or the second foreground pixel points to the total pixel points is greater than or equal to the foreground threshold, step 205 is executed. Alternatively, when the first pixel points are transparent pixel points, if the ratio of the transparent pixel points to the total pixel points is greater than the transparent threshold, the white screen detection result of the page image is white screen, and then step 202 is executed; otherwise, step 205 is executed.
[0055] The foreground threshold can be a threshold of the number ratio for white screen detection set for the target foreground pixel points, i.e. the first foreground pixel points or the second foreground pixel points, which is set according to actual conditions, for example, the foreground threshold can be set to 5%. When the ratio of the target foreground pixel points to the total pixel points is less than the foreground threshold, it is preliminarily confirmed that the white screen detection result is white screen, but the result can be inaccurate and needs to be verified by executing step 202; when the ratio of the target foreground pixel points to the total pixel points is greater than or equal to the foreground threshold, step 205 can be directly executed without calibration.
[0056] When the ratio of the target foreground pixels to the total number of pixels is less than the foreground threshold in the above scheme, it indicates that the foreground content occupies a very low proportion, for example, the page shows not specific page content but special prompt information or prompt icon, the foreground content occupies a low proportion, which can be considered as white screen problem, therefore, the white screen detection can be performed by comparing the ratio of the target foreground pixels to the total number of pixels with a threshold.
[0057] The transparent threshold is a threshold of the ratio of the transparent pixels to the total number of pixels for white screen detection, and the transparent threshold includes a first transparent threshold or a second transparent threshold, the second transparent threshold is greater than the first transparent threshold, if the target foreground pixel is the first foreground pixel, the transparent threshold is the first transparent threshold; if the target foreground pixel is the second foreground pixel, the transparent threshold is the second transparent threshold. The first transparent threshold can be set to 50%, and the second transparent threshold can be set to 95%, for example. When the ratio of the transparent pixels to the total number of pixels is greater than the transparent threshold, it is preliminarily determined that the white screen detection result is white screen, but the result can be inaccurate, and needs to be verified in step 202; when the ratio of the transparent pixels to the total number of pixels is less than or equal to the transparent threshold, step 205 can be directly executed without calibration.
[0058] Since the transparent pixels are assigned a black color value when determining the first foreground pixel, the black color value statistics may incorrectly include the transparent pixels, so the first transparent threshold set for the transparent pixels can be smaller; when determining the second foreground pixel, the actual difference in transparency information is considered, and the transparency information is not converted into a color value, so the second transparent threshold set for the transparent pixels can be larger than the first transparent threshold. When the pixel points of the page image exceeding the transparent threshold are transparent, it is considered that the proportion of non-transparent pixel points is small and cannot carry effective page content, and it is considered that the page image at this time is invalid image, which can be considered as white screen, so the white screen detection can be performed by the ratio of the transparent pixels to the total number of pixels.
[0059] In step 202, the white screen detection result of the white screen is verified based on the second pixel point to obtain a verification result.
[0060] The second pixel point can be the target foreground pixel or the transparent pixel, which is different from the first pixel point. Since the target foreground pixel includes the first foreground pixel or the second foreground pixel, when the first pixel point is the first foreground pixel or the second foreground pixel, the second pixel point is the transparent pixel; or, when the first pixel point is the transparent pixel, the second pixel point is the first foreground pixel or the second foreground pixel.
[0061] When the white screen detection device checks the white screen detection result of the second pixel point, the checking manner is the same as the manner of determining the white screen detection result based on the target foreground pixel point or the transparent pixel point in step 201, and details are not repeated here. The checking result can be whether the white screen detection result of the page image at this time is still white screen.
[0062] In step 203, it is determined whether the checking result is passed. If yes, step 204 is performed; otherwise, step 205 is performed.
[0063] When the white screen detection result determined based on the second pixel point is still white screen, it is determined that the checking result is passed, and then step 204 can be performed; otherwise, it is determined that the checking result is not passed, and then step 205 can be performed.
[0064] In step 204, it is determined that the white screen detection result of the page image is white screen.
[0065] When the white screen detection result of the page image is determined based on the target foreground pixel point and the transparent pixel point respectively, and it is determined that the white screen detection result is white screen, it can be determined that the final result is white screen.
[0066] In step 205, it is determined that the white screen detection result of the page image is non-white screen.
[0067] When the white screen detection result is determined to be non-white screen based on the target foreground pixel point or the background pixel point in step 201, it is not necessary to check, and the final result can be determined to be non-white screen. When the white screen detection result is determined to be white screen based on one of the target foreground pixel point and the background pixel point in step 201 and step 202, and the white screen detection result is determined to be non-white screen based on the other, the final white screen detection result is determined to be non-white screen.
[0068] In the above scheme, when the white screen detection result is determined based on the target foreground pixel point and the transparent pixel point, and the result of one of them is white screen, the other needs to be checked for white screen. When the checking is passed, the final result is determined to be white screen. When the result of any one is non-white screen, it is not necessary to check. This manner can detect white screen under various color pure backgrounds and transparent backgrounds, has wide detection coverage, improves the universality of white screen detection, and effectively improves the accuracy of white screen detection.
[0069] The white screen detection scheme provided by the embodiments of the present disclosure includes: obtaining a page image of a page to be detected; determining RGBA data of the page image; extracting target foreground pixel points and transparent pixel points of the page image based on the RGBA data; and determining a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points. By obtaining the RGBA data of the page image of the page to be detected, and determining the white screen detection result based on the foreground pixel points and the transparent pixel points extracted from the RGBA data, the color value and the transparency information of the image are considered simultaneously during the white screen detection, the white screen detection under a transparent background and a full-color background is implemented, the universality of the white screen detection is improved, and the accuracy of the white screen detection is further improved.
[0070] In some embodiments, after the page image of the page to be detected is obtained, the white screen detection method can further include: reducing the page image from an original size to a preset size, where a ratio of the preset size to the original size is a preset ratio. The preset ratio can be set according to actual conditions, for example, the preset ratio can be set to 1 / 5 or 1 / 6, that is, the preset size accounts for 1 / 5 or 1 / 6 of the original size.
[0071] After the image of the page that needs to be subjected to white screen detection is obtained, the image can be first reduced to reduce the number of pixel points in subsequent processing, thereby accelerating the traversal speed and improving the efficiency of white screen detection.
[0072] Figure 3 A structural diagram of a white screen detection device provided by the embodiments of the present disclosure is shown in FIG. 3. The device can be implemented by software and / or hardware, and can be integrated in an electronic device. As shown in FIG. 3, the device includes: Figure 3
[0073] The obtaining module 301 is configured to obtain a page image of a page to be detected.
[0074] The data module 302 is configured to determine RGBA data of the page image.
[0075] The extraction module 303 is configured to extract target foreground pixel points and transparent pixel points of the page image based on the RGBA data.
[0076] The detection module 304 is configured to determine a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points.
[0077] Optionally, the target foreground pixel points include first foreground pixel points, and the extraction module 303 includes a first unit configured to:
[0078] determine a color value of each pixel point in the page image based on the RGBA data.
[0079] determine a target color value with a color value proportion greater than a preset threshold, and determine a pixel point corresponding to a color value other than the target color value as the first foreground pixel point.
[0080] Optionally, the target foreground pixel point includes a second foreground pixel point, and the extraction module 303 includes a second unit configured to:
[0081] determine a background pixel point of the page image based on the color value in the RGBA data;
[0082] compare each pixel point of the page image with the RGBA data of the background pixel point to obtain a comparison result;
[0083] determine a pixel point with a different comparison result as the second foreground pixel point.
[0084] Optionally, the detection module 304 includes:
[0085] a first detection unit configured to, when a white screen detection result of the page image is determined based on a first pixel point, verify the white screen detection result of the white screen based on a second pixel point to obtain a verification result;
[0086] a second detection unit configured to, when the verification result is a verification pass, determine that the white screen detection result of the page image is a white screen, and when the verification result is a verification fail, determine that the white screen detection result of the page image is a non-white screen.
[0087] When the first pixel point is the first foreground pixel point or the second foreground pixel point, the second pixel point is the transparent pixel point; or when the first pixel point is the transparent pixel point, the second pixel point is the first foreground pixel point or the second foreground pixel point.
[0088] Optionally, the first detection unit is configured to:
[0089] When the first pixel point is the first foreground pixel point or the second foreground pixel point, when a ratio of the first foreground pixel point or the second foreground pixel point to the total number of pixel points is less than a foreground threshold, the white screen detection result of the page image is a white screen.
[0090] Or, when the first pixel point is the transparent pixel point, when a ratio of the transparent pixel point to the total number of pixel points is greater than a transparent threshold, the white screen detection result of the page image is a white screen.
[0091] Optionally, the transparent threshold includes a first transparent threshold or a second transparent threshold, and the second transparent threshold is greater than the first transparent threshold.
[0092] If the target foreground pixel point is the first foreground pixel point, the transparent threshold is the first transparent threshold; if the target foreground pixel point is the second foreground pixel point, the transparent threshold is the second transparent threshold.
[0093] Optionally, the acquisition module 301 is configured to:
[0094] The system screenshot component takes a screenshot of the page to be tested to obtain a page image.
[0095] Optionally, the data module 302 is configured to:
[0096] The page image is converted into a bitmap context, and the RGBA data of each pixel point is extracted from the bitmap context.
[0097] Optionally, the apparatus further includes a reduction module configured to, after the page image of the page to be tested is acquired,
[0098] The page image is reduced from an original size to a preset size, wherein the ratio of the preset size to the original size is a preset ratio.
[0099] The white screen detection apparatus provided by the embodiments of the present disclosure can execute the white screen detection method provided by any of the embodiments of the present disclosure, and has the corresponding function modules and beneficial effects of the execution method.
[0100] The embodiments of the present disclosure further provide a computer program product, which includes computer programs / instructions, and the computer programs / instructions are executed by a processor to implement the white screen detection method provided by any of the embodiments of the present disclosure.
[0101] Figure 4 A structural schematic diagram of an electronic device provided by the embodiments of the present disclosure is provided. The following specifically refers to Figure 4 which shows a structural schematic diagram of an electronic device 400 suitable for being used to implement the embodiments of the present disclosure. The electronic device 400 in the embodiments of the present disclosure can include but is not limited to a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet Personal Computer), a PMP (Portable Multimedia Player), a vehicle terminal (for example, a vehicle navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. Figure 4 The electronic device shown is only an example, and should not bring any limitation to the functions and use range of the embodiments of the present disclosure.
[0102] As Figure 4As shown, the electronic device 400 can include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401 that can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 402 or loaded into a random access memory (RAM) 403 from a storage device 408. Various programs and data required for the operation of the electronic device 400 are also stored in the RAM 403. The processing device 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0103] Generally, the following devices can be connected to the I / O interface 405: input devices 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 408 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 409. The communication devices 409 can allow the electronic device 400 to communicate wirelessly or wired with other devices to exchange data. Although Figure 4 The electronic device 400 is shown with various devices, but it should be understood that all of the illustrated devices are not required to implement or have the electronic device. More or less devices can alternatively be implemented.
[0104] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication devices 409, or installed from the storage devices 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-described functions defined in the white screen detection method of embodiments of the present disclosure are performed.
[0105] It should be noted that the computer-readable medium described above can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program used by or in connection with an instruction execution system, apparatus or device. In the present disclosure, the computer-readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave in a propagated data signal, in which the computer-readable program code is contained. Such a propagated data signal can take many forms, including but not limited to, an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium that can send, propagate or transfer the program for use by or in connection with the instruction execution system, apparatus or device. The program code contained in the computer-readable medium can be transmitted by any suitable medium, including but not limited to, wire, cable, RF (radio frequency), etc., or any suitable combination of the above.
[0106] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.
[0107] The computer-readable medium described above can be included in the electronic device described above; or can exist separately from the electronic device, and is not assembled into the electronic device.
[0108] The computer readable medium described above carries one or more programs, when the one or more programs are executed by the electronic device, cause the electronic device to: acquire a page image of a page to be tested; determine RGBA data of the page image; extract target foreground pixel points and transparent pixel points of the page image based on the RGBA data; and determine a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points.
[0109] Computer program code for carrying out operations of the present disclosure can be written in any one or more programming languages, including object oriented programming languages, such as Java, Smalltalk, C++, or conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0110] The flow diagrams and the block diagrams in the drawings are illustrations of architectures, functionalities, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of present disclosure. In this regard, each block in the flow diagrams or block diagrams can represent a module, a procedure, or a part of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in a different order than that noted in the figures. For example, two blocks noted in succession can in fact be executed substantially concurrently or in the opposite order, depending on the functionality involved. It should also be noted that each block in the block diagrams and / or flow diagrams, and combinations of blocks in the block diagrams and / or flow diagrams, can be implemented by dedicated hardware-based systems that perform the specified functions or operations, or can be implemented by a combination of dedicated hardware-based systems and computer instructions.
[0111] The units described in the embodiments of the present disclosure can be implemented by software, or by hardware. In some cases, the names of the units do not constitute a limitation on the units themselves.
[0112] The functionality described above in this document can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, non- transitory machine-readable media can include RAM, ROM, programmable ROM (EPROM, EEPROM or flash memory), or any other storage device(s) through which program instructions can be stored and executed by a processing unit. The above described functions can be implemented as software modules or software functions using object-oriented design methodology, or using any other suitable programming technique.
[0113] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more of: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0114] The foregoing description merely exemplifies the preferred embodiments of the disclosure and the principles of the technology applied. It is understood by those skilled in the art that the disclosed scope of the disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and also covers other technical solutions formed by any combinations of the above technical features or equivalent features thereof without departing from the above disclosed concept. For example, the technical solutions formed by the mutual replacement of the above features and the technical features disclosed in the disclosure (but not limited to) having similar functions.
[0115] Further, while operations are depicted in a particular order, this should not be understood as requiring performance of such operations in the particular order shown or in sequential order, as some steps can be performed in different orders, or omitted altogether, such as in other embodiments. Likewise, the above described embodiments illustrate exemplary implementations of the present disclosure. Each of the described embodiments can be implemented in combination with one another, or in combination with other embodiments disclosed herein. Similarly, other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the present disclosure disclosed herein. Furthermore, it is intended that the scope of the present disclosure, and claims hereinafter provided, include such alternate embodiments. In addition, while the above descriptions have focused on particular combinations, it should be understood that the present disclosure can include other combinations. For example, the features of one embodiment can be interchanged with features of another embodiment. In addition, certain features can be implemented independently of others on an embodiment.
[0116] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.
Claims
1. A white screen detection method, characterized by, The method comprises the following steps: acquiring a page image of a page to be tested; determining RGBA data of the page image; extracting target foreground pixel points and transparent pixel points of the page image based on the RGBA data; determining a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points; the target foreground pixel points comprise first foreground pixel points or second foreground pixel points, and the determination of the white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points comprises the following steps: when it is determined that the white screen detection result of the page image based on a first pixel point is a white screen, the white screen detection result of the white screen is verified based on a second pixel point to obtain a verification result; when the verification result is a verification pass, it is determined that the white screen detection result of the page image is a white screen; and when the verification result is a verification fail, it is determined that the white screen detection result of the page image is a non-white screen; wherein, when the first pixel point is the first foreground pixel point or the second foreground pixel point, the second pixel point is the transparent pixel point; or when the first pixel point is the transparent pixel point, the second pixel point is the first foreground pixel point or the second foreground pixel point.
2. The method of claim 1, wherein, The extraction of the target foreground pixel points of the page image based on the RGBA data comprises the following steps: determining color values of each pixel point in the page image based on the RGBA data; determining target color values with a color value proportion greater than a preset threshold value, and determining pixel points corresponding to color values other than the target color values as the first foreground pixel points.
3. The method of claim 1, wherein, The extraction of the target foreground pixel points of the page image based on the RGBA data comprises the following steps: determining background pixel points of the page image based on color values in the RGBA data; comparing each pixel point of the page image with RGBA data of the background pixel points to obtain a comparison result; determining pixel points with different comparison results as the second foreground pixel points.
4. The method of claim 1, wherein, The determination of the white screen detection result of the page image based on the first pixel point as a white screen comprises the following steps: when the first pixel point is the first foreground pixel point or the second foreground pixel point, if a proportion of the first foreground pixel point or the second foreground pixel point in the total pixel points is less than a foreground threshold value, the white screen detection result of the page image is a white screen; or, when the first pixel point is the transparent pixel point, if a proportion of the transparent pixel point in the total pixel points is greater than a transparent threshold value, the white screen detection result of the page image is a white screen.
5. The method of claim 4, wherein, The transparent threshold value comprises a first transparent threshold value or a second transparent threshold value, and the second transparent threshold value is greater than the first transparent threshold value; when the target foreground pixel point is the first foreground pixel point, the transparent threshold value is the first transparent threshold value; when the target foreground pixel point is the second foreground pixel point, the transparent threshold value is the second transparent threshold value.
6. The method of claim 1, wherein, The acquisition of the page image of the page to be tested comprises the following steps: capturing the page to be tested through a system screenshot component to obtain a page image.
7. The method of claim 1, wherein, The determination of the RGBA data of the page image comprises the following steps: Convert the page image into a bitmap context, and extract the RGBA data of each pixel point from the bitmap context.
8. The method of claim 1, wherein, After the page image of the page to be tested is obtained, the method further comprises: The page image is reduced from an original size to a preset size, wherein a ratio of the preset size to the original size is a preset ratio.
9. A white screen detection apparatus, characterized by comprising: Comprise: The acquisition module is configured to acquire a page image of a page to be tested. The data module is configured to determine RGBA data of the page image. The extraction module is configured to extract target foreground pixel points and transparent pixel points of the page image based on the RGBA data. The detection module is configured to determine a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points. The target foreground pixel points comprise first foreground pixel points or second foreground pixel points, and the detection module comprises: The first detection unit is configured to, when it is determined based on a first pixel point that the white screen detection result of the page image is a white screen, verify a white screen detection result of the white screen based on a second pixel point to obtain a verification result. The second detection unit is configured to, when the verification result is a verification pass, determine that the white screen detection result of the page image is a white screen, and when the verification result is a verification fail, determine that the white screen detection result of the page image is a non-white screen. When the first pixel point is the first foreground pixel point or the second foreground pixel point, the second pixel point is the transparent pixel point, or when the first pixel point is the transparent pixel point, the second pixel point is the first foreground pixel point or the second foreground pixel point.
10. An electronic device, comprising: The electronic device comprises: A processor; A memory for storing executable instructions of the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the white screen detection method of any one of claims 1-8.
11. A computer readable storage medium, characterized in that, The storage medium stores a computer program, and the computer program is configured to execute the white screen detection method of any one of claims 1-8. The storage medium stores a computer program, and the computer program is configured to execute the white screen detection method of any one of claims 1-8.
Citation Information
Patent Citations
Image main body extraction method and device
CN107123127A
Applet page control method and device, equipment and medium
CN111858303A