CN116524213A - Picture comparison method and device, computing device and readable storage medium - Google Patents

Picture comparison method and device, computing device and readable storage medium Download PDF

Info

Publication number
CN116524213A
CN116524213A CN202310464920.8A CN202310464920A CN116524213A CN 116524213 A CN116524213 A CN 116524213A CN 202310464920 A CN202310464920 A CN 202310464920A CN 116524213 A CN116524213 A CN 116524213A
Authority
CN
China
Prior art keywords
picture
image
image block
judging
color
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
CN202310464920.8A
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.)
Uniontech Software Technology Co Ltd
Original Assignee
Uniontech Software 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 Uniontech Software Technology Co Ltd filed Critical Uniontech Software Technology Co Ltd
Priority to CN202310464920.8A priority Critical patent/CN116524213A/en
Publication of CN116524213A publication Critical patent/CN116524213A/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/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • 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/56Extraction of image or video features relating to colour

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (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

The invention discloses a picture comparison method and device, computing equipment and a readable storage medium, relates to the technical field of picture processing, and can solve the technical problem that picture comparison cannot be automatically executed in the prior art. The picture comparison method comprises the following steps: dividing a first picture and a second picture with the same size into a preset number of blocks, and giving the same number to the blocks with the corresponding positions, wherein the blocks of the first picture and the blocks of the second picture are the same in size and number; judging whether each image block in the first image and the second image is a solid image block or a non-solid image block and recording; and comparing the image blocks with the same numbers in the first image and the second image in sequence. According to the technical scheme, excessive manual intervention is not needed, a more efficient picture comparison method is used, the difference of two pictures can be automatically compared, and a comparison difference result can be recorded.

Description

Picture comparison method and device, computing device and readable storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and apparatus for comparing images, a computing device, and a readable storage medium.
Background
In QT project development, interface design is often required. After the research and development personnel design the interface according to the design drawing, whether the designed interface effect is consistent with the design drawing or not needs to be confirmed. If observed by naked eyes, the observation result is often inaccurate due to interference of external factors such as light rays, a display and the like, and vision and the like.
In the prior art, the picture comparison method generally compares two pictures by comparing the two pictures pixel by pixel, so as to compare whether the two pictures have differences. And comparing the data corresponding to the plurality of pixel points corresponding to the positions in the first picture and the second picture one by one to generate a comparison result. The disadvantages of this picture comparison mode mainly include: 1. the sizes of the two pictures are required to be completely consistent, if one picture is scaled, even if the two pictures are originally identical, the output result is different after comparison; 2. comparing each pixel of the two pictures is less efficient, especially for pictures with larger pixels or less active content, the defect may be more pronounced. In addition, the comparison method also needs to manually extract the picture, convert the format and adjust the size of the picture, has lower overall efficiency and is inconvenient to operate.
Disclosure of Invention
To this end, the present invention provides a picture comparison method and apparatus, a computing device, and a readable storage medium in an effort to solve or at least alleviate at least one of the problems presented above.
According to a first aspect of the present invention, there is provided a picture comparison method comprising: dividing a first picture and a second picture with the same size into a preset number of blocks, and giving the same numbers to the blocks corresponding to the positions in the first picture and the second picture, wherein the sizes and the numbers of the blocks of the first picture and the blocks of the second picture are the same; judging whether each image block in the first image and the second image is a solid image block or a non-solid image block and recording; comparing the image blocks with the same numbers in the first image and the second image in sequence, wherein the comparison process comprises the following steps: judging whether the first image block and the second image block with the same numbers in the first image and the second image are pure-color image blocks or not; if the first image block and the second image block are both solid-color image blocks, judging whether the average values of the colors of the first image block and the second image block are equal; if the first image block and the second image block are equal, judging that the first image block is identical to the second image block, otherwise, recording the coordinate positions of all pixel points in the image blocks; if at least one term is a non-solid color tile, comparing the first tile with the second tile pixel by pixel; judging whether pixel points with different color values exist or not; if no pixel points with different color values exist, judging that the first image block is identical to the second image block, otherwise, recording the coordinate positions of the pixel points with different color values.
Optionally, in the picture comparison method of the present invention, before "dividing each of the first picture and the second picture having the same size into a predetermined number of tiles", it further includes: judging whether one or more pixel rows with all pixel points being the preset color value exist at the upper edge and the lower edge of the first picture and the second picture; judging whether one or more pixel columns with all pixel points being the preset color value exist at the left edge and the right edge of the first picture and the second picture; if so, the pixel rows and columns of the predetermined color values are deleted from the first picture and the second picture.
Optionally, in the picture comparison method of the present invention, the step of determining whether the tile is a solid-color tile includes: calculating a color average of the tiles; randomly selecting a preset number of pixel points from the image block, and judging whether the color value of the preset number of pixel points is equal to the average value of the color; if the image blocks are equal, judging that the image blocks are solid-color image blocks; otherwise, judging the image block to be a non-solid color image block.
Optionally, the picture comparison method of the present invention further includes: and marking the coordinate positions of all the recorded pixels in the first picture and the second picture.
Optionally, the picture comparison method of the present invention further includes: and if the number of the recorded coordinate positions of all the pixel points is smaller than the threshold value, judging that the first picture and the second picture are identical.
According to a second aspect of the present invention, there is provided a picture comparison apparatus comprising: the segmentation module is used for respectively segmenting the first picture and the second picture with the same size into a preset number of image blocks, and giving the same numbers to the image blocks with the corresponding positions in the first picture and the second picture, wherein the image blocks of the first picture and the image blocks of the second picture are the same in size and number; the judging module is used for judging whether each image block in the first image and the second image is a solid image block or a non-solid image block and recording; the comparison module is used for comparing the image blocks with the same numbers in the first image and the second image in sequence, and the comparison module comprises: the first judging submodule is used for judging whether the first image block and the second image block with the same numbers in the first image and the second image are pure-color image blocks or not; the second judging submodule is used for judging whether the average values of the colors of the first image block and the second image block are equal or not under the condition that the first image block and the second image block are pure color image blocks; the third judging sub-module is used for judging that the first image block is identical with the second image block under the condition that the average values of the colors of the first image block and the second image block are equal, otherwise, the coordinate positions of all pixel points in the image block are recorded; a comparison sub-module, configured to, in a case where at least one of the first tile and the second tile is a non-solid-color tile, perform pixel-by-pixel comparison on the first tile and the second tile; a fourth judging sub-module, configured to judge whether there are pixels with different color values; and the fifth judging sub-module is used for judging that the first image block and the second image block are the same under the condition that pixel points with different color values do not exist, and otherwise, recording the coordinate positions of the pixel points with different color values.
Optionally, the picture comparing apparatus of the present invention further includes: an edge removing module, configured to remove edge invalid content of a picture, including: the judging module is used for judging whether one or more pixel rows with preset color values exist at the upper edge and the lower edge of the first picture and the second picture; judging whether one or more pixel columns with all pixel points being the preset color value exist at the left edge and the right edge of the first picture and the second picture; and the deleting module is used for deleting the pixel rows and the pixel columns of the preset color value from the first picture and the second picture in the case that the pixel rows and the pixel columns of the preset color value exist.
Optionally, the picture comparing apparatus of the present invention further includes: and the picture judging module is used for judging that the first picture and the second picture are identical if the number of the coordinate positions of all the recorded pixel points is smaller than the threshold value after all the image blocks are compared.
According to a third aspect of the present invention there is provided a computing device comprising: at least one processor and a memory storing program instructions; the program instructions, when read and executed by the processor, cause the computing device to perform the method as described above.
According to a fourth aspect of the present invention there is provided a readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform a method as described above.
According to the technical scheme, excessive manual intervention is not needed, a more efficient picture comparison method is used, the difference of two pictures can be automatically compared, and a comparison difference result can be recorded.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which set forth the various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to fall within the scope of the claimed subject matter. The above, as well as additional objects, features, and advantages of the present disclosure will become more apparent from the following detailed description when read in conjunction with the accompanying drawings. Like reference numerals generally refer to like parts or elements throughout the present disclosure.
Fig. 1 shows a schematic flow chart of a picture comparison method of an embodiment of the present invention.
Fig. 2 shows a schematic flow chart of a specific implementation of the picture comparison step according to an embodiment of the present invention.
Fig. 3 shows a schematic flow chart of a specific implementation of the edge removal step of an embodiment of the present invention.
Fig. 4 shows a picture example on which the picture comparison method of the embodiment of the present invention is performed.
Fig. 5 shows a schematic block diagram of a picture comparison apparatus according to an embodiment of the invention.
FIG. 6 shows a schematic diagram of a computing device according to one embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
According to an embodiment of the invention, a picture comparison method is provided. Fig. 1 shows a schematic flow chart of the picture comparison method. As shown in FIG. 1, the method includes steps 110-130. The steps are described in detail below.
110, dividing the first picture and the second picture with the same size into a predetermined number of blocks, and giving the same numbers to the blocks with the corresponding positions, wherein the sizes and the numbers of the blocks of the first picture and the blocks of the second picture are the same.
After this step is performed, each tile in the first picture corresponds to each tile in the second picture in position, and the tile in the first picture, for example, the upper left corner is assigned the number 1, and correspondingly, the upper left corner of the second picture is also assigned the number 1. The number of the tiles may be set according to the size of the picture and the size of the resolution, for example, 20×20 total 400 small tiles.
If the two pictures are different in size, the second picture can be scaled according to the size of the first picture in equal proportion so that the first picture and the second picture are the same in size. This ensures that the subsequent comparison step is performed properly.
In one specific implementation example, the first picture may be a design drawing manuscript, the second picture may be a program interface actual display drawing, and the first picture and the second picture may be interchanged. It should be understood that the first picture and the second picture may also be any other pictures, and the invention is not limited herein.
120, determining whether each of the first picture and the second picture is a solid-color tile or a non-solid-color tile, and recording.
This step may be performed by: the first way is: calculating the average value of the colors of the image blocks; randomly selecting a preset number of pixel points from a block, and judging whether the color value of the preset number of pixel points is equal to the average value of the color; if the two blocks are equal, judging that the blocks are solid-color blocks; otherwise, the block is judged to be a non-solid color block.
The color average may be RGB average, RGBA average, and BW average of the picture, and the color value may similarly employ one of the above listed. The invention is not limited herein.
The predetermined number of selected pixels may be ten or more, twenty or more. The predetermined number of pixels have color values equal to the average color value, and the tile is considered to be a solid-color tile. As long as the color value of one pixel point in the predetermined number of pixel points is not equal to the average value, the block is considered to be a non-solid color block.
Alternatively, the color average value can be used to represent the solid-color image block, so that when the image block comparison is performed in the subsequent step, the solid-color image block can be directly compared by the color average value, and re-calculation is not needed again, thereby saving the calculation space and the execution efficiency of the method.
Solid color tiles may also be identified in other ways, such as assigning different values to solid color tiles and non-solid color tiles, etc.
The following advantages can be obtained by using the picture block contrast: when the number of the blank areas or the solid areas in the image is large, the comparison of the image blocks (as described below, comparing the RGB average values of the image blocks) can be completed only by comparing the color values of a few pixel points (judging whether the color values are the solid areas or not), so that the comparison efficiency is greatly improved compared with the pixel-by-pixel comparison mode of the whole image.
The second way is: the color values of the pixel points of each image block are compared in pairs, the color values of all the pixel points are equal in pairs, so that the image block is determined to be a solid-color image block, otherwise, the image block is determined to be a non-solid-color image block.
Other solid color judgment modes can be adopted, so long as the color values of all the pixel points can be judged to be equal.
130, comparing the same numbered blocks in the first picture and the second picture in sequence, wherein the comparison process includes 1310-1360 as shown in fig. 2. The steps are described below.
1310, determining whether the first and second image blocks with the same numbers in the first and second images are solid-color image blocks.
1320, if both are solid color tiles, a determination is made as to whether the average of the colors of the first tile and the second tile are equal.
1330, if the first and second image blocks are equal, determining that the first image block is identical to the second image block, otherwise, recording the coordinate positions of all the pixels in the image block.
1340, if at least one of the terms is a non-solid color tile, comparing the first tile to the second tile pixel by pixel.
1350, determine whether there are pixels with different color values.
1360, if there are no pixels with different color values, determining that the first tile is the same as the second tile, otherwise, recording coordinate positions of the pixels with different color values.
After comparing all tiles, the steps may also be performed: and if the number of the coordinate positions of all the pixel points recorded for the first picture or the second picture is smaller than the threshold value, judging that the first picture and the second picture are identical. Alternatively, in the case where the threshold value is larger than the first picture, it may be determined that the first picture and the second picture are not identical. The threshold may be set as desired, for example, may be 0, so that two pictures are considered to be different as long as there are different pixels. The threshold may be, for example, 5, so that the two pictures are considered to be identical if the number of different pixels is less than 5, and the 5 pixels are defaulted to be picture noise points.
After comparing all the image blocks, the difference between the first image and the second image, namely the coordinate positions of all the different pixel points, can be output so that relevant personnel can intuitively check and directly judge whether the first image and the second image are identical. The output coordinate position may be coordinate position data recorded in a memory or coordinate position displayed in a picture. The method may further comprise the step of, if the coordinate position in the picture is output: and marking the coordinate positions of all the recorded pixels in the first picture and the second picture.
In the conventional art, omission or errors often occur by finding out a difference portion between an actual effect map and a design document by visual observation. The existing comparison tool is used for comparing pixels one by one, so that the resource consumption is high and the efficiency is low.
According to the technical scheme of the invention, only the user is required to provide the designed manuscript and the actual effect screenshot without other treatments such as picture scaling adjustment, and the program automatically carries out pretreatment operation on the pictures, completes comparison and outputs the result, so that the user operation is simplified.
The method of fig. 1 may further include an edge removal step for removing edge invalid content of the picture prior to step 110. The edge removing step comprises the following steps: judging whether one or more pixel rows with all pixel points being the preset color value exist at the upper edge and the lower edge of the first picture and the second picture; judging whether one or more pixel columns with all pixel points being the preset color value exist at the left edge and the right edge of the first picture and the second picture; if so, the pixel rows and columns of the predetermined color values are deleted from the first picture and the second picture. One specific execution example of the edge removal step is described below with reference to fig. 3. It should be understood that the specific process performed is not limited to that shown in fig. 3.
As shown in FIG. 3, the edge removal step includes steps 1010-1070. The steps are described below.
And 1010, traversing the pixel points of the first picture and the second picture from the first row, and acquiring the color value of each pixel point.
In an actual program implementation, the picture may be read into the bitmap, the number of rows and columns of the picture are obtained, and two for loops are used to traverse from the first row of the picture. Taking the RGB value of each pixel as an example for explanation.
And 1020, judging whether the color value of the pixel point of the current line of each of the first picture and the second picture is a preset value.
1030, if so, removing the current line from the first picture and the second picture; otherwise the traversal starting from the first row is ended.
The specific value of the predetermined value may be set in advance by a person according to the picture, for example, for a white background, the value may be set to 255, that is, the RGB values representing the current pixel point are all 255, and the first line is a pure white background, no content, and needs to be removed. If the color value of the pixel point is not equal to 255, the first line is the content line, and the traversal from the first line is finished, and the traversal from the last line is switched.
1040, proceeding to the next row, the above steps are performed for the next row.
1050, after the traversal from the first line is finished, switch to the last line of the first picture and the second picture, and continue to execute the above steps for each line up from the last line.
1060, switching to the leftmost column of the first picture and the second picture, starting to right each column for the leftmost column, and continuing to execute the steps.
1070, switching to the rightmost column of the first picture and the second picture, starting to left each column for the rightmost column, and continuing to execute the steps.
In the above traversal steps starting from the first row, the last row, the leftmost column and the rightmost column, if a pixel point with RGB values not equal to 255 exists in a certain row/column, it is indicated that there is content from the row, and the traversal is stopped. The blank rows in the picture are deleted, so that the work of removing invalid contents from the top, bottom, left and right of the picture is completed, the calculation cost is saved for the execution of the subsequent picture comparison step, and the efficiency of executing the method is greatly improved.
For the two pictures with the resolution of 600×510 shown in fig. 4, the pixel-by-pixel comparison is performed by using the prior art method, which takes 443 ms in total. Using the picture alignment approach according to an embodiment of the present invention, the pictures are divided into 400 tiles and compared, taking 357 milliseconds in total. According to the technical scheme of the embodiment of the invention, the comparison efficiency can be improved by about 20% by adopting a block comparison mode. If the picture with higher resolution and more complex color types is obtained, the technical scheme according to the embodiment of the invention can obtain better lifting effect, and has more obvious advantages.
According to an embodiment of the present invention, there is provided a picture comparing apparatus for performing the above picture comparing method. Fig. 5 shows a schematic block diagram of the picture comparison device. As shown in fig. 5, the apparatus includes a segmentation module 510, a judgment module 520, and a comparison module 530. The modules are described in detail below.
The segmentation module 510 is configured to segment a first picture and a second picture with the same size into a predetermined number of tiles, and assign the same number to the tiles with corresponding positions, where the sizes and numbers of the tiles of the first picture and the tiles of the second picture are the same.
The picture comparison apparatus may further include a scaling module for scaling the second picture in equal proportion according to the size of the first picture such that the first picture and the second picture are the same size.
The determining module 520 is configured to determine whether each of the first picture and the second picture is a solid-color tile or a non-solid-color tile and record.
The judging module 520 may include: a computing sub-module for computing a color average of the tile; the first judging submodule is used for randomly selecting a preset number of pixel points from the image block and judging whether the color value of the preset number of pixel points is equal to the average value of the colors; the second judging submodule is used for judging that the image block is a pure-color image block under the condition that the color values of the preset number of pixel points are equal to the average value of the colors; otherwise, the block is judged to be a non-solid color block.
The predetermined number of the pixels selected by the first determination submodule may be ten or more or twenty or more. The predetermined number of pixels have color values equal to the average color value, and the tile is considered to be a solid-color tile. As long as the color value of one pixel point in the predetermined number of pixel points is not equal to the average value, the block is considered to be a non-solid color block.
Optionally, the determining module 520 may further include a marking module, configured to use the color average value to represent a solid-color tile, so that when the tile comparison is performed in the subsequent step, the solid-color tile can be directly compared with the color average value, and no recalculation is required, thereby saving the calculation space and the method execution efficiency. The tagging module may also identify solid color tiles in other ways, such as assigning different values to solid color tiles and non-solid color tiles.
The determining module 520 may have other configurations besides the above configuration, for example, may include: the comparison submodule is used for comparing the color values of the pixel points of each image block with each other; and the judging sub-module is used for determining that the image block is a solid-color image block under the condition that the color values of all the pixel points are equal to each other, otherwise, judging that the image block is a non-solid-color image block.
The apparatus shown in fig. 5 further includes a comparing module 530, configured to sequentially compare the numbered identical blocks in the first picture and the second picture, where the comparing module 530 includes: the first judging submodule is used for judging whether the first image block and the second image block with the same numbers in the first image and the second image are pure-color image blocks or not; the second judging submodule is used for judging whether the average values of the colors of the first image block and the second image block are equal or not under the condition that the first image block and the second image block with the same numbers in the first image block and the second image block are pure color image blocks; the third judging sub-module is used for judging that the first image block is identical with the second image block under the condition that the average values of the colors of the first image block and the second image block are equal, otherwise, the coordinate positions of all pixel points in the image block are recorded; a comparison sub-module, configured to, in a case where at least one of the first tile and the second tile is a non-solid-color tile, perform pixel-by-pixel comparison on the first tile and the second tile; a fourth judging sub-module, configured to judge whether there are pixels with different color values; and the fifth judging sub-module is used for judging that the first image block and the second image block are the same under the condition that pixel points with different color values do not exist, and otherwise, recording the coordinate positions of the pixel points with different color values.
The apparatus shown in fig. 5 may further include: and the picture judging module is used for judging that the first picture and the second picture are identical if the number of coordinate positions of all pixel points recorded for the first picture or the second picture is smaller than a threshold value after comparing all the picture blocks. Alternatively, if the number of coordinate positions of all the pixel points is greater than the threshold value, the first picture and the second picture may be considered to be different. The threshold may be set as desired, for example, may be 0, so that two pictures are considered to be different as long as there are different pixels. The threshold may be, for example, 5, so that the two pictures are considered to be identical if the number of different pixels is less than 5, and the 5 pixels are defaulted to be picture noise points.
The device shown in fig. 5 may further include an output module, configured to output, after comparing all the tiles, a difference between the first picture and the second picture, that is, coordinate positions of all the different pixels, so that a person involved can intuitively check and directly determine whether the first picture and the second picture are identical. The output coordinate position may be coordinate position data recorded in a memory or coordinate position displayed in a picture. The apparatus may further include an annotation module if the coordinate position in the picture is output: and marking the coordinate positions of all the recorded pixels in the first picture and the second picture.
The apparatus shown in fig. 5 may further include an edge removing module, configured to remove edge invalid content of the picture, including: the judging module is used for judging whether one or more pixel rows with preset color values exist at the upper edge and the lower edge of the first picture and the second picture; judging whether one or more pixel columns with all pixel points being the preset color value exist at the left edge and the right edge of the first picture and the second picture; and the deleting module is used for deleting the pixel rows and the pixel columns of the preset color value from the first picture and the second picture in the case that the pixel rows and the pixel columns of the preset color value exist.
In the device environment snapshot apparatus and the device environment replication apparatus according to the embodiments of the present invention, reference is made to the above detailed description of the method embodiments.
The method of the present invention may be performed in a computing device. The computing device may be any device having storage and computing capabilities, and may be implemented, for example, as a server, a workstation, or the like, or may be implemented as a personal configured computer such as a desktop computer, a notebook computer, or may be implemented as a terminal device such as a mobile phone, a tablet computer, an intelligent wearable device, or an internet of things device, but is not limited thereto.
FIG. 6 shows a schematic diagram of a computing device according to one embodiment of the invention. It should be noted that the computing device shown in fig. 6 is only an example, and in practice, the computing device used to implement the method of the present invention may be any type of device, and the hardware configuration of the computing device may be the same as the computing device shown in fig. 6 or may be different from the computing device shown in fig. 6. In practice, the computing device for implementing the method of the present invention may add or delete hardware components of the computing device shown in fig. 6, and the present invention is not limited to the specific hardware configuration of the computing device.
As shown in fig. 6, the apparatus may include: processor 610, memory 620, input/output interface 630, communication interface 640, and bus 650. Wherein processor 610, memory 620, input/output interface 630, and communication interface 640 enable communication connections among each other within the device via bus 650.
The processor 610 may be implemented by a general-purpose CPU (Central Processing Unit ), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc. for executing relevant programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 620 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory ), a static storage device, a dynamic storage device, or the like. Memory 620 may store an operating system and other application programs, and when the technical solutions provided by the embodiments of the present specification are implemented in software or firmware, relevant program codes are stored in memory 620 and invoked for execution by processor 610.
The input/output interface 630 is used for connecting with an input/output module to realize information input and output. The input/output module may be configured as a component in a device (not shown in the figure) or may be external to the device to provide corresponding functionality. Wherein the input devices may include a keyboard, mouse, touch screen, microphone, various types of sensors, etc., and the output devices may include a display, speaker, vibrator, indicator lights, etc.
The communication interface 640 is used to connect a communication module (not shown in the figure) to enable communication interaction between the present device and other devices. The communication module may implement communication through a wired manner (such as USB, network cable, etc.), or may implement communication through a wireless manner (such as mobile network, WIFI, bluetooth, etc.).
Bus 650 includes a path to transfer information between components of the device (e.g., processor 610, memory 620, input/output interface 630, and communication interface 640).
It should be noted that although the above device only shows the processor 610, the memory 620, the input/output interface 630, the communication interface 640, and the bus 650, in the implementation, the device may further include other components necessary for achieving normal operation. Furthermore, it will be understood by those skilled in the art that the above-described apparatus may include only the components necessary to implement the embodiments of the present description, and not all the components shown in the drawings.
Embodiments of the present invention also provide a non-transitory readable storage medium storing instructions for causing the computing device to perform a method according to embodiments of the present invention. The readable media of the present embodiments, including both permanent and non-permanent, removable and non-removable media, may be any method or technology for information storage. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of readable 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 tape disk storage or other magnetic storage devices, or any other non-transitory readable storage medium.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with examples of the invention. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It should be appreciated that the teachings of the present invention as described herein may be implemented in a variety of programming languages and that the foregoing descriptions of specific languages are provided for disclosure of preferred embodiments of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or may be further divided into a plurality of sub-modules.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. Furthermore, some of the embodiments are described herein as methods or combinations of method elements that may be implemented by a processor of a computer system or by other means of performing the functions. Thus, a processor with the necessary instructions for implementing the described method or method element forms a means for implementing the method or method element. Furthermore, the elements described herein of the device embodiments are examples of the following devices: the apparatus is for carrying out the functions performed by the elements for carrying out the objects of the invention.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter.

Claims (10)

1. A picture comparison method, comprising:
dividing a first picture and a second picture with the same size into a preset number of blocks, and giving the same numbers to the blocks corresponding to the positions in the first picture and the second picture, wherein the sizes and the numbers of the blocks of the first picture and the blocks of the second picture are the same;
judging whether each image block in the first image and the second image is a solid image block or a non-solid image block and recording;
comparing the image blocks with the same numbers in the first image and the second image in sequence, wherein the comparison process comprises the following steps:
judging whether the first image block and the second image block with the same numbers in the first image and the second image are pure-color image blocks or not;
if the first image block and the second image block are both solid-color image blocks, judging whether the average values of the colors of the first image block and the second image block are equal;
if the first image block and the second image block are equal, judging that the first image block is identical to the second image block, otherwise, recording the coordinate positions of all pixel points in the image blocks;
if at least one term is a non-solid color tile, comparing the first tile with the second tile pixel by pixel;
judging whether pixel points with different color values exist or not;
if no pixel points with different color values exist, judging that the first image block is identical to the second image block, otherwise, recording the coordinate positions of the pixel points with different color values.
2. The picture comparison method as claimed in claim 1, further comprising, before dividing each of the first picture and the second picture of the same size into a predetermined number of tiles:
judging whether one or more pixel rows with all pixel points being the preset color value exist at the upper edge and the lower edge of the first picture and the second picture;
judging whether one or more pixel columns with all pixel points being the preset color value exist at the left edge and the right edge of the first picture and the second picture;
if so, the pixel rows and columns of the predetermined color values are deleted from the first picture and the second picture.
3. The picture comparison method as claimed in claim 1, wherein the determining whether the tile is a solid-color tile comprises:
calculating a color average of the tiles;
randomly selecting a preset number of pixel points from the image block, and judging whether the color value of the preset number of pixel points is equal to the average value of the color;
if the image blocks are equal, judging that the image blocks are solid-color image blocks;
otherwise, judging the image block to be a non-solid color image block.
4. The picture comparison method of claim 1, further comprising:
and marking the coordinate positions of all the recorded pixels in the first picture and the second picture.
5. A picture comparison method as claimed in any one of claims 1 to 3, further comprising:
and if the number of the coordinate positions of all the pixel points recorded for the first picture or the second picture is smaller than the threshold value, judging that the first picture and the second picture are identical.
6. A picture comparison apparatus comprising:
the segmentation module is used for respectively segmenting the first picture and the second picture with the same size into a preset number of image blocks, and giving the same numbers to the image blocks with the corresponding positions in the first picture and the second picture, wherein the image blocks of the first picture and the image blocks of the second picture are the same in size and number;
the judging module is used for judging whether each image block in the first image and the second image is a solid image block or a non-solid image block and recording;
the comparison module is used for comparing the image blocks with the same numbers in the first image and the second image in sequence, and the comparison module comprises:
the first judging submodule is used for judging whether the first image block and the second image block with the same numbers in the first image and the second image are pure-color image blocks or not;
the second judging submodule is used for judging whether the average values of the colors of the first image block and the second image block are equal or not under the condition that the first image block and the second image block are pure color image blocks;
the third judging sub-module is used for judging that the first image block is identical with the second image block under the condition that the average values of the colors of the first image block and the second image block are equal, otherwise, the coordinate positions of all pixel points in the image block are recorded;
a comparison sub-module, configured to, in a case where at least one of the first tile and the second tile is a non-solid-color tile, perform pixel-by-pixel comparison on the first tile and the second tile;
a fourth judging sub-module, configured to judge whether there are pixels with different color values;
and the fifth judging sub-module is used for judging that the first image block and the second image block are the same under the condition that pixel points with different color values do not exist, and otherwise, recording the coordinate positions of the pixel points with different color values.
7. The picture comparison apparatus of claim 6, further comprising: an edge removing module, configured to remove edge invalid content of a picture, including:
the judging module is used for judging whether one or more pixel rows with preset color values exist at the upper edge and the lower edge of the first picture and the second picture; judging whether one or more pixel columns with all pixel points being the preset color value exist at the left edge and the right edge of the first picture and the second picture;
and the deleting module is used for deleting the pixel rows and the pixel columns of the preset color value from the first picture and the second picture in the case that the pixel rows and the pixel columns of the preset color value exist.
8. The picture comparison apparatus as claimed in claim 6 or 7, further comprising:
and the picture judging module is used for judging that the first picture and the second picture are identical if the number of coordinate positions of all pixel points recorded for the first picture or the second picture is smaller than a threshold value after comparing all the picture blocks.
9. A computing device, comprising:
at least one processor and a memory storing program instructions;
the program instructions, when read and executed by the processor, cause the computing device to perform the picture comparison method of any one of claims 1-5.
10. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the picture comparison method of any of claims 1-5.
CN202310464920.8A 2023-04-26 2023-04-26 Picture comparison method and device, computing device and readable storage medium Pending CN116524213A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310464920.8A CN116524213A (en) 2023-04-26 2023-04-26 Picture comparison method and device, computing device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310464920.8A CN116524213A (en) 2023-04-26 2023-04-26 Picture comparison method and device, computing device and readable storage medium

Publications (1)

Publication Number Publication Date
CN116524213A true CN116524213A (en) 2023-08-01

Family

ID=87398846

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310464920.8A Pending CN116524213A (en) 2023-04-26 2023-04-26 Picture comparison method and device, computing device and readable storage medium

Country Status (1)

Country Link
CN (1) CN116524213A (en)

Similar Documents

Publication Publication Date Title
WO2020140698A1 (en) Table data acquisition method and apparatus, and server
CN111340752A (en) Screen detection method and device, electronic equipment and computer readable storage medium
US8634659B2 (en) Image processing apparatus, computer readable medium storing program, and image processing method
US9113080B2 (en) Method for generating thumbnail image and electronic device thereof
CN112348815A (en) Image processing method, image processing apparatus, and non-transitory storage medium
WO2018233055A1 (en) Method and apparatus for entering policy information, computer device and storage medium
US10332262B2 (en) Removal of background information from digital images
CN110163786B (en) Method, device and equipment for removing watermark
US8442327B2 (en) Application of classifiers to sub-sampled integral images for detecting faces in images
WO2021248705A1 (en) Image rendering method and apparatus, computer program and readable medium
CN109389659B (en) Rendering method and device of mathematical formula in PPT, storage medium and terminal equipment
KR20150025594A (en) Method for compositing multi image layers
US20180082456A1 (en) Image viewpoint transformation apparatus and method
JP2022017202A (en) Layout analysis method, reading assist device, circuit, and medium
CN110866965A (en) Mapping drawing method and device for three-dimensional model
WO2015161809A1 (en) Picture splitting method and apparatus, and picture loading method and apparatus
WO2020186779A1 (en) Image information identification method and apparatus, and computer device and storage medium
CN113538623A (en) Method and device for determining target image, electronic equipment and storage medium
CN104917963A (en) Image processing method and terminal
US9230309B2 (en) Image processing apparatus and image processing method with image inpainting
CN116524213A (en) Picture comparison method and device, computing device and readable storage medium
US20120281014A1 (en) Method and apparatus for detecting and avoiding conflicts of space entity element annotations
US20160125614A1 (en) Information processing method and electronic device
US11367296B2 (en) Layout analysis
JP2008225964A (en) Image processor, reading order setting method and program

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