CN116468914A - Page comparison method and device, storage medium and electronic equipment - Google Patents

Page comparison method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN116468914A
CN116468914A CN202310437517.6A CN202310437517A CN116468914A CN 116468914 A CN116468914 A CN 116468914A CN 202310437517 A CN202310437517 A CN 202310437517A CN 116468914 A CN116468914 A CN 116468914A
Authority
CN
China
Prior art keywords
page
compared
determining
diagram
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310437517.6A
Other languages
Chinese (zh)
Inventor
李莫凡
王启宇
黄隆宁
张尤长
高亚
林玲
吴昊睿
黄甜甜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Douyin Vision Co Ltd
Original Assignee
Douyin Vision Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Douyin Vision Co Ltd filed Critical Douyin Vision Co Ltd
Priority to CN202310437517.6A priority Critical patent/CN116468914A/en
Publication of CN116468914A publication Critical patent/CN116468914A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/761Proximity, similarity or dissimilarity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/758Involving statistics of pixels or of feature values, e.g. histogram matching
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Theoretical Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

The disclosure relates to a page comparison method, a page comparison device, a storage medium and electronic equipment, so as to improve the accuracy and comparison efficiency of page comparison results. The page comparison method comprises the following steps: acquiring a page diagram to be compared and a reference page diagram; determining a first distribution value corresponding to each preset pixel value in a first histogram of the page diagram to be compared, and determining a second distribution value corresponding to each preset pixel value in a second histogram of the reference page diagram; determining a ratio of a first distribution value to a second distribution value corresponding to each preset pixel value, and determining a first similarity according to the average value of the ratios; and determining a comparison result of the page diagram to be compared and the reference page diagram according to the first similarity.

Description

Page comparison method and device, storage medium and electronic equipment
Technical Field
The disclosure relates to the technical field of computers, and in particular relates to a page comparison method, a page comparison device, a storage medium and electronic equipment.
Background
In various monitoring systems or front-end automation test scenarios, it is often necessary to check whether the content of the front-end page is normally loaded for display. These verification tasks may be performed by the relevant business personnel through configuration monitoring or by writing automated test scripts. When configuring monitoring or writing an automatic test script, relevant business personnel can confirm key contents in each front-end page and configure corresponding check contents. For example, the character recognition through OCR characters and the verification of key areas in the page are configured to be expected, and for example, the key content in the page is configured to be matched with the expected through CV templates.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, the present disclosure provides a page comparison method, the method comprising:
acquiring a page diagram to be compared and a reference page diagram;
determining a first distribution value corresponding to each preset pixel value in a first histogram of the page diagram to be compared, and determining a second distribution value corresponding to each preset pixel value in a second histogram of the reference page diagram, wherein the histograms are constructed according to the distribution condition of each preset pixel value in the page diagram;
determining a ratio of the first distribution value to the second distribution value corresponding to each preset pixel value, and determining a first similarity according to a mean value of the ratio;
and determining a comparison result of the page graph to be compared and the reference page graph according to the first similarity.
In a second aspect, the present disclosure provides a page contrast device, the device comprising:
The acquisition module is used for acquiring the page image to be compared and the reference page image;
the first determining module is used for determining a first distribution value corresponding to each preset pixel value in a first histogram of the page diagram to be compared and a second distribution value corresponding to each preset pixel value in a second histogram of the reference page diagram, wherein the histograms are constructed according to the distribution condition of each preset pixel value in the page diagram;
the second determining module is used for determining the ratio of the first distribution value to the second distribution value corresponding to each preset pixel value, and determining a first similarity according to the average value of the ratio;
and the execution module is used for determining a comparison result of the page image to be compared and the reference page image according to the first similarity.
In a third aspect, the present disclosure provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processing device, implements the steps of the method of the first aspect.
In a fourth aspect, the present disclosure provides an electronic device comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method of the first aspect.
Through the technical scheme, the pixel-level fine page difference in the page image to be compared and the reference page image can be captured, and the accuracy of the comparison result is improved. Compared with the mode of configuring monitoring or writing an automatic test script in the related art, the method has the advantages that the page diagram to be compared is compared with the reference page diagram to determine whether the content, the structure and the like of the page diagram to be compared change, and further whether the page diagram to be compared is a page diagram which is normally rendered is determined, manual configuration and maintenance of verification content of the page are not needed, manual workload is reduced, and page comparison efficiency is improved.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale. In the drawings:
FIG. 1 is a flow chart illustrating a page contrast method according to an exemplary embodiment of the present disclosure.
Fig. 2 is a schematic diagram of a page diagram according to an exemplary embodiment of the present disclosure.
Fig. 3 is a schematic diagram of another page diagram shown in accordance with an exemplary embodiment of the present disclosure.
Fig. 4 is a histogram shown in accordance with an exemplary embodiment of the present disclosure.
Fig. 5 is another histogram shown in accordance with an exemplary embodiment of the present disclosure.
Fig. 6 is a schematic diagram of another page diagram shown in accordance with an exemplary embodiment of the present disclosure.
Fig. 7 is a schematic diagram of another page diagram shown in accordance with an exemplary embodiment of the present disclosure.
FIG. 8 is a flowchart illustrating another page contrast method according to an exemplary embodiment of the present disclosure.
Fig. 9 is a block diagram of a page contrast device, according to an exemplary embodiment of the present disclosure.
Fig. 10 is a block diagram of an electronic device, according to an exemplary embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
It will be appreciated that prior to using the technical solutions disclosed in the embodiments of the present disclosure, the user should be informed and authorized of the type, usage range, usage scenario, etc. of the personal information related to the present disclosure in an appropriate manner according to the relevant legal regulations.
For example, in response to receiving an active request from a user, a prompt is sent to the user to explicitly prompt the user that the operation it is requesting to perform will require personal information to be obtained and used with the user. Thus, the user can autonomously select whether to provide personal information to software or hardware such as an electronic device, an application program, a server or a storage medium for executing the operation of the technical scheme of the present disclosure according to the prompt information.
As an alternative but non-limiting implementation, in response to receiving an active request from a user, the manner in which the prompt information is sent to the user may be, for example, a popup, in which the prompt information may be presented in a text manner. In addition, a selection control for the user to select to provide personal information to the electronic device in a 'consent' or 'disagreement' manner can be carried in the popup window.
It will be appreciated that the above-described notification and user authorization process is merely illustrative and not limiting of the implementations of the present disclosure, and that other ways of satisfying relevant legal regulations may be applied to the implementations of the present disclosure.
Meanwhile, it can be understood that the data (including but not limited to the data itself, the acquisition or the use of the data) related to the technical scheme should conform to the requirements of the corresponding laws and regulations and related regulations.
In various monitoring systems or front-end automation test scenarios, it is often necessary to check whether the content of the front-end page is normally loaded for display. These verification tasks may be performed by the relevant business personnel through configuration monitoring or by writing automated test scripts. When configuring monitoring or writing an automatic test script, relevant business personnel can confirm key contents in each front-end page and configure corresponding check contents. For example, the character recognition through OCR characters and the verification of key areas in the page are configured to be expected, and for example, the key content in the page is configured to be matched with the expected through CV templates. However, the maintenance cost of such manual configuration monitoring or automated test script writing is relatively high due to page variation, unstable template matching, and the like.
In order to automatically check whether the page normally finishes rendering, automatically confirm whether the key content and structure of the page are changed, avoid manual configuration and maintain the check content of the page, the present disclosure proposes to determine whether the page is changed by a page comparison technology.
For example, whether the page to be compared is changed relative to the standard page can be determined by comparing whether the pixel values of the pixel points at the same positions in the page to be compared and the standard page are the same through a strict comparison method. For example, RGB value distribution of the page to be compared and the standard page can be calculated through a histogram comparison algorithm, after a distribution histogram is obtained, the correlation coefficient is calculated after normalization of the histogram data. And determining whether the page to be compared changes relative to the standard page according to the correlation coefficient. For example, the hash values of the page to be compared and the standard page may be determined by a hash algorithm, and the hamming distances of the hash values of the two pages may be compared to measure whether the page to be compared and the standard page are similar. For example, the similarity between the page to be compared and the standard page can be measured in terms of brightness, contrast and structure respectively through a structural similarity algorithm. In addition, the similarity degree between the page to be compared and the standard page can be determined by adopting a content characteristic method, key point matching and other modes.
However, these comparison methods are either too strict to be compatible with the page nuances caused by non-errors, thereby causing a false alarm problem; or too loose for front-end pages that are predominantly large-area solid colors, resulting in too large a computed similarity error.
In view of this, the embodiments of the present disclosure provide a method, an apparatus, a storage medium, and an electronic device for comparing pages, which can automatically check whether a page is rendered normally, automatically confirm whether key contents and structures of the page are changed, avoid manual configuration, maintain check contents of the page, and improve efficiency of page comparison. Moreover, the pixel-level fine page difference in the page image to be compared and the reference page image can be captured, and the accuracy of the comparison result is improved.
FIG. 1 is a flow chart illustrating a page contrast method according to an exemplary embodiment of the present disclosure. Referring to fig. 1, the page comparison method may include:
s11, acquiring a page diagram to be compared and a reference page diagram.
For example, the page map to be compared may be a current screenshot of a front page of the application program, and the reference page map may be a historical screenshot of the front page of the application program. Therefore, whether the current front-end page changes or not can be determined by comparing the current screenshot with the historical screenshot, and the purpose of verifying the content of the front-end page is achieved.
For another example, the page graph to be compared may be a current screenshot of a front page of an application, and the reference page graph may be a standard design graph of the front page of the application.
In some embodiments, the obtaining the page diagram to be compared and the reference page diagram may be: and reading an entry from the database, wherein the entry comprises a page diagram to be compared and a reference page diagram.
In other embodiments, the obtaining the page image to be compared and the reference page image may be: and capturing a front-end page of the application program to obtain a page diagram to be compared, and obtaining a historical capturing corresponding to the front-end page from a database to obtain a reference page diagram.
S12, determining a first distribution value corresponding to each preset pixel value in a first histogram of the page diagram to be compared, and determining a second distribution value corresponding to each preset pixel value in a second histogram of the reference page diagram, wherein the histograms are constructed according to the distribution condition of each preset pixel value in the page diagram.
A Histogram (Histogram), also known as a quality profile, is a statistical report that represents the distribution of data by a series of vertical stripes or segments of unequal height. In general, the horizontal axis in the histogram represents the data type, and the vertical axis represents the distribution. In the embodiment of the disclosure, the first histogram is constructed according to the distribution condition of each preset pixel value in the page to be compared, where the distribution condition includes the number of corresponding pixel points of each preset pixel value in the page to be compared. The second histogram is constructed according to the distribution condition of each preset pixel value in the reference page diagram, wherein the distribution condition comprises the number of corresponding pixel points of each preset pixel value in the reference page diagram.
In some embodiments, if the image type of the page image to be compared and the reference page image is a luminance image/gray image, the preset pixel value may include 256 pixel values of 0-255. In other embodiments, if the image type of the page to be compared with the reference page is an RGB image, the preset pixel values may include a total of 256 x 256 pixel values of (0, 0) - (255 ). It should be further noted that the preset pixel values of the present disclosure include, but are not limited to, the pixel values in the above examples.
In the embodiment of the disclosure, the page image to be compared and/or the reference page image may not include some pixels with preset pixel values. For example, the page image to be compared is a pure white page image, and then the page image to be compared only comprises pixel points with pixel values of (255 ). Correspondingly, the first distribution value of the other preset pixel values except the preset pixel value (255 ) in the first histogram corresponding to the page to be compared is 0.
It should be noted that, since the histogram is constructed according to the distribution situation of each preset pixel value in the page map, the distribution situation includes the number of corresponding pixels of each preset pixel value in the page map, so the displacement tolerance of the histogram to the elements in the page map is very high, as long as the page map does not cause element deletion, size change or element covering due to displacement, and the histogram before and after the displacement of the page map does not change. Therefore, the mode of counting the distribution condition of each preset pixel value by adopting the histogram can be compatible with page nuances caused by non-errors of integral displacement, such as line width, line spacing adjustment and the like, which are caused by the fact that the main structure and the content of the page map are unchanged and UI adjustment is performed.
S13, determining the ratio of the first distribution value to the second distribution value corresponding to each preset pixel value, and determining the first similarity according to the average value of the ratio.
In some embodiments, the first similarity may be a mean value of all the ratios, or may be a value obtained by normalizing the mean value.
In other embodiments, the first similarity may be a mean value of the partial ratios, or may be a value obtained by normalizing the mean value of the partial ratios.
After determining the first distribution value corresponding to each preset pixel value in the first histogram of the page diagram to be compared and determining the second distribution value corresponding to each preset pixel value in the second histogram of the reference page diagram, the ratio of the first distribution value corresponding to each preset pixel value to the second distribution value can be determined. For example, assuming that the first distribution value corresponding to the preset pixel value (255 ) is 100 and the second distribution value is 1000, the ratio of the first distribution value to the second distribution value corresponding to the preset pixel value (255 ) may beOr +.>
In some cases, if the page to be compared is a white-only page, the page to be compared includes only pixels with pixel values (255 ). Correspondingly, the first distribution value of the other preset pixel values except the preset pixel value (255 ) in the first histogram corresponding to the page to be compared is 0. Since 0 may not be used as a denominator to participate in the ratio calculation, the present disclosure provides an embodiment for determining a ratio of a first distribution value and a second distribution value corresponding to each preset pixel value, where:
For each preset pixel value, determining the minimum value and the maximum value in the first distribution value and the second distribution value corresponding to the preset pixel value; and taking the minimum value as a numerator, taking the maximum value as a denominator, and calculating to obtain the ratio corresponding to the preset pixel value.
By way of example, assuming that the first distribution value corresponding to the preset pixel value (255 ) is 0, the second distribution value is 100, the minimum value of the first distribution value 0 and the second distribution value 100 is 0,the maximum value is 100. Taking the minimum value 0 as a numerator, taking the maximum value 100 as a denominator, and calculating to obtain the ratio corresponding to the preset pixel value as
It is easy to understand that if the two graphs are identical, the number of pixels of each preset pixel value in the two graphs is identical. If there is an inconsistency in the number of pixels of a certain preset pixel value a in the two graphs, it is indicated that the two graphs differ at least in the dimension of the preset pixel value a. Therefore, the ratio of the first distribution value to the second distribution value corresponding to each preset pixel value can represent the difference of the page image to be compared and the reference page image in the pixel dimension.
Further, the first similarity may be determined from the average of all ratios. For example, the average of all ratios is determined directly as the first similarity. For another example, multiplying the average of all ratios by a preset coefficient yields a first similarity. In this way, the first similarity is determined according to the ratio of all the preset pixel values, so the first similarity considers the ratio of all the preset pixel values. The ratio corresponding to each preset pixel value represents the difference of the page image to be compared and the reference page image in the pixel dimension corresponding to the preset pixel value, so that the first similarity considers the difference of the page image to be compared and the reference page image in the pixel dimension corresponding to each preset pixel value. And the first similarity is determined according to the average value of the ratios corresponding to all the preset pixel values, so that the attention degree of the first similarity to the pixel dimension corresponding to each preset pixel value is the same on the basis of considering the difference of the page image to be compared and the reference page image on the pixel dimension corresponding to each preset pixel value. Therefore, the first similarity calculation mode can capture the fine page difference in the pixel dimension corresponding to any preset pixel value in the page image to be compared and the reference page image, namely the first similarity calculation mode can capture the fine page difference in the pixel level in the page image to be compared and the reference page image.
Compared with the method of calculating the correlation coefficient after normalizing the histogram data, the method of calculating the first similarity in the step S13 of the present disclosure has more accurate calculation results. Because: the method for calculating the correlation coefficient after normalizing the histogram data has different attention degrees on each pixel value, namely the method for calculating the correlation coefficient after normalizing the histogram data easily ignores the change of the pixel value with smaller occupation and is dominated by the pixel value with larger occupation ratio, so that the method for calculating the correlation coefficient after normalizing the histogram data cannot capture local fine change on a page. In the step S13 of the present disclosure, the degree of attention of the first similarity calculation method to the pixel dimension corresponding to each preset pixel value is the same, so that the fine page difference in the pixel dimension corresponding to any preset pixel value in the page diagram to be compared and the reference page diagram can be captured. For example, referring to fig. 2 and 3, when comparing a pure blank page view displayed on the electronic device as in fig. 2 and a page view with white background color as displayed on the electronic device as in fig. 3, the histogram of the pure blank page view in fig. 2 is shown in fig. 4, and the histogram of the page view with white background color as in fig. 3 is shown in fig. 5. The similarity of both calculated by the way of calculating the first similarity in step S13 of the present disclosure is 12.37%, and the similarity of both calculated by the way of calculating the correlation coefficient after normalizing the histogram data is 98.94%. Obviously, the calculation result of the first similarity calculation in step S13 of the present disclosure more accords with the service requirements of checking the text content, the image content and the page structure in the page.
S14, determining a comparison result of the page image to be compared and the reference page image according to the first similarity.
In some embodiments, the first similarity may be determined as a comparison result of the page map to be compared and the reference page map.
By adopting the mode, the pixel-level fine page difference in the page image to be compared and the reference page image can be captured, and the accuracy of the comparison result is improved. Compared with the mode of configuring monitoring or writing an automatic test script in the related art, the method has the advantages that the page diagram to be compared is compared with the reference page diagram to determine whether the content, the structure and the like of the page diagram to be compared change, and further whether the page diagram to be compared is a page diagram which is normally rendered is determined, manual configuration and maintenance of verification content of the page are not needed, manual workload is reduced, and page comparison efficiency is improved. In addition, the mode of the present disclosure can also be compatible with minor differences caused by non-errors of overall displacement caused by unchanged page diagram main body structure and content, but UI adjustment, such as line width and line spacing adjustment, etc.
In some embodiments, the obtaining the page diagram to be compared and the reference page diagram may be: responding to a comparison request sent by a requester, and obtaining a page diagram to be compared and a reference page diagram according to a page diagram downloading link carried in the comparison request. Accordingly, the page comparison method may further include: and feeding back the comparison result to the requesting party.
For example, the page comparison method of the present disclosure may be an application service provided by a third party, and the comparison request may be sent to the application service by calling an external interface of the application service. The comparison request may include a page map download link. The application service responds to a comparison request sent by a requester, and obtains a first picture and a second picture according to a page diagram downloading link carried in the comparison request. According to the picture identification of the first picture and the second picture, it can be determined which picture in the first picture and the second picture is the page picture to be compared and which picture is the reference page picture. For example, a picture identifier of 1 represents a page diagram to be compared, and a picture identifier of 0 represents a reference page diagram.
The method is compatible with the front-end engineering of any architecture, and the front-end engineering of any architecture can realize the purpose of detecting whether the front-end page meets the requirements or not by calling the application service. The method does not need to manually confirm which contents in each page are important contents and check contents corresponding to configuration, has no maintenance cost, is convenient to use, has strong compatibility and has high utilization rate. In addition, the method is also suitable for comparing any two images.
In some embodiments, before determining the first distribution value corresponding to each preset pixel value in the first histogram of the page to be compared, determining the second distribution value corresponding to each preset pixel value in the second histogram of the reference page may include: preprocessing a page diagram to be compared and a reference page diagram to obtain a first page diagram to be compared and a first reference page diagram; correspondingly, a first histogram is constructed according to the distribution condition of each preset pixel value in the first page diagram to be compared, and a second histogram is constructed according to the distribution condition of each preset pixel value in the first reference page diagram.
In some business scenarios, the page map includes images that can be dynamically changed, such as a dynamic one-dimensional code, a dynamic two-dimensional code, a dynamic expression package image, or a dynamic weather image that characterizes weather, etc. In order to avoid false alarm of the phenomenon, the disclosure proposes an implementation manner, and preprocesses a page diagram to be compared and a reference page diagram to obtain a first page diagram to be compared and a first reference page diagram, which may be: and adjusting the sizes of the page images to be compared and the reference page images to be consistent, obtaining a first reference page image, and obtaining an initial page image to be compared. And if the image blocks of the target type exist in the same position of the initial page image to be compared and the first reference page image, covering the image blocks of the target type in the initial page image to be compared according to the image blocks of the target type in the first reference page image, and obtaining a first page image to be compared.
Wherein an image block may also be referred to as an image area. The target type may be a dynamic change image type, and the image block of the target type may be a one-dimensional code image area, a two-dimensional code image area, or the like that dynamically changes on the page. For example, if two-dimensional code images exist in the same position (e.g., the upper left corner of the page diagram) in both the initial page diagram to be compared and the first reference page diagram, the first page diagram to be compared may be obtained by covering the two-dimensional code images in the initial page diagram to be compared according to the two-dimensional code images in the first reference page diagram.
By adopting the mode, the change of dynamic two-dimensional code images in the page images to be compared can be ignored through the covering operation, and the distribution condition of each preset pixel value in the page images is not greatly influenced. For example, the two-dimensional code images in the page image to be compared and the reference page image are coated with the same color, so that the change of the two-dimensional code images in the page image to be compared can be ignored, and the histogram global distribution can be greatly changed due to the fact that the two-dimensional code images are coated with the same color, and further the calculated first similarity error is larger. According to the method, the pixel values of fewer pixel points are changed and the overall distribution change of the histogram is tiny compared with the mode of coating the two-dimensional code image into the same color according to the mode that the two-dimensional code image in the first reference page image covers the two-dimensional code image in the initial page image to be compared, so that the method, the device and the system can not only ignore the change of the two-dimensional code image in the page image to be compared, but also can not greatly influence the distribution condition of preset pixel values in the page image through covering operation.
In some business scenes, the page map can comprise designs such as watermarks, watermark changes, dynamic page steganography, dark watermark changes and the like; the page images to be compared and the reference page images can also be different in brightness due to incomplete screenshot time/loading and the like. In order to avoid false alarm of different phenomena of page designs and page images, the disclosure proposes an implementation manner, and preprocesses a page image to be compared and a reference page image to obtain a first page image to be compared and a first reference page image, which may be:
and adjusting the sizes of the page images to be compared and the reference page images to be consistent, obtaining a first reference page image, and obtaining an initial page image to be compared. And determining pixel point pairs positioned at the same position in the initial page diagram to be compared and the first reference page diagram. And calculating the pixel difference value of each pixel point pair to obtain a first array. And carrying out zero resetting treatment on pixel difference values larger than a preset threshold value in the first array to obtain a second array. And carrying out summation processing on the initial page diagram to be compared and the second group to obtain a first page diagram to be compared.
Illustratively, an initial page diagram to be compared and a first reference page are determined In the figure, the pixel point pair (a ij ,B ij ) The method comprises the steps of including the ith row of the jth pixel point in the initial page diagram A to be compared and the ith row of the jth pixel point in the first reference page diagram B. The values of i and j are positive integers.
And calculating the pixel difference value of each pixel point pair to obtain a first array. For example, assuming that the pixel values of the pixels in the initial page diagram a to be compared are a [1,2,3,4,5,6], and the pixel values of the pixels in the first reference page diagram B are B [100,3,4,5,20,6], the first array is B-a= [99,1,1,1,15,0].
And carrying out zero resetting treatment on pixel difference values larger than a preset threshold value in the first array to obtain a second array. Assuming that the preset threshold is 10, performing zero resetting treatment on the pixel difference value larger than the preset threshold in the first array [99,1,1,1,15,0] to obtain a second array [0,1, 0].
And carrying out summation processing on the initial page diagram to be compared and the second group to obtain a first page diagram to be compared. For example, the sum of the pixel values a [1,2,3,4,5,6] of each pixel point in the initial page diagram A to be compared and the second group [0,1, 0] is calculated as a' [1,3,4,5,5,6]. a' [1,3,4,5,5,6] represents pixel values of all pixel points in the first page diagram to be compared.
By comparing a' [1,3,4,5,5,6] with b [100,3,4,5,20,6], the problems that the watermark change, the dark watermark change and the brightness of the page image to be compared and the reference page image are different due to incomplete screenshot time/loading can be ignored in this way.
By adopting the mode, before the first similarity is calculated, the difference between the page diagram to be compared and the reference page diagram caused by the normal dynamic page design reasons such as dynamic image design and watermark change design on the page can be ignored by preprocessing the page diagram to be compared and the reference page diagram, so that the first similarity which accords with the service scene is calculated.
In some embodiments, preprocessing the page to be compared and the reference page to obtain a first page to be compared and a first reference page, which may be: and adjusting the sizes of the page images to be compared and the reference page images to be consistent, obtaining a first reference page image, and obtaining a first initial page image to be compared. And if the first initial page image to be compared and the first reference page image have the image blocks of the target type at the same position, covering the image blocks of the target type in the first initial page image to be compared according to the image blocks of the target type in the first reference page image, and obtaining a second initial page image to be compared. And determining pixel point pairs positioned at the same position in the second initial page diagram to be compared and the first reference page diagram. And calculating the pixel difference value of each pixel point pair to obtain a first array. And carrying out zero resetting treatment on pixel difference values larger than a preset threshold value in the first array to obtain a second array. And carrying out summation processing on the second initial page diagram to be compared and the second group to obtain a first page diagram to be compared.
By adopting the method, before the first similarity is calculated, the page image to be compared and the reference page image are preprocessed, so that the difference between the page image to be compared and the reference page image caused by the design of dynamic images on the page can be ignored, and the difference between the page image to be compared and the reference page image caused by the design of watermark change on the page, the design or phenomenon of dynamic page images with different brightness and the like can be ignored, and the first similarity more conforming to a service scene can be calculated.
In some embodiments, the determining, according to the first similarity, a comparison result of the page diagram to be compared and the reference page diagram may be:
if the first similarity is greater than or equal to a similarity threshold value and the target duty ratio is greater than or equal to a duty ratio threshold value, determining a comparison result according to the target duty ratio, wherein the target duty ratio represents the number of pixel point pairs with the same pixel value at the same position in the page image to be compared and the reference page image, and the ratio of the target duty ratio to the total number of pixel points in the page image to be compared or the reference page image is greater than the similarity threshold value. And if the first similarity is greater than or equal to the similarity threshold and the target duty ratio is smaller than the duty ratio threshold, determining a comparison result according to the first similarity.
The target ratio represents the ratio of the number of pixel point pairs with the same pixel value at the same position in the page diagram to be compared and the reference page diagram to the total number of pixel points in the page diagram to be compared or the reference page diagram.
Illustratively, a pair of pixel points (X ij ,Y ij ) Pixel point pair (X ij ,Y ij ) The method comprises the steps that the ith pixel point of the ith row in the page diagram X to be compared and the jth pixel point of the ith row in the reference page diagram Y are included, and the values of i and j are positive integers. Determination of X ij Pixel value sum Y of (2) ij The number n of all pixel pairs having the same pixel value. Determining the total number m of pixel points in a page diagram to be compared or a reference page diagram, or determining the total number m of pixel point pairs, and determining the ratio of the number n to the total number m as a target occupation ratio
Under the condition of preprocessing the page diagram to be compared and the reference page diagram, correspondingly, the target ratio value can also represent the ratio of the number of pixel point pairs with the same pixel value at the same position in the first page diagram to be compared and the first reference page diagram to the total number of pixel points in the first page diagram to be compared or the first reference page diagram.
Since the manner of calculating the first similarity in step S13 of the present disclosure may capture the pixel-level fine page difference in the page image to be compared and the reference page image, in some cases, the calculated first similarity may be lower due to being too sensitive to the fine page difference. For example, the majority of the area of the two images is completely identical, with only one user's head portraits being different, and 99.97% of the pixels of the two images are identical. The similarity calculated by this way of calculating the first similarity in step S13 of the present disclosure is 90.72%. It can be seen that 90.72% is below 99.97%.
In order to improve accuracy of a comparison result of a page image to be compared and a reference page image, the present disclosure proposes that if the first similarity is greater than or equal to a similarity threshold value and the target duty ratio is greater than or equal to a duty ratio threshold value, the target duty ratio is determined to be the comparison result, wherein, since the duty ratio threshold value is greater than the similarity threshold value, for example, the duty ratio threshold value is 95% and the similarity threshold value is 90%, the determination of the target duty ratio to be the comparison result is more accurate than the determination of the first similarity to be the comparison result. Correspondingly, if the first similarity is greater than or equal to the similarity threshold and the target duty ratio is less than the duty ratio threshold, determining the first similarity as a comparison result.
In some business scenarios, a table area, a list area, a title area, a navigation bar area, a content area, etc. may be included in the page map. For example, in the page diagram shown in fig. 6, there are a table area where an AA table is located, a title area where a title is located, and a navigation area where navigation is located. For example, in the page diagram shown in fig. 7, there are a list area where a list exists, a title area where a title exists, a navigation area where navigation exists, and a page content display area.
In some scenarios, the values in the form area, list area may change dynamically. The page diagram changes caused by these dynamically changing values are also normal front-end page designs, and in order to avoid false positives of this phenomenon, the present disclosure proposes an embodiment that is: and if the first similarity is smaller than or equal to a similarity threshold value, carrying out page division on the page diagram to be compared and the reference page diagram to obtain a plurality of first subgraphs corresponding to the page diagram to be compared and a plurality of second subgraphs corresponding to the reference page diagram. And determining a third similarity according to the second similarity between each first sub-graph and the corresponding second sub-graph and the preset weight of each sub-graph in the page graph to which the sub-graph belongs. And determining the third similarity as a comparison result.
The page division of the page diagram to be compared with the reference page diagram can be performed by identifying the page structure and the local characteristics through a deep learning model, and dividing the page diagram into a plurality of subgraphs according to a title area, a navigation bar area, a page content area, a table area, a list area and the like.
In some embodiments, determining a second similarity between the first sub-graph and the corresponding second sub-graph may be: and if the first sub-graph and the corresponding second sub-graph both comprise target content areas, wherein the target content areas are table content areas, list content areas and the like, determining the crossing proportion of the first target content area in the first sub-graph and the second target content area in the second sub-graph. In case the cross ratio is larger than the preset ratio, it is explained that the first target content area and the second target content area are the same table area or list area. In this case, the new first sub-graph may be obtained by overlaying the first target content area in the first sub-graph according to the second target content area. And determining a corresponding second similarity according to the new first sub-graph and the second sub-graph. The second similarity is calculated in the same manner as the first similarity calculated in steps S12 and S13, and will not be described here again.
As an example, the way of determining the cross-ratio of the first target content area in the first sub-image and the second target content area in the second sub-image may be to determine the cross-ratio of the first target content area in the first sub-image and the second target content area in the second sub-image. The intersection ratio refers to the ratio of the intersection to the union.
As another example, determining the cross-scale of the first target content region in the first sub-graph and the second target content region in the second sub-graph may be: determining an intersection of the first target content region and the second target content region on an abscissa, e.g. an intersection of [7,77 ]]. Determining the intersection of abscissa [7,77 ]]The corresponding first abscissa span is 77-7=70, and the second target content area [7,100 ] is determined]The corresponding second abscissa span 100-7=93. Determining the crossing ratio as the ratio of the first abscissa span 70 to the second abscissa span 93
FIG. 8 is a flowchart illustrating another page contrast method according to an exemplary embodiment of the present disclosure. Referring to fig. 8, the page comparison method may include the following steps.
S801, receiving a comparison request sent by a requester, and obtaining a page diagram to be compared and a reference page diagram according to a page diagram downloading link carried in the comparison request.
S802, adjusting the sizes of the page images to be compared and the reference page images to be consistent, obtaining a first reference page image, and obtaining a first initial page image to be compared.
S803, judging whether the first initial page diagram to be compared and the first reference page diagram have the image blocks of the target type at the same position.
S804, covering the image blocks of the target type in the first initial page image to be compared according to the image blocks of the target type in the first reference page image to obtain a second initial page image to be compared.
S805, determining pixel point pairs positioned at the same position in the second initial page diagram to be compared and the first reference page diagram.
S806, calculating pixel difference values of each pixel point pair to obtain a first array.
S807, performing zeroing treatment on pixel difference values larger than a preset threshold in the first array to obtain a second array.
And S808, carrying out summation processing on the second initial page diagram to be compared and the second group to obtain a first page diagram to be compared.
S809, according to the distribution condition of each preset pixel value in the first page diagram to be compared, a first histogram is constructed, and according to the distribution condition of each preset pixel value in the first reference page diagram, a second histogram is constructed.
S810, determining a first distribution value corresponding to each preset pixel value in the first histogram, determining a second distribution value corresponding to each preset pixel value in the second histogram, determining a ratio of the first distribution value corresponding to each preset pixel value to the second distribution value, and determining the first similarity according to the average value of the ratios.
S811, judging whether the first similarity is larger than or equal to a similarity threshold.
S812, determining the first initial page diagram to be compared as a second initial page diagram to be compared.
S813, judging whether the target duty ratio is larger than or equal to a duty ratio threshold.
S814, determining a comparison result according to the target occupancy rate.
S815, determining a comparison result according to the first similarity.
S816, carrying out page division on the page diagram to be compared and the reference page diagram to obtain a plurality of first subgraphs corresponding to the page diagram to be compared and a plurality of second subgraphs corresponding to the reference page diagram.
S817, determining a third similarity according to the second similarity between each first sub-graph and the corresponding second sub-graph and the preset weight of each sub-graph in the page graph to which the sub-graph belongs.
S818, determining a comparison result according to the third similarity.
And S819, feeding the comparison result back to the requester.
The embodiments of the steps described above have been described in detail in the examples of the page comparison method described above, and will not be described in detail herein.
Based on the same conception, the disclosure also provides a page comparison device, which can be part or all of the electronic equipment through software, hardware or a combination of the two modes. As shown in fig. 9, the page comparing apparatus 100 includes:
an obtaining module 101, configured to obtain a page diagram to be compared and a reference page diagram;
a first determining module 102, configured to determine a first distribution value corresponding to each preset pixel value in a first histogram of the page to be compared, and determine a second distribution value corresponding to each preset pixel value in a second histogram of the reference page, where the histogram is constructed according to a distribution condition of each preset pixel value in the page;
a second determining module 103, configured to determine a ratio of the first distribution value and the second distribution value corresponding to each preset pixel value, and determine a first similarity according to a mean value of the ratios;
and the execution module 104 is configured to determine a comparison result of the page image to be compared and the reference page image according to the first similarity.
By adopting the device, the pixel-level fine page difference in the page image to be compared and the reference page image can be captured, and the accuracy of the comparison result is improved. Compared with the mode of configuring monitoring or writing an automatic test script in the related art, the method has the advantages that the page diagram to be compared is compared with the reference page diagram to determine whether the content, the structure and the like of the page diagram to be compared change, and further whether the page diagram to be compared is a page diagram which is normally rendered is determined, manual configuration and maintenance of verification content of the page are not needed, manual workload is reduced, and page comparison efficiency is improved.
Optionally, the second determining module 103 includes:
a calculation sub-module, configured to determine, for each preset pixel value, a minimum value and a maximum value in the first distribution value and the second distribution value corresponding to the preset pixel value; and taking the minimum value as a numerator, taking the maximum value as a denominator, and calculating to obtain the ratio corresponding to the preset pixel value.
Optionally, the apparatus 100 includes:
the preprocessing module is used for preprocessing the page images to be compared and the reference page images to obtain a first page image to be compared and a first reference page image;
The construction module is used for constructing and obtaining the first histogram according to the distribution condition of each preset pixel value in the first page diagram to be compared, and constructing and obtaining the second histogram according to the distribution condition of each preset pixel value in the first reference page diagram.
Optionally, the preprocessing module includes:
the first preprocessing sub-module is used for adjusting the sizes of the page images to be compared and the reference page images to be consistent, obtaining the first reference page images and obtaining initial page images to be compared; and if the initial page diagram to be compared and the first reference page diagram have the image blocks of the target type at the same position, covering the image blocks of the target type in the initial page diagram to be compared according to the image blocks of the target type in the first reference page diagram, and obtaining the first page diagram to be compared.
Optionally, the preprocessing module includes:
the second preprocessing sub-module is used for adjusting the sizes of the page images to be compared and the reference page images to be consistent, obtaining the first reference page image and obtaining an initial page image to be compared; determining pixel point pairs positioned at the same position in the initial page diagram to be compared and the first reference page diagram; calculating a pixel difference value of each pixel point pair to obtain a first array; performing zeroing treatment on the pixel difference value larger than a preset threshold value in the first array to obtain a second array; and carrying out summation processing on the initial page diagram to be compared and the second group to obtain the first page diagram to be compared.
Optionally, the preprocessing module includes:
the third preprocessing sub-module is used for adjusting the sizes of the page images to be compared and the reference page images to be consistent, obtaining the first reference page image and obtaining a first initial page image to be compared; if the first initial page diagram to be compared and the first reference page diagram have the image blocks of the target type at the same position, covering the image blocks of the target type in the first initial page diagram to be compared according to the image blocks of the target type in the first reference page diagram to obtain a second initial page diagram to be compared; determining pixel point pairs positioned at the same position in the second initial page diagram to be compared and the first reference page diagram; calculating a pixel difference value of each pixel point pair to obtain a first array; performing zeroing treatment on the pixel difference value larger than a preset threshold value in the first array to obtain a second array; and carrying out summation processing on the second initial page diagram to be compared and the second group to obtain the first page diagram to be compared.
Optionally, the execution module 104 includes:
the first execution submodule is used for determining the comparison result according to the target occupation ratio if the first similarity is larger than or equal to a similarity threshold value and the target occupation ratio is larger than or equal to a occupation ratio threshold value, wherein the target occupation ratio represents the number of pixel point pairs with the same pixel value at the same position in the page graph to be compared and the reference page graph, and the occupation ratio is larger than the similarity threshold value compared with the total number of pixel points in the page graph to be compared or the reference page graph;
And the second execution sub-module is used for determining the comparison result according to the first similarity if the first similarity is greater than or equal to the similarity threshold and the target duty ratio value is smaller than the duty ratio threshold.
Optionally, the execution module 104 includes:
the third execution sub-module is used for carrying out page division on the page diagram to be compared and the reference page diagram if the first similarity is smaller than a similarity threshold value, so as to obtain a plurality of first sub-diagrams corresponding to the page diagram to be compared and a plurality of second sub-diagrams corresponding to the reference page diagram; determining a third similarity according to the second similarity between each first sub-graph and the corresponding second sub-graph and the preset weight of each sub-graph in the page graph; and determining the comparison result according to the third similarity.
Optionally, the third execution sub-module is configured to determine a cross proportion of a first target content area in the first sub-graph and a second target content area in the second sub-graph if the first sub-graph and the corresponding second sub-graph each include a target content area; when the crossing proportion is larger than a preset ratio, covering the first target content area in the first sub-graph according to the second target content area to obtain a new first sub-graph; and determining the corresponding second similarity according to the new first sub-graph and the second sub-graph.
Optionally, the third execution sub-module is configured to determine an intersection of the abscissa of the first target content area and the second target content area; determining a first abscissa span corresponding to the abscissa intersection, and determining a second abscissa span corresponding to the second target content area; the intersection ratio is determined from a ratio of the first abscissa span to the second abscissa span.
Optionally, the obtaining module 101 is configured to obtain, in response to receiving a comparison request sent by a requester, the page map to be compared and the reference page map according to a page map download link carried in the comparison request;
the apparatus 100 further comprises:
and the feedback module is used for feeding the comparison result back to the requester.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Based on the same conception, the present disclosure also provides a non-transitory computer readable medium having stored thereon a computer program which, when executed by a processing device, implements the steps of any of the page comparison methods described above.
Based on the same concept, the present disclosure also provides an electronic device, comprising: a storage device having a computer program stored thereon; and the processing device is used for executing the computer program in the storage device so as to realize the steps of any page comparison method.
Referring now to fig. 10, a schematic diagram of an electronic device 600 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 10 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 10, the electronic device 600 may include a processing means (e.g., a central processing unit, a graphic processor, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, magnetic tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 10 shows an electronic device 600 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication means 609, or from storage means 608, or from ROM 602. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 601.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, communications may be made using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a page diagram to be compared and a reference page diagram; determining a first distribution value corresponding to each preset pixel value in a first histogram of the page diagram to be compared, and determining a second distribution value corresponding to each preset pixel value in a second histogram of the reference page diagram, wherein the histograms are constructed according to the distribution condition of each preset pixel value in the page diagram; determining a ratio of the first distribution value to the second distribution value corresponding to each preset pixel value, and determining a first similarity according to a mean value of the ratio; and determining a comparison result of the page graph to be compared and the reference page graph according to the first similarity.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented in software or hardware. The name of a module does not in some cases define the module itself.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims. The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.

Claims (14)

1. A method of page comparison, the method comprising:
acquiring a page diagram to be compared and a reference page diagram;
determining a first distribution value corresponding to each preset pixel value in a first histogram of the page diagram to be compared, and determining a second distribution value corresponding to each preset pixel value in a second histogram of the reference page diagram, wherein the histograms are constructed according to the distribution condition of each preset pixel value in the page diagram;
determining a ratio of the first distribution value to the second distribution value corresponding to each preset pixel value, and determining a first similarity according to a mean value of the ratio;
And determining a comparison result of the page graph to be compared and the reference page graph according to the first similarity.
2. The method of claim 1, wherein determining the ratio of the first distribution value to the second distribution value for each of the preset pixel values comprises:
for each preset pixel value, determining the minimum value and the maximum value in the first distribution value and the second distribution value corresponding to the preset pixel value;
and taking the minimum value as a numerator, taking the maximum value as a denominator, and calculating to obtain the ratio corresponding to the preset pixel value.
3. The method according to claim 1 or 2, wherein before said determining a first distribution value for each preset pixel value in the first histogram of the page to be compared, determining a second distribution value for each preset pixel value in the second histogram of the reference page comprises:
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;
the first histogram is constructed according to the distribution condition of the preset pixel values in the first page diagram to be compared, and the second histogram is constructed according to the distribution condition of the preset pixel values in the first reference page diagram.
4. The method of claim 3, wherein the preprocessing the page to be compared and the reference page map to obtain a first page to be compared and a first reference page map includes:
the sizes of the page images to be compared and the reference page images are adjusted to be consistent, the first reference page image is obtained, and an initial page image to be compared is obtained;
and if the image blocks of the target type exist in the same position of the initial page image to be compared and the first reference page image, covering the image blocks of the target type in the initial page image to be compared according to the image blocks of the target type in the first reference page image, and obtaining the first page image to be compared.
5. The method of claim 3, wherein the preprocessing the page to be compared and the reference page map to obtain a first page to be compared and a first reference page map includes:
the sizes of the page images to be compared and the reference page images are adjusted to be consistent, the first reference page image is obtained, and an initial page image to be compared is obtained;
determining pixel point pairs positioned at the same position in the initial page diagram to be compared and the first reference page diagram;
Calculating a pixel difference value of each pixel point pair to obtain a first array;
performing zeroing treatment on the pixel difference value larger than a preset threshold value in the first array to obtain a second array;
and carrying out summation processing on the initial page diagram to be compared and the second group to obtain the first page diagram to be compared.
6. The method of claim 3, wherein the preprocessing the page to be compared and the reference page map to obtain a first page to be compared and a first reference page map includes:
the sizes of the page images to be compared and the reference page images are adjusted to be consistent, so that a first reference page image is obtained, and a first initial page image to be compared is obtained;
if the first initial page diagram to be compared and the first reference page diagram have the image blocks of the target type at the same position, covering the image blocks of the target type in the first initial page diagram to be compared according to the image blocks of the target type in the first reference page diagram to obtain a second initial page diagram to be compared;
determining pixel point pairs positioned at the same position in the second initial page diagram to be compared and the first reference page diagram;
Calculating a pixel difference value of each pixel point pair to obtain a first array;
performing zeroing treatment on the pixel difference value larger than a preset threshold value in the first array to obtain a second array;
and carrying out summation processing on the second initial page diagram to be compared and the second group to obtain the first page diagram to be compared.
7. The method according to claim 1, wherein the determining the comparison result of the page diagram to be compared and the reference page diagram according to the first similarity includes:
if the first similarity is greater than or equal to a similarity threshold value and a target duty ratio is greater than or equal to a duty ratio threshold value, determining the comparison result according to the target duty ratio, wherein the target duty ratio represents the ratio of the number of pixel point 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 pixel points in the page image to be compared or the reference page image, and the duty ratio threshold value is greater than the similarity threshold value;
and if the first similarity is greater than or equal to the similarity threshold and the target duty ratio is smaller than the duty ratio threshold, determining the comparison result according to the first similarity.
8. The method according to claim 1 or 7, wherein the determining the comparison result of the page diagram to be compared and the reference page diagram according to the first similarity includes:
if the first similarity is smaller than a similarity threshold, carrying out page division on the page image to be compared and the reference page image to obtain a plurality of first subgraphs corresponding to the page image to be compared and a plurality of second subgraphs corresponding to the reference page image;
determining a third similarity according to the second similarity between each first sub-graph and the corresponding second sub-graph and the preset weight of each sub-graph in the page graph;
and determining the comparison result according to the third similarity.
9. The method of claim 8, wherein determining a second similarity between the first sub-graph and the corresponding second sub-graph comprises:
if the first sub-graph and the corresponding second sub-graph both comprise target content areas, determining the crossing proportion of the first target content area in the first sub-graph and the second target content area in the second sub-graph;
when the crossing proportion is larger than a preset ratio, covering the first target content area in the first sub-graph according to the second target content area to obtain a new first sub-graph;
And determining the corresponding second similarity according to the new first sub-graph and the second sub-graph.
10. The method of claim 9, wherein the determining the cross-scale of the first target content region in the first sub-graph and the second target content region in the second sub-graph comprises:
determining an abscissa intersection of the first target content area and the second target content area;
determining a first abscissa span corresponding to the abscissa intersection, and determining a second abscissa span corresponding to the second target content area;
the intersection ratio is determined from a ratio of the first abscissa span to the second abscissa span.
11. The method of claim 1, wherein the obtaining the page map to be compared and the reference page map comprises:
responding to a comparison request sent by a requester, and obtaining the page diagram to be compared and the reference page diagram according to a page diagram downloading link carried in the comparison request;
the method further comprises the steps of:
and feeding back the comparison result to the requester.
12. A page contrast device, the device comprising:
The acquisition module is used for acquiring the page image to be compared and the reference page image;
the first determining module is used for determining a first distribution value corresponding to each preset pixel value in a first histogram of the page diagram to be compared and a second distribution value corresponding to each preset pixel value in a second histogram of the reference page diagram, wherein the histograms are constructed according to the distribution condition of each preset pixel value in the page diagram;
the second determining module is used for determining the ratio of the first distribution value to the second distribution value corresponding to each preset pixel value, and determining a first similarity according to the average value of the ratio;
and the execution module is used for determining a comparison result of the page image to be compared and the reference page image according to the first similarity.
13. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processing device, implements the steps of the method according to any one of claims 1-11.
14. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method according to any one of claims 1-11.
CN202310437517.6A 2023-04-21 2023-04-21 Page comparison method and device, storage medium and electronic equipment Pending CN116468914A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310437517.6A CN116468914A (en) 2023-04-21 2023-04-21 Page comparison method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310437517.6A CN116468914A (en) 2023-04-21 2023-04-21 Page comparison method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116468914A true CN116468914A (en) 2023-07-21

Family

ID=87174976

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310437517.6A Pending CN116468914A (en) 2023-04-21 2023-04-21 Page comparison method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116468914A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117076284A (en) * 2023-10-18 2023-11-17 荣耀终端有限公司 Page loading time length detection method, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117076284A (en) * 2023-10-18 2023-11-17 荣耀终端有限公司 Page loading time length detection method, equipment and storage medium
CN117076284B (en) * 2023-10-18 2024-04-05 荣耀终端有限公司 Page loading time length detection method, equipment and storage medium

Similar Documents

Publication Publication Date Title
US10650236B2 (en) Road detecting method and apparatus
CN112270309A (en) Vehicle access point equipment snapshot quality evaluation method and device and readable medium
CN109886864B (en) Privacy mask processing method and device
CN110263301B (en) Method and device for determining color of text
CN114494298A (en) Object segmentation method, device, equipment and storage medium
US20230049656A1 (en) Method of processing image, electronic device, and medium
CN111309617A (en) Application program control method and device, storage medium and electronic equipment
CN116468914A (en) Page comparison method and device, storage medium and electronic equipment
CN111553302A (en) Key frame selection method, device, equipment and computer readable storage medium
CN110740315B (en) Camera correction method and device, electronic equipment and storage medium
CN110866524A (en) License plate detection method, device, equipment and storage medium
CN114283416A (en) Processing method and device for vehicle insurance claim settlement pictures
CN113469869A (en) Image management method and device
US11468269B2 (en) Arithmetic device, arithmetic method, and discrimination system
CN109934185B (en) Data processing method and device, medium and computing equipment
CN115565158B (en) Parking space detection method, device, electronic equipment and computer readable medium
CN116311152A (en) Evaluation method and device for parking space detection effect and related equipment
CN116363239A (en) Method, device, equipment and storage medium for generating special effect diagram
CN117474827A (en) Image definition detection method and device
CN114240780A (en) Seal identification method, device, equipment, medium and product
CN114140427A (en) Object detection method and device
CN113807145A (en) Face recognition method and device
CN113542800B (en) Video picture scaling method, device and terminal equipment
CN111768410B (en) Image processing method and device
CN115601606B (en) Store state detection method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination