CN115222693A - White screen detection method, device, equipment and medium - Google Patents
White screen detection method, device, equipment and medium Download PDFInfo
- Publication number
- CN115222693A CN115222693A CN202210832435.7A CN202210832435A CN115222693A CN 115222693 A CN115222693 A CN 115222693A CN 202210832435 A CN202210832435 A CN 202210832435A CN 115222693 A CN115222693 A CN 115222693A
- Authority
- CN
- China
- Prior art keywords
- white screen
- page image
- pixel points
- screen detection
- pixel point
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10024—Color image
Landscapes
- Engineering & Computer Science (AREA)
- Quality & Reliability (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Analysis (AREA)
Abstract
The embodiment of the disclosure relates to a white screen detection method, a white screen detection device, white screen detection equipment and a white screen detection medium, wherein the method comprises the following steps: acquiring a page image of a page to be detected; determining RGBA data of a page image; extracting target foreground pixel points and transparent pixel points of the page image based on 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 adopting the technical scheme, the RGBA data of the page image of the page to be detected is obtained, the white screen detection result is determined based on the foreground pixel points and the transparent pixel points extracted from the RGBA data, and the color value and the transparency information of the image are simultaneously considered during white screen detection, so that the white screen detection of the transparent background and the white screen under all color backgrounds is realized, the universality of the white screen detection is improved, and the accuracy of the white screen detection is further improved.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a white screen detection method, apparatus, device, and medium.
Background
When an application program or a webpage program opens a page, lunar anomalies can be caused due to various factors, wherein one anomaly is a white screen, the anomalies are difficult to reproduce through technical means and usually occur accidentally, and the problem of the white screen is difficult to perceive in research and development.
In the related art, the white screen can be checked through the white pixel proportion, but the method can only detect the page with the white background, the detection scene is very limited, the universality is low, and the detection accuracy is low.
Disclosure of Invention
In order to solve the technical problem, the present disclosure provides a white screen detection method, device, apparatus, and medium.
The embodiment of the disclosure provides a white screen detection method, which comprises the following steps:
acquiring 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.
The embodiment of the present disclosure further provides a white screen detection device, the device includes:
the acquisition module is used for acquiring a page image of a page to be detected;
the data module is used for determining RGBA data of the page image;
the extraction module is used for extracting target foreground pixel points and transparent pixel points of the page image based on the RGBA data;
and the detection module is used for determining a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points.
An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing the processor-executable instructions; 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 disclosure.
The embodiment of the present disclosure also provides a computer-readable storage medium, where a computer program is stored, where the computer program is used to execute the white screen detection method provided by the embodiment of the present disclosure.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages: according to the white screen detection scheme provided by the embodiment of the disclosure, a page image of a page to be detected is obtained; determining RGBA data of a page image; extracting target foreground pixel points and transparent pixel points of the page image based on 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 adopting the technical scheme, the RGBA data of the page image of the page to be detected is obtained, the white screen detection result is determined based on the foreground pixel points and the transparent pixel points extracted from the RGBA data, and the color value and the transparency information of the image are simultaneously considered during white screen detection, so that white screen detection of a transparent background and pure color backgrounds of various colors is realized, the universality of white screen detection is improved, and the accuracy of white screen detection is further improved.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 is a schematic flow chart of a white screen detection method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart of another white screen detection method provided in the embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a white screen detection device according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "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". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Fig. 1 is a flowchart illustrating a white screen detection method according to an embodiment of the present disclosure, where the white screen detection method may be executed by a white screen detection apparatus, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in an electronic device. As shown in fig. 1, the method includes:
The page to be detected may be a page that needs to be subjected to white screen detection and is displayed to a user in the current device, and the page to be detected may be a page in an application program or an internet web page, and is not limited specifically. The page image may be an image obtained by capturing a screen when the current device displays the page to be measured.
In some embodiments, acquiring a page image of a page to be detected may include: and (4) carrying out screenshot on the page to be detected through the system screenshot component to obtain a page image. The system screenshot component can be a screenshot component of an operating system of the current equipment, and after the white screen detection device displays the page to be detected, the system screenshot component can be called to perform screenshot on the page to be detected, and a page image is obtained. The method for acquiring the page image by the system screenshot component avoids the limitation on the page to be detected, and improves the universality.
Optionally, when the page to be tested is the page of the application program, a screenshot module of the application program can be called to screenshot the page to be tested to obtain a page image; and when the page to be detected is a web page, the web snapshot interface can be called to capture the screenshot of the page to be detected to obtain a page image.
The RGBA data may be data including Red (Red), green (Green), blue (Blue) and Alpha channels, each pixel point in the page image has the above four data, RGB represents a color value of a color space, the Alpha channel may be an attribute inherent in the image and is used for recording transparency information of the image, the Alpha channel may be represented by a percentage, an integer or a real number from 0 to 255, and when the percentage representation is adopted, if the value of the Alpha channel of a pixel point is 0%, it is completely transparent (i.e., invisible), and a value of 100% means complete opacity.
In some embodiments, determining RGBA data for the page image may include: and converting the page image into a bitmap context, and extracting RGBA data of each pixel point from the bitmap context.
The Bitmap Context (Bitmap Graphics Context) can be used to draw an image into a Bitmap object, and can store image information and image status, and the Bitmap, also called a dot matrix image or a raster image, is composed of single points of pixels.
After the white screen detection device acquires the page image of the page to be detected, the page image can be converted into a bitmap context, and then RGBA data of each pixel point of the page image can be acquired based on the bitmap context. Optionally, the white screen detection device may further analyze the page image through an analyzer to obtain RGBA data of each pixel point.
103, extracting target foreground pixel points and transparent pixel points of the page image based on the RGBA data.
The target foreground pixel point may be a pixel point including main features in the page image, for example, the page image includes a house and a white background, and the pixel point where the house is located is the foreground pixel point. In the embodiment of the disclosure, the target foreground pixel points include a first foreground pixel point or a second foreground pixel point. The transparent pixel points can be pixel points with transparent value characteristics of Alpha channels in a plurality of pixel points included in the page image.
In some embodiments, the target foreground pixel includes a first foreground pixel, and extracting a foreground pixel of the page image based on the RGBA data may include: determining the color value of each pixel point in the page image based on the RGBA data; and determining a target color value with the color value ratio larger than a preset threshold value, and determining pixel points corresponding to other color values except the target color value as first foreground pixel points.
The color value may represent RGB data in the RGBA data, and the transparent pixel point is assigned to black in the color value. The preset threshold may be a ratio threshold set for the color value ratio, and the color value ratio may be a ratio of the number of pixels of one color value to the total number of pixels, and may be specifically set according to an actual situation, for example, the preset threshold may be set to 50%. The first foreground pixel point may be a foreground pixel point determined based on a color value of the page image, and the transparency in the transparency information may be converted into black in the color value with emphasis on the color value at this time.
Specifically, when the white screen detection device extracts foreground pixels of a page image, the color value of each pixel of the page image can be determined based on RGBA data, a transparent pixel is given black in the color values, the number ratio of the pixel of each color value to the total pixels is determined, namely, the color value ratio, each color value ratio is compared with a preset threshold value, a target color value of which the color value ratio is greater than the preset threshold value is determined, the pixel of the target color value is a background pixel, the color value of the background pixel is a pure color, and pixels corresponding to other color values except the target color value in the page image are determined to be a first foreground pixel. For example, if the preset threshold is 50% and the ratio of the black color value is greater than 50%, determining the pixel points corresponding to the other color values except for black as the first foreground pixel points.
In other embodiments, the target foreground pixel includes a second foreground pixel, and extracting a foreground pixel of the page image based on the RGBA data may include: 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 a background pixel point to obtain a comparison result; and determining the pixel points with different comparison results as second foreground pixel points.
The background pixel points may be initial background pixel points determined based on color values of the page image. Optionally, the background pixel point may also be a pixel point corresponding to preset RGBA data, for example, the background pixel point may be a pixel point corresponding to which RGB is red and the value of the Alpha channel is 100%. The second foreground pixel points can be foreground pixel points determined based on the color values of the page image and the values of the Alpha channels, and at the moment, transparency information represented by the Alpha channels is taken into consideration.
Specifically, when extracting foreground pixels of a page image, the white screen detection device may acquire preset RGBA data and determine corresponding pixels as initial background pixels at this time, or determine background pixels based on color values in the RGBA data, where in a specific determination manner, reference is made to the above-mentioned first foreground pixels, and pixels corresponding to a target color value when determining are initial background pixels at this time; comparing the RGBA data of each pixel point of the page image with the RGBA data of the initial background pixel point, comparing the RGBA data of four channels during comparison, judging whether the RGBA data are the same, and obtaining a comparison result; if the data of one pixel point and the data of the RGBA four channels of the initial background pixel point are the same, the comparison result is the same; if one pixel point is different from at least one data in the RGBA four channels of the initial background pixel point, the comparison result is different; and determining pixel points, which are different from the RGBA data of the initial background pixel point, in the plurality of pixel points of the page image as second foreground pixel points, wherein the difference at the moment means that at least one data in the RGBA four channels is different.
It can be understood that the first foreground pixel point is a pixel point different from RGB data of the background pixel point, and transparency information is not considered, and the second foreground pixel point is a pixel point different from RGBA data of the background pixel point, and transparency information is considered, so that the second foreground pixel point is different from the first foreground pixel point under the condition that the background pixel point is the same.
In the above scheme, when the foreground pixel points of the page image are extracted, the determination can be performed based on two modes of color values and color values plus transparency information, the condition of a colored pure-color background is considered, the condition of a transparent background is also considered, and the universality of subsequent white screen detection is further improved.
And step 104, determining a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points.
In the embodiment of the disclosure, after the white screen detection device extracts the target foreground pixel points and the transparent pixel points of the page image, the white screen detection result can be determined according to the number of the target foreground pixel points, the number of the transparent pixel points and the number of the total pixel points.
Exemplarily, fig. 2 is a schematic flow diagram of another white screen detection method provided in the embodiment of the present disclosure, as shown in fig. 2, in a feasible implementation manner, determining a white screen detection result of a page image based on a target foreground pixel and a transparent pixel may include the following steps:
The first pixel points can be target foreground pixel points or transparent pixel points, and the target foreground pixel points comprise the first foreground pixel points or the second foreground pixel points.
Specifically, the white screen detection device may determine whether the white screen detection result of the page image is a white screen based on the first pixel point, specifically, when the first pixel point is the first foreground pixel point or the second foreground pixel point, and when the ratio of the number of the first foreground pixel point or the second foreground pixel point to the total pixel points is smaller than the foreground threshold, the white screen detection result of the page image is a white screen, and then step 202 is executed; the ratio of the number of the first foreground pixels or the second foreground pixels to the total pixels is greater than or equal to the foreground threshold, and step 205 is executed. Or, when the first pixel point is a transparent pixel point, if the ratio of the number 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 a white screen, and then step 202 is executed; otherwise step 205 is performed.
The foreground threshold may be a threshold of a number ratio for performing white screen detection, which is set for a target foreground pixel, that is, a first foreground pixel or a second foreground pixel, and is specifically set according to an actual situation, for example, the foreground threshold may be set to 5%. When the ratio of the number of the target foreground pixels to the total pixels is smaller than the foreground threshold, preliminarily determining that the white screen detection result is a white screen, but the result may be inaccurate, and performing the step 202 for verification; when the ratio of the number of the target foreground pixels to the total pixels is greater than or equal to the foreground threshold, step 205 may be directly performed without calibration.
In the above scheme, when the ratio of the number of the target foreground pixels to the total pixels is smaller than the foreground threshold, it is indicated that the foreground content ratio is very low, for example, under the condition that the specific page content is not displayed in the page but the special prompt information or prompt icon, the foreground content ratio is low, and it can be considered that the white screen problem occurs, so that the white screen detection can be performed by comparing the ratio of the number of the target foreground pixels to the total pixels with a threshold.
The transparent threshold is a threshold of a quantity ratio for white screen detection, which is set for the transparent pixel points, and comprises a first transparent threshold or a second transparent threshold, wherein the second transparent threshold is greater than the first transparent threshold, and if the target foreground pixel points are first foreground pixel points, the transparent threshold is the first transparent threshold; and if the target foreground pixel point is the second foreground pixel point, the transparent threshold value is the second transparent threshold value. Specifically, the first transparency threshold may be set to 50% and the second transparency threshold may be set to 95%, for example. If the ratio of the number of the transparent pixels to the total number of the pixels is greater than the transparent threshold, preliminarily determining that the white screen detection result is a white screen, but the result may be inaccurate, and performing the step 202 for verification; when the ratio of the number of the transparent pixels to the total number of the pixels is smaller than or equal to the transparent threshold, step 205 may be directly performed without calibration.
The transparent pixel points are endowed with black color values when the first foreground pixel points are determined, the transparent pixel points can be mistakenly carried in when the black color values are counted, and the first transparent threshold value set for the transparent pixel points can be smaller; and determining that the second foreground pixel points consider the actual difference of the transparency information, and the transparency information cannot be converted into color values, and at the moment, the second transparent threshold value set for the transparent pixel points can be larger than the first transparent threshold value. And when the pixel points of the page image exceeding the transparent threshold are transparent, the occupation ratio of the non-transparent pixel points is considered to be small, the effective page content cannot be borne, the page image at the moment is considered to be an invalid image, and the invalid image can be regarded as a white screen, so that the white screen detection can be carried out according to the number ratio of the transparent pixel points to the total pixel points.
The second pixel points can be target foreground pixel points or transparent pixel points, and are different from the first pixel points. Because the target foreground pixel points comprise the first foreground pixel points or the second foreground pixel points, and when the first pixel points are the first foreground pixel points or the second foreground pixel points, the second pixel points are transparent pixel points; or when the first pixel points are transparent pixel points, the second pixel points are first foreground pixel points or second foreground pixel points.
When the white screen detection device verifies the white screen detection result of the white screen based on the second pixel point, the verification mode is the same as the mode for determining the white screen detection result based on the target foreground pixel point or the transparent pixel point in step 201, and is not repeated here, and the verification result may be whether the white screen detection result of the page image is still the white screen at this time.
When it is determined that the white screen detection result is still a white screen based on the second pixel point, it is determined that the verification result is a verification pass, and then step 204 may be executed; otherwise, it is determined that the verification result is verification failed, and then step 205 may be executed.
And step 204, determining that the white screen detection result of the page image is a white screen.
After the white screen detection results of the page image are respectively determined based on the target foreground pixel points and the transparent pixel points, when the white screen detection results are all determined to be white screen, the final result can be determined to be white screen.
And step 205, determining that the white screen detection result of the page image is a non-white screen.
When the white screen detection result is determined to be a non-white screen based on the target foreground pixel points or the background pixel points in step 201, the final result can be determined to be the non-white screen without checking; when one of the target foreground pixel points and the target background pixel points in step 201 and step 202 determines that the white screen detection result is a white screen and the other determines that the white screen detection result is a non-white screen, the final white screen detection result is determined to be the non-white screen.
In the above scheme, when the white screen detection result is determined based on the target foreground pixel points and the transparent pixel points, when one of the determination results is adopted as the white screen, the other one needs to be adopted to check the white screen, the final result is determined as the white screen if the check is passed, the check is not needed when any one of the determination results is the non-white screen, the white screen detection can be performed on the pure background and the transparent background of various colors in the mode, the detection coverage range is wide, the universality of the white screen detection is improved, and the accuracy of the white screen detection is effectively improved.
According to the white screen detection scheme provided by the embodiment of the disclosure, a page image of a page to be detected is obtained; determining RGBA data of a page image; extracting target foreground pixel points and transparent pixel points of the page image based on 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 adopting the technical scheme, the RGBA data of the page image of the page to be detected is obtained, the white screen detection result is determined based on the foreground pixel points and the transparent pixel points extracted from the RGBA data, and the color value and the transparency information of the image are simultaneously considered during white screen detection, so that the white screen detection of the transparent background and the white screen under all color backgrounds is realized, the universality of the white screen detection is improved, and the accuracy of the white screen detection is further improved.
In some embodiments, after acquiring the page image of the page to be detected, the white screen detection method may further include: and reducing the page image from the original size to a preset size, wherein the 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, etc., that is, the preset size is 1/5 or 1/6 of the original size.
After the image of the page needing white screen detection is obtained, the image can be reduced firstly, so that the number of pixel points of subsequent processing is reduced, the traversal speed is accelerated, and the white screen detection efficiency is improved.
Fig. 3 is a schematic structural diagram of a white screen detection apparatus provided in an embodiment of the present disclosure, where the white screen detection apparatus may be implemented by software and/or hardware, and may be generally integrated in an electronic device. As shown in fig. 3, the apparatus includes:
an obtaining module 301, configured to obtain a page image of a page to be detected;
a data module 302 for determining RGBA data of the page image;
an extracting module 303, configured to extract target foreground pixels and transparent pixels of the page image based on the RGBA data;
a detection module 304, configured to determine a white screen detection result of the page image based on the target foreground pixel and the transparent pixel.
Optionally, the target foreground pixel includes a first foreground pixel, and the extracting module 303 includes a first unit configured to:
determining the color value of each pixel point in the page image based on the RGBA data;
and determining a target color value with the color value ratio larger than a preset threshold value, and determining pixel points corresponding to other color values except the target color value as the first foreground pixel points.
Optionally, the target foreground pixel includes a second foreground pixel, and the extracting module 303 includes a second unit configured to:
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 point to obtain a comparison result;
and determining the pixel points with different comparison results as the second foreground pixel points.
Optionally, the detecting module 304 includes:
the first detection unit is used for verifying the white screen detection result of the white screen based on the second pixel point when the white screen detection result of the page image is determined to be the white screen based on the first pixel point, so as to obtain a verification result;
the second detection unit is used for determining that the white screen detection result of the page image is a white screen when the verification result is that verification passes; when the verification result is that the verification is not passed, determining that the white screen detection result of the page image is a non-white screen;
when the first pixel points are the first foreground pixel points or the second foreground pixel points, the second pixel points are the transparent pixel points; 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.
Optionally, the first detecting unit is configured to:
when the first pixel points are the first foreground pixel points or the second foreground pixel points, and the ratio of the number of the first foreground pixel points or the second foreground pixel points to the total pixel points is smaller 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, the white screen detection result of the page image is a white screen when the ratio of the number of the transparent pixel points to the total pixel points is greater than a transparent threshold value.
Optionally, the transparency threshold includes a first transparency threshold or a second transparency threshold, and the second transparency threshold is greater than the first transparency threshold;
if the target foreground pixel point is the first foreground pixel point, the transparent threshold value is the first transparent threshold value; and if the target foreground pixel point is the second foreground pixel point, the transparent threshold value is the second transparent threshold value.
Optionally, the obtaining module 301 is configured to:
and carrying out screenshot on the page to be detected through a system screenshot component to obtain a page image.
Optionally, the data module 302 is configured to:
and converting the page image into a bitmap context, and extracting RGBA data of each pixel point from the bitmap context.
Optionally, the apparatus further includes a scaling module, configured to: after the acquiring of the page image of the page to be measured,
and reducing the page image from an original size to a preset size, wherein the ratio of the preset size to the original size is a preset ratio.
The white screen detection device provided by the embodiment of the disclosure can execute the white screen detection method provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
Embodiments of the present disclosure also provide a computer program product, which includes a computer program/instruction, and when executed by a processor, the computer program/instruction implements the white screen detection method provided in any embodiment of the present disclosure.
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. Referring now specifically to fig. 4, a schematic diagram of an electronic device 400 suitable for use in implementing embodiments of the present disclosure is shown. The electronic device 400 in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle-mounted terminal (e.g., a car navigation terminal), and the like, and fixed terminals such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 4, electronic device 400 may include a processing device (e.g., central processing unit, graphics processor, etc.) 401 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage device 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for the operation of the electronic apparatus 400 are also stored. The processing device 401, the ROM 402, and the RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device 400 to communicate wirelessly or by wire with other devices to exchange data. While fig. 4 illustrates an electronic device 400 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. 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 method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or installed from the storage device 408, or installed from the ROM 402. The computer program performs the above-described functions defined in the white screen detection method of the embodiment of the present disclosure when executed by the processing device 401.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may 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 foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring 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.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may 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 case of a remote computer, the remote computer may 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 may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may 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 a machine-readable storage medium would include an electrical connection based on 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 compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
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 (12)
1. A white screen detection method is characterized by comprising the following steps:
acquiring 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.
2. The method of claim 1, wherein the target foreground pixel comprises a first foreground pixel, and wherein extracting the target foreground pixel of the page image based on the RGBA data comprises:
determining the color value of each pixel point in the page image based on the RGBA data;
and determining a target color value with the color value ratio larger than a preset threshold value, and determining pixel points corresponding to other color values except the target color value as the first foreground pixel points.
3. The method of claim 1, wherein the target foreground pixels include second foreground pixels, and wherein extracting the target foreground pixels of the page image based on the RGBA data comprises:
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 point to obtain a comparison result;
and determining the pixel points with different comparison results as the second foreground pixel points.
4. The method of claim 2 or 3, wherein determining the white screen detection result of the page image based on the target foreground pixel and the transparent pixel comprises:
when the white screen detection result of the page image is determined to be a white screen based on the first pixel point, the white screen detection result of the white screen is verified based on the second pixel point to obtain a verification result;
when the verification result is that verification is passed, determining that the white screen detection result of the page image is a white screen; when the verification result is that the verification is not passed, determining that the white screen detection result of the page image is a non-white screen;
when the first pixel points are the first foreground pixel points or the second foreground pixel points, the second pixel points are the transparent pixel points; 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.
5. The method of claim 4, wherein determining that the white screen detection result of the page image is white screen based on the first pixel point comprises:
when the first pixel point is the first foreground pixel point or the second foreground pixel point, and the ratio of the first foreground pixel point or the second foreground pixel point to the total pixel points is smaller 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, the white screen detection result of the page image is a white screen when the ratio of the number of the transparent pixel points to the total pixel points is greater than a transparent threshold value.
6. The method of claim 5, wherein the transparency threshold comprises a first transparency threshold or a second transparency threshold, the second transparency threshold being greater than the first transparency threshold;
if the target foreground pixel point is the first foreground pixel point, the transparent threshold value is the first transparent threshold value; and if the target foreground pixel point is the second foreground pixel point, the transparent threshold value is the second transparent threshold value.
7. The method of claim 1, wherein obtaining the page image of the page to be tested comprises:
and carrying out screenshot on the page to be detected through a system screenshot component to obtain a page image.
8. The method of claim 1, wherein determining RGBA data for the page image comprises:
and converting the page image into a bitmap context, and extracting RGBA data of each pixel point from the bitmap context.
9. The method according to claim 1, wherein after said obtaining the page image of the page to be tested, the method further comprises:
and reducing the page image from an original size to a preset size, wherein the ratio of the preset size to the original size is a preset ratio.
10. A white screen detection device, comprising:
the acquisition module is used for acquiring a page image of a page to be detected;
the data module is used for determining RGBA data of the page image;
the extraction module is used for extracting target foreground pixel points and transparent pixel points of the page image based on the RGBA data;
and the detection module is used for determining a white screen detection result of the page image based on the target foreground pixel points and the transparent pixel points.
11. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory for storing the processor-executable instructions;
the processor is configured to read the executable instructions from the memory and execute the instructions to implement the white screen detection method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that the storage medium stores a computer program for executing the white screen detection method of any one of the preceding claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210832435.7A CN115222693A (en) | 2022-07-14 | 2022-07-14 | White screen detection method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210832435.7A CN115222693A (en) | 2022-07-14 | 2022-07-14 | White screen detection method, device, equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115222693A true CN115222693A (en) | 2022-10-21 |
Family
ID=83611326
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210832435.7A Pending CN115222693A (en) | 2022-07-14 | 2022-07-14 | White screen detection method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115222693A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117556162A (en) * | 2023-11-01 | 2024-02-13 | 书行科技(北京)有限公司 | Picture loading detection method, video rendering detection method and related products |
-
2022
- 2022-07-14 CN CN202210832435.7A patent/CN115222693A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117556162A (en) * | 2023-11-01 | 2024-02-13 | 书行科技(北京)有限公司 | Picture loading detection method, video rendering detection method and related products |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111476309B (en) | Image processing method, model training method, device, equipment and readable medium | |
CN112241714B (en) | Method and device for identifying designated area in image, readable medium and electronic equipment | |
CN111314614B (en) | Image processing method and device, readable medium and electronic equipment | |
WO2022105779A1 (en) | Image processing method, model training method, and apparatus, medium, and device | |
CN111784712B (en) | Image processing method, device, equipment and computer readable medium | |
CN111080595A (en) | Image processing method, image processing device, electronic equipment and computer readable medium | |
CN109068132B (en) | VBO display interface test method, device, equipment and storage medium | |
CN113742025B (en) | Page generation method, device, equipment and storage medium | |
CN114494298A (en) | Object segmentation method, device, equipment and storage medium | |
CN111325704A (en) | Image restoration method and device, electronic equipment and computer-readable storage medium | |
CN115222693A (en) | White screen detection method, device, equipment and medium | |
CN115272182A (en) | Lane line detection method, lane line detection device, electronic device, and computer-readable medium | |
CN111783632B (en) | Face detection method and device for video stream, electronic equipment and storage medium | |
CN112800961B (en) | Stroke writing sequence detection method, device, medium and electronic equipment | |
CN110399802B (en) | Method, apparatus, medium, and electronic device for processing eye brightness of face image | |
CN114332324B (en) | Image processing method, device, equipment and medium | |
CN114820484A (en) | Page detection method, device, equipment and medium | |
CN113112472B (en) | Image processing method and device | |
CN110807114B (en) | Method, device, terminal and storage medium for picture display | |
CN112418233B (en) | Image processing method and device, readable medium and electronic equipment | |
CN114399696A (en) | Target detection method and device, storage medium and electronic equipment | |
CN111538657B (en) | Page overdrawing detection method and device, electronic equipment and readable medium | |
CN111353536B (en) | Image labeling method and device, readable medium and electronic equipment | |
CN110189279B (en) | Model training method and device, electronic equipment and storage medium | |
CN110334763B (en) | Model data file generation method, model data file generation device, model data file identification device, model data file generation apparatus, model data file identification apparatus, and model data file identification medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |