Page comparison method and device, storage medium and electronic device

By constructing histograms and calculating pixel value distribution ratios, the system automatically verifies whether a page is rendered correctly. This solves the problem of high maintenance costs associated with manual configuration of monitoring or writing of automated test scripts in existing technologies, and achieves efficient and accurate page comparison.

CN116468914BActive Publication Date: 2026-04-24DOUYIN VISION CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DOUYIN VISION CO LTD
Filing Date
2023-04-21
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

In existing monitoring systems and front-end automated testing scenarios, manually configuring monitoring or writing automated test scripts to verify whether the front-end page content is loaded and displayed correctly results in high maintenance costs and difficulty in handling subtle differences in the page and differences caused by non-errors.

Method used

By acquiring the page image to be compared and the baseline page image, a histogram is constructed and the distribution ratio of preset pixel values ​​is calculated to determine the first similarity. This automatically verifies whether the page is rendered correctly, avoiding the need for manual configuration of verification content.

Benefits of technology

It improves the accuracy and efficiency of page comparison, reduces manual workload, can capture subtle differences in the page, and is compatible with situations where the page structure and content remain unchanged but UI adjustments have been made.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116468914B_ABST
    Figure CN116468914B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a page comparison method and device, a storage medium and an electronic device, to improve the accuracy and efficiency of the page comparison result. The page comparison method comprises: obtaining a to-be-compared page image and a reference page image; determining a first distribution value corresponding to each preset pixel value in a first histogram of the to-be-compared page image, and determining a second distribution value corresponding to each preset pixel value in a second histogram of the reference page image; determining a ratio of the first distribution value and the second distribution value corresponding to each preset pixel value, and determining a first similarity according to the average of the ratio; and determining a comparison result of the to-be-compared page image and the reference page image according to the first similarity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a page comparison method, apparatus, storage medium, and electronic device. Background Technology

[0002] In various monitoring systems or front-end automated testing scenarios, it is often necessary to verify whether the content of the front-end page loads and displays correctly. These verification tasks are typically performed by relevant business personnel through configuring monitoring or writing automated test scripts. When configuring monitoring or writing automated test scripts, these personnel identify the key content within each front-end page and configure corresponding verification content. For example, they might configure OCR text recognition to verify whether the text in key areas of the page matches expectations, or configure CV template matching to verify whether key content on the page matches expectations. Summary of the Invention

[0003] This summary section is provided to briefly introduce the concepts, which will be described in detail in the detailed description section below. This summary section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0004] Firstly, this disclosure provides a page comparison method, the method comprising:

[0005] Obtain the page image to be compared and the baseline page image;

[0006] Determine the first distribution value corresponding to each preset pixel value in the first histogram of the page image to be compared, and determine the second distribution value corresponding to each preset pixel value in the second histogram of the reference page image, wherein the histogram is constructed based on the distribution of each preset pixel value in the page image;

[0007] Determine the ratio of the first distribution value to the second distribution value corresponding to each preset pixel value, and determine the first similarity based on the mean of the ratio;

[0008] The comparison result between the page image to be compared and the benchmark page image is determined based on the first similarity.

[0009] Secondly, this disclosure provides a page comparison device, the device comprising:

[0010] The acquisition module is used to acquire the page image to be compared and the baseline page image;

[0011] The first determining module is used to determine the first distribution value of each preset pixel value in the first histogram of the page image to be compared, and to determine the second distribution value of each preset pixel value in the second histogram of the reference page image, wherein the histogram is constructed based on the distribution of each preset pixel value in the page image;

[0012] The second determining module is used to determine the ratio of the first distribution value and the second distribution value corresponding to each preset pixel value, and to determine the first similarity based on the mean of the ratio;

[0013] An execution module is used to determine the comparison result between the page image to be compared and the benchmark page image based on the first similarity.

[0014] Thirdly, this disclosure provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.

[0015] Fourthly, this disclosure provides an electronic device, comprising:

[0016] A storage device on which computer programs are stored;

[0017] A processing device for executing the computer program in the storage device to implement the steps of the method described in the first aspect.

[0018] The above technical solution can capture pixel-level subtle page differences between the page image to be compared and the benchmark page image, improving the accuracy of the comparison results. Compared to related technologies that rely on configuring monitoring or writing automated test scripts, this method, which compares the page image to be compared with the benchmark page image to determine whether the content and structure of the page image to be compared have changed, and thus determines whether the page image to be compared is a correctly rendered page image, eliminates the need for manual configuration and maintenance of page verification content, reducing manual workload and improving the efficiency of page comparison.

[0019] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description

[0020] 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. In the drawings:

[0021] Figure 1 This is a flowchart illustrating a page comparison method according to an exemplary embodiment of the present disclosure.

[0022] Figure 2 This is a schematic diagram of a page diagram according to an exemplary embodiment of the present disclosure.

[0023] Figure 3 This is a schematic diagram of another page diagram illustrated according to an exemplary embodiment of the present disclosure.

[0024] Figure 4 This is a histogram illustrated according to an exemplary embodiment of the present disclosure.

[0025] Figure 5 This is another histogram illustrated according to an exemplary embodiment of the present disclosure.

[0026] Figure 6 This is a schematic diagram of another page diagram illustrated according to an exemplary embodiment of the present disclosure.

[0027] Figure 7 This is a schematic diagram of another page diagram illustrated according to an exemplary embodiment of the present disclosure.

[0028] Figure 8 This is a flowchart illustrating another page comparison method according to an exemplary embodiment of the present disclosure.

[0029] Figure 9 This is a block diagram illustrating a page comparison device according to an exemplary embodiment of the present disclosure.

[0030] Figure 10 This is a block diagram illustrating an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation

[0031] 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.

[0032] 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.

[0033] The term "comprising" and its variations as used herein are open-ended inclusion, 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.

[0034] 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.

[0035] 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".

[0036] 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.

[0037] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0038] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0039] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose whether to "agree" or "disagree" to provide personal information to the electronic device.

[0040] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0041] Meanwhile, it is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0042] In various monitoring systems or front-end automated testing scenarios, it is often necessary to verify whether the content of the front-end page loads and displays correctly. This verification is typically performed by relevant business personnel through configuring monitoring or writing automated test scripts. When configuring monitoring or writing automated test scripts, these personnel identify the key content within each front-end page and configure corresponding verification content. For example, they might configure OCR text recognition to verify whether the text in key areas of the page matches expectations, or configure CV template matching to verify whether key content on the page matches expectations. However, due to page changes and unstable template matching, the maintenance cost of this manual monitoring configuration or automated test script writing method is relatively high.

[0043] In order to automatically verify whether a page has been rendered correctly and to automatically confirm whether the key content and structure of the page have changed, thus avoiding the need for manual configuration and maintenance of the page's verification content, this disclosure proposes to use page comparison technology to determine whether the page has changed.

[0044] For example, a rigorous comparison method can be used to compare the pixel values ​​of pixels at the same positions on the page to be compared and the standard page to determine whether the page to be compared has changed relative to the standard page. Alternatively, a histogram comparison algorithm can be used to calculate the RGB value distribution of the page to be compared and the standard page, obtain a distribution histogram, normalize the histogram data, and calculate a correlation coefficient. The correlation coefficient is then used to determine whether the page to be compared has changed relative to the standard page. Another example is using a hash algorithm to determine the hash values ​​of the page to be compared and the standard page, and comparing the Hamming distance between the hash values ​​of the two pages to measure their similarity. A structural similarity algorithm can be used to measure the similarity between the page to be compared and the standard page in terms of brightness, contrast, and structure. Furthermore, content feature analysis and keypoint matching methods can also be used to determine the degree of similarity between the page to be compared and the standard page.

[0045] However, these comparison methods are either too strict, unable to accommodate subtle differences in the page that are not caused by errors, thus causing false alarms; or too lenient for front-end pages that mainly use large areas of solid color, resulting in excessive errors in the calculated similarity.

[0046] In view of this, embodiments of this disclosure propose a page comparison method, apparatus, storage medium, and electronic device, which can automatically verify whether a page has been rendered correctly and automatically confirm whether key page content and structure have changed, avoiding manual configuration and maintenance of page verification content and improving the efficiency of page comparison. Furthermore, it can capture pixel-level subtle page differences between the page image to be compared and the reference page image, improving the accuracy of the comparison results.

[0047] Figure 1 This is a flowchart illustrating a page comparison method according to an exemplary embodiment of this disclosure. (Refer to...) Figure 1 The comparison methods for this page may include:

[0048] S11. Obtain the page image to be compared and the baseline page image.

[0049] For example, the image to be compared can be a current screenshot of the application's front-end page, while the baseline image can be a historical screenshot of the application's front-end page. In this way, by comparing the current screenshot and the historical screenshot, it can be determined whether the current front-end page has changed, thus achieving the purpose of validating the content of the front-end page.

[0050] In another example, the comparison page image can be a current screenshot of the application's front-end page, while the baseline page image can be a standard design of the application's front-end page.

[0051] In some implementations, obtaining the page image to be compared and the baseline page image can be done by reading input parameters from a database, including the page image to be compared and the baseline page image.

[0052] In other implementations, obtaining the comparison page image and the baseline page image can be done by taking a screenshot of the application's front-end page to obtain the comparison page image, and retrieving historical screenshots corresponding to the front-end page from the database to obtain the baseline page image.

[0053] S12. Determine the first distribution value of each preset pixel value in the first histogram of the page image to be compared, and determine the second distribution value of each preset pixel value in the second histogram of the benchmark page image. The histogram is constructed based on the distribution of each preset pixel value in the page image.

[0054] A histogram, also known as a quality distribution chart, is a statistical reporting chart that uses a series of vertical bars or lines of varying heights to represent the distribution of data. Typically, the horizontal axis of a histogram represents the data type, and the vertical axis represents the distribution. In this embodiment, the first histogram is constructed based on the distribution of each preset pixel value in the page image to be compared, including the number of pixels corresponding to each preset pixel value in the page image to be compared. The second histogram is constructed based on the distribution of each preset pixel value in the reference page image, including the number of pixels corresponding to each preset pixel value in the reference page image.

[0055] In some embodiments, if the image types of the page image to be compared and the reference page image are luminance / grayscale images, then the preset pixel values ​​may include 256 pixel values ​​ranging from 0 to 255. In other embodiments, if the image types of the page image to be compared and the reference page image are RGB images, then the preset pixel values ​​may include 256×256×256 pixel values ​​ranging from (0,0,0) to (255,255,255). It should also be noted that the preset pixel values ​​of this disclosure include, but are not limited to, the pixel values ​​in the examples above.

[0056] In this embodiment of the disclosure, the page image to be compared and / or the reference page image may not include pixels with certain preset pixel values. For example, if the page image to be compared is a pure white page image, then the page image to be compared only includes pixels with pixel values ​​of (255, 255, 255). Correspondingly, the first distribution value of the preset pixel values ​​other than the preset pixel values ​​of (255, 255, 255) in the first histogram corresponding to the page image to be compared is 0.

[0057] It's important to note that because the histogram is constructed based on the distribution of each preset pixel value within the page image—including the number of pixels corresponding to each preset pixel value—it is highly tolerant of element displacement within the page image. As long as the page image doesn't suffer from missing elements, size changes, or element obscuration due to displacement, the histogram before and after displacement will remain unchanged. Therefore, this method of using histograms to statistically analyze the distribution of preset pixel values ​​is compatible with minor page differences caused by UI adjustments, such as line width or line spacing, where the main structure and content of the page image remain unchanged but the overall displacement is due to non-error-related changes.

[0058] S13. Determine the ratio of the first distribution value and the second distribution value corresponding to each preset pixel value, and determine the first similarity based on the mean of the ratio.

[0059] In some implementations, the first similarity can be the mean of all ratios, or it can be a value after normalizing the mean.

[0060] In other implementations, the first similarity may be the mean of the partial ratios, or it may be the normalized value of the mean of the partial ratios.

[0061] After determining the first distribution value corresponding to each preset pixel value in the first histogram of the page image to be compared, and determining the second distribution value corresponding to each preset pixel value in the second histogram of the reference page image, the ratio of the first distribution value and the second distribution value corresponding to each preset pixel value can be determined. For example, assuming the first distribution value corresponding to the preset pixel value (255, 255, 255) is 100 and the second distribution value is 1000, then the ratio of the first distribution value and the second distribution value corresponding to the preset pixel value (255, 255, 255) can be: Or for

[0062] In some cases, such as when the page image to be compared is a pure white page image, the page image to be compared only includes pixels with a pixel value of (255, 255, 255). Correspondingly, the first distribution value of the preset pixel values ​​other than the preset pixel value of (255, 255, 255) in the first histogram corresponding to the page image to be compared is 0. Since 0 cannot be used as a denominator in the ratio calculation, this disclosure provides an implementation method for determining the ratio of the first distribution value and the second distribution value corresponding to each preset pixel value as follows:

[0063] For each preset pixel value, determine the minimum and maximum values ​​of the first and second distribution values ​​corresponding to that preset pixel value; use the minimum value as the numerator and the maximum value as the denominator to calculate the ratio corresponding to that preset pixel value.

[0064] For example, suppose the preset pixel value (255, 255, 255) corresponds to a first distribution value of 0 and a second distribution value of 100. The minimum value between the first distribution value 0 and the second distribution value 100 is 0, and the maximum value is 100. Using the minimum value 0 as the numerator and the maximum value 100 as the denominator, the ratio corresponding to this preset pixel value is calculated as follows:

[0065] It's easy to understand that if two images are completely identical, then the number of pixels for each preset pixel value in both images will also be completely identical. If the number of pixels for a certain preset pixel value A is inconsistent between the two images, it means that the two images are different at least in the dimension of preset pixel value A. Therefore, the ratio of the first distribution value and the second distribution value corresponding to each preset pixel value can characterize the magnitude of the difference between the page image to be compared and the reference page image in the pixel dimension.

[0066] Furthermore, the first similarity can be determined based on the mean of all ratios. For example, the mean of all ratios can be directly used to determine the first similarity. Alternatively, the mean of all ratios can be multiplied by a preset coefficient to obtain the first similarity. This method of similarity calculation considers all preset pixel values ​​because the first similarity is determined based on the ratios corresponding to all preset pixel values. Since the ratio corresponding to each preset pixel value represents the magnitude of the difference between the page image to be compared and the reference page image in the pixel dimension corresponding to that preset pixel value, the first similarity considers the differences between the page image to be compared and the reference page image in the pixel dimensions corresponding to each preset pixel value. Moreover, since the first similarity is determined based on the mean of the ratios corresponding to all preset pixel values, it considers the differences between the page image to be compared and the reference page image in the pixel dimensions corresponding to each preset pixel value, and also pays equal attention to the pixel dimensions corresponding to each preset pixel value. Therefore, this method of calculating the first similarity can capture subtle page differences in the pixel dimension corresponding to any preset pixel value in the page image to be compared and the benchmark page image. In other words, this method of calculating the first similarity can capture subtle page differences at the pixel level between the page image to be compared and the benchmark page image.

[0067] Compared to calculating the correlation coefficient after normalizing histogram data, the method of calculating the first similarity in step S13 of this disclosure yields more accurate results. This is because the method of calculating the correlation coefficient after normalizing histogram data pays varying degrees of attention to each pixel value. Specifically, it tends to overlook changes in smaller pixel values ​​and is dominated by larger pixel values, thus failing to capture subtle local changes on the page. In contrast, the method of calculating the first similarity in step S13 of this disclosure pays equal attention to the pixel dimension corresponding to each preset pixel value, enabling it to capture subtle page differences in the pixel dimension corresponding to any preset pixel value in the comparison page image and the reference page image. For example, see... Figure 2 and Figure 3 For example, Figure 2 A blank page displayed on an electronic device and such as Figure 3 When a page image with a white background is displayed on an electronic device, Figure 2 The histogram of a blank page is as follows: Figure 4 As shown, Figure 3 The histogram of a page with a white background is shown below. Figure 5As shown, the similarity between the two calculated using the method of calculating the first similarity in step S13 of this disclosure is 12.37%, while the similarity calculated using the method of calculating the correlation coefficient after normalizing the histogram data is 98.94%. Obviously, the result of calculating the first similarity using the method of calculating the first similarity in step S13 of this disclosure is more in line with the business requirements of verifying the text content, image content, and page structure of the page.

[0068] S14. Determine the comparison result between the page image to be compared and the reference page image based on the first similarity.

[0069] In some implementations, the first similarity can be determined as the comparison result between the page image to be compared and the reference page image.

[0070] By employing the above method, pixel-level subtle page differences between the page image to be compared and the baseline page image can be captured, improving the accuracy of the comparison results. Compared to related technologies that rely on configuring monitoring or writing automated test scripts, this method, which compares the page image to be compared with the baseline page image to determine whether the content and structure of the page image to be compared have changed, and thus determines whether the page image to be compared is a correctly rendered page image, eliminates the need for manual configuration and maintenance of page verification content, reducing manual workload and improving the efficiency of page comparison. Furthermore, this method is also compatible with minor differences caused by non-errors when the main structure and content of the page image remain unchanged but UI adjustments have been made, such as adjustments to line width and line spacing, resulting in overall displacement.

[0071] In some implementations, obtaining the page image to be compared and the baseline page image may involve: in response to receiving a comparison request from the requesting party, obtaining the page image to be compared and the baseline page image based on the page image download link carried in the comparison request. Accordingly, the page comparison method may also include: feeding back the comparison results to the requesting party.

[0072] For example, the page comparison method disclosed herein can be an application service provided by a third party. By calling the external interface of the application service, a comparison request can be sent to the application service. The comparison request may include a page image download link. Upon receiving the comparison request from the requesting party, the application service obtains a first image and a second image based on the page image download link carried in the comparison request. Based on the image identifiers of the first and second images, it can be determined which image is the page image to be compared and which image is the baseline page image. For example, an image identifier of 1 represents the page image to be compared, and an image identifier of 0 represents the baseline page image.

[0073] This method is compatible with front-end projects of any architecture. Any front-end project can call this application service to check whether the front-end page meets the requirements. This method eliminates the need for manual confirmation of which content on each page is important and the corresponding validation settings, resulting in no maintenance costs. It is easy to use, highly compatible, and has high utilization. Furthermore, this method is also suitable for comparing any two images.

[0074] In some implementations, before determining the first distribution value corresponding to each preset pixel value in the first histogram of the page image to be compared, and before determining the second distribution value corresponding to each preset pixel value in the second histogram of the reference page image, the process may include: preprocessing the page image to be compared and the reference page image to obtain a first page image to be compared and a first reference page image; accordingly, constructing a first histogram based on the distribution of each preset pixel value in the first page image to be compared, and constructing a second histogram based on the distribution of each preset pixel value in the first reference page image.

[0075] In some business scenarios, page images include dynamically changing images, such as dynamic barcodes, dynamic QR codes, dynamic emoji images, or dynamic meteorological images representing the weather. Changes in page images caused by these dynamically changing images are normal. To avoid false alarms regarding this phenomenon, this disclosure proposes an implementation method that preprocesses the page image to be compared and the reference page image to obtain a first page image to be compared and a first reference page image. This can be achieved by: adjusting the sizes of the page image to be compared and the reference page image to the same size to obtain a first reference page image, and obtaining an initial page image to be compared. If the initial page image to be compared and the first reference page image contain image blocks of the target type at the same position, the image blocks of the target type in the first reference page image are used to overwrite the image blocks of the target type in the initial page image to be compared, thus obtaining the first page image to be compared.

[0076] Here, an image block can also be called an image region. The target type can be a dynamically changing image type, and the image block of the target type can be a dynamically changing one-dimensional barcode image region, a two-dimensional barcode image region, etc. on the page. For example, if the initial page image to be compared and the first reference page image both have a barcode image in the same position (such as the upper left corner of the page image), then the first page image to be compared can be obtained by overlaying the barcode image in the initial page image with the barcode image in the first reference page image.

[0077] This method, through the overlay operation, can ignore dynamic changes in the QR code image in the page image to be compared, without significantly affecting the distribution of each preset pixel value in the page image. For example, the method of coloring the QR code images in both the page image to be compared and the reference page image the same color, which also ignores changes in the QR code image in the page image to be compared, causes a significant change in the global distribution of the histogram due to coloring the QR code images with the same color, resulting in a larger error in the calculated first similarity. However, the method of overlaying the QR code image in the initial page image to be compared with the QR code image in the first reference page image, compared to coloring the QR code images with the same color, changes the pixel values ​​of fewer pixels, resulting in minimal changes to the global distribution of the histogram. Therefore, this method, through the overlay operation, can ignore changes in the QR code image in the page image to be compared, without significantly affecting the distribution of each preset pixel value in the page image.

[0078] In some business scenarios, page images may include designs such as watermarks, watermark changes, dynamic page steganography, and hidden watermark changes; the page image to be compared and the baseline page image may also have different brightness levels due to factors such as the timing of the screenshot / incomplete loading. To avoid false alarms regarding these page designs and differences in page image brightness, this disclosure proposes an implementation method that preprocesses the page image to be compared and the baseline page image to obtain a first page image to be compared and a first baseline page image, which may be:

[0079] The sizes of the page image to be compared and the reference page image are adjusted to be the same to obtain the first reference page image and the initial page image to be compared. Pixel pairs located at the same position in the initial page image to be compared and the first reference page image are identified. The pixel difference value of each pixel pair is calculated to obtain the first array. Pixel difference values ​​in the first array that are greater than a preset threshold are zeroed out to obtain the second array. The initial page image to be compared and the second array are summed to obtain the first page image to be compared.

[0080] For example, determine the pixel pairs located at the same position in the initial page image to be compared and the first reference page image, the pixel pair (A ij B ij This includes the i-th row and j-th pixel in the initial comparison page image A and the i-th row and j-th pixel in the first reference page image B. The values ​​of i and j are both positive integers.

[0081] Calculate the pixel difference value for each pair of pixels to obtain the first array. For example, suppose the pixel value of each pixel in the initial comparison page A is a[1,2,3,4,5,6], and the pixel value of each pixel in the first reference page B is b[100,3,4,5,20,6], then the first array is ba=[99,1,1,1,15,0].

[0082] The pixel difference values ​​in the first array that are greater than a preset threshold are zeroed out to obtain the second array. Assuming the preset threshold is 10, after zeroing out the pixel difference values ​​in the first array [99,1,1,1,15,0] that are greater than the preset threshold, the second array is [0,1,1,1,0,0].

[0083] The initial page image to be compared and the second array are summed to obtain the first page image to be compared. For example, the sum of the pixel values ​​a[1,2,3,4,5,6] of each pixel in the initial page image to be compared A and the second array [0,1,1,1,0,0] is calculated as a'[1,3,4,5,5,6]. a'[1,3,4,5,5,6] represents the pixel value of each pixel in the first page image to be compared.

[0084] By comparing a'[1,3,4,5,5,6] and b[100,3,4,5,20,6], it can be seen that this method can ignore watermark changes, dark watermark changes, and the differences in brightness between the page image to be compared and the baseline page image due to factors such as the timing of the screenshot / incomplete loading.

[0085] By using the above method, before calculating the first similarity, the differences between the page image to be compared and the benchmark page image can be ignored due to normal dynamic page design reasons such as dynamic image design and watermark change design on the page, so as to calculate a first similarity that is more in line with the business scenario.

[0086] In some implementations, preprocessing the page image to be compared and the reference page image to obtain a first page image to be compared and a first reference page image can be performed. This can be done by: adjusting the sizes of the page image to be compared and the reference page image to be consistent to obtain a first reference page image, and obtaining a first initial page image to be compared. If the first initial page image to be compared and the first reference page image contain image blocks of the target type at the same position, then the image blocks of the target type in the first reference page image are overwritten to obtain a second initial page image to be compared. Pixel pairs located at the same position in the second initial page image to be compared and the first reference page image are determined. The pixel difference value of each pixel pair is calculated to obtain a first array. Pixel difference values ​​in the first array that are greater than a preset threshold are zeroed out to obtain a second array. The second initial page image to be compared and the second array are summed to obtain the first page image to be compared.

[0087] By using this method, before calculating the first similarity, the page images to be compared and the baseline page images are preprocessed. This can ignore the differences between the page images to be compared and the baseline page images caused by the dynamic image design on the page, as well as the differences between the page images to be compared and the baseline page images caused by normal dynamic page design or phenomena such as watermark changes or different image brightness. In this way, a first similarity that is more in line with the business scenario can be calculated.

[0088] In some implementations, determining the comparison result between the page image to be compared and the reference page image based on a first similarity can be:

[0089] If the first similarity is greater than or equal to the similarity threshold, and the target proportion is greater than or equal to the proportion threshold, then the comparison result is determined based on the target proportion. The target proportion represents the ratio of the number of pixel pairs with the same pixel value at the same position in the page image to be compared and the reference page image to the total number of pixels in either the page image to be compared or the reference page image. The proportion threshold is greater than the similarity threshold. If the first similarity is greater than or equal to the similarity threshold, and the target proportion is less than the proportion threshold, then the comparison result is determined based on the first similarity.

[0090] The target percentage value represents the ratio of the number of pixel pairs with the same pixel value at the same position in the page image to be compared and the benchmark page image to the total number of pixels in the page image to be compared or the benchmark page image.

[0091] For example, determine the pairs of pixels (X) located at the same position in the page image to be compared and the reference page image. ij ,Y ij ), pixel pairs (X ij ,Y ij (Including the pages to be compared) Figure XThe i-th row and j-th pixel in the image X is compared with the i-th row and j-th pixel in the baseline page image Y, where i and j are both positive integers. Determine X. ij pixel values ​​and Y ij The number n of all pixel pairs with the same pixel value. Determine the total number m of pixels in the comparison page image or the baseline page image, or the total number m of pixel pairs, and determine the target proportion value as the ratio of the number n to the total number m.

[0092] When the comparison page image and the reference page image are preprocessed, the target proportion value can also represent the ratio of the number of pixel pairs with the same pixel value at the same position in the first comparison page image and the first reference page image to the total number of pixels in the first comparison page image or the first reference page image.

[0093] Because the method of calculating the first similarity in step S13 of this disclosure can capture minute page differences at the pixel level between the page image to be compared and the reference page image, in some cases, the calculated first similarity may be too low due to excessive sensitivity to these minute page differences. For example, if most areas of two images are completely identical, and only one user's avatar differs, and 99.97% of the pixels in the two images are the same, the similarity calculated using the method of calculating the first similarity in step S13 of this disclosure is 90.72%. It is clear that 90.72% is lower than 99.97%.

[0094] To improve the accuracy of comparison results between the page image to be compared and the baseline page image, this disclosure proposes that if the first similarity is greater than or equal to a similarity threshold and the target proportion is greater than or equal to a proportion threshold, the target proportion is determined as the comparison result. Since the proportion threshold is greater than the similarity threshold (e.g., the proportion threshold is 95% and the similarity threshold is 90%), determining the target proportion as the comparison result is more accurate than determining the first similarity. Correspondingly, if the first similarity is greater than or equal to the similarity threshold and the target proportion is less than the proportion threshold, the first similarity is determined as the comparison result.

[0095] In some business scenarios, page layouts may include table areas, list areas, title areas, navigation bar areas, content areas, etc. For example... Figure 6 The page layout shown includes the table area containing table AA, the title area containing the title, and the navigation area containing the navigation. For example... Figure 7 The page diagram shown includes the list area where the list is located, the title area where the title is located, the navigation area where the navigation is located, and the page content display area.

[0096] In some scenarios, the values ​​in table or list areas can change dynamically. These dynamically changing values ​​causing changes in the page layout are normal front-end page design. To avoid false positives for this phenomenon, this disclosure proposes an implementation method: If the first similarity is less than or equal to a similarity threshold, the page layout to be compared and the baseline page layout are divided into multiple first sub-images corresponding to the page layout to be compared, and multiple second sub-images corresponding to the baseline page layout. A third similarity is determined based on the second similarity between each first sub-image and its corresponding second sub-image, and the preset weight of each sub-image within its respective page layout. The third similarity is then used as the comparison result.

[0097] To divide the page image for comparison and the baseline page image, a deep learning model can be used to identify the page structure and local features, and the page image can be divided into multiple sub-images according to the title area, navigation bar area, page content area, table area, list area, etc.

[0098] In some implementations, determining the second similarity between the first sub-image and the corresponding second sub-image can be as follows: If both the first sub-image and the corresponding second sub-image include a target content area, such as a table content area or a list content area, then determine the intersection ratio of the first target content area in the first sub-image and the second target content area in the second sub-image. If the intersection ratio is greater than a preset ratio, it indicates that the first target content area and the second target content area are the same table area or list area. In this case, a new first sub-image can be obtained by covering the first target content area in the first sub-image with the second target content area. The corresponding second similarity is determined based on the new first sub-image and the second sub-image. The calculation method for the second similarity is the same as the method for calculating the first similarity in the aforementioned steps S12 and S13, and will not be repeated here.

[0099] One example of determining the intersection ratio of a first target content region in a first subfigure and a second target content region in a second subfigure is to determine the intersection-union ratio (IUR) of the first target content region in the first subfigure and the second target content region in the second subfigure. The IUR is the ratio of the intersection to the union.

[0100] Another example of determining the intersection ratio of the first target content region in the first sub-image and the second target content region in the second sub-image can be: Determine the intersection of the horizontal coordinates of the first and second target content regions, for example, if the intersection is [7, 77]. Determine the first horizontal coordinate span corresponding to the intersection [7, 77] as 77 - 7 = 70, and determine the second horizontal coordinate span corresponding to the second target content region [7, 100] as 100 - 7 = 93. Based on the ratio of the first horizontal coordinate span of 70 to the second horizontal coordinate span of 93, determine the intersection ratio.

[0101] Figure 8 This is a flowchart illustrating another page comparison method according to an exemplary embodiment of this disclosure. (Refer to...) Figure 8 The comparison method for this page may include the following steps.

[0102] S801: Receive the comparison request sent by the requester, and obtain the page diagram to be compared and the baseline page diagram according to the page diagram download link carried in the comparison request.

[0103] S802. Adjust the size of the page image to be compared and the reference page image to be consistent to obtain the first reference page image and the first initial page image to be compared.

[0104] S803. Determine whether the first initial page image to be compared and the first reference page image have image blocks of the target type at the same position.

[0105] S804. Based on the image blocks of the target type in the first reference page image, cover the image blocks of the target type in the first initial page image to be compared to obtain the second initial page image to be compared.

[0106] S805. Determine the pixel pairs located at the same position in the second initial page image to be compared and the first reference page image.

[0107] S806. Calculate the pixel difference value for each pixel pair to obtain the first array.

[0108] S807. The pixel difference values ​​in the first array that are greater than the preset threshold are zeroed out to obtain the second array.

[0109] S808. Summation is performed on the second initial page image to be compared and the second array to obtain the first page image to be compared.

[0110] S809. Based on the distribution of each preset pixel value in the first comparison page image, a first histogram is constructed, and based on the distribution of each preset pixel value in the first reference page image, a second histogram is constructed.

[0111] S810. Determine the first distribution value corresponding to each preset pixel value in the first histogram, determine the second distribution value corresponding to each preset pixel value in the second histogram, determine the ratio of the first distribution value and the second distribution value corresponding to each preset pixel value, and determine the first similarity based on the mean of each ratio.

[0112] S811. Determine whether the first similarity is greater than or equal to the similarity threshold.

[0113] S812. The first initial page image to be compared is determined as the second initial page image to be compared.

[0114] S813. Determine whether the target percentage value is greater than or equal to the percentage threshold.

[0115] S814. Determine the comparison results based on the target percentage.

[0116] S815. Determine the comparison result based on the first similarity.

[0117] S816. Divide the page image to be compared and the baseline page image into multiple first sub-images corresponding to the page image to be compared and multiple second sub-images corresponding to the baseline page image.

[0118] S817. Determine the third similarity based on the second similarity between each first sub-image and its corresponding second sub-image, and the preset weight of each sub-image in the page image to which it belongs.

[0119] S818. Determine the comparison result based on the third similarity.

[0120] S819. Feedback the comparison results to the requesting party.

[0121] The implementation methods for each of the above steps have been described in detail in the relevant embodiments of the aforementioned page comparison method, and will not be elaborated here.

[0122] Based on the same concept, this disclosure also provides a page comparison device, which can be part or all of an electronic device through software, hardware, or a combination of both. For example... Figure 9 As shown, the page comparison device 100 includes:

[0123] Module 101 is used to acquire the page image to be compared and the baseline page image;

[0124] The first determining module 102 is used to determine the first distribution value of each preset pixel value in the first histogram of the page image to be compared, and to determine the second distribution value of each preset pixel value in the second histogram of the reference page image, wherein the histogram is constructed based on the distribution of each preset pixel value in the page image;

[0125] The second determining module 103 is used to determine the ratio of the first distribution value and the second distribution value corresponding to each preset pixel value, and to determine the first similarity based on the mean of the ratio;

[0126] The execution module 104 is used to determine the comparison result between the page image to be compared and the benchmark page image based on the first similarity.

[0127] This device can capture pixel-level subtle differences between the page image to be compared and the baseline page image, improving the accuracy of the comparison results. Compared to related technologies that rely on configuring monitoring or writing automated test scripts, this method, which compares the page image to be compared with the baseline page image to determine whether the content and structure of the page image to be compared have changed, and thus whether the page image to be compared is a correctly rendered page image, eliminates the need for manual configuration and maintenance of page verification content, reducing manual workload and improving the efficiency of page comparison.

[0128] Optionally, the second determining module 103 shown includes:

[0129] The calculation submodule is used to determine the minimum and maximum values ​​of the first distribution value and the second distribution value corresponding to each preset pixel value; and to calculate the ratio corresponding to the preset pixel value by using the minimum value as the numerator and the maximum value as the denominator.

[0130] Optionally, the device 100 includes:

[0131] The preprocessing module is used to preprocess the page image to be compared and the reference page image to obtain a first page image to be compared and a first reference page image.

[0132] The construction module is used to construct a first histogram based on the distribution of each preset pixel value in the first comparison page image, and to construct a second histogram based on the distribution of each preset pixel value in the first reference page image.

[0133] Optionally, the preprocessing module includes:

[0134] The first preprocessing submodule is used to adjust the size of the page image to be compared and the reference page image to be consistent, so as to obtain the first reference page image and the initial page image to be compared; if the initial page image to be compared and the first reference page image have image blocks of the target type at the same position, the target type image blocks in the first reference page image are used to cover the target type image blocks in the initial page image to be compared, so as to obtain the first page image to be compared.

[0135] Optionally, the preprocessing module includes:

[0136] The second preprocessing submodule is used to adjust the sizes of the page image to be compared and the reference page image to be consistent, to obtain the first reference page image, and to obtain the initial page image to be compared; to determine the pixel pairs located at the same position in the initial page image to be compared and the first reference page image; to calculate the pixel difference value of each pixel pair, to obtain a first array; to zero out the pixel difference values ​​in the first array that are greater than a preset threshold, to obtain a second array; and to sum the initial page image to be compared and the second array to obtain the first page image to be compared.

[0137] Optionally, the preprocessing module includes:

[0138] The third preprocessing submodule is used to adjust the sizes of the page image to be compared and the reference page image to be consistent, thereby obtaining the first reference page image and a first initial page image to be compared; if the first initial page image to be compared and the first reference page image have image blocks of the target type at the same position, then the image blocks of the target type in the first reference page image are overlaid to cover the image blocks of the target type in the first initial page image to be compared, thereby obtaining a second initial page image to be compared; determine the pixel pairs located at the same position in the second initial page image to be compared and the first reference page image; calculate the pixel difference value of each pixel pair to obtain a first array; perform zeroing on the pixel difference values ​​in the first array that are greater than a preset threshold to obtain a second array; and perform summation on the second initial page image to be compared and the second array to obtain the first page image to be compared.

[0139] Optionally, the execution module 104 includes:

[0140] The first execution submodule is configured to determine the comparison result based on the target proportion value if the first similarity is greater than or equal to the similarity threshold and the target proportion value is greater than or equal to the proportion threshold. The target proportion value represents the ratio of the number of pixel pairs with the same pixel value at the same position in the page image to be compared and the benchmark page image to the total number of pixels in the page image to be compared or the benchmark page image. The proportion threshold is greater than the similarity threshold.

[0141] The second execution submodule is used to determine the comparison result based on the first similarity if the first similarity is greater than or equal to the similarity threshold and the target proportion value is less than the proportion threshold.

[0142] Optionally, the execution module 104 includes:

[0143] The third execution submodule is configured to, if the first similarity is less than a similarity threshold, divide the page image to be compared and the benchmark page image into multiple first sub-images corresponding to the page image to be compared and multiple second sub-images corresponding to the benchmark page image; determine a third similarity based on a second similarity between each first sub-image and its corresponding second sub-image, and a preset weight of each sub-image in its respective page image; and determine the comparison result based on the third similarity.

[0144] Optionally, the third execution submodule is configured to: if both the first subgraph and the corresponding second subgraph include target content regions, determine the intersection ratio of the first target content region in the first subgraph and the second target content region in the second subgraph; if the intersection ratio is greater than a preset ratio, obtain a new first subgraph based on the second target content region covering the first target content region in the first subgraph; and determine the corresponding second similarity based on the new first subgraph and the second subgraph.

[0145] Optionally, the third execution submodule is configured to determine the intersection of the horizontal coordinates of the first target content region and the second target content region; determine the first horizontal coordinate span corresponding to the intersection of the horizontal coordinates; determine the second horizontal coordinate span corresponding to the second target content region; and determine the intersection ratio based on the ratio of the first horizontal coordinate span to the second horizontal coordinate span.

[0146] Optionally, the acquisition module 101 is configured to, in response to receiving a comparison request sent by the requester, obtain the page image to be compared and the benchmark page image according to the page image download link carried in the comparison request;

[0147] The device 100 further includes:

[0148] The feedback module is used to send the comparison results back to the requesting party.

[0149] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0150] Based on the same concept, this disclosure also provides a non-transitory computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of any of the page comparison methods described above.

[0151] Based on the same concept, this disclosure also provides an electronic device, including: a storage device having a computer program stored thereon; and a processing device for executing the computer program in the storage device to implement the steps of any of the above page comparison methods.

[0152] The following is for reference. Figure 10 This diagram illustrates a structural schematic of an electronic device 600 suitable for implementing embodiments of the present disclosure. The terminal devices in the embodiments of the present disclosure may include, but are 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 10 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0153] like Figure 10 As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 600. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.

[0154] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 10 An electronic device 600 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.

[0155] 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 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.

[0156] 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.

[0157] In some implementations, communication can be conducted using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol), and can be interconnected 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 end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0158] 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.

[0159] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquire a page image to be compared and a reference page image; determine a first distribution value corresponding to each preset pixel value in a first histogram of the page image to be compared, and determine a second distribution value corresponding to each preset pixel value in a second histogram of the reference page image, wherein the histogram is constructed based on the distribution of each preset pixel value in the page image; determine the ratio of the first distribution value to the second distribution value corresponding to each preset pixel value, and determine a first similarity based on the mean of the ratio; and determine a comparison result between the page image to be compared and the reference page image based on the first similarity.

[0160] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming 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).

[0161] 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.

[0162] The modules described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules are not, in some cases, intended to limit the functionality of the module itself.

[0163] 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.

[0164] 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.

[0165] 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.

[0166] 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.

[0167] 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 forms of implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which the various modules perform their operations has been described in detail in the embodiments relating to the method, and will not be elaborated upon here.

Claims

1. A page comparison method, characterized in that, The method includes: Obtain the page image to be compared and the baseline page image; The page image to be compared and the reference page image are preprocessed to obtain a first page image to be compared and a first reference page image. A first histogram is constructed based on the distribution of each preset pixel value in the first comparison page image, and a second histogram is constructed based on the distribution of each preset pixel value in the first reference page image. Determine the first distribution value corresponding to each preset pixel value in the first histogram of the page image to be compared, and determine the second distribution value corresponding to each preset pixel value in the second histogram of the reference page image, wherein the histogram is constructed based on the distribution of each preset pixel value in the page image; Determine the ratio of the first distribution value to the second distribution value corresponding to each preset pixel value, and determine the first similarity based on the mean of the ratio; The comparison result between the page image to be compared and the benchmark page image is determined based on the first similarity. The step of preprocessing the page image to be compared and the benchmark page image to obtain the first page image to be compared and the first benchmark page image includes: The sizes of the page image to be compared and the reference page image are adjusted to be the same to obtain the first reference page image and the initial page image to be compared. If the initial page image to be compared and the first reference page image have image blocks of the target type at the same position, then the image blocks of the target type in the initial page image to be compared are overwritten by the image blocks of the target type in the first reference page image to obtain the first page image to be compared.

2. The method according to claim 1, characterized in that, Determining the ratio of the first distribution value to the second distribution value corresponding to each of the preset pixel values ​​includes: For each preset pixel value, determine the minimum and maximum values ​​of the first distribution value and the second distribution value corresponding to the preset pixel value; The ratio corresponding to the preset pixel value is calculated by using the minimum value as the numerator and the maximum value as the denominator.

3. The method according to claim 1, characterized in that, The preprocessing of the page image to be compared and the reference page image to obtain the first page image to be compared and the first reference page image includes: The sizes of the page image to be compared and the reference page image are adjusted to be the same to obtain the first reference page image and the initial page image to be compared. Identify the pixel pairs located at the same position in the initial page image to be compared and the first reference page image; Calculate the pixel difference value for each pair of pixels to obtain the first array; The pixel difference values ​​in the first array that are greater than a preset threshold are zeroed out to obtain the second array; The initial page image to be compared and the second array are summed to obtain the first page image to be compared.

4. The method according to claim 1, characterized in that, The preprocessing of the page image to be compared and the reference page image to obtain the first page image to be compared and the first reference page image includes: The sizes of the page image to be compared and the reference page image are adjusted to be the same to obtain the first reference page image and the first initial page image to be compared. If the first initial page image to be compared and the first reference page image have image blocks of the target type at the same position, then the image blocks of the target type in the first initial page image to be compared are overwritten according to the image blocks of the target type in the first reference page image to obtain the second initial page image to be compared. Identify pixel pairs located at the same position in the second initial page image to be compared and the first reference page image; Calculate the pixel difference value for each pair of pixels to obtain the first array; The pixel difference values ​​in the first array that are greater than a preset threshold are zeroed out to obtain the second array; The second initial page image to be compared and the second array are summed to obtain the first page image to be compared.

5. The method according to claim 1, characterized in that, Determining the comparison result between the page image to be compared and the benchmark page image based on the first similarity includes: If the first similarity is greater than or equal to the similarity threshold and the target proportion is greater than or equal to the proportion threshold, then the comparison result is determined according to the target proportion, wherein the target proportion represents the ratio of the number of pixel pairs with the same pixel value at the same position in the page image to be compared and the benchmark page image to the total number of pixels in the page image to be compared or the benchmark page image, and the proportion threshold is greater than the similarity threshold. If the first similarity is greater than or equal to the similarity threshold and the target proportion is less than the proportion threshold, then the comparison result is determined based on the first similarity.

6. The method according to claim 1 or 5, characterized in that, Determining the comparison result between the page image to be compared and the benchmark page image based on the first similarity includes: If the first similarity is less than the similarity threshold, then the page image to be compared and the benchmark page image are divided into multiple first sub-images corresponding to the page image to be compared and multiple second sub-images corresponding to the benchmark page image. A third similarity is determined based on the second similarity between each first subgraph and its corresponding second subgraph, and the preset weight of each subgraph in the page graph to which it belongs. The comparison result is determined based on the third similarity.

7. The method according to claim 6, characterized in that, Determining the second similarity between the first subgraph and the corresponding second subgraph includes: If both the first subgraph and the corresponding second subgraph include target content regions, then determine the intersection ratio of the first target content region in the first subgraph and the second target content region in the second subgraph; If the cross ratio is greater than a preset ratio, a new first sub-image is obtained by covering the first target content area in the first sub-image with the second target content area; The corresponding second similarity is determined based on the new first subgraph and the second subgraph.

8. The method according to claim 7, characterized in that, Determining the intersection ratio of the first target content region in the first sub-image and the second target content region in the second sub-image includes: Determine the intersection of the x-coordinates of the first target content region and the second target content region; Determine the first horizontal coordinate span corresponding to the intersection of the horizontal coordinates, and determine the second horizontal coordinate span corresponding to the second target content area; The cross ratio is determined based on the ratio of the first horizontal axis span to the second horizontal axis span.

9. The method according to claim 1, characterized in that, The process of obtaining the page image to be compared and the baseline page image includes: In response to receiving a comparison request from the requesting party, the page image to be compared and the benchmark page image are obtained according to the page image download link carried in the comparison request; The method further includes: The comparison results are then fed back to the requesting party.

10. A page comparison device, characterized in that, The device includes: The acquisition module is used to acquire the page image to be compared and the baseline page image; The preprocessing module is used to preprocess the page image to be compared and the reference page image to obtain a first page image to be compared and a first reference page image. The construction module is used to construct a first histogram based on the distribution of each preset pixel value in the first comparison page image, and to construct a second histogram based on the distribution of each preset pixel value in the first reference page image. The first determining module is used to determine the first distribution value of each preset pixel value in the first histogram of the page image to be compared, and to determine the second distribution value of each preset pixel value in the second histogram of the reference page image, wherein the histogram is constructed based on the distribution of each preset pixel value in the page image; The second determining module is used to determine the ratio of the first distribution value and the second distribution value corresponding to each preset pixel value, and to determine the first similarity based on the mean of the ratio; An execution module is used to determine the comparison result between the page image to be compared and the benchmark page image based on the first similarity. The preprocessing module includes: The first preprocessing submodule is used to adjust the size of the page image to be compared and the reference page image to be consistent, so as to obtain the first reference page image and the initial page image to be compared; if the initial page image to be compared and the first reference page image have image blocks of the target type at the same position, the target type image blocks in the first reference page image are used to cover the target type image blocks in the initial page image to be compared, so as to obtain the first page image to be compared.

11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processing device, the program implements the steps of the method according to any one of claims 1-9.

12. An electronic device, characterized in that, include: A storage device on which computer programs are stored; A processing device for executing the computer program in the storage device to implement the steps of the method according to any one of claims 1-9.

Citation Information

Patent Citations

  • Page matching method and device

    CN104111960A

  • Page testing method and device, equipment, storage medium and program

    CN115048283A

  • Picture structure comparison method and device

    CN115393607A