Graph approximate matching method and device, electronic equipment and storage medium

By smoothing and breaking non-Manhattan 2D graphics, and making preliminary similarity judgments based on the number of edges, the problem of low matching efficiency of non-Manhattan graphics is solved, and a faster matching speed is achieved.

CN121329964APending Publication Date: 2026-01-13HUAXINCHENG (HANGZHOU) TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511728742.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

Existing technologies suffer from reduced matching efficiency when matching non-Manhattan 2D graphs due to the large number of edges and computational demands.

Method used

By smoothing the non-Manhattan 2D graphics to be matched, removing anomalies, and breaking the target edge into multiple edges, the similarity of the graphics is initially judged based on the number of edges, and then precise matching is performed.

Benefits of technology

The matching process is simplified, the number of calculations is reduced, and the speed of approximate matching of non-Manhattan figures is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121329964A_ABST
    Figure CN121329964A_ABST
Patent Text Reader

Abstract

The invention relates to the field of graph processing, and discloses a graph approximate matching method and device, electronic equipment and a storage medium, and the method comprises the steps: carrying out the smoothing of a to-be-matched non-Manhattan two-dimensional graph, and obtaining a smoothed non-Manhattan two-dimensional graph; breaking a target edge in the smoothed non-Manhattan two-dimensional graph, and segmenting the target edge into a plurality of edges to obtain a processed non-Manhattan two-dimensional graph; determining the number of edges in the processed non-Manhattan two-dimensional graph, and determining the preliminary similarity between the non-Manhattan two-dimensional graph and the reference graph based on the number and the corresponding number in the reference graph; and when the non-Manhattan two-dimensional graph is preliminarily similar to the reference graph, matching the edges of the non-Manhattan two-dimensional graph and the reference graph, and determining the similarity between the non-Manhattan two-dimensional graph and the reference graph. The number of times of matching calculation can be reduced and the approximate matching speed of the non-Manhattan graph can be improved by carrying out smoothing processing on the non-Manhattan two-dimensional graph and carrying out preliminary screening on the number of the edges of the non-Manhattan two-dimensional graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of graphics processing, and in particular to a method, apparatus, electronic device, and computer-readable storage medium for approximate matching of graphics. Background Technology

[0002] When determining whether figures are similar, matching can be performed based on the edges. This matching process can be calculated using cosine similarity and Euclidean distance. When different line segments have similar angles to the horizontal plane, their cosine values ​​are also similar. Therefore, the cosine value can be used to determine whether the angles of corresponding edges match. Euclidean distance can be used to calculate the length of a line segment in a planar figure. In the case of matching angles, Euclidean distance can be used to determine whether the lengths of edges match. When the cosine value of a line segment's angle and its Euclidean distance are both approximately similar, that line segment can be used as a reference edge. Subsequent edges connected to the reference edge are compared sequentially until all edges in the figure have been compared.

[0003] For non-Manhattan two-dimensional graphs composed of many short sides, when performing matching calculations in the above manner, the corresponding cosine value and Euclidean distance of each side must be calculated. Since there are too many sides, the amount of computation will increase significantly, which will lead to a decrease in matching efficiency.

[0004] Therefore, how to solve the above-mentioned technical problems should be a key focus for those skilled in the art. Summary of the Invention

[0005] The purpose of this invention is to provide a method, apparatus, electronic device, and computer-readable storage medium for approximate graphic matching to improve matching speed.

[0006] To solve the above-mentioned technical problems, the present invention provides a graphic approximation matching method, comprising: The non-Manhattan 2D graphic to be matched is smoothed to obtain a smoothed non-Manhattan 2D graphic. The target edge in the smoothed non-Manhattan 2D graphic is broken into multiple edges to obtain the processed non-Manhattan 2D graphic. The number of edges in the processed non-Manhattan 2D graphic is determined, and the preliminary similarity between the non-Manhattan 2D graphic and the reference graphic is determined based on the number of edges and the corresponding number in the reference graphic. When the non-Manhattan 2D graphic is initially similar to the reference graphic, the edges of the non-Manhattan 2D graphic and the reference graphic are matched to determine the similarity between the non-Manhattan 2D graphic and the reference graphic.

[0007] Optionally, determining the number of edges in the processed non-Manhattan 2D graphic, and determining the preliminary similarity between the non-Manhattan 2D graphic and the reference graphic based on the corresponding number in the reference graphic, includes: Determine the total number of edges in the processed non-Manhattan 2D graphic, and determine a first difference between the total number and the total number of edges in the baseline graphic; Determine whether the first difference is less than a first preset difference threshold; If the first difference is not less than the first preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the first difference is less than the first preset difference threshold, then the number of targets on the target direction of the processed non-Manhattan 2D graphic is determined. Determine a second difference between the target quantity and the quantity of the reference graphic above the target direction; Determine whether the second difference is less than a second preset difference threshold; If the second difference is not less than the second preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the second difference is less than the second preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic.

[0008] Optionally, determining the number of targets on the target direction of the processed non-Manhattan 2D graphic includes: Determine the first number of edges in the horizontal direction and the second number of edges in the vertical direction of the processed non-Manhattan 2D graphic; Determining the second difference between the target quantity and the quantity of the reference graphic above the target direction includes: Determine a third difference between the first quantity and the quantity of the reference graphic in the horizontal direction; Determine a fourth difference between the second quantity and the quantity of the reference graphic in the vertical direction; Determining whether the second difference is less than the second preset difference threshold includes: Determine whether the third difference is less than the second preset difference threshold; If the second difference is not less than the second preset difference threshold, then determining that the non-Manhattan 2D graphic is dissimilar to the reference graphic includes: If the third difference is not less than the second preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the second difference is less than the second preset difference threshold, then determining that the non-Manhattan 2D graphic is initially similar to the reference graphic includes: If the third difference is less than the second preset difference threshold, then determine whether the fourth difference is less than the third preset difference threshold; If the fourth difference is not less than the third preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the fourth difference is less than the third preset difference threshold, then the non-Manhattan two-dimensional graphic is determined to be initially similar to the reference graphic.

[0009] Optionally, it also includes: Determine the third quantity of the non-Manhattan 2D graphic in the tilt direction after the processing; If the fourth difference is less than the third preset difference threshold, then determining that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic includes: If the fourth difference is less than the third preset difference threshold, then a fifth difference is determined between the third quantity and the quantity of the reference graphic on the inclined direction; Determine whether the fifth difference is less than the fourth preset difference threshold; If the fifth difference is not less than the fourth preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the fifth difference is less than the fourth preset difference threshold, then the non-Manhattan two-dimensional graphic is determined to be initially similar to the reference graphic.

[0010] Optionally, breaking the target edge in the smoothed non-Manhattan 2D graphic includes: The target edge is broken according to a preset break length threshold.

[0011] Optionally, breaking the target edge in the smoothed non-Manhattan 2D graphic includes: The target edge is broken according to a preset number of breaks.

[0012] The present invention also provides a graphic approximation matching device, comprising: The smoothing module is used to smooth the non-Manhattan 2D graphic to be matched, and obtain the smoothed non-Manhattan 2D graphic. The interruption module is used to interrupt the target edge in the smoothed non-Manhattan two-dimensional graphic, and divide the target edge into multiple edges to obtain the processed non-Manhattan two-dimensional graphic. The first determining module is used to determine the number of edges in the processed non-Manhattan two-dimensional graphic, and to determine the preliminary similarity between the non-Manhattan two-dimensional graphic and the reference graphic based on the number of edges and the corresponding number in the reference graphic. The matching module is used to match the edges of the non-Manhattan 2D graphic and the reference graphic when the non-Manhattan 2D graphic is initially similar to the reference graphic, and to determine the similarity between the non-Manhattan 2D graphic and the reference graphic.

[0013] Optionally, the interruption module is specifically used to interrupt the target edge according to a preset interruption length threshold.

[0014] The present invention also provides an electronic device, comprising: Memory, used to store computer programs; A processor, configured to implement the steps of any of the above-described graphic approximation matching methods when executing the computer program.

[0015] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the above-described graphic approximation matching methods.

[0016] The matching method of this invention smooths the non-Manhattan 2D graphics to be matched, removing anomalies and reducing errors in edge counting, even decreasing the number of edges, thereby simplifying the matching method and improving matching speed. Then, the target edges in the smoothed non-Manhattan 2D graphics are segmented. Based on the number of edges in the processed non-Manhattan 2D graphics and their corresponding numbers in the reference graphics, a preliminary similarity assessment is made between the non-Manhattan 2D graphics and the reference graphics. Only when the non-Manhattan 2D graphics and the reference graphics show preliminary similarity are they matched; otherwise, no further matching is needed. Therefore, the number of matching calculations can be reduced, thereby improving the approximate matching speed of non-Manhattan graphics.

[0017] Furthermore, the present invention also provides an apparatus, electronic device, and computer-readable storage medium having the above-mentioned advantages. Attached Figure Description

[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 A flowchart of a graphic approximation matching method provided in an embodiment of the present invention; Figure 2 A schematic diagram of a non-Manhattan two-dimensional graphic before and after smoothing, provided as an embodiment of the present invention; Figure 3 This is a flowchart illustrating a preliminary similarity determination method provided in an embodiment of the present invention. Figure 4 This is a structural block diagram of the graphic approximation matching device provided in an embodiment of the present invention; Figure 5 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0020] To enable those skilled in the art to better understand the present invention, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0021] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0022] As described in the background section, when matching non-Manhattan 2D graphs, the computational load increases significantly due to the large number of edges, leading to a decrease in matching efficiency.

[0023] In view of this, the present invention provides a method for approximate graphic matching, please refer to... Figure 1 The method may include: Step S101: Smooth the non-Manhattan 2D graphic to be matched to obtain a smoothed non-Manhattan 2D graphic.

[0024] Non-Manhattan 2D graphics refer to 2D geometric shapes that do not follow strict horizontal and vertical orthogonal constraints (i.e., non-right angle, non-axial alignment).

[0025] The purpose of smoothing is to remove anomalies in non-Manhattan 2D graphics. After smoothing, the number of sides in a non-Manhattan 2D graphic can be much smaller than that of a standard non-Manhattan 2D graphic. For example... Figure 2 As shown, the non-Manhattan 2D graphic 1 is smoothed to become the smoothed non-Manhattan 2D graphic 2.

[0026] This invention does not impose specific limitations on the smoothing method, as long as it can remove the anomalies in the graphic and reduce the number of sides. For example, any one or any combination of the Douglas-Puk algorithm, the Bézier curve fitting method, and the Chaikin curve smoothing algorithm can be used.

[0027] It should be pointed out that, Figure 2 The difference in the number of sides between the non-Manhattan 2D graphic 1 and the smoothed non-Manhattan 2D graphic 2 is not significant. However, in actual graphics, non-Manhattan 2D graphics are composed of smaller and shorter sides. For clarity, the figures are simplified below. Figure 2 No more small line segments were drawn.

[0028] Step S102: Break the target edge in the smoothed non-Manhattan 2D graphic by dividing the target edge into multiple edges to obtain the processed non-Manhattan 2D graphic.

[0029] The smoothed non-Manhattan 2D graphic consists of multiple edges. The target edge is the edge in the smoothed non-Manhattan 2D graphic whose length exceeds a preset length threshold. The preset length threshold is not limited in this invention and can be set arbitrarily. The breaking of the target edge is as follows: Figure 2 As shown, the diagonal lines on the target edge of the smoothed non-Manhattan 2D graphic 2 indicate the break point.

[0030] It should be noted that the method of interruption processing is not limited in this invention and can be selected by the user.

[0031] As one possible implementation, breaking the target edge in the smoothed non-Manhattan 2D graphic includes breaking the target edge according to a preset breaking length threshold.

[0032] The preset break length threshold is not limited in this invention and can be set by the user. For example, for a target edge with a length of 105, if the preset break length threshold is 25, the target edge will be broken into 5 edges.

[0033] As another possible implementation method, breaking the target edge in the smoothed non-Manhattan 2D graphic includes breaking the target edge according to a preset number of breaks.

[0034] The preset number of interruptions is not limited in this invention and can be set by the user. For example, for a target edge with a length of 105, if the preset number of interruptions is 5, the target edge will be interrupted into 5 smaller edges with a length of 21.

[0035] Step S103: Determine the number of edges in the processed non-Manhattan 2D graphic, and determine the preliminary similarity between the non-Manhattan 2D graphic and the reference graphic based on the number of edges and the corresponding number in the reference graphic.

[0036] The reference graphic is a non-Manhattan 2D graphic that needs to be matched, and it is determined whether the non-Manhattan 2D graphic is similar to it. The specific shape of the reference graphic is not limited in this invention and depends on the situation.

[0037] It should be noted that the present invention does not limit the process of determining preliminary similarity based on quantity. For example, the determination can be based on the difference between the total number of edges in the processed non-Manhattan 2D graphic and the total number of edges in the base graphic. When the difference is less than a first preset difference threshold, preliminary similarity can be considered; otherwise, they are not similar. Alternatively, the determination can be based on the number of edges of more types to improve the accuracy of the determination. This method is specifically described in the following embodiments.

[0038] Step S104: When the non-Manhattan 2D graphic is initially similar to the reference graphic, the edges of the non-Manhattan 2D graphic and the reference graphic are matched to determine the similarity between the non-Manhattan 2D graphic and the reference graphic.

[0039] The process of further matching non-Manhattan two-dimensional graphics with preliminary similarity with the reference graphics is not described in detail in this invention; relevant technologies can be consulted.

[0040] It is understandable that when a non-Manhattan 2D graphic does not have a preliminary similarity to the reference graphic, it can be determined that the non-Manhattan 2D graphic is not similar to the reference graphic, and there is no need to perform the edge matching process.

[0041] The matching method in this embodiment smooths the non-Manhattan 2D graphics to be matched, removing variations in the non-Manhattan 2D graphics, reducing errors in edge counting, and even reducing the number of edges, thereby simplifying the matching method and improving matching speed. Then, the target edges in the smoothed non-Manhattan 2D graphics are broken, thus segmenting the target edges. A preliminary similarity judgment is made between the non-Manhattan 2D graphics and the base graphics based on the number of edges in the processed non-Manhattan 2D graphics and their corresponding numbers in the base graphics. This preliminary screening of similarity between the non-Manhattan 2D graphics and the base graphics is performed only when there is preliminary similarity; otherwise, no further matching is needed. Therefore, the number of matching calculations can be reduced, thereby improving the approximate matching speed of non-Manhattan graphics.

[0042] Please refer to Figure 3 Based on the above embodiments, in one embodiment of the present invention, determining the number of edges in the processed non-Manhattan two-dimensional graphic, and determining the preliminary similarity between the non-Manhattan two-dimensional graphic and the reference graphic based on the number of edges and the corresponding number in the reference graphic, includes: Step S201: Determine the total number of edges in the processed non-Manhattan 2D graphic, and determine a first difference between the total number and the total number of edges in the base graphic.

[0043] The total number of edges in a non-Manhattan 2D graph after processing includes the sum of the number of unbroken edges and the number of each broken edge.

[0044] Step S202: Determine whether the first difference is less than the first preset difference threshold.

[0045] The first preset difference threshold is not limited in this invention and can be set by the user.

[0046] Step S203: If the first difference is not less than the first preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic.

[0047] Step S204: If the first difference is less than the first preset difference threshold, then determine the number of targets on the target direction of the processed non-Manhattan 2D graphic.

[0048] When the first difference is less than the first preset difference threshold, it indicates that there may be preliminary similarity, and further judgment is required.

[0049] The target direction is not specifically limited in this invention and depends on the situation. For example, the target direction can be horizontal, vertical, or both.

[0050] Step S205: Determine a second difference between the target quantity and the quantity of the reference pattern on the target direction.

[0051] Step S206: Determine whether the second difference is less than the second preset difference threshold.

[0052] The second preset difference threshold is not limited in this invention and can be set by the user.

[0053] Step S207: If the second difference is not less than the second preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic.

[0054] Step S208: If the second difference is less than the second preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic.

[0055] In this embodiment, when determining whether a non-Manhattan 2D graphic and a reference graphic have preliminary similarity, the determination is made based on the total number of edges in the processed non-Manhattan 2D graphic and the number of targets on the target direction, which can improve the accuracy of the preliminary similarity determination.

[0056] In one embodiment of the present invention, when the target direction is horizontal and vertical, determining the number of edges in the processed non-Manhattan two-dimensional graphic, and determining the preliminary similarity between the non-Manhattan two-dimensional graphic and the reference graphic based on the corresponding number in the reference graphic includes: Step S301: Determine the total number of edges in the processed non-Manhattan 2D graphic, and determine a first difference between the total number and the total number of edges in the base graphic.

[0057] Step S302: Determine whether the first difference is less than the first preset difference threshold.

[0058] Step S303: If the first difference is not less than the first preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic.

[0059] Step S304: If the first difference is less than the first preset difference threshold, then determine the first number of the processed non-Manhattan two-dimensional graphic in the horizontal direction and the second number of the processed non-Manhattan two-dimensional graphic in the vertical direction.

[0060] Step S305: Determine a third difference between the first quantity and the quantity of the reference graphic in the horizontal direction; and determine a fourth difference between the second quantity and the quantity of the reference graphic in the vertical direction.

[0061] Step S306: Determine whether the third difference is less than the second preset difference threshold.

[0062] Step S307: If the third difference is not less than the second preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic.

[0063] Step S308: If the third difference is less than the second preset difference threshold, then determine whether the fourth difference is less than the third preset difference threshold.

[0064] In this invention, the third preset difference threshold is not limited and can be set by the user.

[0065] Step S309: If the fourth difference is not less than the third preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic.

[0066] Step S310: If the fourth difference is less than the third preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic.

[0067] It should be noted that after determining the third and fourth differences, the size relationship between the fourth difference and the second preset difference threshold can be compared first. When the fourth difference is less than the second preset difference threshold, the size relationship between the third difference and the third preset difference threshold can be compared.

[0068] In this embodiment, the target directions are two directions: horizontal and vertical. This can improve the accuracy of the initial similarity judgment while reducing the amount of calculation.

[0069] Based on the above embodiments, in one embodiment of the present invention, if the fourth difference is less than the third preset difference threshold, it may further include: Determine the first Euclidean distance of each side in the horizontal direction and the second Euclidean distance of each side in the vertical direction for the processed non-Manhattan 2D graphic. Determine the third Euclidean distance of each side of the reference figure in the horizontal direction and the fourth Euclidean distance of each side in the vertical direction; Determine whether the first distance difference between the first Euclidean distance and the corresponding third Euclidean distance is less than a first preset distance difference threshold; If the first distance difference is not less than the first preset distance difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the first distance difference is less than the first preset distance difference threshold, then determine whether the second distance difference between the second Euclidean distance and the corresponding fourth Euclidean distance is less than the second preset distance difference threshold. If the second distance difference is not less than the second preset distance difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the second distance difference is less than the second preset distance difference threshold, then proceed to the step of determining that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic.

[0070] In this embodiment, the preliminary similarity of opposite sides is further determined by Euclidean distance, which can improve the accuracy of the preliminary similarity determination.

[0071] In one embodiment of the present invention, if the second distance difference is less than a second preset distance difference threshold, the method may further include: Determine the first cross-entropy of each edge in the horizontal direction and the second cross-entropy of each edge in the vertical direction for the processed non-Manhattan 2D graphic. Determine the third cross-entropy of each side of the baseline figure in the horizontal direction and the fourth cross-entropy of each side in the vertical direction; Determine whether the difference between the first cross-entropy and the corresponding third cross-entropy is less than a first preset cross-entropy difference threshold. If the first cross-entropy difference is not less than the first preset cross-entropy difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic. If the first cross-entropy difference is less than the first preset cross-entropy difference threshold, then determine whether the second cross-entropy difference between the second cross-entropy and the corresponding fourth cross-entropy is less than the second preset cross-entropy difference threshold. If the second cross-entropy difference is not less than the second preset cross-entropy difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic. If the second cross-entropy difference is less than the second preset cross-entropy difference threshold, then proceed to the step of determining that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic.

[0072] In this embodiment, the initial similarity of edges is further judged by Euclidean distance and cross entropy, which can further improve the accuracy of the initial similarity judgment.

[0073] Based on the above embodiments, in one embodiment of the present invention, the graphic approximation matching method may further include: Determine the third quantity of the non-Manhattan 2D graphic in the tilt direction after the processing; If the fourth difference is less than the third preset difference threshold, then determining that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic includes: If the fourth difference is less than the third preset difference threshold, then a fifth difference is determined between the third quantity and the quantity of the reference graphic on the inclined direction; Determine whether the fifth difference is less than the fourth preset difference threshold; If the fifth difference is not less than the fourth preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the fifth difference is less than the fourth preset difference threshold, then the non-Manhattan two-dimensional graphic is determined to be initially similar to the reference graphic.

[0074] The angle of the tilt direction is not limited in this invention and can be selected by the user. For example, the tilt direction can be any direction or any combination of directions with an angle of 45 degrees, 135 degrees, 225 degrees, or 315 degrees to the horizontal.

[0075] In this embodiment, the target direction includes not only the horizontal and vertical directions, but also the tilt direction, which can further improve the accuracy of preliminary similarity judgment.

[0076] Based on the above embodiments, in one embodiment of the present invention, if the fifth difference is less than the fourth preset difference threshold, the following may also be included: Determine the fifth Euclidean distance of each edge of the non-Manhattan 2D graphic in the tilt direction after processing; Determine the sixth Euclidean distance of each side of the reference figure in the direction of inclination; Determine whether the third distance difference between the fifth Euclidean distance and the corresponding sixth Euclidean distance is less than the third preset distance difference threshold; If the third distance difference is not less than the third preset distance difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the third distance difference is less than the third preset distance difference threshold, then the fifth cross entropy of each edge of the processed non-Manhattan two-dimensional graphic in the tilt direction is determined, and the sixth cross entropy of each edge of the reference graphic in the tilt direction is determined. Determine whether the difference between the third cross-entropy of the fifth cross-entropy and the corresponding sixth cross-entropy is less than the third preset cross-entropy difference threshold; If the third cross-entropy difference is not less than the third preset cross-entropy difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic. If the third cross-entropy difference is less than the third preset cross-entropy difference threshold, then proceed to the step of determining that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic.

[0077] The graphic approximation matching device provided in the embodiments of the present invention will be described below. The graphic approximation matching device described below can be referred to in correspondence with the graphic approximation matching method described above.

[0078] Figure 4 The structural block diagram of the graphic approximation matching device provided in the embodiments of the present invention may include: The smoothing module 100 is used to smooth the non-Manhattan two-dimensional graphic to be matched, so as to obtain a smoothed non-Manhattan two-dimensional graphic. The interruption module 200 is used to interrupt the target edge in the smoothed non-Manhattan two-dimensional graphic, and divide the target edge into multiple edges to obtain the processed non-Manhattan two-dimensional graphic. The first determining module 300 is used to determine the number of edges in the processed non-Manhattan two-dimensional graphic, and to determine the preliminary similarity between the non-Manhattan two-dimensional graphic and the reference graphic based on the number of edges and the corresponding number of edges in the reference graphic. The matching module 400 is used to match the edges of the non-Manhattan two-dimensional graphic and the reference graphic when the non-Manhattan two-dimensional graphic is initially similar to the reference graphic, and to determine the similarity between the non-Manhattan two-dimensional graphic and the reference graphic.

[0079] The graphic approximation matching device of this embodiment is used to implement the aforementioned graphic approximation matching method. Therefore, the specific implementation of the graphic approximation matching device can be found in the embodiment section of the graphic approximation matching method above. For example, the smoothing module 100, the interruption module 200, the first determination module 300, and the matching module 400 are used to implement steps S101, S102, S103, and S104 in the above graphic approximation matching method, respectively. Therefore, the specific implementation can be referred to the description of the corresponding embodiments, which will not be repeated here.

[0080] As one possible implementation, the first determining module includes: The first determining submodule is used to determine the total number of edges in the processed non-Manhattan two-dimensional graphic, and to determine a first difference between the total number and the total number of edges in the base graphic. The first judgment submodule is used to determine whether the first difference is less than a first preset difference threshold. The second determining submodule is used to determine that the non-Manhattan two-dimensional graphic is not similar to the reference graphic if the first difference is not less than the first preset difference threshold. The third determining submodule is used to determine the number of targets in the target direction of the processed non-Manhattan two-dimensional graphic if the first difference is less than the first preset difference threshold. The fourth determining submodule is used to determine a second difference between the target quantity and the quantity of the reference pattern on the target direction; The second judgment submodule is used to determine whether the second difference is less than the second preset difference threshold. The fifth determining submodule is used to determine that the non-Manhattan two-dimensional graphic is not similar to the reference graphic if the second difference is not less than the second preset difference threshold. The sixth determining submodule is used to determine that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic if the second difference is less than the second preset difference threshold.

[0081] As one possible implementation, the third determining submodule is specifically used to determine the first number of edges in the horizontal direction and the second number of edges in the vertical direction of the processed non-Manhattan two-dimensional graphic. The fourth determination submodule includes: The first determining unit is configured to determine a third difference between the first quantity and the quantity of the reference graphic in the horizontal direction. The second determining unit is used to determine a fourth difference between the second quantity and the quantity of the reference pattern in the vertical direction. The second judgment submodule is specifically used to determine whether the third difference is less than the second preset difference threshold; The fifth determining submodule is specifically used to determine that the non-Manhattan two-dimensional graphic is not similar to the reference graphic if the third difference is not less than the second preset difference threshold. The sixth determination submodule includes: The first judgment unit is used to determine whether the fourth difference is less than the third preset difference threshold if the third difference is less than the second preset difference threshold. The third determining unit is used to determine that the non-Manhattan two-dimensional graphic is not similar to the reference graphic if the fourth difference is not less than the third preset difference threshold. The fourth determining unit is used to determine that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic if the fourth difference is less than the third preset difference threshold.

[0082] As one possible implementation, it also includes: The second determining module is used to determine the third quantity of the processed non-Manhattan two-dimensional graphic in the tilt direction; The third determining module is used to determine that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic if the fourth difference is less than a third preset difference threshold, including: The fourth determining module is used to determine a fifth difference between the third quantity and the quantity of the reference graphic on the inclined direction if the fourth difference is less than the third preset difference threshold. The judgment module is used to determine whether the fifth difference is less than the fourth preset difference threshold. The fifth determining module is used to determine that the non-Manhattan two-dimensional graphic is not similar to the reference graphic if the fifth difference is not less than the fourth preset difference threshold. The sixth determining module is used to determine that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic if the fifth difference is less than the fourth preset difference threshold.

[0083] As one possible implementation, the interruption module is specifically used to interrupt the target edge according to a preset interruption length threshold.

[0084] As one possible implementation, the interruption module is specifically used to interrupt the target edge according to a preset interruption number.

[0085] The electronic device provided in the embodiments of the present invention will be described below. The electronic device described below and the graphic approximation matching method described above can be referred to in correspondence.

[0086] This invention provides an electronic device, please refer to... Figure 5 ,include: Memory 11 is used to store computer programs; The processor 12 is configured to implement the steps of the graphic approximation matching method described in any of the above embodiments when executing the computer program.

[0087] The computer-readable storage medium provided in the embodiments of the present invention is described below. The computer-readable storage medium described below can be referred to in correspondence with the graphic approximation matching method described above.

[0088] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the graphic approximation matching method described in any of the above embodiments.

[0089] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0090] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0091] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0092] The foregoing has provided a detailed description of the graphic approximation matching method, apparatus, electronic device, and computer-readable storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the embodiments above are merely for the purpose of helping to understand the solution and core ideas of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the present invention.

Claims

1. A method for approximate graphic matching, characterized in that, include: The non-Manhattan 2D graphic to be matched is smoothed to obtain a smoothed non-Manhattan 2D graphic. The target edge in the smoothed non-Manhattan 2D graphic is broken into multiple edges to obtain the processed non-Manhattan 2D graphic. The number of edges in the processed non-Manhattan 2D graphic is determined, and the preliminary similarity between the non-Manhattan 2D graphic and the reference graphic is determined based on the number of edges and the corresponding number in the reference graphic. When the non-Manhattan 2D graphic is initially similar to the reference graphic, the edges of the non-Manhattan 2D graphic and the reference graphic are matched to determine the similarity between the non-Manhattan 2D graphic and the reference graphic.

2. The graphic approximate matching method as described in claim 1, characterized in that, Determining the number of edges in the processed non-Manhattan 2D graphic, and determining the preliminary similarity between the non-Manhattan 2D graphic and the reference graphic based on the corresponding number of edges in the reference graphic, includes: Determine the total number of edges in the processed non-Manhattan 2D graphic, and determine a first difference between the total number and the total number of edges in the baseline graphic; Determine whether the first difference is less than a first preset difference threshold; If the first difference is not less than the first preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the first difference is less than the first preset difference threshold, then the number of targets on the target direction of the processed non-Manhattan 2D graphic is determined. Determine a second difference between the target quantity and the quantity of the reference graphic above the target direction; Determine whether the second difference is less than a second preset difference threshold; If the second difference is not less than the second preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the second difference is less than the second preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic.

3. The graphic approximate matching method as described in claim 2, characterized in that, Determining the number of targets in the target direction of the processed non-Manhattan 2D graphic includes: Determine the first number of edges in the horizontal direction and the second number of edges in the vertical direction of the processed non-Manhattan 2D graphic; Determining the second difference between the target quantity and the quantity of the reference graphic above the target direction includes: Determine a third difference between the first quantity and the quantity of the reference graphic in the horizontal direction; Determine a fourth difference between the second quantity and the quantity of the reference graphic in the vertical direction; Determining whether the second difference is less than the second preset difference threshold includes: Determine whether the third difference is less than the second preset difference threshold; If the second difference is not less than the second preset difference threshold, then determining that the non-Manhattan 2D graphic is dissimilar to the reference graphic includes: If the third difference is not less than the second preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the second difference is less than the second preset difference threshold, then determining that the non-Manhattan 2D graphic is initially similar to the reference graphic includes: If the third difference is less than the second preset difference threshold, then determine whether the fourth difference is less than the third preset difference threshold; If the fourth difference is not less than the third preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the fourth difference is less than the third preset difference threshold, then the non-Manhattan two-dimensional graphic is determined to be initially similar to the reference graphic.

4. The graphic approximate matching method as described in claim 3, characterized in that, Also includes: Determine the third quantity of the non-Manhattan 2D graphic in the tilt direction after the processing; If the fourth difference is less than the third preset difference threshold, then determining that the non-Manhattan two-dimensional graphic is initially similar to the reference graphic includes: If the fourth difference is less than the third preset difference threshold, then a fifth difference is determined between the third quantity and the quantity of the reference graphic on the inclined direction; Determine whether the fifth difference is less than the fourth preset difference threshold; If the fifth difference is not less than the fourth preset difference threshold, then it is determined that the non-Manhattan two-dimensional graphic is not similar to the reference graphic; If the fifth difference is less than the fourth preset difference threshold, then the non-Manhattan two-dimensional graphic is determined to be initially similar to the reference graphic.

5. The graphic approximate matching method as described in claim 1, characterized in that, The process of breaking the target edge in the smoothed non-Manhattan 2D graphic includes: The target edge is broken according to a preset break length threshold.

6. The graphic approximate matching method as described in claim 1, characterized in that, The process of breaking the target edge in the smoothed non-Manhattan 2D graphic includes: The target edge is broken according to a preset number of breaks.

7. A graphic approximation matching device, characterized in that, include: The smoothing module is used to smooth the non-Manhattan 2D graphic to be matched, and obtain the smoothed non-Manhattan 2D graphic. The interruption module is used to interrupt the target edge in the smoothed non-Manhattan two-dimensional graphic, and divide the target edge into multiple edges to obtain the processed non-Manhattan two-dimensional graphic. The first determining module is used to determine the number of edges in the processed non-Manhattan two-dimensional graphic, and to determine the preliminary similarity between the non-Manhattan two-dimensional graphic and the reference graphic based on the number of edges and the corresponding number in the reference graphic. The matching module is used to match the edges of the non-Manhattan 2D graphic and the reference graphic when the non-Manhattan 2D graphic is initially similar to the reference graphic, and to determine the similarity between the non-Manhattan 2D graphic and the reference graphic.

8. The graphic approximation matching device as described in claim 7, characterized in that, The interruption module is specifically used to interrupt the target edge according to a preset interruption length threshold.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the graphical approximation matching method as described in any one of claims 1 to 6 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the graphic approximation matching method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Inter-graph similarity calculation method and system, terminal equipment and storage medium

    CN111723847A

  • Layout extraction method, layout extraction system and computer medium

    CN115629516A

  • Building mapping precision calculation method and system based on contour matching

    CN117649532A

  • Lithographic mask optimization method and device, computer storage medium and program product

    CN120447300A

  • Fast Pattern Matching

    US20120191729A1