Image coincidence recognition method, electronic device and computer-readable storage medium
By calculating the slope difference of the image boundary line, the problem of repeated inclusion and recommendation of images is solved, and resource conservation and user experience improvement are achieved.
Patent Information
- Application Number
- CN202011414523.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-03
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2040-12-03
AI Technical Summary
The prior art is difficult to effectively identify and avoid repeated inclusion and recommendation of images, resulting in waste of storage resources and reduced user experience.
By obtaining the boundary line slope in the image, calculating the boundary line slope difference, determining the boundary line similarity, thereby identifying the degree of overlap between images.
Recognition of image repeatability is achieved, avoiding waste of storage resources and reduced user experience, reducing labor costs and improving identification efficiency.
Smart Images

Figure CN112464956B_ABST
Abstract
Description
[Technical field]
[0001] The present application relates to video processing technology, and in particular to an image coincidence recognition method, 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 an image coincidence recognition method, an electronic device, and a computer-readable storage medium for identifying coincidence between images.
[0006] In one aspect of the present application, a method for identifying image coincidence is provided, comprising:
[0007] Acquire a first boundary line in the first image;
[0008] Acquire the slope of the first boundary line, and acquire the slope of a second boundary line in the second image corresponding to the first boundary line;
[0009] determining a difference between a slope of the first boundary line and a slope of the second boundary line;
[0010] A similarity between the first boundary line and the second boundary line is determined based on the difference, so as to determine a degree of coincidence between the first image and the second image according to the similarity.
[0011] Another aspect of the present application provides an electronic device, the electronic device comprising:
[0012] one or more processors;
[0013] a storage device for storing one or more programs,
[0014] When the one or more programs are executed by the one or more processors, the one or more processors implement the image coincidence recognition method provided in the above aspect.
[0015] Another aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image coincidence recognition method provided in the above aspect.
[0016] It can be seen from the above technical solution that the embodiment of the present application obtains the first boundary line in the first image, and further obtains the slope of the first boundary line, and the slope of the second boundary line corresponding to the first boundary line in the second image, and then determines the difference between the slope of the first boundary line and the slope of the second boundary line, and then determines the similarity between the first boundary line and the second boundary line based on the difference, so as to determine the overlap between the first image and the second image according to the similarity. In this way, the recognition of the overlap between the two images is achieved, so that images with repeated content can be identified.
[0017] In addition, by adopting the technical solution provided in the present application, since it is possible to identify whether there are images with duplicate content based on the slope of the boundary line in the image, 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.
[0018] In addition, by adopting the technical solution provided in the present application, since it is possible to identify whether there are images with duplicate content based on the slope of the boundary line in the image, 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.
[0019] 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
[0020] 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.
[0021] Figure 1 A schematic diagram of a flow chart of an image coincidence recognition method provided in one embodiment of the present application;
[0022] Figure 2 An example diagram of an image received and a first image in an embodiment of the present application;
[0023] Figure 3 A schematic diagram of a process for obtaining the slope of the first boundary line in an embodiment of the present application;
[0024] Figure 4 This is an example diagram of a slope binary tree in an embodiment of the present application;
[0025] Figure 5 An example diagram of a weighted slope binary tree in an embodiment of the present application;
[0026] Figure 6 A schematic diagram of a flow chart of an image coincidence recognition method provided by another embodiment of the present application;
[0027] 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]
[0028] 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.
[0029] 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.
[0030] 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.
[0031] 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.
[0032] Therefore, there is an urgent need to provide a method for identifying image repetitiveness, so as to identify images with repetitive content.
[0033] Figure 1 A schematic diagram of a process for image coincidence recognition provided by an embodiment of the present application is shown in FIG. Figure 1 shown.
[0034] 101. Acquire a first boundary line in a first image.
[0035] 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.
[0036] 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.
[0037] 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.
[0038] 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.
[0039] 102. Obtain a slope of the first boundary line, and obtain a slope of a second boundary line in a second image corresponding to the first boundary line.
[0040] 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.
[0041] 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.
[0042] 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.
[0043] 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.
[0044] 103. Determine a difference between a slope of the first boundary line and a slope of the second boundary line.
[0045] 104. Determine a similarity between the first boundary line and the second boundary line based on the difference, so as to determine a degree of overlap between the first image and the second image according to the similarity.
[0046] It should be noted that part or all of the execution entities of 101 to 104 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, and the embodiments of the present application do not specifically limit this.
[0047] 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.
[0048] In this way, the recognition of the overlap between two images is achieved, so that images with repeated content can be identified.
[0049] In addition, by adopting the technical solution provided in the present application, since it is possible to identify whether there are images with duplicate content based on the slope of the boundary line in the image, 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.
[0050] In addition, by adopting the technical solution provided in the present application, since it is possible to identify whether there are images with duplicate content based on the slope of the boundary line in the image, 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.
[0051] 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.
[0052] The embodiments of the present application can be applied to any website, forum, self-media platform, etc. to identify the content duplication of images uploaded by users. 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.
[0053] 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.
[0054] Optionally, in some implementations, before 101, the received image may be sharpened to obtain the first image.
[0055] 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.
[0056] 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.
[0057] 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.
[0058] 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.
[0059] 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.
[0060] 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-whitening the left image. The white edge lines of the brim, shoulders, hair, etc. in the right image are the boundary lines.
[0061] 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.
[0062] Optionally, in some of the implementations, before 101, the rectangular boundary area of the longest boundary line among the first boundary lines, that is, the circumscribed rectangular area of the longest boundary line, can be obtained, and then, based on a preset size, and the length and height of the rectangular boundary area, the first boundary line can be proportionally scaled along the two coordinate axis directions in the preset plane coordinate system.
[0063] Based on this embodiment, a rectangular boundary area of the longest boundary line in the first boundary lines is obtained, and based on the length and height of the rectangular boundary area, the first boundary line is proportionally scaled along the two coordinate axis directions in the preset plane coordinate system with a preset size as the standard. Without changing the shape of the boundary line, the boundary line is proportionally scaled in two directions to the preset standard size. This can avoid the inability to accurately obtain the slope of the first boundary line due to the small size of the first image, and can also avoid the large size of the first image causing the slopes of some points located at the peaks and troughs to be magnified, thereby affecting the overall slope. This helps to accurately determine the slope of the first boundary line, thereby improving the similarity results between boundary lines, and ultimately improving the overlap recognition results between images.
[0064] Optionally, in some implementations, in 101, at least one boundary line in the first image may be obtained as the first boundary line based on a preset method.
[0065] For example, the longest boundary line can be selected from the first image as the first boundary line, or the longest boundary line and at least one boundary line intersecting with the longest boundary line can be selected from the first image as the first boundary line, or at least one boundary line can be selected from the first image in descending order of length as the first boundary line. Alternatively, multiple boundary lines can be selected from the first image in descending order of length, and at least one boundary line intersecting with each of the multiple boundary lines can be selected as the first boundary line. The embodiment of the present application does not limit the method for selecting the first boundary line and the number of specifically selected boundary lines, which can be set according to specific needs.
[0066] Since longer boundary lines correspond to larger contours of objects in the image, they can better reflect the content of the image as a whole. Based on this embodiment, longer boundary lines are selected from the image, or intersecting boundary lines are further selected to determine the degree of overlap between the image and other images, which helps to improve the accuracy of the image overlap recognition results.
[0067] Optionally, in some implementations, the first boundary line includes at least one boundary line to be identified. Accordingly, in 102, when obtaining the slope of the first boundary line, the slope of each boundary line to be identified can be calculated for each boundary line to be identified in the at least one boundary line to be identified, and the slope of the sub-line segment on each boundary line to be identified can be recursively calculated using a binary search method.
[0068] Optionally, in some implementations, the second boundary line includes at least one reference boundary line.
[0069] Optionally, in the above embodiments of the present application, it is also possible to compare the number of slopes corresponding to each boundary line to be identified with the number of slopes corresponding to each reference boundary line in at least one reference boundary line corresponding to each boundary line to be identified for each boundary line to be identified. The number of slopes corresponding to each boundary line to be identified is the number of slopes of each boundary line to be identified and the slopes of all line segments on each boundary line to be identified, and the number of slopes corresponding to each reference boundary line is the number of slopes of each reference boundary line and the slopes of all line segments on each reference boundary line. If the number of slopes corresponding to each boundary line to be identified is inconsistent with the number of slopes corresponding to each corresponding reference boundary line, the slope of each corresponding boundary line to be identified can be interpolated or sampled based on the number of slopes corresponding to each reference boundary line, so that the number of slopes corresponding to each boundary line to be identified obtained by interpolation or sampling is consistent with the number of slopes corresponding to each corresponding reference boundary line.
[0070] Based on this embodiment, the number of slopes of the two compared boundary lines can be made consistent, thereby achieving corresponding comparison of the slopes of the two boundary lines.
[0071] Figure 3 FIG. 1 is a flow chart of obtaining the slope of the first boundary line in one embodiment of the present application. Figure 3 As shown, obtaining the slope of each boundary line to be identified can be achieved in the following way:
[0072] 301. Calculate the slope of each boundary line to be identified.
[0073] 302. Divide each of the boundary lines to be identified into two segment segments based on the midpoint of each of the boundary lines to be identified.
[0074] 303. Calculate the slope of each of the two line segments respectively.
[0075] 304. Taking each of the line segments as each of the boundary lines to be identified, iteratively perform operations 302 to 303 until a preset condition is met.
[0076] Based on this embodiment, the slope of each boundary line to be identified can be calculated, and then the slope of each line segment on the boundary line to be identified can be recursively calculated using the binary search method. Compared with calculating the slope of each boundary line to be identified point by point, the amount of calculated data is reduced and the calculation efficiency is improved.
[0077] Optionally, in some of the implementations, a preset condition is satisfied, for example, it may be: the number of iterative executions of operations 302 to 303 reaches a preset number of times; and / or, the difference between the slope of each line segment and the slope of the line segment before each line segment is segmented is less than a preset threshold, that is, the difference between the efficiency of a line segment before being segmented and the slope of any of the two line segments obtained by further segmentation is less than a preset threshold, that is, it is considered that the slopes of the two segments are similar and no further segmentation 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 segmented 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.
[0078] based on Figure 3 In the manner of the illustrated embodiment, the slope of each to-be-identified boundary line in the first boundary lines may be calculated respectively, thereby obtaining the slope of the first boundary line.
[0079] Optionally, in some of the implementations, by Figure 3 After obtaining the slope of each boundary line to be identified, the embodiment shown can also store the slope of each boundary line to be identified and the slope of the line segment on each boundary line to be identified in a tree structure to obtain a first slope binary tree. The node value of each layer of nodes in the first slope binary tree represents the slope of the line segment obtained after each boundary line to be identified is divided a corresponding number of times. The deeper the level of the node in the tree structure, the more corresponding division times. For example, the node value of the first-layer (highest-layer) node represents the slope of each boundary line to be identified, which can be understood as the slope of the line segment obtained after each boundary line to be identified is divided 0 times (i.e., not divided); the node value of the second-layer node represents the slope of the two line segments obtained after each boundary line to be identified is divided once; the node value of the third-layer node represents the slope of the four line segments obtained after each boundary line to be identified is divided twice (i.e., the two line segments obtained after being divided once are divided separately), ... and so on. The slopes of line segments that are divided more times can be stored through deeper nodes.
[0080] Optionally, in some implementations, in 102, when obtaining the slope of the second boundary line corresponding to the first boundary line in the second image, a second slope binary tree corresponding to each reference boundary line in the second boundary line can be obtained from a database. The second slope binary tree stores the slope of each reference boundary line and the slope of the segment obtained by recursively dividing each reference boundary line using the binary division method in a tree structure, and the node value of each layer of nodes in the second slope binary tree represents the slope of the segment obtained after each reference boundary line is divided a corresponding number of times, and the deeper the node level, the more corresponding division times.
[0081] Figure 4 This is an example diagram of a slope binary tree in an embodiment of the present application. The slope binary tree is an example of the slope of the boundary line and the slope of the line segment on the boundary line stored in a tree structure, which can be a first slope binary tree or a second slope binary tree. Taking the slope of a boundary line to be identified stored in the first slope binary tree as an example, it means that the boundary line to be identified is divided twice. The first time, the boundary line to be identified is divided into two line segments: line segment 1 and line segment 2. The second time, line segment 1 and line segment 2 are each divided into two line segments: line segment 11, line segment 12, line segment 21, and line segment 22. Among them, the node value 0 of the first-layer (highest-layer) nodes represents the slope of a boundary line to be identified, and the node values 1.2 and 2.3 of the second-layer nodes respectively represent the slopes of segment 1 and segment 2 obtained after the boundary line to be identified is divided once; the node values 0.5 and -8.1 of the third-layer nodes respectively represent the slopes of segment 11 and segment 12 obtained by dividing segment 1, and the node values 1.3 and 4.2 of the third-layer nodes respectively represent the slopes of segment 21 and segment 22 obtained by dividing segment 2.
[0082] Accordingly, in 103, the difference between the node values of the corresponding hierarchical nodes in the first slope binary tree of each boundary line to be identified and the corresponding second slope binary tree of each reference boundary line can be determined respectively, so as to obtain the difference between the slope of the first boundary line and the slope of the second boundary line. For example, the difference between the node values of the corresponding hierarchical nodes in the first slope binary tree of all boundary lines to be identified in the first boundary line and the corresponding second slope binary tree of each reference boundary line can be summed to obtain the difference between the slope of the first boundary line and the slope of the second boundary line.
[0083] In the embodiment of the present application, the slope of the second boundary line in the second image can be obtained in advance by adopting the method of obtaining the slope of the first boundary line in the above embodiment, and stored in the database corresponding to the second image. Alternatively, the slope of the second boundary line in the second image can be obtained in real time by adopting the method of obtaining the slope of the first boundary line in the above embodiment. The embodiment of the present application does not limit this.
[0084] Optionally, in some of the implementations, in 104, the similarity between each of the boundary lines to be identified and each of the corresponding reference boundary lines can be determined based on the difference between the node values of the corresponding hierarchical nodes and the weight corresponding to the hierarchical depth of each hierarchical node in the tree structure.
[0085] The deeper the level of each node in the tree structure, the smaller the corresponding weight. Figure 5 As shown, it is an example diagram of a weighted slope binary tree in an embodiment of the present application, wherein the values 1 and 0.8 on the connecting line between two nodes are the weights corresponding to the differences between the node values of the nodes of the upper level connected by the connecting line.
[0086] For example, in a specific implementation, the similarity R between each to-be-identified boundary line and each corresponding reference boundary line may be calculated by the following formula:
[0087]
[0088] Among them, Wi represents the weight corresponding to the hierarchical depth of each hierarchical node in the tree structure, Di represents the difference between the node values of the corresponding hierarchical nodes, and k represents the normalization coefficient, which is a value greater than 0 and less than 1. The smaller the value of R, the more similar each boundary line to be identified is to each corresponding reference boundary line.
[0089] Specifically, the differences between the node values of the corresponding hierarchical nodes in each of the to-be-identified boundary lines and the corresponding reference boundary lines can be weighted and then summed up by the weights corresponding to the hierarchical depths of the hierarchical nodes in the tree structure, to obtain the similarity between each to-be-identified boundary line and the corresponding reference boundary line. Then, the similarities between all the to-be-identified boundary lines in the first boundary line and the corresponding reference boundary lines can be summed up to obtain the similarity between the first boundary line and the second boundary line.
[0090] Optionally, in some of the implementations, different weights can be set in advance for borderlines of different lengths according to preset rules, and the longer the borderline, the higher the weight, and the shorter the borderline, the lower the weight. When determining the similarity between the first borderline and the second borderline based on the similarity between each of the borderlines to be identified and each of the corresponding reference borderlines, the weight corresponding to the length of each of the borderlines to be identified in the first borderline can be first determined, and the similarity between the borderline to be identified and each of the corresponding reference borderlines can be weighted by the weight corresponding to the length of each of the borderlines to be identified, and then the weighted similarities corresponding to all the borderlines to be identified are summed to obtain the similarity between the first borderline and the second borderline.
[0091] Based on this embodiment, the corresponding similarities are weighted based on the weights corresponding to the lengths of each boundary line to be identified in the first boundary line, and then the weighted similarities corresponding to all the boundary lines to be identified are summed as the similarity between the first boundary line and the second boundary line. Since the longer the boundary line, the higher the weight, and the shorter the boundary line, the lower the weight, in this way, the role of larger contours in the image (corresponding to longer boundary lines) in the image coincidence determination can be improved, and the influence of smaller details (corresponding to shorter boundary lines, such as facial wrinkles) on the image coincidence determination can be reduced, thereby improving the accuracy of the image coincidence recognition results.
[0092] Figure 6 A flowchart of an image coincidence recognition method provided by another embodiment of the present application is shown in FIG. Figure 6 shown.
[0093] 601. Receive an image upload request, where the image upload request is used to request uploading of the first image.
[0094] 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.
[0095] 602. Acquire a first boundary line in a first image.
[0096] 603. Obtain a slope of the first boundary line, and obtain a slope of a second boundary line in the second image corresponding to the first boundary line.
[0097] 604. Determine a difference between a slope of the first boundary line and a slope of the second boundary line.
[0098] 605. Determine a similarity between the first boundary line and the second boundary line based on the difference, and determine a degree of overlap between the first image and the second image according to the similarity.
[0099] Optionally, in some of the implementations, the similarity between the first boundary line and the second boundary line can be directly used as the overlap between the first image and the second image; or, the correspondence between the boundary line similarity and the image overlap can be pre-set, and after determining the similarity between the first boundary line and the second boundary line, the correspondence is queried to obtain the overlap corresponding to the similarity between the first boundary line and the second boundary line, which is the overlap between the first image and the second image.
[0100] 606. Identify whether the degree of overlap between the first image and the second image is lower than a preset threshold.
[0101] 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 execute 607; 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 execute 608.
[0102] 607. Store the first image and the slope corresponding to the first image in a database.
[0103] After storing the first image and the slope corresponding to the first image in the database, the first image can be used as the second image in the future to compare the degree of overlap with the image requested to be uploaded by the user.
[0104] 608. Output a prompt message indicating that the image upload failed.
[0105] Based on this embodiment, when a user requests to upload an image, it is possible to promptly identify whether an image with the same content as the image requested to be uploaded by the user already exists in the database, 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.
[0106] 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.
[0107] In addition, by adopting the technical solution provided in the present application, since it is possible to identify whether there are images with duplicate content based on the slope of the boundary line in the image, 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.
[0108] In addition, by adopting the technical solution provided in the present application, since it is possible to identify whether there are images with duplicate content based on the slope of the boundary line in the image, 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.
[0109] 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.
[0110] 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.
[0111] 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.
[0112] 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.
[0113] 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).
[0114] 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.
[0115] 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.
[0116] 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.
[0117] 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.
[0118] 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.
[0119] 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 identifying image repeatability in any embodiment.
[0120] 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 identifying image repeatability in any embodiment.
[0121] 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.
[0122] 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.
[0123] 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.
[0124] 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).
[0125] 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.
[0126] 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.
[0127] 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.
[0128] 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.
[0129] 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 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.
[0130] 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 identifying image coincidence, characterized in that: include: According to the length of the boundary line, acquiring at least one boundary line in the first image as a first boundary line, wherein the first boundary line includes at least one boundary line to be identified; Acquire the slope of the first boundary line, and acquire the slope of a second boundary line corresponding to the first boundary line in the second image, wherein the second boundary line includes at least one reference boundary line; Determining the similarity between each to-be-identified boundary line and each corresponding reference boundary line according to the difference between the node values of each corresponding level node in the first slope binary tree of each to-be-identified boundary line and the second slope binary tree of each corresponding reference boundary line, wherein the first slope binary tree is obtained according to the slope of the first boundary line, and the second slope binary tree is obtained according to the slope of the second boundary line; Based on the weight corresponding to the length of each boundary line to be identified, the similarities between each boundary line to be identified and the corresponding reference boundary lines are weighted respectively, and the similarity between the first boundary line and the second boundary line is determined according to the addition result of the weighted similarities, so as to determine the overlap between the first image and the second image according to the similarity, wherein the longer the boundary line is, the higher the weight corresponding to it.
2. The method according to claim 1, characterized in that Before acquiring the 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 the first boundary line in the first image, the method further includes: Obtain a rectangular boundary area of the boundary line with the longest length among the first boundary lines; Based on the preset size, and the length and height of the rectangular boundary area, the first boundary line is proportionally scaled along two coordinate axis directions in a preset plane coordinate system.
4. The method according to claim 1, characterized in that The acquiring, according to the length of the boundary line, at least one boundary line in the first image as the first boundary line comprises: Selecting the longest boundary line from the first image; or, Selecting the longest boundary line and at least one boundary line intersecting with the longest boundary line from the first image; or, Selecting at least one boundary line from the first image in descending order of length; or, A plurality of boundary lines and at least one boundary line respectively intersecting with each of the plurality of boundary lines are selected from the first image in descending order of length.
5. The method according to claim 1, characterized in that: The obtaining the slope of the first boundary line includes: For each of the at least one boundary line to be identified, the slope of each boundary line to be identified is calculated respectively, and the slopes of the line segments on each boundary line to be identified are recursively calculated using a binary search method.
6. The method according to claim 5, characterized in that The method further comprises: For each of the boundary lines to be identified, respectively, compare whether the number of slopes corresponding to each of the boundary lines to be identified is consistent with the number of slopes corresponding to each of the reference boundary lines in the at least one reference boundary line corresponding to each of the boundary lines to be identified; the number of slopes corresponding to each of the boundary lines to be identified is the number of slopes of each of the boundary lines to be identified and the number of slopes of all line segments on each of the boundary lines to be identified, and the number of slopes corresponding to each of the reference boundary lines is the number of slopes of each of the reference boundary lines and the number of slopes of all line segments on each of the reference boundary lines; If the number of slopes corresponding to each boundary line to be identified is inconsistent with the number of slopes corresponding to each reference boundary line, the slopes of each boundary line to be identified are interpolated or sampled based on the number of slopes corresponding to each reference boundary line, so that the number of slopes corresponding to each boundary line to be identified obtained by interpolation or sampling is consistent with the number of slopes corresponding to each reference boundary line.
7. The method according to claim 5, characterized in that The recursive calculation of the slope of each line segment on each boundary line to be identified by using the binary division method includes: Cutting each of the boundary lines to be identified into two segment segments based on the midpoint of each of the boundary lines to be identified; Calculate the slope of each of the two line segments respectively; Taking each of the line segments as each of the boundary lines to be identified, the operations of dividing each of the boundary lines to be identified into two line segments based on the midpoint of each of the boundary lines to be identified and calculating the slope of each of the two line segments respectively are iteratively performed until a preset condition is met.
8. The method according to claim 7, characterized in that The satisfying of the preset conditions includes: The number of iterative executions of the operations of dividing each boundary line to be identified into two sub-line segments based on the midpoint of each boundary line to be identified and respectively calculating the slope of each of the two sub-line segments reaches a preset number; and / or, A difference between the slope of each of the line segments and the slope of the line segment before each of the line segments is divided is less than a preset threshold.
9. The method according to claim 7, characterized in that: Also includes: The slope of each boundary line to be identified and the slope of the line segment on each boundary line to be identified are stored in a tree structure to obtain a first slope binary tree. The node value of each layer of nodes in the first slope binary tree represents the slope of the line segment obtained after each boundary line to be identified is divided a corresponding number of times. The deeper the level of the node in the tree structure, the more corresponding division times.
10. The method according to claim 9, characterized in that The acquiring a slope of a second boundary line corresponding to the first boundary line in the second image includes: A second slope binary tree corresponding to each reference boundary line in the second boundary line is obtained from the database. The second slope binary tree stores the slope of each reference boundary line and the slopes of the segmented lines obtained by recursively dividing each reference boundary line using binary division in a tree structure. The node value of each layer of nodes in the second slope binary tree represents the slope of the segment obtained after each reference boundary line is divided a corresponding number of times. The deeper the node level, the more corresponding division times.
11. The method according to claim 10, characterized in that Determining the similarity between each to-be-identified boundary line and each corresponding reference boundary line according to the difference between the node values of the corresponding hierarchical nodes in the first slope binary tree of each to-be-identified boundary line and the second slope binary tree of each corresponding reference boundary line includes: For each of the boundary lines to be identified and each of the corresponding reference boundary lines, the similarity between each of the boundary lines to be identified and each of the corresponding reference boundary lines is determined based on the difference between the node values of the corresponding hierarchical nodes and the weight corresponding to the hierarchical depth of each hierarchical node in the tree structure; wherein, the deeper the hierarchical depth of each hierarchical node in the tree structure, the smaller the corresponding weight.
12. The method according to any one of claims 1 to 11, characterized in that: Before acquiring the 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 overlap between the first image and the second image is lower than a preset threshold, the first image and the slope corresponding to the second image are 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.