Image coincidence determination method, electronic device and computer-readable storage medium
By calculating the similarity between the image boundary line and the intersection boundary line and determining the image overlap, the problem of low efficiency in identifying pirated pictures in the prior art is solved, and fast and accurate repetitive recognition of image content and savings in storage resources are achieved.
Patent Information
- Application Number
- CN202011413425.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-03
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2040-12-03
AI Technical Summary
The prior art is difficult to effectively identify and eliminate pirated pictures caused by image name modification, and the method of manually comparing the image content is inefficient and costly.
By obtaining the boundary lines and intersection boundary lines in the image, the similarity between boundary lines combinations is calculated, thereby determining the degree of overlap between images.
It realizes the repetition of image content quickly and accurately, avoids the problem of repeatedly storing and recommending the same picture, reduces labor costs and improves recognition efficiency.
Smart Images

Figure CN112464955B_ABST
Abstract
Description
[Technical field]
[0001] The present application relates to video processing technology, and in particular to a method for determining image coincidence, an electronic device, and a computer-readable storage medium. [Background technology]
[0002] At present, with the rapid development of Internet technology and the popularization of smart terminals, various forums, websites, and self-media platforms are constantly emerging. Video manufacturers and users generate a large number of videos and pictures with rich and diverse content every day, which are uploaded to various video websites, forums, self-media platforms, etc. for users to watch.
[0003] At the same time, pirated videos and pictures are also emerging in an endless stream, especially pictures, which are easily downloaded by some users from a certain website, forum, or self-media platform and then uploaded to other websites, forums, and self-media platforms. This results in websites, forums, and self-media platforms actually repeatedly collecting pictures with the same content, wasting storage resources; in addition, when recommending pictures to users, it is easy to recommend multiple pictures with the same content to users, causing users to watch pictures with duplicate content, which reduces the user experience.
[0004] In the prior art, it is generally determined whether the pictures are similar by comparing the names of the pictures, or by manually comparing the contents of the two pictures, and then determining whether a picture is a pirated picture. However, the names of pictures are easily modified. For some pirated pictures with modified names, it is difficult to identify pirated pictures by comparing the picture names, and the detection method of manually comparing the contents of two pictures is labor-intensive and inefficient. [Summary of the invention]
[0005] Multiple aspects of the present application provide a method for determining image coincidence, an electronic device, and a computer-readable storage medium for determining coincidence between images.
[0006] In one aspect of the present application, a method for determining image coincidence is provided, comprising:
[0007] Acquire at least one first boundary line in the first image;
[0008] For each of the at least one first boundary line, respectively, obtain a first intersecting boundary line intersecting with each of the first boundary lines;
[0009] Acquire at least one second boundary line similar to each of the first boundary lines and at least one third boundary line similar to the first intersecting boundary line in the second image;
[0010] Determining the similarity between a first intersection boundary line combination and a second intersection boundary line combination; wherein the first intersection boundary line combination includes each of the first boundary lines and the corresponding first intersection boundary line, and the second intersection boundary line combination includes the at least one second boundary line corresponding to the first group of intersection boundary lines and the at least one third boundary line;
[0011] Based on the similarity corresponding to the at least one first boundary line, a degree of coincidence between the first image and the second image is determined.
[0012] Another aspect of the present application provides an electronic device, the electronic device comprising:
[0013] one or more processors;
[0014] a storage device for storing one or more programs,
[0015] When the one or more programs are executed by the one or more processors, the one or more processors implement the image coincidence determination method provided in the above aspect.
[0016] In another aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for determining image coincidence provided in the above aspect is implemented.
[0017] It can be known from the above technical scheme that the embodiment of the present application obtains at least one first boundary line in the first image, and respectively obtains the first intersection boundary line intersecting with each first boundary line for each first boundary line in the at least one first boundary line, and obtains at least one second boundary line similar to each first boundary line and at least one third boundary line similar to the first intersection boundary line in the second image, and then determines the similarity between the first intersection boundary line combination and the second intersection boundary line combination, wherein the first intersection boundary line combination includes each first boundary line and the corresponding first intersection boundary line, and the second intersection boundary line combination includes the at least one second boundary line and the at least one third boundary line corresponding to the first group of intersection boundary lines, and then, based on the similarity corresponding to the at least one first boundary line, determines the overlap between the first image and the second image, thereby realizing the determination of the overlap between the two images, so that images with repeated content can be identified.
[0018] In addition, by adopting the technical solution provided in the present application, since it is possible to determine the degree of overlap between images by comparing the relationship between the combinations of intersecting boundary lines in the images, and thus determine whether the contents of two images are repeated, it is possible to avoid websites, forums, and self-media platforms from repeatedly collecting images with the same content, thereby saving storage resources and maintenance resources.
[0019] In addition, by adopting the technical solution provided in the present application, since it is possible to determine the degree of overlap between images by comparing the relationship between the combinations of intersecting boundary lines in the images, and thus determine whether the contents of two images are repeated, it is possible to avoid recommending multiple images with the same content to users when recommending images to users, thereby preventing users from viewing pictures with the same content, and effectively improving the user experience.
[0020] In addition, the technical solution provided by the present application reduces labor costs and improves recognition efficiency compared to detection methods that determine whether images are similar by manually comparing the contents of two images.
Brief Description of the Drawings
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0022] Figure 1 A schematic diagram of a flow chart of a method for determining image coincidence provided in an embodiment of the present application;
[0023] Figure 2 An example diagram of an image received and a first image in an embodiment of the present application;
[0024] Figure 3 for Figure 1 A schematic diagram of a process of obtaining at least one second boundary line and at least one third boundary line in the illustrated embodiment;
[0025] Figure 4 for Figure 1 Another schematic diagram of a process of obtaining at least one second boundary line and at least one third boundary line in the illustrated embodiment;
[0026] Figure 5 A schematic diagram of a flow chart of a method for determining image coincidence provided in another embodiment of the present application;
[0027] Figure 6 A schematic flow chart of a method for determining image coincidence provided in yet another embodiment of the present application;
[0028] Figure 7 FIG. 1 is a block diagram of an exemplary computer system / server 12 suitable for implementing embodiments of the present application. [Specific implementation method]
[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0030] It should be noted that the terminals involved in the embodiments of the present application may include but are not limited to mobile phones, personal digital assistants (PDAs), wireless handheld devices, tablet computers, personal computers (PCs), MP3 players, MP4 players, wearable devices (for example, smart glasses, smart watches, smart bracelets, etc.), etc.
[0031] In addition, the term "and / or" in this article is only a description of the association relationship between the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0032] As described in the background technology, various pictures can be easily downloaded by some users from a certain website, forum, or self-media platform and then uploaded to other websites, forums, or self-media platforms. In this way, websites, forums, or self-media platforms actually repeatedly collect pictures with the same content, wasting storage resources. In addition, when recommending pictures to users, it is easy to recommend multiple pictures with the same content to users, causing users to watch pictures with duplicate content, which reduces user experience. However, the method of judging whether pictures are similar by comparing the names between pictures is difficult to identify pirated pictures by comparing the names of pictures, because the names of pictures are easily modified. The detection method of judging whether pictures are similar by manually comparing the contents of two pictures is labor-intensive and inefficient.
[0033] Therefore, there is an urgent need to provide a method for determining image coincidence, so as to determine whether the contents of two images are repeated.
[0034] Figure 1 A schematic diagram of a flow chart of a method for determining image coincidence provided in an embodiment of the present application, such as Figure 1 shown.
[0035] 101. Acquire at least one first boundary line in a first image.
[0036] Optionally, the first image in the embodiment of the present application refers to an image that needs to be identified as to whether it is repeated with other image contents.
[0037] In addition, the first image in the embodiment of the present application can be a picture of any format and content, for example, it can be an image in the format of bmp, jpg, png, tif, gif, pcx, tga, exif, fpx, svg, psd, cdr, pcd, dxf, ufo, eps, ai, raw, WMF, webp, avif, etc.
[0038] In addition, the first image in the embodiment of the present application can be a separate picture or a picture captured from a video, and the embodiment of the present application does not limit this.
[0039] In addition, the first boundary line in the embodiment of the present application refers to the boundary line in the first image, which may include one boundary line, any number of boundary lines, or all boundary lines in the first image. The boundary line refers to the edge line, contour line, and other lines of each part of the content (person, object, etc.) in the first image.
[0040] 102. For each first boundary line of the at least one first boundary line, obtain a first intersecting boundary line intersecting with the each first boundary line.
[0041] 103. Acquire at least one second boundary line similar to each of the first boundary lines and at least one third boundary line similar to the first intersecting boundary line in the second image.
[0042] Optionally, the second image in the embodiment of the present application refers to any image used to compare with the first image to identify whether the content of the first image is repeated therewith.
[0043] In addition, the second image in the embodiment of the present application can be a picture of any format and content, for example, it can be an image in the format of bmp, jpg, png, tif, gif, pcx, tga, exif, fpx, svg, psd, cdr, pcd, dxf, ufo, eps, ai, raw, WMF, webp, avif, etc.
[0044] In addition, the second image in the embodiment of the present application can be a separate picture or a picture captured from a video, and the embodiment of the present application does not limit this.
[0045] In addition, the second boundary line in the embodiment of the present application refers to the boundary line in the second image, which may include one boundary line, any number of boundary lines, or all boundary lines in the second image. The boundary line refers to the edge line, contour line, and other lines of each part of the content (person, object, etc.) in the second image.
[0046] 104. Determine the similarity between the first intersecting boundary line combination and the second intersecting boundary line combination.
[0047] The first intersecting boundary line combination includes each of the first boundary lines and the corresponding first intersecting boundary line, and the second intersecting boundary line combination includes the at least one second boundary line and the at least one third boundary line corresponding to the first group of intersecting boundary lines.
[0048] 105. Determine a degree of overlap between the first image and the second image based on a degree of similarity corresponding to the at least one first boundary line.
[0049] It should be noted that part or all of the execution entities of 101 to 105 may be applications located in the terminal, or may also be functional units such as plug-ins or software development kits (SDKs) in the applications that set the terminal, or may also be applications located in the network side server. The embodiments of the present application do not specifically limit this.
[0050] It is understandable that the application may be a local program (nativeApp) installed on the terminal, or may be a web page program (webApp) of a browser on the terminal, which is not limited in the embodiments of the present application.
[0051] In this way, the degree of coincidence between two images is determined, thereby enabling the identification of images with duplicate content.
[0052] In addition, by adopting the technical solution provided in the present application, since it is possible to determine the degree of overlap between images by comparing the relationship between the combinations of intersecting boundary lines in the images, and thus determine whether the contents of two images are repeated, it is possible to avoid websites, forums, and self-media platforms from repeatedly collecting images with the same content, thereby saving storage resources and maintenance resources.
[0053] In addition, by adopting the technical solution provided in the present application, since it is possible to determine the degree of overlap between images by comparing the relationship between the combinations of intersecting boundary lines in the images, and thus determine whether the contents of two images are repeated, it is possible to avoid recommending multiple images with the same content to users when recommending images to users, thereby preventing users from viewing pictures with the same content, and effectively improving the user experience.
[0054] In addition, the technical solution provided by the present application reduces labor costs and improves recognition efficiency compared to detection methods that determine whether images are similar by manually comparing the contents of two images.
[0055] The embodiments of the present application can be applied to any website, forum, self-media platform, etc., to identify the content overlap between the image uploaded by the user and the existing images in the database. At this time, the first image is the image uploaded by the user or the image obtained by performing some processing (such as sharpening, black and white, etc.) on the uploaded image, and the second image is any image stored in the database of the website, forum, self-media platform, etc. By comparing the first image with all the images stored in the database one by one, it is possible to identify whether the image uploaded by the user has the same content as the existing images in the database.
[0056] In addition, the embodiments of the present application can be applied to a terminal device to compare whether the contents of any two images are repeated.
[0057] Optionally, in some implementations, before 101, the received image may be sharpened to obtain the first image.
[0058] Among them, image sharpening is to compensate for the contour of the image, enhance the edge of the image and the grayscale jump part, so that the image becomes clear, which is divided into two categories: spatial domain processing and frequency domain processing. Image sharpening is to highlight the edges, contours, or characteristics of certain linear target elements of the objects on the image. This filtering method increases the contrast between the edge of the object and the surrounding pixels, so it is also called edge enhancement. In the embodiment of the present application, any image sharpening method, such as first-order differential, second-order differential, etc., can be used to sharpen the received image. The embodiment of the present application does not limit the specific image sharpening method used.
[0059] Based on this embodiment, by sharpening the received image, the edge lines and contour lines of the objects in the image can be made clearer, which helps to obtain clearer boundary lines. Since the similarity between the boundary lines in the two images can be more accurately determined, the overlap between the two images can be more accurately determined, thereby improving the recognition effect of the repeatability of the image content.
[0060] Alternatively, in some other implementations, before step 101, the received image may be sharpened and converted to black and white in sequence to obtain the first image.
[0061] Among them, black and white conversion, also known as grayscale conversion, is to process the image in black and white to make it lose color. Starting from the pixel point, it is to make the values of the three color components of red, green and blue (R, G, B) of each pixel point the same. The embodiment of the present application can adopt any black and white conversion method, such as the commonly used maximum method (Maximum), average method (Average), weighted average method (WeightedAverage), etc. The embodiment of the present application is not limited to a specific black and white conversion method.
[0062] Alternatively, in some other implementations, before step 101, the received image may be converted to black and white and sharpened in sequence to obtain the first image.
[0063] Figure 2 is an example diagram of the received image and the first image in the embodiment of the present application. Figure 2 As shown, the left image is the received image (also called the original image), and the right image is the first image obtained by sequentially sharpening and black-and-whiteing the left image. The white edge lines of the hat brim, shoulders, hair, etc. in the right image are the boundary lines.
[0064] Based on this embodiment, the image is black and whited on the basis of image sharpening, so that the values of the three color components of each pixel are the same, which helps to more accurately and quickly determine the edge lines and contour lines of the objects in the image, so as to improve the accuracy and efficiency of boundary line acquisition.
[0065] Optionally, in some of the implementations, before 101, the distance between two intersection points determined based on a preset method on the boundary line with the longest length in the first image can be obtained to obtain a first distance, and the distance between two intersection points determined based on the preset method on the boundary line with the longest length in the second image can be obtained to obtain a second distance. Then, based on the first distance and the second distance, the first image is proportionally scaled along two coordinate axis directions in a preset plane coordinate system so that the first distance is close to the second distance.
[0066] In a specific implementation, the first distance being close to the second distance means that the first distance is close to and equal to the second distance, or the difference between the two is less than a preset value, or the ratio between the two is less than a preset value, etc., and the embodiments of the present application do not impose any restrictions on this.
[0067] In a specific implementation, the distance between two intersection points determined based on a preset method can be, for example, the distance between two adjacent intersection points at either end of the boundary line, or the distance between two intersection points located at both ends of the boundary line, etc. The embodiment of the present application does not impose any restrictions on this.
[0068] For example, in a specific implementation, assuming that the distance between the two intersection points determined in the first image based on a preset method is P, and the distance between the two intersection points determined in the first image based on a preset method is Q, the scaling ratio of the first image can be determined by the following formula to scale the first image proportionally along the two coordinate axis directions in the preset plane coordinate system:
[0069] C=(PQ) / P
[0070] Wherein, a value of C greater than 0 indicates that the first image needs to be reduced, a value of C less than 0 indicates that the first image needs to be enlarged, and a value of C equal to 0 indicates that the first image does not need to be scaled.
[0071] In actual scenarios, images may be scaled proportionally. Based on this embodiment, based on the distance between two intersection points determined based on a preset method on the boundary line of the two images, the first image is scaled proportionally along the two coordinate axis directions in the preset plane coordinate system, so that the distance between the two intersection points determined based on a preset method on the boundary line of the two images is close. This can avoid inaccurate similarity between the first intersecting boundary line combination and the second intersecting boundary line combination obtained due to the large size difference between the two images, thereby improving the accuracy of the image coincidence recognition results.
[0072] Optionally, in some of the implementations, in 101, at least one first boundary line in the first image can be obtained specifically in the following manner: selecting at least one first boundary line from the first image in order of length from large to small; or selecting at least one first boundary line from the first image in order of number of intersections from large to small.
[0073] The embodiment of the present application does not limit the method of obtaining at least one first boundary line from the first image and the number of first boundary lines, which can be set according to specific needs.
[0074] Since longer boundary lines correspond to larger outlines of features in the image, boundary lines with more intersection points can accurately reflect the content of the features in the image. At least one first boundary line selected based on the two methods can better reflect the content of the image as a whole. Based on this embodiment, boundary lines with longer lengths or boundary lines with more intersection points are selected from the image to determine the degree of overlap between the image and other images, which helps to improve the accuracy of image overlap recognition results.
[0075] Figure 3 for Figure 1 The embodiment shown is a schematic diagram of a process of obtaining at least one second boundary line and at least one third boundary line. Figure 3 As shown, in Figure 1 Based on the illustrated embodiment, 103 includes:
[0076] 301. Obtain a slope of each of the first boundary lines and a slope of the first intersecting boundary line intersecting with each of the first boundary lines.
[0077] 302. Obtain slopes of multiple candidate boundary lines in the second image.
[0078] 303. Select, from the multiple candidate boundary lines, a candidate boundary line whose slope differs from the slope of each of the first boundary lines by less than a preset slope threshold as the at least one second boundary line, and select, from the multiple candidate boundary lines, a candidate boundary line whose slope differs from the slope of the first intersecting boundary line by less than a preset slope threshold as the at least one third boundary line.
[0079] Based on this embodiment, at least one second boundary line similar to each first boundary line and at least one third boundary line similar to the first intersecting boundary line of each first boundary line may be selected based on the slopes between the boundary lines.
[0080] Optionally, in some of the implementations, in 301, the slope of each of the first boundary lines can be calculated, and the slope of the line segment on each of the first boundary lines can be recursively calculated using the bisection method, and the slope of the first intersecting boundary line that intersects with each of the first boundary lines can be calculated, and the slope of the line segment on the first intersecting boundary line that intersects with each of the first boundary lines can be recursively calculated using the bisection method.
[0081] And / or, in some implementations, in 302, the slope of each candidate boundary line among the multiple candidate boundary lines can be calculated respectively, and the slopes of the line segments on each candidate boundary line can be recursively calculated using the bisection method.
[0082] Optionally, in some of the implementations, the bisection method is used to recursively calculate the slope of the segment on a boundary line (such as the first boundary line, the first intersecting boundary line, the candidate boundary line, etc.) as follows:
[0083] Dividing the one boundary line into two segment segments based on the midpoint of the one boundary line;
[0084] Calculate the slope of one of the two line segments respectively;
[0085] Taking each of the line segments as the boundary line, the operations of dividing the boundary line into two line segments based on the midpoint of the boundary line and calculating the slope of one of the two line segments are iteratively performed until a preset condition is met.
[0086] Based on this embodiment, the slope of a boundary line can be calculated, and then the slopes of the line segments on the boundary line can be recursively calculated using the binary search method. Compared with calculating the slope of a boundary line point by point, the amount of calculated data is reduced and the calculation efficiency is improved.
[0087] Optionally, in some of the implementations, a preset condition is satisfied, for example: the number of iterative executions of operations 302 to 303 reaches a preset number of times; and / or the difference between the slope of the line segment and the slope of the line segment before the line segment is split is less than a preset threshold, that is, the difference between the efficiency of a line segment before being split and the slope of any of the two line segments obtained by further splitting is less than a preset threshold, that is, it is considered that the slopes of the two segments are similar and no further splitting is required; and / or the starting point and end point of each line segment coincide. Since the more slopes are calculated, the more accurate the slope comparison result is, and the more computing and storage resources are consumed, in actual calculations, the number of times the line segment needs to be split to calculate the slope can be determined based on the computing and storage performance, as well as the accuracy requirements for the image coincidence recognition results.
[0088] Figure 4 for Figure 1 Another flow chart of obtaining at least one second boundary line and at least one third boundary line in the embodiment shown. Figure 4 As shown, in Figure 1 Based on the illustrated embodiment, 103 includes:
[0089] 401. Obtain a first angle between each of the first boundary lines and a preset coordinate axis direction in a preset plane coordinate system, and obtain a second angle between the first intersecting boundary line intersecting with each of the first boundary lines and the preset coordinate axis direction.
[0090] 402. Obtain a third angle between each of the plurality of candidate boundary lines in the second image and the preset coordinate axis direction.
[0091] 403. Select, from the multiple candidate boundary lines, a candidate boundary line whose third angle has a difference with the first angle less than a second preset angle threshold as the at least one second boundary line, and select, from the multiple candidate boundary lines, a candidate boundary line whose third angle has a difference with the second angle less than the second preset angle threshold as the at least one third boundary line.
[0092] Based on this embodiment, at least one second boundary line similar to each first boundary line and at least one third boundary line similar to the first intersecting boundary line of each first boundary line can be selected based on the angle between the boundary line and the preset coordinate axis direction.
[0093] Figure 5FIG. 1 is a flow chart of a method for determining image coincidence provided by another embodiment of the present application. Figure 5 shown.
[0094] 501. Acquire at least one first boundary line in a first image.
[0095] 502. For each first boundary line of the at least one first boundary line, obtain a first intersecting boundary line that intersects with the at least one first boundary line.
[0096] 503. Obtain a fourth angle between each of the first boundary lines and the first intersecting boundary line.
[0097] 504. Acquire at least one second boundary line similar to each of the first boundary lines and at least one third boundary line similar to the first intersecting boundary line in the second image.
[0098] 505. Obtain a combination of the at least one second boundary line and the at least one third boundary line that intersect with each other to obtain K groups of intersecting boundary lines.
[0099] Each of the K groups of intersecting boundary lines includes a second boundary line and a third boundary line that intersect each other, and K is an integer greater than or equal to 0.
[0100] 506. Obtain a fifth angle between each group of intersecting boundary lines in the K groups of intersecting boundary lines.
[0101] 507. Select L groups of intersecting boundary lines from the K groups of intersecting boundary lines, wherein the difference between the fifth angle and the fourth angle is less than a first preset angle threshold.
[0102] Wherein, L is an integer greater than or equal to 0 and not greater than K;
[0103] 508. Determine the similarity between the first combination of intersecting boundary lines and the L groups of intersecting boundary lines.
[0104] The first intersecting boundary line combination includes each of the first boundary lines and the corresponding first intersecting boundary line.
[0105] 509. Determine a degree of overlap between the first image and the second image based on a degree of similarity corresponding to the at least one first boundary line.
[0106] Optionally, in some of the implementations, the similarity corresponding to the at least one first boundary line can be directly used as the degree of overlap between the first image and the second image; or, a correspondence between the similarity and the image overlap can be pre-set, and based on the correspondence, the degree of overlap corresponding to the similarity corresponding to the at least one first boundary line is obtained, that is, the degree of overlap between the first image and the second image.
[0107] Based on this embodiment, the fourth angle between each first boundary line and its first intersecting boundary line in the first image can be obtained first, and K groups of intersecting boundary lines consisting of at least one second boundary line and at least one third boundary line similar to each first boundary line and its first intersecting boundary line can be obtained from the second image. Based on the fourth angle, L groups of intersecting boundary lines are screened out from the K groups of intersecting boundary lines to compare the similarity with each first boundary line and its first intersecting boundary line, thereby realizing the screening of possibly similar boundary lines in the second image based on angular similarity, which can avoid the computational performance of comparing unnecessary combinations of intersecting boundary lines in the two images, save computing resources and improve computing efficiency, and will not miss possibly similar boundary lines, thereby ensuring accurate identification of the overlap between the two images.
[0108] Optionally, in some implementations, in 508, the number of intersections on each of the first boundary lines and the number of intersections on the first intersecting boundary line corresponding to each of the first boundary lines can be obtained, and then, for each group of intersecting boundary lines in the L groups of intersecting boundary lines, the number of intersections on the second boundary lines in each group of intersecting boundary lines and the number of intersections on the third boundary lines are obtained, and then, based on the number of intersections on each first boundary line and the number of intersections on the corresponding first intersecting boundary line, and the number of intersections on the second boundary line and the number of intersections on the third boundary line, the similarity of intersections between the first intersecting boundary line combination and each group of intersecting boundary lines is determined, and then, based on the similarity of intersections between the first intersecting boundary line combination and each group of intersecting boundary lines, the similarity between the first intersecting boundary line combination and the L groups of intersecting boundary lines is determined.
[0109] Since the number of intersection points reflects the crossing direction between the boundary lines in the image, and thus reflects the outline of the features in the image, based on this embodiment, for possible similar combinations of intersecting boundary lines in two images, the similarity between the combinations of intersecting boundary lines in the two images can be quickly determined by comparing the number of intersection points, thereby determining the degree of overlap between the two images.
[0110] Optionally, in the above implementation, the difference between the fourth angle between the first intersection boundary line combination and the fifth angle between each group of intersection boundary lines can be further obtained to determine the angular similarity between the first intersection boundary line combination and each group of intersection boundary lines. Accordingly, the similarity between the first intersection boundary line combination and the L groups of intersection boundary lines can be determined based on the intersection point similarity and the angular similarity between the first intersection boundary line combination and each group of intersection boundary lines.
[0111] Based on this embodiment, by combining the intersection point similarity and angle similarity between the intersecting boundary line combinations in the two images to determine the similarity between the intersecting boundary line combinations in the two images, the accuracy of the similarity between the intersecting boundary line combinations in the two images can be improved, thereby improving the accuracy of the overlap recognition and determination between the two images.
[0112] Or, optionally, in the above implementation, the slope of each of the first boundary lines and the slope of the first intersecting boundary line intersecting with each of the first boundary lines can also be obtained, and the slope of the second boundary line in each group of intersecting boundary lines and the slope of the third boundary line can be obtained, and then the first slope difference between the slope of each of the first boundary lines and the slope of the second boundary line in each group of intersecting boundary lines can be obtained, and the second slope difference between the slope of each of the first boundary lines and the slope of the third boundary line in each group of intersecting boundary lines can be obtained, and then, based on the first slope difference and the second slope difference, the slope similarity between the first intersecting boundary line combination and each group of intersecting boundary lines can be determined. Accordingly, the similarity between the first intersecting boundary line combination and the L groups of intersecting boundary lines can be determined based on the intersection point similarity and slope similarity between the first intersecting boundary line combination and each group of intersecting boundary lines.
[0113] Based on this embodiment, the similarity between the intersecting boundary line combinations in the two images is determined by combining the intersection point similarity and the slope similarity between the intersecting boundary line combinations in the two images, which can improve the accuracy of the similarity between the intersecting boundary line combinations in the two images, thereby improving the accuracy of the coincidence recognition and determination between the two images.
[0114] Optionally, in some of the implementations, in 509, based on the number of intersections on each of the at least one first boundary line, a weighted average can be performed on the similarities between the corresponding first intersecting boundary line combination and the L groups of intersecting boundary lines to obtain the degree of overlap between the first image and the second image.
[0115] For example, if two boundary lines in the first image are obtained as the at least one first boundary line to perform the above embodiment, the number of intersections on the two boundary lines is A and B respectively, and the similarities between the corresponding first intersecting boundary line combination and the L groups of intersecting boundary lines are m and n respectively, then the coincidence degree R between the first image and the second image can be obtained by weighted averaging using the following formula:
[0116] R=m*A)+(n*B) / (A+B)
[0117] Since the number of intersections reflects the crossing direction between the boundary lines in the image, and thus reflects the outline of the features in the image, boundary lines with a larger number of intersections can accurately reflect the content of the features in the image. Based on this embodiment, the corresponding similarities are weighted averaged based on the number of intersections on each first boundary line, which can improve the overlap between the first image and the second image.
[0118] Figure 6 A flowchart of a method for determining image coincidence provided in another embodiment of the present application is shown in FIG. Figure 6 shown.
[0119] 601. Receive an image upload request, where the image upload request is used to request uploading of the first image.
[0120] The image upload request may be initiated by the user to a website, forum, self-media platform or other platform when requesting to upload a first image.
[0121] 602. Acquire at least one first boundary line in a first image.
[0122] 603. For each first boundary line of the at least one first boundary line, obtain a first intersecting boundary line that intersects with each first boundary line.
[0123] 604 . Acquire at least one second boundary line similar to each of the first boundary lines and at least one third boundary line similar to the first intersecting boundary line in the second image.
[0124] 605. Determine the similarity between the first intersecting boundary line combination and the second intersecting boundary line combination.
[0125] The first intersecting boundary line combination includes each of the first boundary lines and the corresponding first intersecting boundary line, and the second intersecting boundary line combination includes the at least one second boundary line and the at least one third boundary line corresponding to the first group of intersecting boundary lines.
[0126] 606. Determine a degree of overlap between the first image and the second image based on a similarity corresponding to the at least one first boundary line.
[0127] Optionally, in some of the implementations, the similarity corresponding to the at least one first boundary line can be directly used as the degree of overlap between the first image and the second image; or, a correspondence between the similarity and the image overlap can be pre-set, and based on the correspondence, the degree of overlap corresponding to the similarity corresponding to the at least one first boundary line is obtained, that is, the degree of overlap between the first image and the second image.
[0128] 607. Identify whether the degree of overlap between the first image and the second image is lower than a preset threshold.
[0129] If the degree of overlap between the first image and the second image is lower than a preset threshold, it can be considered that the first image and the second image do not overlap, and execution 608; otherwise, if the degree of overlap between the first image and the second image is not lower than the preset threshold, it can be considered that the first image and the second image overlap, and execution 609.
[0130] 608. Store the first image in a database.
[0131] After the first image is stored in the database, the first image can be used as the second image in the future to compare the degree of coincidence with the image requested to be uploaded by the user.
[0132] 609. Output a prompt message indicating that the image upload failed.
[0133] Based on this embodiment, when a user requests to upload an image, it is possible to promptly identify in the database whether an image with a high degree of overlap in content with the image requested to be uploaded by the user already exists, thereby avoiding storing images with the same content, saving storage resources and maintenance resources, and avoiding subsequently recommending multiple images with the same content to other users, which can effectively improve the user experience.
[0134] The technical solution of the present application can be applied to image processing applications in terminals, servers and other devices. When the image repetitiveness recognition method provided in the embodiment of the present application is executed by using image processing applications, the overlap between two images can be recognized, thereby being able to recognize images with repeated content.
[0135] In addition, by adopting the technical solution provided in the present application, since it is possible to determine the degree of overlap between images by comparing the relationship between the combinations of intersecting boundary lines in the images, and thus determine whether the contents of two images are repeated, it is possible to avoid websites, forums, and self-media platforms from repeatedly collecting images with the same content, thereby saving storage resources and maintenance resources.
[0136] In addition, by adopting the technical solution provided in the present application, since it is possible to determine the degree of overlap between images by comparing the relationship between the combinations of intersecting boundary lines in the images, and thus determine whether the contents of two images are repeated, it is possible to avoid recommending multiple images with the same content to users when recommending images to users, thereby preventing users from viewing pictures with the same content, and effectively improving the user experience.
[0137] In addition, the technical solution provided by the present application reduces labor costs and improves recognition efficiency compared to detection methods that determine whether images are similar by manually comparing the contents of two images.
[0138] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0139] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0140] Figure 7 A block diagram of an exemplary computer system / server 12 suitable for use in implementing embodiments of the present application is shown. Figure 7 The computer system / server 12 shown is merely an example and should not limit the functionality and scope of use of the embodiments of the present application.
[0141] like Figure 7 As shown, computer system / server 12 is represented in the form of a general-purpose computing device. Components of computer system / server 12 may include, but are not limited to: one or more processors or processing units 16, storage devices or system memory 28, and buses 18 that connect different system components (including system memory 28 and processing units 16).
[0142] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0143] Computer system / server 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer system / server 12, including volatile and nonvolatile media, removable and non-removable media.
[0144] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The computer system / server 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 not shown, usually called a "hard drive"). Although Figure 7 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical medium) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present application.
[0145] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0146] The computer system / server 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), one or more devices that enable a user to interact with the computer system / server 12, and / or any device that enables the computer system / server 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 44. In addition, the computer system / server 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the computer system / server 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the computer system / server 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0147] The processing unit 16 executes various functional applications and data processing by running the programs stored in the system memory 28, such as implementing Figure 1 to Figure 6 The corresponding embodiment provides a method for determining image coincidence degree according to any one of the embodiments.
[0148] Another embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements Figure 1 to Figure 6 The corresponding embodiment provides a method for determining image coincidence degree according to any one of the embodiments.
[0149] Specifically, any combination of one or more computer-readable media can be used. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.
[0150] Computer-readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0151] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0152] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0153] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0154] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or page components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0155] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0156] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0157] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for determining image coincidence, characterized in that: include: Acquire at least one first boundary line in the first image; For each of the at least one first boundary line, respectively, obtain a first intersecting boundary line intersecting with each of the first boundary lines; Acquire at least one second boundary line similar to each of the first boundary lines and at least one third boundary line similar to the first intersecting boundary line in the second image; Selecting L groups of intersecting boundary lines from the second intersecting boundary line combination, and determining the similarity between the first intersecting boundary line combination and the L groups of intersecting boundary lines; wherein the first intersecting boundary line combination includes each of the first boundary lines and the corresponding first intersecting boundary line, and the second intersecting boundary line combination includes the at least one second boundary line and the at least one third boundary line corresponding to the first intersecting boundary line combination; Based on the number of intersections on each of the at least one first boundary line, a weighted average is performed on the similarities between the corresponding first intersecting boundary line combination and the L groups of intersecting boundary lines to determine the overlap between the first image and the second image.
2. The method according to claim 1, characterized in that Before acquiring at least one first boundary line in the first image, the method further includes: sharpening the received image to obtain the first image; or, sequentially sharpening and black-and-whitening the received image to obtain the first image; or, The received image is sequentially converted to black and white and sharpened to obtain the first image.
3. The method according to claim 1, characterized in that Before acquiring at least one first boundary line in the first image, the method further includes: Acquire the distance between two intersection points determined based on a preset method on the boundary line with the longest length in the first image to obtain a first distance; Acquire the distance between two intersection points determined based on the preset method on the boundary line with the longest length in the second image to obtain a second distance; Based on the first distance and the second distance, the first image is proportionally scaled along two coordinate axis directions in a preset plane coordinate system so that the first distance is close to the second distance.
4. The method according to claim 1, characterized in that: The acquiring at least one first boundary line in the first image comprises: Selecting at least one first boundary line from the first image in descending order of length; or, At least one first boundary line is selected from the first image in descending order of the number of intersection points.
5. The method according to claim 1, characterized in that The acquiring, in the second image, at least one second boundary line similar to each of the first boundary lines and at least one third boundary line similar to the first intersecting boundary line comprises: Respectively acquiring the slope of each of the first boundary lines and the slope of the first intersecting boundary line intersecting with each of the first boundary lines; Acquire slopes of a plurality of candidate boundary lines in the second image; A candidate boundary line whose slope differs from the slope of each of the first boundary lines by less than a preset slope threshold is selected from the multiple candidate boundary lines as the at least one second boundary line, and a candidate boundary line whose slope differs from the slope of the first intersecting boundary line by less than a preset slope threshold is selected from the multiple candidate boundary lines as the at least one third boundary line.
6. The method according to claim 5, characterized in that The obtaining of the slope of each of the first boundary lines and the slope of the first intersecting boundary line intersecting with each of the first boundary lines comprises: Calculating the slope of each first boundary line, and recursively calculating the slope of the line segments on each first boundary line using a binary search method; Calculating the slope of the first intersecting boundary line intersecting with each of the first boundary lines, and recursively calculating the slope of the sub-line segments on the first intersecting boundary line intersecting with each of the first boundary lines by using a binary search method; and / or, The obtaining the slopes of the plurality of candidate boundary lines in the second image includes: For each of the plurality of candidate boundary lines, the slope of each candidate boundary line is calculated, and the slopes of the line segments on each candidate boundary line are recursively calculated using a binary search method.
7. The method according to claim 1, characterized in that The acquiring, in the second image, at least one second boundary line similar to each of the first boundary lines and at least one third boundary line similar to the first intersecting boundary line comprises: Respectively obtain a first angle between each of the first boundary lines and a preset coordinate axis direction in a preset plane coordinate system, and obtain a second angle between the first intersecting boundary line intersecting with each of the first boundary lines and the preset coordinate axis direction; Respectively acquiring a third angle between each of the plurality of candidate boundary lines in the second image and the preset coordinate axis direction; A candidate boundary line whose third angle has a difference with the first angle less than a second preset angle threshold is selected from the multiple candidate boundary lines as the at least one second boundary line, and a candidate boundary line whose third angle has a difference with the second angle less than the second preset angle threshold is selected from the multiple candidate boundary lines as the at least one third boundary line.
8. The method according to any one of claims 1 to 7, characterized in that: The step of selecting L groups of intersecting boundary lines from the second set of intersecting boundary lines comprises: Acquire a fourth angle between each of the first boundary lines and the first intersecting boundary line; Acquire a combination of the at least one second boundary line and the at least one third boundary line that intersects, to obtain K groups of intersecting boundary lines; wherein each group of the K groups of intersecting boundary lines includes a second boundary line and a third boundary line that intersect, and K is an integer greater than or equal to 0; Obtaining a fifth angle between each group of intersecting boundary lines in the K groups of intersecting boundary lines; Select L groups of intersecting boundary lines from the K groups of intersecting boundary lines, wherein the difference between the fifth angle and the fourth angle is less than the first preset angle threshold; wherein L is an integer greater than or equal to 0 and not greater than K.
9. The method according to claim 1, characterized in that: The determining the similarity between the first intersection boundary line combination and the L groups of intersection boundary lines includes: Acquire the number of intersection points on each of the first boundary lines and the number of intersection points on the first intersecting boundary lines corresponding to each of the first boundary lines; For each group of the L groups of intersecting boundary lines, respectively, obtain the number of intersection points on the second boundary line and the number of intersection points on the third boundary line in each group of the intersecting boundary lines; Determine the similarity of intersections between the first intersection boundary line combination and each group of intersection boundary lines based on the number of intersections on each first boundary line and the number of intersections on the corresponding first intersection boundary line, and the number of intersections on the second boundary line and the number of intersections on the third boundary line; Based on the similarity of intersection points between the first intersection boundary line combination and each group of intersection boundary lines, the similarity between the first intersection boundary line combination and the L groups of intersection boundary lines is determined.
10. The method according to claim 9, characterized in that Also includes: Obtaining a difference between a fourth angle between the first combination of intersecting boundary lines and a fifth angle between each group of intersecting boundary lines, and determining an angle similarity between the first combination of intersecting boundary lines and each group of intersecting boundary lines; The determining the similarity between the first intersection boundary line combination and the L groups of intersection boundary lines based on the similarity of the intersection points between the first intersection boundary line combination and each group of intersection boundary lines includes: Based on the intersection point similarity and the angle similarity between the first intersection boundary line combination and each group of intersection boundary lines, the similarity between the first intersection boundary line combination and the L groups of intersection boundary lines is determined.
11. The method according to claim 9, characterized in that Also includes: Obtaining the slope of each of the first boundary lines and the slope of the first intersecting boundary line intersecting with each of the first boundary lines; Obtaining the slope of the second boundary line and the slope of the third boundary line in each group of intersecting boundary lines; Obtaining a first slope difference between the slope of each first boundary line and the slope of the second boundary line in each group of intersecting boundary lines, and obtaining a second slope difference between the slope of each first boundary line and the slope of the third boundary line in each group of intersecting boundary lines; Determining the slope similarity between the first intersection boundary line combination and each group of intersection boundary lines based on the first slope difference and the second slope difference; The determining the similarity between the first intersection boundary line combination and the L groups of intersection boundary lines based on the similarity of the intersection points between the first intersection boundary line combination and each group of intersection boundary lines includes: Based on the intersection point similarity and slope similarity between the first intersection boundary line combination and each group of intersection boundary lines, the similarity between the first intersection boundary line combination and the L groups of intersection boundary lines is determined.
12. The method according to any one of claims 1 to 7, characterized in that: Before acquiring at least one first boundary line in the first image, the method further includes: receiving an image upload request, where the image upload request is used to request uploading of the first image; After determining the degree of overlap between the first image and the second image, the method further includes: If the degree of overlap between the first image and the second image is lower than a preset threshold, the first image is stored in a database.
13. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 12.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Contour-extraction-based building image matching and fusion method
CN108537782A