CN115393607A - Picture structure comparison method and device - Google Patents

Picture structure comparison method and device Download PDF

Info

Publication number
CN115393607A
CN115393607A CN202211035674.6A CN202211035674A CN115393607A CN 115393607 A CN115393607 A CN 115393607A CN 202211035674 A CN202211035674 A CN 202211035674A CN 115393607 A CN115393607 A CN 115393607A
Authority
CN
China
Prior art keywords
picture
pixel
sequence
determining
pixel 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
CN202211035674.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.)
Zhejiang Geely Holding Group Co Ltd
Zhejiang Zeekr Intelligent Technology Co Ltd
Original Assignee
Zhejiang Geely Holding Group Co Ltd
Zhejiang Zeekr Intelligent Technology 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 Zhejiang Geely Holding Group Co Ltd, Zhejiang Zeekr Intelligent Technology Co Ltd filed Critical Zhejiang Geely Holding Group Co Ltd
Priority to CN202211035674.6A priority Critical patent/CN115393607A/en
Publication of CN115393607A publication Critical patent/CN115393607A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • 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

Landscapes

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

Abstract

One or more embodiments of the present specification provide a picture structure comparison method, an apparatus, an electronic device, and a machine-readable storage medium, where the method includes: acquiring a first picture and a second picture; respectively determining first position distribution and second position distribution of target pixel points respectively contained in the first picture and the second picture; the target pixel point and other pixel points adjacent to the target pixel point are equal in pixel value; and comparing the first position distribution with the second position distribution, and determining whether the picture structures of the first picture and the second picture are consistent or not based on the comparison result.

Description

Picture structure comparison method and device
Technical Field
One or more embodiments of the present disclosure relate to the field of image processing, and in particular, to an image structure comparison method, an apparatus, an electronic device, and a machine-readable storage medium.
Background
In practical applications, a certain rule of pixel points included in a picture to be subjected to similarity evaluation is usually found respectively, and the similarity between the pictures is evaluated by comparing the similarities between the rules corresponding to the pictures.
For example, taking a first picture and a second picture for which similarity evaluation is required as an example, the similarity evaluation between the first picture and the second picture is generally performed in the following 2 ways, respectively:
1. and (3) mean value hash algorithm: calculating the pixel average value of the picture, traversing each pixel point in the picture, counting the size relation between the pixel value of each pixel point and the pixel average value of the picture, and counting that the corresponding statistical result of the pixel point is 1 if the pixel value of the pixel point is greater than the average pixel value; on the contrary, if the pixel value of the pixel point is less than or equal to the average pixel value, the statistical result corresponding to the pixel point is counted to be 0; and the statistical results are combined into a Hash sequence for describing the relationship between the pixel value of each pixel point in the picture and the pixel average value of the picture.
Based on the method, a first hash number sequence corresponding to the first picture and a second hash number sequence corresponding to the second picture can be obtained respectively, and further, the similarity between the first picture and the second picture can be evaluated by calculating the hamming distance between the first hash number sequence and the second hash number sequence.
The smaller the hamming distance between the first hash number sequence and the second hash number sequence is, the higher the similarity between the first picture and the second picture is.
2. And (3) a difference hash algorithm: traversing each pixel point in the picture, counting the size relation between the pixel value of the pixel point positioned at the previous position of the target pixel point in each line of the picture and the pixel value of the target pixel point, and counting that the corresponding statistical result of the pixel point is 1 if the pixel value of the pixel point is greater than the pixel value of the target pixel point; on the contrary, if the pixel value of the pixel point is less than or equal to the pixel value of the target pixel point, the corresponding statistical result of the pixel point is counted to be 0; and the statistical results are combined into a Hash sequence for describing the size relationship between the pixel value of each pixel point in the picture and the pixel value of the pixel point at the previous position.
Based on the method, a first hash number sequence corresponding to the first picture and a second hash number sequence corresponding to the second picture can be obtained respectively, and further, the similarity between the first picture and the second picture can be evaluated by calculating the hamming distance between the first hash number sequence and the second hash number sequence.
The smaller the hamming distance between the first hash number sequence and the second hash number sequence is, the higher the similarity between the first picture and the second picture is.
However, the method can determine whether the first picture and the second picture are different as a whole, but cannot determine whether the picture structures of the pictures are different.
Disclosure of Invention
The application provides a picture structure comparison method, which comprises the following steps:
acquiring a first picture and a second picture;
respectively determining first position distribution and second position distribution of target pixel points respectively contained in the first picture and the second picture; the target pixel point and other pixel points adjacent to the target pixel point are equal in pixel value; and comparing the first position distribution with the second position distribution, and determining whether the picture structures of the first picture and the second picture are consistent or not based on the comparison result.
Optionally, before determining the first position distribution and the second position distribution of the target pixel points included in the first picture and the second picture respectively in the first picture and the second picture, the method further includes: according to the sequence of each pixel point contained in the first picture, combining the pixel values of the pixel points into a first sequence for describing the structural characteristics of the pixel points contained in the first picture; and according to the sequence of each pixel point contained in the second picture, combining the pixel values of the pixel points into a second sequence for describing the structural characteristics of the pixel points contained in the second picture.
Optionally, the determining a first position distribution and a second position distribution of target pixel points in the first picture and the second picture respectively, where the target pixel points are included in the first picture and the second picture respectively, includes: traversing each pixel value in the first array, and counting whether other pixel values which are adjacent to the traversed pixel value and have the same size with the traversed pixel value exist in the first array; if yes, determining a pixel point corresponding to the pixel value as a target pixel point in the first picture, and determining a statistical result corresponding to the pixel value as a first statistical result; if the pixel value does not exist, determining the statistical result corresponding to the pixel value as a second statistical result; forming a third sequence according to the sequence of the pixel values in the first sequence by using the statistical results corresponding to the pixel values contained in the first sequence so as to obtain a first position distribution for describing the target pixel point in the first picture; traversing each pixel value in the second array, and counting whether other pixel values which are adjacent to the traversed pixel value and have the same size with the traversed pixel value exist in the second array; if yes, determining a pixel point corresponding to the pixel value as a target pixel point in the second picture, and determining a statistical result corresponding to the pixel value as a first statistical result; if the pixel value does not exist, determining the statistical result corresponding to the pixel value as a second statistical result; and forming a fourth sequence of statistical results corresponding to the pixel values included in the second sequence according to the sequence of the pixel values in the second sequence, so as to obtain a second position distribution for describing the target pixel point in the second picture.
Optionally, the other pixels adjacent to the target pixel, include: other pixels in a position before the target pixel and/or other pixels in a position after the target pixel.
Optionally, the comparing the first position distribution with the second position distribution, and determining whether the picture structures of the first picture and the second picture are consistent based on the comparison result includes: comparing the statistical results at the corresponding positions in the third number sequence and the fourth number sequence; if the statistical results at the corresponding positions in the third array and the fourth array are consistent, determining that the picture structures of the first picture and the second picture are consistent; otherwise, determining that the picture structures of the first picture and the second picture are inconsistent.
Optionally, the first statistical result is 0 or 1; the second statistical result is 1 or 0; the third number sequence and the fourth number sequence are both binary character strings consisting of numerical values 0 and 1; comparing the statistical results at the corresponding positions in the third number sequence and the fourth number sequence; if the statistical results at the corresponding positions in the third array and the fourth array are consistent, determining that the picture structures of the first picture and the second picture are consistent; otherwise, determining that the picture structures of the first picture and the second picture are inconsistent, including: calculating a hamming distance between the third sequence and the fourth sequence; if the calculated Hamming distance is 0, determining that the picture structures of the first picture and the second picture are consistent; otherwise, determining that the picture structures of the first picture and the second picture are inconsistent.
Optionally, the first picture includes an interface image corresponding to a graphical user interface output by the software to be tested facing the user; the second picture includes an expected interface image corresponding to a graphical user interface of the software to be tested.
Optionally, the first picture and the second picture have the same resolution.
Optionally, the resolution includes: 8 by 8 pixels or 16 by 16 pixels.
The present application further provides a picture structure comparison device, the device includes:
the image acquisition module is used for acquiring a first image and a second image;
a position distribution determining module, configured to determine a first position distribution and a second position distribution of target pixel points included in the first picture and the second picture, respectively; the target pixel point and other pixel points adjacent to the target pixel point are equal in pixel value;
and the comparison module is used for comparing the first position distribution with the second position distribution and determining whether the picture structures of the first picture and the second picture are consistent or not based on the comparison result.
Optionally, the position distribution determining module is further configured to, according to an order of each pixel point included in the first picture, combine the pixel values of the pixel points into a first sequence for describing a structural feature of the pixel points included in the first picture; and according to the sequence of each pixel point contained in the second picture, combining the pixel values of the pixel points into a second sequence for describing the structural characteristics of the pixel points contained in the second picture.
Optionally, the position distribution determining module is further configured to traverse each pixel value in the first number sequence, and count whether there are other pixel values in the first number sequence that are adjacent to the traversed pixel value and have the same size as the traversed pixel value; if yes, determining a pixel point corresponding to the pixel value as a target pixel point in the first picture, and determining a statistical result corresponding to the pixel value as a first statistical result; if the pixel value does not exist, determining the statistical result corresponding to the pixel value as a second statistical result; forming a third array according to the sequence of the pixel values in the first array of the statistical results corresponding to the pixel values contained in the first array to obtain a first position distribution for describing the target pixel points in the first picture; traversing each pixel value in the second array, and counting whether other pixel values which are adjacent to the traversed pixel value and have the same size with the traversed pixel value exist in the second array; if yes, determining a pixel point corresponding to the pixel value as a target pixel point in the second picture, and determining a statistical result corresponding to the pixel value as a first statistical result; if the pixel value does not exist, determining the statistical result corresponding to the pixel value as a second statistical result; and forming a fourth sequence according to the sequence of the pixel values in the second sequence by using the statistical results corresponding to the pixel values contained in the second sequence so as to obtain a second position distribution for describing the target pixel point in the second picture.
Optionally, the other pixels adjacent to the target pixel, include: other pixels in a position before the target pixel and/or other pixels in a position after the target pixel.
Optionally, the comparing module is further configured to compare statistical results at corresponding positions in the third number sequence and the fourth number sequence; if the statistical results at the corresponding positions in the third array and the fourth array are consistent, determining that the picture structures of the first picture and the second picture are consistent; otherwise, determining that the picture structures of the first picture and the second picture are inconsistent.
Optionally, the first statistical result is 0 or 1; the second statistical result is 1 or 0; the third number sequence and the fourth number sequence are both binary character strings consisting of numerical values 0 and 1;
the comparison module is further used for calculating the Hamming distance between the third number sequence and the fourth number sequence; if the calculated Hamming distance is 0, determining that the picture structures of the first picture and the second picture are consistent; otherwise, determining that the picture structures of the first picture and the second picture are inconsistent.
Optionally, the first picture includes an interface image corresponding to a graphical user interface output by the software to be tested facing the user; the second picture includes an expected interface image corresponding to a graphical user interface of the software to be tested.
Optionally, the first picture and the second picture have the same resolution.
Optionally, the resolution includes: 8 by 8 pixels or 16 by 16 pixels.
The technical scheme has the following technical effects:
in the application, whether the distribution conditions of the target pixel points in the two pictures are consistent or not is compared, wherein the pixel values of the target pixel points and other pixel points adjacent to the target pixel points are equal, so that whether the picture structures of the two pictures are consistent or not can be determined.
Drawings
FIG. 1 is a flow chart of a picture structure comparison method shown in an exemplary embodiment;
FIG. 2 is a diagram illustrating a picture structure comparison method according to an exemplary embodiment;
FIG. 3 is a diagram illustrating a picture structure comparison method in accordance with an exemplary embodiment;
fig. 4 is a schematic structural diagram of an electronic device in which a picture structure comparison apparatus according to an exemplary embodiment is located;
fig. 5 is a block diagram of a picture structure comparison apparatus according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of one or more embodiments of the specification, as detailed in the claims that follow.
It should be noted that: in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described herein. In some other embodiments, the method may include more or fewer steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
When similarity evaluation is performed on a plurality of pictures, rules included in the pictures to be subjected to the similarity evaluation are generally respectively searched, and the similarity among the pictures is evaluated by comparing the similarities among the rules included in the pictures.
The rules included in the picture may include rules between pixels included in the picture.
In practical applications, the rules among the pixels included in the picture may include position rules among the pixels included in the picture; and/or the size rule among the pixel values of the pixel points; and/or, a combination of the two foregoing laws. Such as a mean hash algorithm, a difference hash algorithm, etc.
By the method, the similarity among the target pictures can be evaluated to judge whether at least two identical pictures exist among the target pictures.
When testing software to be tested, it is required to determine whether an interface image corresponding to a graphical user interface output by the software to be tested facing a user is consistent with an image structure of an expected interface image corresponding to the graphical user interface of the software to be tested.
And determining whether the image structures of the interface image and the expected interface image are consistent or not so as to further determine whether the graphical user interface output by the software to be tested facing the user is consistent with the expected interface structure of the graphical user interface of the test software.
In practical application, a user can determine whether the interface structure of the user interface of the software to be tested meets an expected result based on a result of comparing an interface image corresponding to the graphical user interface output by the software to be tested to the user with an expected picture structure of the user interface image of the software to be tested, and further can perform other tests.
There may be a difference in image color and a difference in image structure between the determined image of the user interface with test software and the predicted image of the user interface with test software.
For example, the difference in the colors of the graphics may be reflected in: the background colors of the user interfaces of the test software are different, the theme colors of the user interfaces of the test software are different, the graphic colors contained in the graphic user interfaces of the test software are different, and the like;
the difference in the image structure can be reflected in: the user interfaces of the software to be tested have different interface structures.
When comparing the structural features of the user interface image with the test software with the predicted structural features of the user interface image with the test software, it is obviously impossible to determine whether the image structures of the images are consistent or not by evaluating the similarity between the actual interface image and the expected interface image. Therefore, the above method is not suitable for this scenario, and cannot solve the problem of whether the picture structures in this scenario are consistent.
In view of this, the present specification aims to provide a method for determining whether the picture structures of two pictures are consistent by comparing whether the position distributions of a target pixel point in the two pictures are consistent, wherein the pixel values of the target pixel point and other pixel points adjacent to the target pixel point are equal.
When the method is realized, a first picture and a second picture which need to be judged whether picture structures are consistent or not can be respectively obtained; then, it may be determined that target pixel points included in the picture are in position distribution in the picture, where pixel values of pixel points adjacent to the target pixel points are equal in size, so as to determine first position distribution of the target pixel points in the first picture and second position distribution of the target pixel points in the second picture; the first position distribution and the second position distribution are compared, and whether the picture structures of the first picture and the second picture are consistent or not can be determined according to the comparison result.
Therefore, by comparing whether the distribution conditions of the target pixel points in the two pictures are consistent or not, wherein the pixel values of the target pixel points and other pixel points adjacent to the target pixel points are equal, the judgment on whether the picture structures of the two pictures are consistent or not can be realized.
The present application is described below with reference to specific embodiments and specific application scenarios.
Referring to fig. 1, fig. 1 is a flowchart illustrating a picture structure comparison method according to an exemplary embodiment, where the method performs the following steps:
s102, a first picture and a second picture are obtained.
The number of the obtained pictures is not limited in this specification, and may be two pictures, three pictures, or the like, because the comparison of the pictures is involved, the number of the obtained pictures is at least two, and in this specification, the picture structure comparison method is exemplified by obtaining two pictures, which are respectively a first picture and a second picture.
In practical applications, the first picture and the method for obtaining the second picture may include pictures uploaded by a user, may include screenshots located on a computing device, and the like, and the description is not limited otherwise.
In an embodiment shown, the first picture may include an interface image corresponding to a graphical user interface output by the software to be tested to the user; the second picture may include an expected interface image corresponding to the graphical user interface of the software to be tested.
The method comprises the steps that a graphical user interface output by the software to be tested facing a user is subjected to screen capture, so that an interface image corresponding to the graphical user interface is obtained and serves as a first image; an expected interface image corresponding to the graphical user interface of the software to be tested uploaded by the user can be obtained and used as a second image.
The first picture and the second picture may be the same or different in picture size, picture quality, picture color, image resolution, and the like, and this is not otherwise limited in this embodiment.
In one embodiment, the first picture and the second picture have the same resolution.
The same resolution means that the number of pixels of the first picture and the second picture in the horizontal and vertical directions is equal.
In practical applications, if the resolutions of the first picture and the second picture are equal, the step 102 is directly executed to directly obtain the first picture and the second picture;
if the resolutions of the first picture and the second picture are not equal, before performing step 102, the method may further include:
acquiring a first original image corresponding to the first picture and acquiring a second original image corresponding to the second picture, wherein the first original image and the second original image have different resolutions;
then, the first original image and the second original image are respectively subjected to image standardization to obtain a first picture and a second picture with the same image resolution.
In practical applications, the shapes of the first picture and the second picture to be obtained may be regular patterns having the same resolution or irregular patterns having the same resolution, and in this specification, the shapes of the first picture and the second picture are not limited as long as the resolutions of the first picture and the second picture to be obtained are the same.
For example, the shape may be circular, triangular, parallelogram, rectangular, square, polygonal, irregular polygonal.
In this embodiment, by obtaining the standardized picture, the feature comparison of the pixel points included in the picture can be more conveniently and quickly achieved, and especially, the determination of the position distribution of the target pixel point in step 104 is conveniently performed.
In one embodiment shown, the same resolution as above may include: 8 × 8 pixels or 16 × 16 pixels.
For example, referring to fig. 2, fig. 2 is a schematic diagram of a picture structure comparison method according to an exemplary embodiment.
As shown in a of fig. 2, a of fig. 2 is the obtained first picture, the resolution of the first picture is 3 × 3, and the pixel values of each pixel point included in the first day picture are: a is a 1 ,a 2 ,a 3 ,…,a 9
As shown in b of fig. 2, b of fig. 2 is the obtained second picture, the resolution of the second picture is 3 × 3, and the pixel values of the pixels included in the second picture are: b 1 ,b 2 ,b 3 ,…,b 9
In practical applications, the resolutions of the first picture and the second picture are not limited in this specification, and the resolution can be set by a user according to a user's requirement.
When the resolution value is lower, fewer pixel points in the picture are needed, fewer pixel points are needed for comparison, and thus, the comparison data can be reduced, and the comparison result can be obtained more quickly;
when the resolution value is higher, more pixel points are in the picture, more pixel points are used for comparison, and then the data for comparison can be increased, so that the time for obtaining the comparison result is longer.
S104, respectively determining first position distribution and second position distribution of target pixel points respectively contained in the first picture and the second picture; and the pixel values of the target pixel point and other pixel points adjacent to the target pixel point are equal.
And determining the position distribution of target pixel points contained in the first picture, and determining the position distribution of target pixel points contained in the second picture, wherein the target pixel points and other pixel points adjacent to the target pixel points have pixel values with the same size.
In an embodiment shown, the other pixels adjacent to the target pixel may include: other pixels in a position before the target pixel and/or other pixels in a position after the target pixel.
In practical application, the target pixel point includes a pixel point adjacent to the target pixel point and having the same pixel value.
For example, please refer to fig. 2, as a in fig. 2, if the pixel values of the 2 nd, 3 rd, 5 th, and 7 th pixels in the first picture are equal, i.e. a is a 2 =a 3 =a 5 =a 7 And the adjacent pixel points in the pixel points with the same pixel value are: the 2 nd pixel point and the 3 rd pixel point are target pixel points which are adjacent in position and equal in pixel value in the first picture;
the position distribution of the target pixel point in the first picture is: the 2 nd and 3 rd pixel points.
As shown in b of fig. 2, if the pixel values of the 2 nd, 4 th, 5 th and 8 th pixels in the second picture are equal, that is, b is 2 =b 4 =b 5 =b 8 And the adjacent pixel points in the pixel points with the same pixel value are: the 4 th pixel point and the 5 th pixel point in the second picture can be determined to be target pixel points based on the same method, and the position distribution of the target pixel points in the second picture can be determinedComprises the following steps: the 4 th and 5 th pixel points.
In an embodiment shown in the present invention, before determining the position distribution of the target pixel point in the picture, the method may further include:
according to the sequence of each pixel point contained in the first picture, the pixel value of the pixel point is combined into a first sequence for describing the structural characteristics of the pixel point contained in the first picture;
and according to the sequence of each pixel point contained in the second picture, combining the pixel values of each pixel point into a second sequence for describing the structural characteristics of the pixel points contained in the second picture.
And composing the pixel values of the pixel points contained in the picture into a sequence for describing the structural characteristics of the pixel points contained in the picture according to the sequence of the pixel points in the picture. And acquiring a first number sequence corresponding to the first picture and acquiring a second number sequence corresponding to the second picture.
In practical application, the sequence of the pixels may be a sequence from left to right, from right to left, from top to bottom, or from bottom to top in the picture, and the sequence of the pixels is not limited in this specification, and the sequence may also be set by a user in a user-defined manner, as long as the sequence of the pixels included in the first picture is the same as the sequence of the pixels included in the second picture.
For example, referring to fig. 3, fig. 3 is a schematic diagram illustrating a picture structure comparison method according to an exemplary embodiment. As shown in a-c of fig. 3, 3 orders of the pixels included in the first picture are respectively shown, wherein a dotted line in the figure shows the order of the pixels included in the image, and an arrow on the dotted line shows a direction of the order.
Then, the first sequence corresponding to a of fig. 3 may be: { a 1 ,a 2 ,a 3 ,a 4 ,a 5 ,a 6 ,a 7 ,a 8 ,a 9 };
Then, the first number corresponding to b of FIG. 3The columns may be: { a 1 ,a 2 ,a 3 ,a 6 ,a 5 ,a 4 ,a 7 ,a 8 ,a 9 };
Then, the first sequence corresponding to c of fig. 3 may be: { a) 1 ,a 4 ,a 7 ,a 2 ,a 5 ,a 8 ,a 3 ,a 6 ,a 9 }。
For another example, with reference to fig. 2, the sequence of the pixels included in the first picture is the same as the sequence of a in fig. 3, for example,
the first number is { a } 1 ,a 2 ,…,a 9 The second number is { b } 1 ,b 2 ,…,b 9 }。
In an embodiment shown in the above, the determining a first position distribution and a second position distribution of target pixels respectively included in the first picture and the second picture respectively includes:
traversing each pixel value in the first array, and counting whether other pixel values which are adjacent to the traversed pixel value and have the same size with the traversed pixel value exist in the first array; if yes, determining a pixel point corresponding to the pixel value as a target pixel point in the first picture, and determining a statistical result corresponding to the pixel value as a first statistical result; if the pixel value does not exist, determining the statistical result corresponding to the pixel value as a second statistical result; forming a third sequence of statistical results corresponding to the pixel values included in the first sequence according to the sequence of the pixel values in the first sequence, so as to obtain a first position distribution for describing the target pixel point in the first picture;
traversing each pixel value in the second array, and counting whether other pixel values which are adjacent to the traversed pixel value and have the same size with the traversed pixel value exist in the second array; if yes, determining a pixel point corresponding to the pixel value as a target pixel point in the second picture, and determining a statistical result corresponding to the pixel value as a first statistical result; if the pixel value does not exist, determining the statistical result corresponding to the pixel value as a second statistical result; and forming a fourth sequence of statistical results corresponding to the pixel values included in the second sequence according to the sequence of the pixel values in the second sequence, so as to obtain a second position distribution for describing the target pixel point in the second picture.
In practical application, it may be determined whether other pixel values that are adjacent to the pixel value position and have the same pixel value size exist in each pixel value in the first sequence one by one, if so, the pixel point corresponding to the pixel value is determined as a target pixel point, and the statistical result corresponding to the pixel value is determined as a first statistical result, otherwise, the statistical result corresponding to the pixel value is determined as a second statistical result;
and composing the statistical result into a third sequence according to the sequence of the pixel values corresponding to the statistical result in the first sequence. And the third sequence is used for describing the position distribution of the target pixel point in the first picture.
In the same way, the target pixel point in the second picture and the fourth sequence for describing the position distribution of the target pixel point in the second picture can be determined.
The first statistical result may include True or False, and correspondingly, the second statistical result may include False or True; the first statistical result may include "consistent" or "inconsistent", and correspondingly, the second statistical result may include "inconsistent" or "consistent"; the present specification does not excessively limit the value and the expression method of the first statistical result and the second statistical result, and may be configured to distinguish the first statistical result from the second statistical result.
S106, comparing the first position distribution with the second position distribution, and determining whether the picture structures of the first picture and the second picture are consistent or not based on the comparison result.
And comparing the first position distribution of the target pixel points in the first picture with the second position distribution of the target pixel points in the second picture, and determining whether the picture structures of the first picture and the second picture are consistent or not based on the comparison result.
The picture structure refers to an interface structure on the graphical user interface with the test software.
In an embodiment, the comparing the first location distribution with the second location distribution and determining whether the picture structures of the first picture and the second picture are consistent based on the comparison result may include:
comparing the statistical results at the corresponding positions in the third sequence and the fourth sequence; if the statistical results at the corresponding positions in the third number sequence and the fourth number sequence are consistent, determining that the picture structures of the first picture and the second picture are consistent; otherwise, determining that the picture structures of the first picture and the second picture are inconsistent.
In practical applications, the third sequence and the fourth sequence may be compared to determine whether the statistical result of each digit is consistent.
For example, it may be compared whether the statistical result of the first bit in the third sequence is consistent with the statistical result of the first bit in the fourth sequence.
If the comparison result is consistent, the picture structures of the first picture corresponding to the third sequence and the second picture corresponding to the fourth sequence are consistent; and if the comparison results are not consistent, the picture structures of the first picture corresponding to the third sequence and the second picture corresponding to the fourth sequence are not consistent.
In practical application, if the picture structures of the pictures are consistent, it indicates that the interface structures of the graphical user interfaces in the test software are consistent, and otherwise, it indicates that the interface structures of the graphical user interfaces in the test software are inconsistent.
In one embodiment shown, the first statistical result may be 0 or 1; the second statistical result may be 1 or 0; the third number sequence and the fourth number sequence may be binary strings each composed of values 0 and 1;
comparing the statistical results at corresponding positions in the third sequence and the fourth sequence; if the statistical results at the corresponding positions in the third number sequence and the fourth number sequence are consistent, determining that the picture structures of the first picture and the second picture are consistent; otherwise, determining that the picture structures of the first picture and the second picture are not consistent, including:
a hamming distance between the third sequence and the fourth sequence can be calculated;
if the calculated hamming distance is 0, it can be determined that the picture structures of the first picture and the second picture are consistent; otherwise, it may be determined that the picture structures of the first picture and the second picture are not consistent.
The hamming distance refers to the number of different characters at the corresponding positions of two character strings with the same length.
In practical applications, if the statistical result is set to "0" or "1", both the third number sequence and the fourth number sequence may be binary strings containing only "1" and "0", and therefore, by calculating the hamming distance between the third number sequence and the fourth number sequence, it can be quickly determined whether the statistical results at corresponding positions in the third number sequence and the fourth number sequence are consistent, and thus, it can be quickly determined whether the picture structures of the first picture and the second picture are consistent.
Corresponding to the embodiment of the picture structure comparison method, the present specification also provides an embodiment of a picture structure comparison apparatus.
Referring to fig. 4, fig. 4 is a hardware structure diagram of an electronic device in which a picture structure comparing apparatus according to an exemplary embodiment is located. At the hardware level, the device includes a processor 402, an internal bus 404, a network interface 406, a memory 408, and a non-volatile memory 410, although it may include hardware required for other services. One or more embodiments of the present description may be implemented in software, such as by processor 402 reading a corresponding computer program from non-volatile storage 410 into memory 408 and then executing the computer program. Of course, besides software implementation, the one or more embodiments in this specification do not exclude other implementations, such as logic devices or combinations of software and hardware, and so on, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Referring to fig. 5, fig. 5 is a block diagram of a picture structure comparison apparatus according to an exemplary embodiment. The web page classification and identification device can be applied to the electronic equipment shown in fig. 4 to realize the technical scheme of the specification. Wherein, the picture structure comparison device may include:
a picture obtaining module 502, configured to obtain a first picture and a second picture;
a position distribution determining module 504, configured to determine a first position distribution and a second position distribution of target pixel points included in the first picture and the second picture, respectively; the target pixel point and other pixel points adjacent to the target pixel point are equal in pixel value;
a comparing module 506, configured to compare the first location distribution with the second location distribution, and determine whether the picture structures of the first picture and the second picture are consistent based on a result of the comparison.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiment, since it basically corresponds to the method embodiment, reference may be made to the partial description of the method embodiment for relevant points. The above-described embodiments of the apparatus are only illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in the present specification. One of ordinary skill in the art can understand and implement it without inventive effort.
The systems, apparatuses, modules or units described in the above embodiments may be specifically implemented by a computer chip or an entity, or implemented by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission medium, that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises that element.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein in one or more embodiments to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of one or more embodiments herein. The word "if" as used herein may be interpreted as "at" \8230; "or" when 8230; \8230; "or" in response to a determination ", depending on the context.
The above description is only for the purpose of illustrating the preferred embodiments of the one or more embodiments of the present disclosure, and is not intended to limit the scope of the one or more embodiments of the present disclosure, and any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the one or more embodiments of the present disclosure should be included in the scope of the one or more embodiments of the present disclosure.

Claims (12)

1. A picture structure comparison method, the method comprising:
acquiring a first picture and a second picture;
respectively determining first position distribution and second position distribution of target pixel points respectively contained in the first picture and the second picture; the target pixel point and other pixel points adjacent to the target pixel point are equal in pixel value;
and comparing the first position distribution with the second position distribution, and determining whether the picture structures of the first picture and the second picture are consistent or not based on the comparison result.
2. The method of claim 1, the determining that the target pixel points included in the first picture and the second picture, respectively, precede the first location distribution and the second location distribution in the first picture and the second picture, respectively, the method further comprising:
according to the sequence of each pixel point contained in the first picture, the pixel value of the pixel point is combined into a first sequence for describing the structural characteristics of the pixel point contained in the first picture;
and according to the sequence of each pixel point contained in the second picture, combining the pixel values of the pixel points into a second sequence for describing the structural characteristics of the pixel points contained in the second picture.
3. The method of claim 2, wherein the determining a first location distribution and a second location distribution of target pixels contained in the first picture and the second picture, respectively, comprises:
traversing each pixel value in the first array, and counting whether other pixel values which are adjacent to the traversed pixel value and have the same size with the traversed pixel value exist in the first array; if yes, determining a pixel point corresponding to the pixel value as a target pixel point in the first picture, and determining a statistical result corresponding to the pixel value as a first statistical result; if the pixel value does not exist, determining the statistical result corresponding to the pixel value as a second statistical result; forming a third array according to the sequence of the pixel values in the first array of the statistical results corresponding to the pixel values contained in the first array to obtain a first position distribution for describing the target pixel points in the first picture;
traversing each pixel value in the second array, and counting whether other pixel values which are adjacent to the traversed pixel value and have the same size with the traversed pixel value exist in the second array; if yes, determining a pixel point corresponding to the pixel value as a target pixel point in the second picture, and determining a statistical result corresponding to the pixel value as a first statistical result; if the pixel value does not exist, determining the statistical result corresponding to the pixel value as a second statistical result; and forming a fourth sequence of statistical results corresponding to the pixel values included in the second sequence according to the sequence of the pixel values in the second sequence, so as to obtain a second position distribution for describing the target pixel point in the second picture.
4. The method of claim 1, other pixels located adjacent to the target pixel, comprising:
other pixels in a position prior to the target pixel,
and/or the presence of a gas in the atmosphere,
and other pixel points at a position behind the target pixel point.
5. The method of claim 3, the comparing the first location distribution and the second location distribution and determining whether picture structures of the first picture and the second picture are consistent based on a result of the comparing, comprising:
comparing the statistical results at the corresponding positions in the third number sequence and the fourth number sequence; if the statistical results at the corresponding positions in the third array and the fourth array are consistent, determining that the picture structures of the first picture and the second picture are consistent; otherwise, determining that the picture structures of the first picture and the second picture are inconsistent.
6. The method of claim 5, the first statistical result being 0 or 1; the second statistical result is 1 or 0; the third number sequence and the fourth number sequence are both binary character strings consisting of numerical values 0 and 1;
comparing the statistical results at the corresponding positions in the third sequence and the fourth sequence; if the statistical results at the corresponding positions in the third array and the fourth array are consistent, determining that the picture structures of the first picture and the second picture are consistent; otherwise, determining that the picture structures of the first picture and the second picture are inconsistent, including:
calculating a hamming distance between the third sequence and the fourth sequence;
if the calculated Hamming distance is 0, determining that the picture structures of the first picture and the second picture are consistent; otherwise, determining that the picture structures of the first picture and the second picture are inconsistent.
7. The method of claim 1, the first picture comprising an interface image corresponding to a graphical user interface of a user-oriented output of software to be tested; the second picture includes an expected interface image corresponding to a graphical user interface of the software to be tested.
8. The method of claim 1, the first picture and the second picture having a same resolution.
9. The method of claim 8, the resolution comprising:
8 by 8 pixels or 16 by 16 pixels.
10. A picture structure comparison device, the device comprising:
the image acquisition module is used for acquiring a first image and a second image;
a position distribution determining module, configured to determine a first position distribution and a second position distribution of target pixel points included in the first picture and the second picture, respectively; the target pixel point and other pixel points adjacent to the target pixel point are equal in pixel value;
and the comparison module is used for comparing the first position distribution with the second position distribution and determining whether the picture structures of the first picture and the second picture are consistent or not based on the comparison result.
11. An electronic device, comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are connected with each other through the bus;
the memory stores machine-readable instructions, and the processor executes the method of any one of claims 1 to 9 by calling the machine-readable instructions.
12. A machine readable storage medium having stored thereon machine readable instructions which, when invoked and executed by a processor, carry out the method of any of claims 1 to 9.
CN202211035674.6A 2022-08-26 2022-08-26 Picture structure comparison method and device Pending CN115393607A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211035674.6A CN115393607A (en) 2022-08-26 2022-08-26 Picture structure comparison method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211035674.6A CN115393607A (en) 2022-08-26 2022-08-26 Picture structure comparison method and device

Publications (1)

Publication Number Publication Date
CN115393607A true CN115393607A (en) 2022-11-25

Family

ID=84121836

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211035674.6A Pending CN115393607A (en) 2022-08-26 2022-08-26 Picture structure comparison method and device

Country Status (1)

Country Link
CN (1) CN115393607A (en)

Similar Documents

Publication Publication Date Title
CN111681273B (en) Image segmentation method and device, electronic equipment and readable storage medium
CN111091123A (en) Text region detection method and equipment
CN111175318A (en) Screen scratch fragmentation detection method and equipment
CN111311556B (en) Mobile phone defect position identification method and equipment
CN111325717B (en) Mobile phone defect position identification method and equipment
CN112149677A (en) Point cloud semantic segmentation method, device and equipment
CN112634201B (en) Target detection method and device and electronic equipment
CN109271910A (en) A kind of Text region, character translation method and apparatus
CN111553290A (en) Text recognition method, device, equipment and storage medium
CN117576108B (en) Visual optimization method and device for wafer defect detection and computer equipment
CN113129298B (en) Method for identifying definition of text image
CN112215266B (en) X-ray image contraband detection method based on small sample learning
CN110059563B (en) Text processing method and device
CN111127480B (en) Image processing method and device, electronic equipment and storage medium
CN115393607A (en) Picture structure comparison method and device
CN109443697B (en) Optical center testing method, device, system and equipment
CN116977336A (en) Camera defect detection method, device, computer equipment and storage medium
CN116071418A (en) Method, apparatus, computer device, storage medium and computer program product for measuring build-up dimensions
CN111062385A (en) Network model construction method and system for image text information detection
CN112446933B (en) Imaging method and device of financial asset, electronic equipment and readable storage medium
CN115471703A (en) Two-dimensional code detection method, model training method, device, equipment and storage medium
CN114463764A (en) Table line detection method and device, computer equipment and storage medium
CN111242116B (en) Screen positioning method and device
CN113568578B (en) Picture processing method and device, electronic equipment and readable storage medium
US10277912B2 (en) Methods and apparatus for storing data related to video decoding

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