Page detection method, device, equipment and medium
By acquiring the pixel values and image features of the page image, it is determined whether the preset white screen display conditions are met, which solves the problems of low efficiency and insufficient accuracy of page white screen detection in the existing technology, and realizes automated and efficient white screen page recognition.
Patent Information
- Application Number
- CN202210394138.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-14
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-04-14
AI Technical Summary
Current technologies rely on manual testing for detecting blank screens on web pages, which is inefficient and lacks accuracy.
By acquiring the pixel values and image features of the page images, it is determined whether the preset white screen display conditions are met, including pixel clustering, watermark removal, and component cropping. Page elements are identified, and image recognition technology and deep learning models are used to improve detection efficiency and accuracy.
It has achieved automated white screen page detection, improved detection efficiency and accuracy, expanded the ways to recognize white screen pages, and reduced manual intervention.
Smart Images

Figure CN114820484B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to a method, apparatus, device and medium for detecting pages. Background Technology
[0002] If the page code crashes during the page loading process, it will cause page code errors and the page content will fail to load, resulting in display errors such as a blank screen. Therefore, it is very important to perform blank screen detection for page code maintenance.
[0003] In related technologies, testers rely on opening each page to be tested one by one and manually determining whether the page is a blank screen. This manual testing method is inefficient. Summary of the Invention
[0004] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a method, apparatus, device, and medium for detecting pages, which determines whether a page is a blank page based on image information, ensuring the accuracy of blank page recognition, improving the efficiency of blank page recognition, and expanding the ways to recognize blank pages.
[0005] This disclosure provides a method for detecting a page, the method comprising: acquiring a page image of a page to be detected and extracting image information of the page image; determining whether the image information meets preset white screen display conditions; and if the white screen display conditions are met, determining that the page to be detected is a white screen page.
[0006] This disclosure also provides a page detection device, the device comprising: an extraction module for acquiring a page image of a page to be detected and extracting image information of the page image; a judgment module for judging whether the image information meets preset white screen display conditions; and a white screen determination module for determining that the page to be detected is a white screen page when the white screen display conditions are met.
[0007] This disclosure also provides an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the page detection method provided in this disclosure.
[0008] This disclosure also provides a computer-readable storage medium storing a computer program for executing the page detection method provided in this disclosure.
[0009] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0010] The page detection scheme provided in this embodiment acquires a page image of the page to be detected and extracts image information from the page image. If the image information meets preset white screen display conditions, the page to be detected is determined to be a white screen page. Therefore, white screen pages can be identified based on image information values, improving the detection efficiency of white screen pages. Furthermore, determining white screen pages based on image information ensures the detection accuracy of white screen pages and expands the methods for recognizing white screen pages. Attached Figure Description
[0011] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0012] Figure 1 A schematic flowchart of a page detection method provided in an embodiment of this disclosure;
[0013] Figure 2 A schematic diagram of a page detection scenario provided by an embodiment of this disclosure;
[0014] Figure 3 A schematic flowchart of another page detection method provided in this embodiment of the disclosure;
[0015] Figure 4 A schematic diagram of another page detection scenario provided by an embodiment of this disclosure;
[0016] Figure 5 A schematic diagram of another page detection scenario provided by an embodiment of this disclosure;
[0017] Figure 6 A schematic diagram of another page detection scenario provided by an embodiment of this disclosure;
[0018] Figure 7 A schematic flowchart of another page detection method provided in this embodiment of the disclosure;
[0019] Figure 8 A schematic diagram of the structure of a page detection device provided in an embodiment of this disclosure;
[0020] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0021] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0022] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0023] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based 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". Definitions of other terms will be given in the description below.
[0024] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0025] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0026] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0027] To address the aforementioned problems, this disclosure provides a method for detecting pages, which will be described below with reference to specific embodiments.
[0028] Figure 1 This is a flowchart illustrating a page detection method provided in an embodiment of the present disclosure. The method can be executed by a page detection device, which can be implemented in software and / or hardware, and is generally integrated into an electronic device. Figure 1 As shown, the method includes:
[0029] Step 101: Obtain the page image of the page to be inspected and extract the image information of the page image.
[0030] In this embodiment, the image information includes, but is not limited to, one or more of the following: pixel values of pixels contained in the image, image features contained in the image, page elements (which may be page frame elements, text elements, pop-up elements, etc.), and text content contained in the image.
[0031] In this embodiment, the page to be detected can be screenshotted to obtain the corresponding page image. The white screen detection is performed using the page image as the object, which makes the detection more convenient and eliminates the need to consider the underlying code and layer structure of the page.
[0032] In one embodiment of this disclosure, if the image information includes the pixel value of each pixel in the page image, then in this embodiment, after obtaining the page image, the pixel value of each pixel in the page image is extracted. If the page image is an image in RGB color mode, then the pixel value includes the values of the three color channels of RGB.
[0033] In one embodiment of this disclosure, when the image information contains page elements, the page elements contained in the page image can be identified by means of image recognition and other technical means. The page elements include, but are not limited to, page pop-up elements, page prompt icon elements, etc.
[0034] Step 102: Determine whether the image information meets the preset white screen display conditions.
[0035] Step 103: If the white screen display conditions are met, then the page to be tested is determined to be a white screen page.
[0036] In one embodiment of this disclosure, if the image information is a page element, it should be understood that, in order to indicate an error, if a white screen appears during loading, a preset white screen prompt element will be displayed on the page. This preset white screen prompt element can be a page error pop-up reminder icon, or a pop-up window, etc. Therefore, in this embodiment, after obtaining the preset white screen prompt element corresponding to the page to be detected, the first element image feature of the preset white screen prompt element is determined. Then, based on the page image, the second element image feature of the page element is extracted, and it is determined whether there is a target element image feature in the second element image feature that matches the first element image feature. If there is a target element image feature, it is determined that the image information meets the preset white screen display conditions, that is, if a white screen error message is displayed on the page, it is considered that the page has a white screen.
[0037] In one embodiment of this disclosure, when the image information includes the pixel value of each pixel, the background pixels in the page image and the first number of background pixels are determined based on the pixel values.
[0038] It is understandable that, such as Figure 2As shown, if the page to be tested appears blank, it means that because the page image cannot load content, a large number of pixels will have the same color as the background. That is, the background pixels will be displayed in the content display area instead of the corresponding content pixels.
[0039] Therefore, in the embodiments of this disclosure, the background pixels in the page image are determined based on the pixel values, as well as the first number of background pixels, so as to determine the white screen page based on the number of background pixels.
[0040] It should be noted that the method for determining the background pixels in a page image based on pixel values differs in different application scenarios, as shown in the following example:
[0041] In one embodiment of this disclosure, such as Figure 3 As shown, the background pixels in the page image are determined based on pixel values, and the first number of background pixels is determined, including:
[0042] Step 301: Cluster the pixels whose pixel value difference is less than a preset difference threshold to obtain at least one set of pixels, wherein the pixel value difference between any pixels in each set of pixels is less than the preset difference threshold.
[0043] Step 302: Count the second number of pixels contained in each pixel set.
[0044] Step 303: Determine the maximum value among at least one second quantity as the first quantity, and determine the pixels in the set of pixels corresponding to the maximum value as background pixels.
[0045] It should be understood that for a blank screen page, since a large number of empty areas are displayed, there will be a large number of background pixels in the corresponding page image, while the number of other pixels that do not belong to the background pixels will obviously be relatively small. In this embodiment, the pixels are clustered according to the pixel value, and the number of pixels in the clustered pixel set is counted to determine the first number of background pixels.
[0046] Then, determine the second number of pixels contained in each set of pixels, determine the maximum value among at least one of the second numbers as the first number, and determine the pixels in the set of pixels corresponding to the maximum value as background pixels.
[0047] In the above embodiments, when clustering pixels, pixels with the same pixel value can be clustered together. However, in some scenarios, if the page to be detected includes a watermark (usually a visible watermark in a color very close to the background color to avoid affecting viewing, or a dark watermark added to the page to be detected, where random noise is not directly visible but can be reflected by pixel values; usually, the pixel values of pixels with this random noise will change slightly), the addition of the watermark will cause a slight change in the pixel values of the pixels. If a dark watermark is added to a pure white background with pixel values of (255, 255, 255), pixels with values similar to (251, 251, 250), (250, 250, 250), and (249, 249, 249) will appear. Even if some white-screen displays contain the corresponding watermark, the pixels corresponding to the watermark should still belong to the background pixels. Therefore, to compensate for the influence of the watermark on pixel values, in the embodiments of this disclosure, when clustering pixels, pixels with relatively similar pixel values are clustered into a set of pixels, i.e., the pixel difference between pixels is calculated. The square of the difference between each pixel and every other pixel in each color channel is calculated, and the square root of the sum of the squares of the differences in all color channels is the pixel value difference.
[0048] Assuming pixel value A is (Ra, Ga, Ba) and pixel value B is (Rb, Gb, Bb), then the pixel difference is... Pixels whose pixel difference is less than a preset difference threshold are clustered into a set of pixels, wherein the difference between any two pixels in each set of pixels is less than the preset difference threshold (in some possible embodiments, the preset difference threshold is 3.47).
[0049] Of course, in one embodiment of this disclosure, the interference of the watermark can also be removed directly. Since the watermark can be reflected in the image features of the page image after it is added, in the embodiment of this disclosure, the watermark removal process is performed before determining whether the image information meets the preset white screen display conditions.
[0050] In this embodiment, image features of the page image are acquired, and the presence of target watermark pixels that meet the conditions for watermark addition is determined based on the image features. In some possible embodiments, a deep learning model can be trained based on a large amount of sample data, and the image features can be input into the corresponding deep learning model to determine whether there are target watermark pixels that meet the conditions for watermark addition in the page image.
[0051] If a target watermark pixel exists, the pixel drift value after the watermark is added is determined. For example, the semantic information of each pixel is identified to determine whether the pixel is a background pixel. If it is a background pixel, the original pixel value of the clean background pixel without the watermark and the reference pixel value of the background pixel with the watermark are determined. The pixel difference between the reference pixel and the original pixel is calculated, and the pixel difference is determined as the pixel drift value. Alternatively, the watermark type is determined based on the image features of the watermark pixel, and a preset correspondence is queried based on the watermark type to obtain the pixel drift value.
[0052] Then, the pixel value of the target watermark pixel is corrected according to the pixel offset value in order to remove the watermark. That is, the pixel value of the target watermark pixel is summed with the pixel drift value based on the current pixel value of the target watermark pixel, and the pixel value of the target watermark pixel is updated according to the summation result.
[0053] In one embodiment of this disclosure, considering that the pixel values of some background pixels on the page to be detected are not uniform, for example, Figure 4 As shown, when the background of the page to be detected includes two colors, pixel clustering will cluster the different colored parts into different pixel sets, thus causing errors in the number of confirmed background pixels. Therefore, in order to shield against this interference, in the embodiments of this disclosure, the background pixel value corresponding to the page image is obtained. The background pixel value can be preset, such as the correspondence between the page identifier of each page and the corresponding background pixel value is preset and stored. The background pixel value can be one or multiple, and can be a range of one pixel value or multiple ranges of pixel values.
[0054] Furthermore, pixels whose values match the background pixel values are identified as background pixels, and the first count of these background pixels is then recorded. Thus, even if the background of a page image contains multiple colors, they can all be identified as background pixels.
[0055] Further, determine whether the first quantity meets the preset quantity conditions.
[0056] If the quantity condition is met, then the page to be tested is determined to be a blank screen page.
[0057] It's easy to understand that if there are many background pixels in the page image, the probability of the page being tested appearing blank is higher. This is because much of the content that should be displayed is not shown, and only the background pixels are visually displayed.
[0058] Therefore, in this embodiment, it is determined whether the first quantity meets the preset white screen display conditions. If the preset quantity is met, the page to be detected is considered to be a white screen page.
[0059] It should be noted that the method for determining whether the first quantity meets the preset quantity condition varies in different application scenarios. Examples are shown below:
[0060] In one embodiment of this disclosure, the ratio of a first quantity to the total number of pixels in the page image is calculated. The total number of pixels in the page image can be obtained based on the resolution of the page image. For example, if the resolution of the page image is 1400*1000, then the corresponding total number of pixels is 1,4000,000.
[0061] After obtaining the ratio, it is determined whether the ratio is greater than a preset ratio threshold. The preset ratio threshold can be set by the user according to their personal detection needs, or it can be obtained by matching the corresponding database according to the page type. In this embodiment, if the ratio is greater than the preset ratio threshold, it indicates that the content that should have been displayed on the current page to be detected is not displayed. Therefore, it is determined that the page meets the preset quantity condition.
[0062] For example, if the highest number of pixels in the resulting pixel set is 1,232,670 after clustering the pixel values of other pixels on a page with a resolution of 1400*1000, then the ratio of 1,232,670 to 1,400,000 is 88.05%, which is greater than the preset ratio threshold of 85%. Therefore, the corresponding page to be detected is determined to be a blank screen page.
[0063] In another embodiment of this disclosure, if the ratio is less than a preset ratio threshold, it indicates that the blank page is not a blank screen page.
[0064] In summary, the page detection method of this disclosure acquires a page image of the page to be detected and extracts image information from the page image. If the image information meets preset white screen display conditions, the page to be detected is determined to be a white screen page. Therefore, white screen pages can be identified based on the recognition of image information in the image, improving the detection efficiency of white screen pages. Furthermore, identifying white screen pages based on image information ensures the detection accuracy of white screen pages and expands the methods for recognizing white screen pages.
[0065] Based on the above embodiments, in order to improve the accuracy of white screen judgment, some interference factors can be removed before judging white screen based on image information.
[0066] In one embodiment of this disclosure, a range of text quantity can be set. When the page to be detected contains a number of valid texts within this range, it indicates that the current page to be detected is not a blank screen page.
[0067] In this embodiment, characters in the page image are identified by Optical Character Recognition (OCR). Non-text characters such as punctuation marks are deleted to determine the remaining text. The number of texts is counted, and it is determined whether the number of texts falls within a preset text number range. If the number of texts is greater than the upper boundary of the preset text number range, the page to be detected is determined to be a non-white screen. If the number of texts is less than the lower boundary of the preset text number range, the page to be detected is determined to be a white screen.
[0068] If the number of characters is within the preset range, the pixel values mentioned above are used to determine whether the page to be detected is a blank page, so as to improve the recognition accuracy of blank pages.
[0069] Of course, in some possible embodiments, even if the number of characters is small, it may contain some, for example, Figure 5 As shown, keywords such as "login" typically correspond to pages with a relatively small amount of text. While these pages contain a limited amount of text, they are not necessarily blank pages. Therefore, in this embodiment, a keyword whitelist corresponding to the page to be detected can be obtained. This whitelist can be acquired through big data analysis or customized by the user based on detection needs. If the text information contains keywords from the whitelist, the corresponding page is determined not to be a blank page. If the text information does not contain keywords from the whitelist, further verification of whether the page to be detected is a blank page is based on factors such as the amount of text.
[0070] In one embodiment of this disclosure, considering practical applications, such as Figure 6 As shown, when the page displays a white screen, some components, such as common components, can still be displayed normally. In this scenario, the text or pixel color contained in the common components may interfere with the judgment of the white screen.
[0071] To avoid such interference, before performing white screen detection based on pixel values, components of a preset type in the page image are identified. These preset component types can be title components, navigation bar components, warning information components, etc. These preset component types can be user-defined or determined based on big data. In actual execution, the methods for identifying preset component types in the page image can be either through image recognition technology or by pre-training a recognition model based on sample data and then inputting the page image into the recognition model to determine the preset component types in the page image.
[0072] After determining the component of the preset type, determine the component area where the component of the preset type is located. For example, generate the bounding box of the recognized component, determine the corresponding component area based on the bounding box, crop the component area in the page image, and then use the white screen to distinguish the cropped page image.
[0073] To enable those skilled in the art to have a clearer understanding of the page detection method of the present disclosure embodiments, the following description is provided in conjunction with specific examples:
[0074] like Figure 7 As shown, in this embodiment, a preset text quantity range A and a preset ratio threshold B1 are set. OCR technology is used to identify characters contained in the page image corresponding to the page to be detected. Preset types of characters, such as punctuation marks, are removed, and the remaining text quantity is obtained. It is then determined whether this text quantity is higher than the upper limit t1 of A. If it is higher than t1, the corresponding page is determined to be a non-white screen. If it is not higher than the upper limit t1, it is then determined whether the text quantity is lower than the lower limit t2 of A. If it is lower than t2, the corresponding page to be detected is directly determined to be a white screen page.
[0075] If the number of characters is greater than or equal to t2 and less than or equal to t1, then the common component area in the page is identified according to the pre-trained model. After cropping the common component area, the pixel values of the remaining pixels in the image are counted. The pixel values are clustered to generate at least one set of pixels. In each set of pixels, the difference between the pixel values of any two pixels is less than a preset threshold. The number of pixels contained in the set of pixels with the most pixels is calculated. The ratio B2 of the number of pixels in the set of pixels with the most pixels in the image is calculated. It is determined whether B2 is greater than B1. If it is greater than B1, the page to be detected is determined to be a white screen page. Otherwise, the corresponding page is determined to be a non-white screen page.
[0076] In summary, the page detection method of this disclosure identifies the number of characters contained in the page image before performing white screen recognition based on image information, and removes some common component areas from the page image. By eliminating the influence of some interfering factors based on the number of characters and component areas, the accuracy of white screen detection is improved.
[0077] To implement the above embodiments, this disclosure also proposes a page detection device. Figure 8 This is a schematic diagram of a page detection device provided in an embodiment of the present disclosure. This device can be implemented by software and / or hardware, and is generally integrated into an electronic device for page detection. Figure 8 As shown, the device includes:
[0078] The extraction module 810 is used to obtain the page image of the page to be detected and extract the image information of the page image;
[0079] The judgment module 832 is used to determine whether the image information meets the preset white screen display conditions;
[0080] The white screen determination module 830 is used to determine that the page to be detected is a white screen page when the white screen display conditions are met.
[0081] The page detection device provided in this disclosure can execute the page detection method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the method execution.
[0082] To implement the above embodiments, this disclosure also proposes a computer program product, including a computer program / instructions, which, when executed by a processor, implements the page detection method in the above embodiments.
[0083] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure.
[0084] The following is a detailed reference. Figure 9 The diagram illustrates a structural schematic suitable for implementing the electronic device 900 in the embodiments of this disclosure. The electronic device 900 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 9 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0085] like Figure 9 As shown, the electronic device 900 may include a processor (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a memory 908 into a random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the electronic device 900. The processor 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0086] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic device 900 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 9 An electronic device 900 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0087] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this 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 shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a memory 908, or installed from a ROM 902. When the computer program is executed by the processor 901, it performs the functions defined in the page detection method of embodiments of this disclosure.
[0088] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0089] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0090] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0091] The aforementioned computer-readable medium carries one or more programs. When these programs are executed by the electronic device, the electronic device: acquires a page image of the page to be detected and extracts image information from the page image. If the image information meets preset white screen display conditions, the page to be detected is determined to be a white screen page. Therefore, white screen pages can be identified based on image information, improving the detection efficiency of white screen pages. Furthermore, identifying white screen pages based on image information ensures the detection accuracy of white screen pages and expands the methods for recognizing white screen pages.
[0092] Electronic devices can be programmed with computer program code in one or more programming languages or combinations thereof to perform the operations of this disclosure. These programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0093] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0094] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0095] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0096] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0097] In one embodiment of this disclosure, a method for detecting a page is provided, comprising the following steps: obtaining a page image of the page to be detected, and extracting image information of the page image;
[0098] Determine whether the image information meets the preset white screen display conditions;
[0099] If the white screen display conditions are met, then the page to be detected is determined to be a white screen page.
[0100] In one embodiment of this disclosure, when the image information includes the pixel value of each pixel, determining whether the image information meets a preset white screen display condition includes: determining the background pixels in the page image based on the pixel value, and a first number of the background pixels; determining whether the first number meets a preset quantity condition, wherein if the quantity condition is met, the image information is determined to meet the preset white screen display condition.
[0101] In one embodiment of this disclosure, determining the background pixels in the page image based on the pixel values, and the first number of the background pixels, includes:
[0102] Clustering of pixels whose pixel values differ from a preset difference threshold to obtain at least one set of pixels, wherein the difference in pixel values between any pixels in each set of pixels is less than the preset difference threshold;
[0103] Count the second number of pixels contained in each set of pixels;
[0104] The maximum value among at least one of the second quantities is determined as the first quantity, and the pixel in the set of pixel points corresponding to the maximum value is determined as the background pixel.
[0105] In one embodiment of this disclosure, determining whether the first quantity satisfies a preset quantity condition includes:
[0106] Calculate the ratio of the first quantity to the total number of pixels in the page image;
[0107] Determine whether the ratio is greater than a preset ratio threshold, wherein if it is greater than the preset ratio threshold, then the quantity condition is determined to be met.
[0108] In one embodiment of this disclosure, clustering pixels whose pixel values differ by less than a preset difference threshold to obtain at least one set of pixels includes:
[0109] Calculate the squared difference between the pixel values of each pixel and every other pixel in each color channel;
[0110] The difference in pixel value is calculated as the square root of the sum of the squares of the differences in all color channels.
[0111] Pixels whose pixel values differ from a preset threshold are clustered to obtain at least one set of pixels.
[0112] In one embodiment of this disclosure, determining the background pixels in the page image based on the pixel values, and the first number of the background pixels, includes:
[0113] Obtain the background pixel value corresponding to the page image;
[0114] The pixel whose pixel value matches the background pixel value is identified as the background pixel.
[0115] Determine the first number of background pixels.
[0116] In one embodiment of this disclosure, before extracting the image information of the page image, the method further includes:
[0117] The page image is subjected to text recognition processing to extract text information from the page image;
[0118] Count the number of characters contained in the text information;
[0119] The number of characters is determined to be within a preset range.
[0120] In one embodiment of this disclosure, it further includes:
[0121] If the number of characters is greater than the upper limit of the preset character number range, then the page to be detected is determined to be a non-white screen page;
[0122] If the number of characters is less than the lower limit of the preset character number range, then
[0123] Obtain the keyword whitelist corresponding to the page to be detected;
[0124] If the text information does not contain text information that matches the keyword whitelist, then the page to be detected is determined to be a blank screen page;
[0125] If the text information includes text information that matches the keyword whitelist, then the page to be detected is determined to be a non-blank screen page.
[0126] In one embodiment of this disclosure, before extracting the image information of the page image, the method further includes:
[0127] Identify the component area containing a preset type of component in the page image;
[0128] The component area in the page image is cropped to obtain the updated page image.
[0129] In one embodiment of this disclosure, before determining whether the image information meets the preset white screen display conditions, the method further includes:
[0130] Obtain the image features of the page image, and determine whether there are target watermark pixels in the page image that meet the conditions for watermark addition based on the image features;
[0131] If the target watermark pixel exists, then determine the pixel drift value after the watermark is added;
[0132] The pixel value of the target watermark pixel is corrected based on the pixel offset value.
[0133] In one embodiment of this disclosure, when the image information includes page elements, determining whether the image information meets preset white screen display conditions includes:
[0134] Obtain the preset white screen prompt element corresponding to the page to be detected;
[0135] Determine the first element image feature of the preset white screen prompt element;
[0136] Obtain the second element image feature of each of the page elements;
[0137] Determine whether there is a target element image feature in the second element image features that matches the first element image features. If the target element image feature exists, then determine that the image information meets the preset white screen display conditions.
[0138] In one embodiment of this disclosure, a page detection device is also provided, comprising:
[0139] The extraction module is used to obtain the page image of the page to be detected and extract the image information of the page image;
[0140] The judgment module is used to determine whether the image information meets the preset white screen display conditions;
[0141] The white screen determination module is used to determine that the page to be detected is a white screen page when the white screen display conditions are met.
[0142] In one embodiment of this disclosure, when the image information includes the pixel value of each pixel, the determination module is specifically used for:
[0143] The background pixels in the page image are determined based on the pixel values, as well as the first number of the background pixels;
[0144] Determine whether the first quantity meets the preset quantity condition, wherein if the quantity condition is met, then determine that the image information meets the preset white screen display condition.
[0145] In one embodiment of this disclosure, the judgment module is specifically used to: cluster pixels whose pixel value difference is less than a preset difference threshold to obtain at least one set of pixels, wherein the pixel value difference between any pixels in each set of pixels is less than the preset difference threshold.
[0146] Count the second number of pixels contained in each set of pixels;
[0147] The maximum value among at least one of the second quantities is determined as the first quantity, and the pixel in the set of pixel points corresponding to the maximum value is determined as the background pixel.
[0148] In one embodiment of this disclosure, the determining module is specifically used to: calculate the ratio of the first quantity to the total number of pixels in the page image;
[0149] Determine whether the ratio is greater than a preset ratio threshold, wherein if it is greater than the preset ratio threshold, then the quantity condition is determined to be met.
[0150] In one embodiment of this disclosure, the determination module is specifically used to: calculate the squared difference between the pixel values of each pixel and every other pixel in each color channel;
[0151] The difference in pixel value is calculated as the square root of the sum of the squares of the differences in all color channels.
[0152] Pixels whose pixel values differ from a preset threshold are clustered to obtain at least one set of pixels.
[0153] In one embodiment of this disclosure, the determining module is specifically used to: obtain the background pixel value corresponding to the page image;
[0154] The pixel whose pixel value matches the background pixel value is identified as the background pixel.
[0155] Determine the first number of background pixels.
[0156] In one embodiment of this disclosure, it further includes: a text quantity determination module, used for:
[0157] The page image is subjected to text recognition processing to extract text information from the page image;
[0158] Count the number of characters contained in the text information;
[0159] The number of characters is determined to be within a preset range.
[0160] In one embodiment of this disclosure, it further includes: a text content processing module, used for:
[0161] If the number of characters is greater than the upper limit of the preset character number range, then the page to be detected is determined to be a non-white screen page;
[0162] If the number of characters is less than the lower limit of the preset character number range, then
[0163] Obtain the keyword whitelist corresponding to the page to be detected;
[0164] If the text information does not contain text information that matches the keyword whitelist, then the page to be detected is determined to be a blank screen page;
[0165] If the text information includes text information that matches the keyword whitelist, then the page to be detected is determined to be a non-blank screen page.
[0166] In one embodiment of this disclosure, it further includes:
[0167] The cropping module is used to identify the component area where a preset type of component is located in the page image;
[0168] The component area in the page image is cropped to obtain the updated page image.
[0169] In one embodiment of this disclosure, when the image information includes page elements, the determining module is specifically used for:
[0170] Obtain the preset white screen prompt element corresponding to the page to be detected;
[0171] Determine the first element image feature of the preset white screen prompt element;
[0172] Obtain the second element image feature of each of the page elements;
[0173] Determine whether there is a target element image feature in the second element image features that matches the first element image features. If the target element image feature exists, then determine that the image information meets the preset white screen display conditions.
[0174] In one embodiment of this disclosure, an electronic device is also provided, the electronic device comprising:
[0175] processor;
[0176] Memory used to store the processor's executable instructions;
[0177] The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the above-described surface detection method.
[0178] In one embodiment of this disclosure, a computer-readable storage medium is also provided, the computer-readable storage medium storing a computer program for performing the above-described page detection method.
[0179] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0180] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0181] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for detecting a page, characterized in that, Includes the following steps: Obtain the page image of the page to be inspected, and extract the pixel value of each pixel in the page image; Clustering of pixels whose pixel values differ from a preset difference threshold is performed to obtain at least one set of pixels, wherein the difference in pixel values between any pixels in each set of pixels is less than the preset difference threshold. Count the second number of pixels contained in each set of pixels; Determine at least one of the maximum values of the second quantity as the first quantity, and determine the pixels in the set of pixels corresponding to the maximum value as background pixels; Determine whether the first number of background pixels meets a preset quantity condition; If the quantity condition is met, then the page to be detected is determined to be a blank screen page.
2. The method as described in claim 1, characterized in that, The step of determining whether the first quantity meets the preset quantity condition includes: Calculate the ratio of the first quantity to the total number of pixels in the page image; Determine whether the ratio is greater than a preset ratio threshold, wherein if it is greater than the preset ratio threshold, then the quantity condition is determined to be met.
3. The method as described in claim 1, characterized in that, The clustering of pixels whose differences in pixel values are less than a preset difference threshold to obtain at least one set of pixels includes: Calculate the squared difference between the pixel values of each pixel and every other pixel in each color channel; The difference in pixel value is calculated as the square root of the sum of the squares of the differences in all color channels. Pixels whose pixel values differ from a preset threshold are clustered to obtain at least one set of pixels.
4. The method as described in claim 1, characterized in that, Before extracting the pixel value of each pixel in the page image, the method further includes: The page image is subjected to text recognition processing to extract text information from the page image; Count the number of characters contained in the text information; The number of characters is determined to be within a preset range.
5. The method as described in claim 4, characterized in that, Also includes: If the number of characters is greater than the upper limit of the preset character count range, then the page to be tested is determined to be a non-white screen page. If the number of characters is less than the lower limit of the preset character number range, then Obtain the keyword whitelist corresponding to the page to be detected; If the text information does not contain text information that matches the keyword whitelist, then the page to be detected is determined to be a blank screen page; If the text information includes text information that matches the keyword whitelist, then the page to be detected is determined to be a non-blank screen page.
6. The method as described in claim 1, characterized in that, Before extracting the pixel value of each pixel in the page image, the method further includes: Identify the component area containing a preset type of component in the page image; The component area in the page image is cropped to obtain the updated page image.
7. The method as described in claim 1, characterized in that, Before determining whether the first number of background pixels meets a preset quantity condition, the method further includes: Obtain the image features of the page image, and determine whether there are target watermark pixels in the page image that meet the conditions for watermark addition based on the image features; If the target watermark pixel exists, then determine the pixel drift value after the watermark is added; The pixel value of the target watermark pixel is corrected based on the pixel offset value.
8. A page detection device, characterized in that, include: The extraction module is used to acquire the page image of the page to be detected and extract the pixel value of each pixel in the page image; The judgment module is used to cluster pixels whose pixel value difference is less than a preset difference threshold to obtain at least one set of pixels, wherein the pixel value difference between any pixels in each set of pixels is less than the preset difference threshold, count the second number of pixels contained in each set of pixels, determine the maximum value of at least one of the second numbers as the first number, determine the pixels in the set of pixels corresponding to the maximum value as background pixels, and determine whether the first number of background pixels meets a preset number condition. The blank screen determination module is used to determine that the page to be detected is a blank screen page when the quantity condition is met.
9. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the page detection method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program for performing the page detection method according to any one of claims 1-7.
Citation Information
Patent Citations
Applet page control method and device, equipment and medium
CN111858303A
Page control method, device, system and equipment and readable storage medium
CN112559918A