Image similarity calculation method and device

By calculating the pixel count data of the peripheral connected area and the internal area of ​​the image respectively and using the S-shaped growth curve function to determine the similarity, the problems of low efficiency and insufficient accuracy of graphic recognition in the existing technology are solved, and higher recognition accuracy is achieved.

CN114398990BActive Publication Date: 2025-09-09INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210047575.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-17
Publication Date
2025-09-09
Estimated Expiration
2042-01-17

AI Technical Summary

Technical Problem

Existing technologies in graphic recognition calculate similarity by the number of identical pixels in the entire graphic, ignoring local features of the graphic, resulting in low recognition efficiency and insufficient accuracy, especially poor performance in complex interference situations.

Method used

The image similarity calculation method is used to calculate the pixel count data of the peripheral connected area and the internal area of ​​the image respectively, and the similarity is determined using the S-type growth curve function. The final image similarity is calculated by combining the similarities of the peripheral and internal areas.

Benefits of technology

The accuracy of image recognition is improved, the impact of noise is reduced, and the recognition effect is particularly good for images with deformed pixels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114398990B_ABST
    Figure CN114398990B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention disclose a method and device for calculating image similarity, which can be applied to the financial field or other technical fields. The method includes: obtaining a comparison reference image and an image to be compared, wherein the comparison reference image includes a first closed figure, which includes a first peripheral connected area and a first internal area, and the image to be compared includes a second closed figure, which includes a second peripheral connected area and a second internal area; determining peripheral connected area similarity based on the number of pixels in the first peripheral connected area and the number of pixels that are common between the first and second peripheral connected areas; determining internal area similarity based on the number of pixels in the first internal area and the number of pixels that are common between the first and second internal areas; and determining final image similarity based on the peripheral connected area similarity and the internal area similarity. The present invention helps improve the accuracy of image recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a method and device for calculating image similarity. Background Art

[0002] Existing techniques for calculating similarity in image recognition typically use edit distances, such as the Hamming distance and the Levenshtein distance. In existing image recognition processes, the image is typically subjected to noise reduction and binarization, and then the binarized image information is traversed and searched. When the similarity calculated by the similarity algorithm meets a threshold, the current image is considered similar to the target image. This indicates that the most important similarity calculation method in the image recognition process is the accuracy of the similarity calculation method, which directly determines the efficiency of the image recognition algorithm.

[0003] Currently, similarity is calculated based on the number of identical pixels across the entire graphic. This approach prioritizes the spatial characteristics of the entire graphic, treating all atomic pixels equally, while ignoring the importance of local features. This can lead to high similarity between dissimilar graphics in some cases, reducing image recognition efficiency. Furthermore, existing algorithms for calculating image similarity produce similarity that increases linearly with the number of identical pixels. This often results in poor performance in practical applications, particularly when encountering complex and numerous interfering graphics.

[0004] When using edit distance to calculate similarity, the similarity tends to increase linearly with the number of identical pixels. For example, if a graphic consists of a number of pixels and another graphic has d identical black pixels and c identical white pixels when compared to it, the similarity calculated using the Hamming distance is (d + c) / a, the total number of identical pixels. This similarity is proportional to the total number of identical pixels (d + c). For example, if the graphic has 100 pixels and only 20 black pixels on the periphery, then when comparing this graphic to a blank area (an area without black pixels), the similarity can reach 80%, which is obviously unreasonable.

[0005] It can be seen that the prior art urgently needs a solution to the technical problem that the similarity calculation method in the prior art leads to insufficient accuracy in graphic recognition. Summary of the Invention

[0006] In order to solve at least one technical problem in the above background technology, the present invention proposes a method and device for calculating image similarity.

[0007] To achieve the above object, according to one aspect of the present invention, a method for calculating image similarity is provided, the method comprising:

[0008] Acquire a comparison reference image and an image to be compared, wherein the comparison reference image includes a first closed figure, which includes a first peripheral connected area and a first internal area, and the image to be compared includes a second closed figure, which includes a second peripheral connected area and a second internal area;

[0009] Determine first pixel number data of the first peripheral connected area, second pixel number data of the first internal area, third pixel number data common to the first peripheral connected area and the second peripheral connected area, and fourth pixel number data common to the first internal area and the second internal area;

[0010] Determine the similarity of the peripheral connected regions according to the first pixel number data and the third pixel number data;

[0011] Determine the internal area similarity according to the second pixel point data and the fourth pixel point data;

[0012] The similarity between the image to be compared and the comparison reference image is determined according to the peripheral connected region similarity and the internal region similarity.

[0013] Optionally, determining the peripheral connected region similarity based on the first pixel number data and the third pixel number data specifically includes:

[0014] Determine a first parameter according to the first pixel point data and the third pixel point data;

[0015] Substitute the first parameter into the S-shaped growth curve function to obtain the similarity of the peripheral connected region.

[0016] Optionally, determining the internal region similarity according to the second pixel point data and the fourth pixel point data specifically includes:

[0017] Determine a second parameter according to the second pixel point data and the fourth pixel point data;

[0018] Substitute the second parameter into the S-shaped growth curve function to obtain the internal region similarity.

[0019] Optionally, determining the first parameter according to the first pixel number data and the third pixel number data specifically includes:

[0020] Calculating a first ratio of the third pixel point data to the first pixel point data;

[0021] The first parameter is determined according to the first ratio.

[0022] Optionally, determining the second parameter according to the second pixel point data and the fourth pixel point data specifically includes:

[0023] Calculating a second ratio of the fourth pixel point data to the second pixel point data;

[0024] The second parameter is determined according to the second ratio.

[0025] Optionally, determining the similarity between the image to be compared and the comparison reference image based on the peripheral connected region similarity and the internal region similarity specifically includes:

[0026] The similarity between the image to be compared and the comparison reference image is obtained by calculating the mean or weighted average of the similarity of the peripheral connected region and the similarity of the internal region.

[0027] In order to achieve the above object, according to another aspect of the present invention, there is provided an image similarity calculation device, the device comprising:

[0028] an image acquisition unit, configured to acquire a comparison reference image and an image to be compared, wherein the comparison reference image includes a first closed figure, the first closed figure including a first peripheral connected area and a first internal area, and the image to be compared includes a second closed figure, the second closed figure including a second peripheral connected area and a second internal area;

[0029] a pixel counting unit, configured to determine first pixel count data of the first peripheral connected area, second pixel count data of the first internal area, third pixel count data common to the first peripheral connected area and the second peripheral connected area, and fourth pixel count data common to the first internal area and the second internal area;

[0030] a peripheral connected region similarity determination unit, configured to determine the peripheral connected region similarity based on the first pixel point number data and the third pixel point number data;

[0031] an internal region similarity determination unit, configured to determine the internal region similarity based on the second pixel point data and the fourth pixel point data;

[0032] The final similarity determination unit is configured to determine the similarity between the image to be compared and the comparison reference image according to the peripheral connected region similarity and the internal region similarity.

[0033] Optionally, the peripheral connected region similarity determination unit specifically includes:

[0034] A first parameter calculation module, configured to determine a first parameter based on the first pixel point data and the third pixel point data;

[0035] The first function calculation module is used to bring the first parameter into the S-shaped growth curve function to obtain the similarity of the peripheral connected region.

[0036] Optionally, the internal region similarity determination unit specifically includes:

[0037] A second parameter calculation module, configured to determine a second parameter based on the second pixel point data and the fourth pixel point data;

[0038] The second function calculation module is used to bring the second parameter into the S-shaped growth curve function to obtain the internal region similarity.

[0039] To achieve the above-mentioned objective, according to another aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned image similarity calculation method when executing the computer program.

[0040] To achieve the above object, according to another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the above image similarity calculation method are implemented.

[0041] To achieve the above object, according to another aspect of the present invention, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the above image similarity calculation method when executed by a processor.

[0042] The beneficial effects of the present invention are:

[0043] When calculating the similarity of images, the embodiments of the present invention first calculate the similarity of the image's peripheral connected regions and the image's internal regions, respectively. The similarity of the final images is then determined based on the similarity of the peripheral connected regions and the internal regions. Compared with the prior art method of calculating similarity based on the number of identical pixels in the entire graphic, the accuracy of graphic recognition is higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0045] Figure 1 is a flow chart of a method for calculating image similarity according to an embodiment of the present invention;

[0046] Figure 2 is a flow chart of determining the similarity of peripheral connected regions according to an embodiment of the present invention;

[0047] Figure 3 is a flow chart of determining internal region similarity according to an embodiment of the present invention;

[0048] Figure 4 is a flow chart of determining a first parameter according to an embodiment of the present invention;

[0049] Figure 5 is a flow chart of determining a second parameter according to an embodiment of the present invention;

[0050] Figure 6 is a schematic diagram of a closed figure according to an embodiment of the present invention;

[0051] Figure 7 is a structural block diagram of an image similarity calculation device according to an embodiment of the present invention;

[0052] Figure 8 This is a structural block diagram of a peripheral connected region similarity determination unit according to an embodiment of the present invention;

[0053] Figure 9 is a structural block diagram of an internal region similarity determination unit according to an embodiment of the present invention;

[0054] Figure 10 Schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0055] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0056] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0057] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products or apparatuses.

[0058] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0059] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.

[0060] It should be noted that the image similarity calculation method and device of the present invention can be applied to the financial field as well as other technical fields.

[0061] It should be noted that the closed figure of the present invention is a closed figure composed of n (n is a positive integer) line segments or arcs, and the present invention refers to a closed figure in a two-dimensional plane, such as a triangle or a rectangle.

[0062] It should be noted that the connected region of the present invention generally refers to an image region composed of pixels with the same pixel value and adjacent positions in the image.

[0063] The present invention can identify similar graphics based on a specific graphic, and can be applied to identify certain graphics in pictures, such as identifying all workstations, furniture, tables and chairs based on a workplace plan drawing, and can mark the location information of workstations, furniture, tables and chairs, etc., to facilitate the digital entry of workplace information.

[0064] Figure 1 Flowchart of the method for calculating image similarity according to an embodiment of the present invention is shown in FIG. Figure 1 As shown, in one embodiment of the present invention, the image similarity calculation method of the present invention includes steps S101 to S105.

[0065] Step S101, obtaining a comparison reference image and an image to be compared, wherein the comparison reference image includes a first closed figure, the first closed figure includes: a first peripheral connected area and a first internal area, and the image to be compared includes a second closed figure, the second closed figure includes: a second peripheral connected area and a second internal area.

[0066] In one embodiment of the present invention, both the comparison reference image and the image to be compared are binary images.

[0067] Figure 6 Schematic diagram of a closed figure according to an embodiment of the present invention, Figure 6 As shown, the closed graph of the present invention consists of a peripheral connected area and an internal area.

[0068] In one embodiment of the present invention, the pixel values ​​of the peripheral connected areas are all 1.

[0069] In one embodiment of the present invention, the internal area is an internal connected area, and the pixel values ​​of the internal connected area are all 0.

[0070] In another embodiment of the present invention, the internal area is all the pixels located inside the peripheral connected area.

[0071] Step S102, determine the first pixel point data of the first peripheral connected area, the second pixel point data of the first internal area, the third pixel point data that is the same as the first peripheral connected area and the second peripheral connected area, and the fourth pixel point data that is the same as the first internal area and the second internal area.

[0072] In the present invention, the first pixel point data is specifically the pixel point data of the first peripheral connected area, which is represented by tb in the present invention.

[0073] In the present invention, the second pixel point data is specifically the pixel point data of the first internal area, which is represented by tw in the present invention.

[0074] In the present invention, the third pixel point data is specifically the number of pixels that are the same as the first peripheral connected area and the second peripheral connected area, and is represented by b in the present invention.

[0075] In the present invention, the fourth pixel point data is specifically the same pixel point number in the first internal area and the second internal area, which is represented by w in the present invention.

[0076] Step S103 : determining the similarity of the peripheral connected regions according to the first pixel count data and the third pixel count data.

[0077] Step S104 : determining the internal region similarity according to the second pixel point data and the fourth pixel point data.

[0078] Step S105 : determining the similarity between the image to be compared and the comparison reference image according to the peripheral connected region similarity and the internal region similarity.

[0079] In one embodiment of the present invention, this step may specifically calculate the mean or weighted average of the similarity of the peripheral connected regions and the similarity of the internal regions to obtain the similarity between the image to be compared and the comparison reference image.

[0080] In a specific embodiment of the present invention, after obtaining the peripheral connected region similarity s1 and the internal region similarity s2, the present invention may calculate the average of the two similarities to obtain the similarity of the two images s=(s1+s2) / 2.

[0081] Figure 2 FIG. 1 is a flow chart of determining the similarity of peripheral connected regions according to an embodiment of the present invention. Figure 2 As shown, in one embodiment of the present invention, the above-mentioned step S103 of determining the similarity of the peripheral connected regions according to the first pixel point data and the third pixel point data specifically includes step S201 and step S202.

[0082] Step S201: determining a first parameter according to the first pixel point data and the third pixel point data.

[0083] Step S202: Substitute the first parameter into the S-shaped growth curve function to obtain the similarity of the peripheral connected regions.

[0084] In the present invention, the function of the S-shaped growth curve is specifically:

[0085]

[0086] In the present invention, this step specifically substitutes the first parameter into x in the function of the S-shaped growth curve to obtain the peripheral connected region similarity s1=y(x).

[0087] Figure 3 FIG. 1 is a flow chart of determining the similarity of internal regions according to an embodiment of the present invention. Figure 3 As shown, in one embodiment of the present invention, the above step S104 of determining the internal region similarity according to the second pixel point data and the fourth pixel point data specifically includes step S301 and step S302.

[0088] Step S301: determining a second parameter according to the second pixel point data and the fourth pixel point data.

[0089] Step S302: Substitute the second parameter into the S-shaped growth curve function to obtain the internal region similarity.

[0090] In the present invention, this step specifically substitutes the second parameter into x in the function of the above-mentioned S-shaped growth curve to obtain the internal region similarity s2=y(x).

[0091] Figure 4 is a flow chart of determining the first parameter according to an embodiment of the present invention, such as Figure 4 As shown, in one embodiment of the present invention, the above-mentioned step S201 of determining the first parameter according to the first pixel point data and the third pixel point data specifically includes step S401 and step S402.

[0092] Step S401: Calculate a first ratio of the third pixel point data to the first pixel point data.

[0093] In the present invention, the first ratio can be expressed as b / tb.

[0094] Step S402: Determine the first parameter according to the first ratio.

[0095] In one embodiment of the present invention, this step specifically involves first multiplying the first ratio by a preset first coefficient, and then subtracting the first preset value from the product to obtain the first parameter.

[0096] In a specific embodiment of the present invention, the first coefficient may be 10, and the first preset value may be 6. In a specific embodiment of the present invention, the first parameter is specifically:

[0097]

[0098] Figure 5 Flowchart of determining the second parameter according to an embodiment of the present invention is as follows. Figure 5 As shown, in one embodiment of the present invention, the above-mentioned step S301 of determining the second parameter according to the second pixel point data and the fourth pixel point data specifically includes step S501 and step S502.

[0099] Step S501: Calculate a second ratio of the fourth pixel point data to the second pixel point data.

[0100] In the present invention, the second ratio can be expressed as w / tw.

[0101] Step S502: Determine the second parameter according to the second ratio.

[0102] In one embodiment of the present invention, this step specifically involves first multiplying the second ratio by a preset second coefficient, and then subtracting a second preset value from the product to obtain the second parameter.

[0103] In a specific embodiment of the present invention, the second coefficient may be 10, the second preset value may be 6, and the second parameter is specifically:

[0104]

[0105] It can be seen from the above embodiments that the similarity algorithm in the present invention effectively reduces the number of noise points in pattern recognition, improves the accuracy of pattern recognition, and also has a good recognition effect on patterns after pixel deformation.

[0106] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0107] Based on the same inventive concept, an embodiment of the present invention also provides an image similarity calculation device, which can be used to implement the image similarity calculation method described in the above embodiment, as described in the following embodiment. Since the principle of solving the problem by the image similarity calculation device is similar to that of the image similarity calculation method, the embodiment of the image similarity calculation device can refer to the embodiment of the image similarity calculation method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiment is preferably implemented in software, implementation by hardware, or a combination of software and hardware, is also possible and conceived.

[0108] Figure 7 : is a structural block diagram of an image similarity calculation device according to an embodiment of the present invention. Figure 7 As shown, in one embodiment of the present invention, the image similarity calculation device of the present invention includes:

[0109] An image acquisition unit 1 is configured to acquire a comparison reference image and an image to be compared, wherein the comparison reference image includes a first closed figure, which includes a first peripheral connected area and a first internal area, and the image to be compared includes a second closed figure, which includes a second peripheral connected area and a second internal area.

[0110] a pixel counting unit 2, configured to determine first pixel count data of the first peripheral connected area, second pixel count data of the first internal area, third pixel count data common to the first peripheral connected area and the second peripheral connected area, and fourth pixel count data common to the first internal area and the second internal area;

[0111] A peripheral connected region similarity determination unit 3 is configured to determine the peripheral connected region similarity based on the first pixel number data and the third pixel number data;

[0112] An internal region similarity determination unit 4 is configured to determine the internal region similarity based on the second pixel point data and the fourth pixel point data;

[0113] The final similarity determination unit 5 is configured to determine the similarity between the image to be compared and the comparison reference image according to the peripheral connected region similarity and the internal region similarity.

[0114] Figure 8 : is a structural block diagram of a peripheral connected region similarity determination unit according to an embodiment of the present invention. Figure 8 As shown, in one embodiment of the present invention, the peripheral connected region similarity determination unit 3 specifically includes:

[0115] A first parameter calculation module 301 is configured to determine a first parameter based on the first pixel number data and the third pixel number data;

[0116] The first function calculation module 302 is used to substitute the first parameter into the S-shaped growth curve function to obtain the similarity of the peripheral connected regions.

[0117] Figure 9 is a structural block diagram of an internal region similarity determination unit according to an embodiment of the present invention. Figure 9 As shown, in one embodiment of the present invention, the internal region similarity determination unit 4 specifically includes:

[0118] A second parameter calculation module 401 is configured to determine a second parameter based on the second pixel point data and the fourth pixel point data;

[0119] The second function calculation module 402 is used to substitute the second parameter into the S-shaped growth curve function to obtain the internal region similarity.

[0120] In one embodiment of the present invention, the first parameter calculation module 301 is specifically configured to calculate a first ratio of the third pixel point data to the first pixel point data; and then determine the first parameter based on the first ratio.

[0121] In one embodiment of the present invention, the second parameter calculation module 401 is specifically configured to calculate a second ratio of the fourth pixel point data to the second pixel point data; and then determine the second parameter based on the second ratio.

[0122] In one embodiment of the present invention, the final similarity determination unit 5 is specifically configured to obtain the similarity between the image to be compared and the comparison reference image by calculating the mean or weighted average of the peripheral connected region similarity and the internal region similarity.

[0123] In order to achieve the above object, according to another aspect of the present application, a computer device is also provided. Figure 10 As shown, the computer device includes a memory, a processor, a communication interface and a communication bus. The memory stores a computer program that can be run on the processor. When the processor executes the computer program, the steps in the above embodiment method are implemented.

[0124] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0125] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and units, such as the corresponding program units in the above-described method embodiments of the present invention. The processor executes the non-transitory software programs, instructions, and modules stored in memory to perform various processor functions and work data processing, thereby implementing the methods in the above-described method embodiments.

[0126] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely located relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0127] The one or more units are stored in the memory, and when executed by the processor, perform the method in the above embodiment.

[0128] The specific details of the above-mentioned computer device can be understood by referring to the corresponding descriptions and effects in the above-mentioned embodiments, and will not be repeated here.

[0129] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a computer-readable storage medium is further provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed in a computer processor, the steps in the above-mentioned image similarity calculation method are implemented. Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.

[0130] In order to achieve the above object, according to another aspect of the present application, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the above image similarity calculation method when executed by a processor.

[0131] Obviously, those skilled in the art will appreciate that the modules or steps of the present invention described above can be implemented using a general-purpose computing device. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computing device, which can then be stored in a storage device and executed by the computing device. Alternatively, they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0132] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.

Claims

1. A method for calculating image similarity, characterized in that: include: Obtaining a comparison reference image and an image to be compared, wherein the comparison reference image includes a first closed figure, which includes: a first peripheral connected region and a first internal region; the image to be compared includes a second closed figure, which includes: a second peripheral connected region and a second internal region; the connected region refers to an image region consisting of adjacent pixels having the same pixel value in the image; and both the comparison reference image and the image to be compared are binary images; Determine first pixel number data of the first peripheral connected area, second pixel number data of the first internal area, third pixel number data common to the first peripheral connected area and the second peripheral connected area, and fourth pixel number data common to the first internal area and the second internal area; Determine the similarity of the peripheral connected regions according to the first pixel number data and the third pixel number data; Determine the internal area similarity according to the second pixel point data and the fourth pixel point data; Determining the similarity between the image to be compared and the comparison reference image according to the peripheral connected region similarity and the internal region similarity; The determining of the similarity of the peripheral connected regions according to the first pixel number data and the third pixel number data specifically includes: Determine a first parameter according to the first pixel point data and the third pixel point data; Substituting the first parameter into the S-shaped growth curve function to obtain the similarity of the peripheral connected region; The determining of the internal region similarity according to the second pixel number data and the fourth pixel number data specifically includes: Determine a second parameter according to the second pixel point data and the fourth pixel point data; Substitute the second parameter into the S-shaped growth curve function to obtain the internal region similarity.

2. The image similarity calculation method according to claim 1, characterized in that: The determining of the first parameter according to the first pixel number data and the third pixel number data specifically includes: Calculating a first ratio of the third pixel point data to the first pixel point data; The first parameter is determined according to the first ratio.

3. The image similarity calculation method according to claim 1, characterized in that: The determining of the second parameter according to the second pixel number data and the fourth pixel number data specifically includes: Calculating a second ratio of the fourth pixel point data to the second pixel point data; The second parameter is determined according to the second ratio.

4. The image similarity calculation method according to claim 1, characterized in that: The determining the similarity between the image to be compared and the comparison reference image according to the peripheral connected region similarity and the internal region similarity specifically includes: The similarity between the image to be compared and the comparison reference image is obtained by calculating the mean or weighted average of the similarity of the peripheral connected region and the similarity of the internal region.

5. An image similarity calculation device, characterized in that: include: An image acquisition unit is configured to acquire a comparison reference image and an image to be compared, wherein the comparison reference image includes a first closed figure, which includes a first peripheral connected region and a first internal region; the image to be compared includes a second closed figure, which includes a second peripheral connected region and a second internal region; the connected region refers to an image region consisting of adjacent pixels having the same pixel value in the image; and both the comparison reference image and the image to be compared are binary images; a pixel counting unit, configured to determine first pixel count data of the first peripheral connected area, second pixel count data of the first internal area, third pixel count data common to the first peripheral connected area and the second peripheral connected area, and fourth pixel count data common to the first internal area and the second internal area; a peripheral connected region similarity determination unit, configured to determine the peripheral connected region similarity based on the first pixel point number data and the third pixel point number data; an internal region similarity determination unit, configured to determine the internal region similarity based on the second pixel point data and the fourth pixel point data; a final similarity determination unit, configured to determine the similarity between the image to be compared and the comparison reference image according to the peripheral connected region similarity and the internal region similarity; The peripheral connected region similarity determination unit specifically includes: A first parameter calculation module, configured to determine a first parameter based on the first pixel point data and the third pixel point data; A first function calculation module is used to substitute the first parameter into an S-shaped growth curve function to obtain the similarity of the peripheral connected regions; The internal region similarity determination unit specifically includes: A second parameter calculation module, configured to determine a second parameter based on the second pixel point data and the fourth pixel point data; The second function calculation module is used to bring the second parameter into the S-shaped growth curve function to obtain the internal region similarity.

6. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Feature extraction method, image processing method, model training method and device

    CN111414922A

  • Graph recognition method and system based on pixel deformation, electronic device and storage medium

    CN112507910A