Repeated image detection method and device
By acquiring and judging the matching intensity of feature points in repeated image detection, ensuring uniform distribution of feature points, the problem of low detection accuracy caused by feature point aggregation in the prior art is solved, and higher detection accuracy is achieved.
Patent Information
- Application Number
- CN202111493220.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-08
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2041-12-08
AI Technical Summary
The accuracy of repeated image detection in the prior art is low, mainly due to the feature point matching method, which affects the subsequent similarity calculation.
By obtaining the matching intensity of the feature points of the image to be detected and the reference image, we judge whether the feature points are the feature points with the largest matching intensity within the preset range, and determine them as the feature points to be detected. Image detection is performed based on these feature points to ensure the uniform distribution of the feature points.
The accuracy of repeated image detection is improved, feature point aggregation is avoided, and detection reliability is enhanced.
Smart Images

Figure CN114170576B_ABST
Abstract
Description
Technical Field
[0001] The present application mainly relates to the field of image processing technology, and specifically to a method and device for detecting repeated images. Background Art
[0002] In applications such as autonomous driving, map production, and smart transportation, it is often necessary to upload the information collected by the front-end camera to the cloud for processing. One way to do this is to extract appropriate images from the video and then upload them to the cloud for intelligent analysis. However, if duplicate images are transferred to cloud storage, the amount of waybill processing will increase, so duplicate images need to be identified. In the existing technology, the method for identifying duplicate images mainly uses conventional feature point matching methods, but the feature points extracted by this method are clustered and unevenly distributed in space. This feature will cause the final feature point pairs to also be clustered, which greatly affects the subsequent similarity calculation and results in a low accuracy rate for duplicate image detection.
[0003] That is, the accuracy of duplicate image detection in the prior art is low. Summary of the Invention
[0004] The present application provides a method and apparatus for detecting duplicate images, aiming to solve the problem of low accuracy of duplicate image detection in the prior art.
[0005] In a first aspect, the present application provides a method for detecting repeated images, the method comprising:
[0006] Obtaining an image to be detected and a reference image;
[0007] Obtaining the matching strength between each first feature point in the image to be detected and the reference image;
[0008] Determining whether each first feature point is a feature point with the greatest matching strength within its corresponding preset range, wherein the first feature point is within the corresponding preset range;
[0009] If the first feature point is the feature point with the largest matching strength within the corresponding preset range, the first feature point is determined as the feature point to be detected, and a plurality of feature points to be detected on the image to be detected are obtained;
[0010] The image to be detected and the reference image are detected based on a plurality of feature points to be detected on the image to be detected to obtain a detection result.
[0011] Optionally, obtaining the matching strength between each first feature point in the image to be detected and the reference image includes:
[0012] Extracting feature points from the image to be detected and the reference image to obtain a plurality of first feature points in the image to be detected and a plurality of second feature points in the reference image;
[0013] Determine each first feature point as a first target feature point;
[0014] Calculating the similarity between the first target feature point and each second feature point;
[0015] Sort the second feature points according to their similarity from large to small, and determine the first two second feature points after sorting as the third feature point and the fourth feature point of the first target feature point respectively;
[0016] The matching strength between the first target feature point and the reference image is determined based on the third feature point and the fourth feature point, and the matching strength between each first feature point and the reference image is obtained.
[0017] Optionally, the preset range is a circular range, and determining whether each first feature point is a feature point with the greatest matching strength within the corresponding preset range includes:
[0018] determining the first feature points as second target feature points respectively;
[0019] Obtaining the position and preset radius of the second target feature point;
[0020] Taking the position of the second target feature point as the center of the preset range and the preset radius as the radius of the preset range, generating a preset range corresponding to the second target feature point;
[0021] Determine whether the second target feature point is the feature point with the highest matching strength within the corresponding preset range.
[0022] Optionally, detecting the image to be detected and the reference image based on a plurality of feature points to be detected on the image to be detected to obtain a detection result includes:
[0023] Determining the number of matching feature point pairs based on a plurality of feature points to be detected on the image to be detected;
[0024] Determining whether the number of matching feature point pairs is greater than a first preset value;
[0025] If the number of the matching feature point pairs is greater than a first preset value, the detection result is determined to be image duplication.
[0026] Optionally, obtaining the matching strength between each first feature point in the image to be detected and the reference image includes:
[0027] Dividing the image to be detected into a plurality of first image areas, and dividing the reference image into a plurality of second image areas corresponding to the plurality of first image areas;
[0028] Performing pixel-level matching on each first image region and its corresponding second image region to obtain a region similarity between each first image region and its corresponding second image region;
[0029] determining the image similarity between the image to be detected and the reference image based on the region similarities corresponding to the respective first image regions;
[0030] If the image similarity is not greater than a second preset value, the matching strength between each first feature point in the image to be detected and the reference image is obtained.
[0031] Optionally, determining the image similarity between the image to be detected and the reference image according to the region similarities corresponding to the respective first image regions includes:
[0032] sorting the first image regions from large to small based on the region similarity to obtain a plurality of sorted first image regions;
[0033] Eliminating the top-ranked first image regions and the bottom-ranked first image regions from the sorted first image regions to obtain a plurality of third image regions;
[0034] The image similarity between the image to be detected and the reference image is determined according to the region similarities corresponding to each third image region.
[0035] Optionally, acquiring the image to be detected and the reference image includes:
[0036] Acquire a video to be detected, wherein the video to be detected is captured by a camera installed on the vehicle while the vehicle is moving;
[0037] Extracting multiple target images and the vehicle moving speed when each target image is captured from the video to be detected;
[0038] If the vehicle moving speed when the target image is captured is not greater than a preset speed, the target image is determined as the image to be detected.
[0039] In a second aspect, the present application provides a repeated image detection device, the repeated image detection device comprising:
[0040] A first acquisition unit, configured to acquire an image to be detected and a reference image;
[0041] A second acquiring unit, configured to acquire a matching strength between each first feature point in the image to be detected and the reference image;
[0042] A judging unit, configured to judge whether each first feature point is a feature point with the greatest matching strength within a corresponding preset range, wherein the first feature point is within the corresponding preset range;
[0043] a determining unit, configured to determine the first feature point as a feature point to be detected if the first feature point is a feature point with the greatest matching strength within a corresponding preset range, thereby obtaining a plurality of feature points to be detected on the image to be detected;
[0044] The detection unit is used to detect the image to be detected and the reference image based on a plurality of feature points to be detected on the image to be detected to obtain a detection result.
[0045] Optionally, the second acquiring unit is configured to:
[0046] Extracting feature points from the image to be detected and the reference image to obtain a plurality of first feature points in the image to be detected and a plurality of second feature points in the reference image;
[0047] Determine each first feature point as a first target feature point;
[0048] Calculating the similarity between the first target feature point and each second feature point;
[0049] Sort the second feature points according to their similarity from large to small, and determine the first two second feature points after sorting as the third feature point and the fourth feature point of the first target feature point respectively;
[0050] The matching strength between the first target feature point and the reference image is determined based on the third feature point and the fourth feature point, and the matching strength between each first feature point and the reference image is obtained.
[0051] Optionally, the preset range is a circular range, and the judging unit is configured to:
[0052] determining the first feature points as second target feature points respectively;
[0053] Obtaining the position and preset radius of the second target feature point;
[0054] Taking the position of the second target feature point as the center of the preset range and the preset radius as the radius of the preset range, generating a preset range corresponding to the second target feature point;
[0055] Determine whether the second target feature point is the feature point with the highest matching strength within the corresponding preset range.
[0056] Optionally, the detection unit is used to:
[0057] Determining the number of matching feature point pairs based on a plurality of feature points to be detected on the image to be detected;
[0058] Determining whether the number of matching feature point pairs is greater than a first preset value;
[0059] If the number of the matching feature point pairs is greater than a first preset value, the detection result is determined to be image duplication.
[0060] Optionally, the second acquiring unit is configured to:
[0061] Dividing the image to be detected into a plurality of first image areas, and dividing the reference image into a plurality of second image areas corresponding to the plurality of first image areas;
[0062] Performing pixel-level matching on each first image region and its corresponding second image region to obtain a region similarity between each first image region and its corresponding second image region;
[0063] determining the image similarity between the image to be detected and the reference image based on the region similarities corresponding to the respective first image regions;
[0064] If the image similarity is not greater than a second preset value, the matching strength between each first feature point in the image to be detected and the reference image is obtained.
[0065] Optionally, the second acquiring unit is used to:
[0066] sorting the first image regions from large to small based on the region similarity to obtain a plurality of sorted first image regions;
[0067] Eliminating the top-ranked first image regions and the bottom-ranked first image regions from the sorted first image regions to obtain a plurality of third image regions;
[0068] The image similarity between the image to be detected and the reference image is determined according to the region similarities corresponding to each third image region.
[0069] Optionally, the first acquiring unit is configured to:
[0070] Acquire a video to be detected, wherein the video to be detected is captured by a camera installed on the vehicle while the vehicle is moving;
[0071] Extracting multiple target images and the vehicle moving speed when each target image is captured from the video to be detected;
[0072] If the vehicle moving speed when the target image is captured is not greater than a preset speed, the target image is determined as the image to be detected.
[0073] In a third aspect, the present application provides a computer device, comprising:
[0074] one or more processors;
[0075] Memory; and
[0076] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the method for detecting repeated images according to any one of the first aspects.
[0077] In a fourth aspect, the present application provides a computer-readable storage medium storing a plurality of instructions, wherein the instructions are suitable for loading by a processor to execute the steps in the method for detecting repeated images according to any one of the first aspects.
[0078] The present application provides a method and device for detecting repeated images, which includes: obtaining an image to be detected and a reference image; obtaining the matching strength between each first feature point in the image to be detected and the reference image; judging whether each first feature point is a feature point with the greatest matching strength within its corresponding preset range, wherein the first feature point is located within the corresponding preset range; if the first feature point is the feature point with the greatest matching strength within the corresponding preset range, determining the first feature point as the feature point to be detected, and obtaining multiple feature points to be detected on the image to be detected; detecting the image to be detected and the reference image based on the multiple feature points to be detected on the image to be detected, and obtaining a detection result. In the prior art, the feature points extracted by the feature point matching method are clustered and unevenly distributed in space, which makes the final feature point pairs also clustered, resulting in a low accuracy rate of repeated image detection. The present application creatively proposes a repeated image detection method, firstly obtaining the matching strength of each first feature point in the image to be detected and the reference image, and when the first feature point is the feature point with the largest matching strength in the corresponding preset range, determining the first feature point as the feature point to be detected for repeated image detection. On the one hand, the feature point to be detected is the point with the highest matching strength in the preset range, and can more accurately represent the characteristics of the feature points within the preset range; on the other hand, it can ensure that there are no other feature points in the preset range where the feature point to be detected is located, thereby homogenizing the feature points, avoiding the clustering of feature points, and improving the accuracy rate of repeated image detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0080] Figure 1 Schematic diagram of a scene of a repeated image detection system provided in an embodiment of the present application;
[0081] Figure 2 1 is a flow chart of an embodiment of a method for detecting repeated images provided in an embodiment of the present application;
[0082] Figure 3 1 is a flow chart of another embodiment of the method for detecting repeated images provided in the embodiments of the present application;
[0083] Figure 4 1 is a schematic structural diagram of an embodiment of a device for detecting repeated images provided in an embodiment of the present application;
[0084] Figure 5 It is a schematic diagram of the structure of an embodiment of the computer device provided in the embodiments of the present application. DETAILED DESCRIPTION
[0085] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0086] In the description of the present application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the present application, "multiple" means two or more, unless otherwise clearly and specifically defined.
[0087] In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is given to enable any person skilled in the art to implement and use the present application. In the following description, details are listed for the purpose of explanation. It should be understood that one of ordinary skill in the art can recognize that the present application can be implemented without using these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the present application with unnecessary details. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in this application.
[0088] The embodiments of the present application provide a method and apparatus for detecting repeated images, which are described in detail below.
[0089] See also Figure 1 , Figure 1 This is a schematic diagram of a scenario of a repeated image detection system provided in an embodiment of the present application. The repeated image detection system may include a computer device 100, in which a repeated image detection apparatus is integrated.
[0090] In the embodiments of the present application, the computer device 100 may be an independent server, or a server network or server cluster composed of servers. For example, the computer device 100 described in the embodiments of the present application includes, but is not limited to, a computer, a network host, a single network server, a set of multiple network servers, or a cloud server composed of multiple servers. A cloud server is composed of a large number of computers or network servers based on cloud computing.
[0091] In the embodiment of the present application, the computer device 100 can be a general-purpose computer device or a dedicated computer device. In a specific implementation, the computer device 100 can be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device, an embedded device, etc. This embodiment does not limit the type of the computer device 100.
[0092] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or fewer computer devices as shown in Figure 1Only one computer device is shown in the figure. It can be understood that the repeated image detection system can also include one or more other computer devices that can process data, which is not limited here.
[0093] In addition, if Figure 1 As shown, the repeated image detection system may further include a memory 200 for storing data.
[0094] It should be noted that Figure 1 The scenario diagram of the duplicate image detection system shown is merely an example. The duplicate image detection system and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. A person skilled in the art will appreciate that, with the evolution of the duplicate image detection system and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is equally applicable to similar technical problems.
[0095] First, an embodiment of the present application provides a method for detecting repeated images, which includes: obtaining an image to be detected and a reference image; obtaining the matching strength between each first feature point in the image to be detected and the reference image; judging whether each first feature point is a feature point with the largest matching strength within its corresponding preset range, wherein the first feature point is located within the corresponding preset range; if the first feature point is the feature point with the largest matching strength within the corresponding preset range, then the first feature point is determined as the feature point to be detected, and multiple feature points to be detected on the image to be detected are obtained; based on the multiple feature points to be detected on the image to be detected, the image to be detected and the reference image are detected to obtain a detection result.
[0096] like Figure 2 As shown, Figure 2 2 is a flow chart of an embodiment of a method for detecting repeated images provided in an embodiment of the present application. The method for detecting repeated images includes the following steps S201 to S205:
[0097] S201: Acquire an image to be detected and a reference image.
[0098] In an embodiment of the present application, the image to be detected and the reference image can be any two images. In a specific scenario, the image to be detected and the reference image are two images of the same video to be detected. The reference image can also be an image taken before the image to be detected in the same video to be detected. For example, the reference image and the image to be detected are the front and back frames of the same video to be detected. Of course, the reference image can also be an image cached in the cloud. The video to be detected can be captured by a camera installed on a vehicle while the vehicle is moving. For example, a camera is installed on the electric bike of a courier. When the courier is delivering the package by bike, the camera captures the surrounding environment to obtain the video to be detected.
[0099] In a specific embodiment, obtaining the image to be detected and the reference image may include:
[0100] (1) Obtain the video to be detected.
[0101] The video to be detected is captured by a camera installed on the vehicle while the vehicle is moving.
[0102] (2) Extract multiple target images and the vehicle moving speed when each target image is taken from the video to be detected.
[0103] Each frame of the video to be detected can be determined as the target image, or one frame of the video to be detected can be obtained from the video to be detected at intervals of a preset number of frames as the target image. The preset number of frames can be set according to the specific situation, for example, 2 frames, 3 frames, etc. Specifically, the vehicle's moving speed at the time each frame of the video to be detected is read from the vehicle's speed sensor, and the vehicle's moving speed at the time each target image is captured is determined based on the vehicle's moving speed at the time each frame is captured.
[0104] (3) If the vehicle moving speed when the target image is taken is not greater than the preset speed, the target image is determined as the image to be detected.
[0105] The preset speed can be set to a specific value, such as 10 m / s or another value, depending on the specific situation. If the vehicle's speed at the time the target image is captured is greater than the preset speed, it indicates that the vehicle was moving at a high speed and the target image is likely dissimilar to the reference image. In this case, the target image can be used directly to update the reference image. If the vehicle's speed at the time the target image is captured is less than the preset speed, it indicates that the vehicle was moving at a low speed and requires detection. In this case, the target image is determined as the image to be detected.
[0106] In a specific embodiment, to improve computational speed, the acquired image to be detected and the reference image are scaled to a preset size. This size is required to ensure that there are sufficient feature points in the image to ensure that subsequent feature point pairing is performed properly. This can generally be determined by statistical experiments on actual captured video. For example, the preset size in this application is 320x240.
[0107] S202: Obtain the matching strength between each first feature point in the image to be detected and the reference image.
[0108] In the embodiment of the present application, obtaining the matching strength between each first feature point in the image to be detected and the reference image may include:
[0109] (1) Feature points are extracted from the image to be detected and the reference image to obtain a plurality of first feature points in the image to be detected and a plurality of second feature points in the reference image.
[0110] In one specific embodiment, the scale-invariant feature transform (SIFT) algorithm is used to extract feature points from the image to be detected and the reference image, obtaining a plurality of first feature points in the image to be detected and a plurality of second feature points in the reference image. Of course, in other embodiments, the SURF algorithm, ORB algorithm, or the like can also be used to extract feature points from the image to be detected and the reference image, obtaining a plurality of first feature points in the image to be detected and a plurality of second feature points in the reference image. The SIFT algorithm is a computer vision algorithm. It is used to detect and describe local features in images. It searches for extreme points in a spatial scale and extracts their position, scale, and rotation invariants. The description and detection of local image features can help identify objects. SIFT features are based on local points of interest on the object's appearance and are independent of the image's size and rotation. They are also highly tolerant to light, noise, and slight changes in viewing angle. Due to these characteristics, they are highly significant and relatively easy to extract. In a large feature database, objects can be easily identified with minimal misidentification. SIFT feature points contain a large amount of information, making them suitable for fast and accurate matching in massive databases. The SIFT algorithm mainly includes the following steps: constructing a Gaussian pyramid scale space, calculating extreme points in the Gaussian pyramid scale space, obtaining feature points with sub-pixel accuracy through quadratic curve interpolation, removing low-contrast points, and removing edge response points by calculating the Hessian matrix.
[0111] (2) Each first feature point is determined as a first target feature point.
[0112] (3) Calculate the similarity between the first target feature point and each second feature point.
[0113] In the embodiment of the present application, the Euclidean distance between the first target feature point and each second feature point is calculated, and the Euclidean distance between the first target feature point and each second feature point is determined as the similarity between the first target feature point and each second feature point.
[0114] In another specific embodiment, each feature point has three pieces of information: position, scale, and orientation. A descriptor is created for each feature point, using a set of vectors to describe the key point, ensuring that it remains stable under various conditions, such as changes in lighting and viewing angle. This descriptor includes not only the feature point but also the surrounding pixels that contribute to it. The descriptor should be highly unique to increase the probability of a correct feature point match.
[0115] Specifically, the SIFT operator is used to calculate the descriptor of the first target feature point and the descriptors of each second feature point, the Euclidean distance between the descriptor of the first target feature point and the descriptor of the second feature point is calculated, and the Euclidean distance between the descriptor of the first target feature point and the descriptor of the second feature point is determined as the similarity between the first target feature point and the second feature point. Among them, the SIFT algorithm describes the feature points detected in the image with a 128-dimensional feature vector. Therefore, after passing through the SIFT algorithm, an image is represented as a 128-dimensional feature vector set. This feature vector set has the characteristics of being invariant to image scaling, translation, and rotation, and is also invariant to a certain extent to lighting, affine, and projection transformations. It is a very excellent local feature description algorithm.
[0116] (4) Sort the second feature points according to their similarity from large to small, and determine the first two second feature points after sorting as the third feature point and the fourth feature point of the first target feature point respectively.
[0117] For the first target feature point p in the image to be detected, its spatial coordinates can be represented by (x1p, y1p), and its descriptor is a d-dimensional vector V(p). A second feature point q exists in the reference image, and its descriptor is a vector V(q). The similarity between points p and q, Dist(p,q), is expressed as the Euclidean distance between their descriptors. Dist(p,q) = ||V(p) - V(q)||. The third feature point is the nearest neighbor, and the fourth feature point is the next nearest neighbor.
[0118] (5) Determine the matching strength between the first target feature point and the reference image based on the third feature point and the fourth feature point, and obtain the matching strength between each first feature point and the reference image.
[0119] In a specific embodiment, the ratio of the similarity between the first target feature point and the fourth feature point to the similarity between the first target feature point and the third feature point is determined as the matching strength M(p) between the first feature point and the reference image.
[0120] Assuming that there are a third feature point s and a fourth feature point t in the reference image, the matching strength M(p) between the first target feature point p and the reference image is M(p) = Dist(p,t) / Dist(p,s), that is, the ratio of the similarity Dist(p,t) between the first target feature point p and the fourth feature point t and the Euclidean distance Dist(p,s) between the similarity between the first target feature point p and the third feature point s. The larger the ratio, the more reliable the feature point pair formed by the first target feature point p. Preferably, the first target feature point and the feature point in the reference image with the highest similarity to the first target feature point form a feature point pair, that is, the first target feature point and the corresponding third feature point form a feature point pair. Of course, in other embodiments, the first target feature point can also be formed into a feature point pair with another feature point in the reference image.
[0121] S203: Determine whether each first feature point is a feature point with the greatest matching strength within the corresponding preset range.
[0122] The first feature point is located within the corresponding preset range.
[0123] In the embodiment of the present application, the preset range can be a variety of shapes such as a rectangle, an ellipse, a triangle, a square, and a circle. The first feature point is located at the centroid of the corresponding preset range. The area of the preset range is smaller than the area of the image to be detected.
[0124] In a specific embodiment, determining whether each first feature point is a feature point with the greatest matching strength within the corresponding preset range may include:
[0125] (1) The first feature points are respectively determined as the second target feature points.
[0126] (2) Obtain the position and preset radius of the second target feature point.
[0127] In the embodiment of the present application, the preset radius r can be set according to specific circumstances.
[0128] (3) The position of the second target feature point is determined as the center of the preset range, and the preset radius is used as the radius of the preset range to generate the preset range corresponding to the second target feature point.
[0129] (4) Determine whether the second target feature point is the feature point with the highest matching strength within the corresponding preset range.
[0130] S204 : If the first feature point is the feature point with the largest matching strength within the corresponding preset range, the first feature point is determined as the feature point to be detected, and a plurality of feature points to be detected on the image to be detected are obtained.
[0131] After obtaining the matching strength of each first feature point in the image to be detected, for point p, if the matching strength M(p) of point p is the maximum value within the circle with p as the center and radius r, then point p is retained as the feature point to be detected and the corresponding feature point pair, otherwise it is removed.
[0132] By using S201-S204, we have completed the equalization of the feature points of the image to be detected and the equalization of the feature point pairs with the feature points of the image to be detected as reference points.
[0133] Furthermore, the matching strength between each second feature point in the image to be detected and the reference image is obtained; it is determined whether each second feature point is the feature point with the greatest matching strength within its corresponding preset range, wherein the second feature point is located within the corresponding preset range; if the second feature point is the feature point with the greatest matching strength within the corresponding preset range, the second feature point is determined as the feature point to be detected, and a plurality of feature points to be detected on the reference image are obtained. This application exchanges the image to be detected and the reference image, and can also obtain a set of feature points of the reference image and corresponding feature point pairs. Finally, the feature points and feature point pairs under the two methods are merged as the final result of this step.
[0134] S205 : Detecting the image to be detected and the reference image based on the plurality of feature points to be detected on the image to be detected to obtain a detection result.
[0135] In a specific embodiment, detecting the image to be detected and the reference image based on a plurality of feature points to be detected on the image to be detected to obtain a detection result may include:
[0136] (1) Determine the number of matching feature point pairs based on multiple feature points to be detected on the image to be detected.
[0137] In an embodiment of the present application, the number of matching feature point pairs may be the number of multiple feature points to be detected on the image to be detected, or the sum of the multiple feature points to be detected on the image to be detected and the multiple feature points to be detected on the reference image.
[0138] Furthermore, the feature point to be detected and the corresponding third feature point form a set of feature point pairs. The relative distance between each feature point to be detected and the corresponding third feature point is obtained; the feature point to be detected and the third feature point whose relative distance is less than a preset distance are determined as fixed feature point pairs, and the number of fixed feature point pairs is determined as the number of matching feature point pairs. The preset distance T can be set according to specific circumstances. Specifically, the fixed feature point pairs satisfy the relationship shown in formula (1).
[0139] (x 1i -x 2i ) 2 +(y 1i -y 2i ) 2 <T (1)
[0140] Among them, x 1i and y 1i x is the horizontal and vertical coordinates of the feature point to be detected in the fixed feature point pair. 2i and y 2i are the horizontal and vertical coordinates of the third feature point corresponding to the feature point to be detected in the fixed feature point pair; T is the preset distance.
[0141] When T is set to a small value, the formula can be understood as that the points in the reference image and the corresponding points in the image to be detected are almost in the same position.
[0142] (2) Determine whether the number of matching feature point pairs is greater than a first preset value.
[0143] The first preset value T2 can be set according to specific circumstances.
[0144] (3) If the number of matching feature point pairs is greater than a first preset value, the detection result is determined to be image duplication.
[0145] If the number of matching feature point pairs exceeds the first preset value T2, it indicates that a large number of fixed points exist. It can be assumed that the reference image has not changed position relative to the image being tested. In other words, it has neither rotated nor translated in terms of pose. The detection result is determined to be image duplication. If the number of matching feature point pairs is not greater than the first preset value T2, the detection result is determined to be image dissimilarity.
[0146] Since feature points are robust to lighting and have local characteristics, the similarity based on feature point comparison can effectively overcome the interference of lighting changes and moving objects in the picture, and improve the accuracy of duplicate image detection.
[0147] Furthermore, if the detection result is that the images are not similar, the reference image is updated to the image to be detected.
[0148] Further, such as Figure 3 As shown, Figure 3 3 is a flow chart of another embodiment of a method for detecting repeated images provided in an embodiment of the present application. The method for detecting repeated images includes the following steps S301 to S308:
[0149] S301: Acquire an image to be detected and a reference image.
[0150] In the embodiment of the present application, the specific steps of S301 can refer to S201 of the previous embodiment and will not be repeated here.
[0151] S302 : Divide the image to be detected into a plurality of first image regions; and divide the reference image into a plurality of second image regions corresponding to the plurality of first image regions.
[0152] The multiple first image regions can be arranged in a matrix. The image to be detected with an image resolution of mh×nw is divided into multiple first image regions of size m×n and number h×w. Similarly, the reference image is divided into multiple second image regions of size m×n and number h×w.
[0153] S303 : Perform pixel-level matching on each first image region and its corresponding second image region to obtain a region similarity between each first image region and its corresponding second image region.
[0154] In this embodiment, a Normalized Cross Correlation (NCC) algorithm is used to perform pixel-level matching between each first image region and its corresponding second image region to determine the regional similarity between each first image region and its corresponding second image region. The NCC algorithm is primarily based on pixel comparison and is used to evaluate the autocorrelation of local image blocks. By removing the mean, it can reduce the impact of localized illumination unevenness on similarity calculations.
[0155] The calculation method of the region similarity s(k) between the kth first image region and the corresponding second image region is shown in formula (2):
[0156]
[0157] Among them, μ I and μ J denotes the pixel mean of the kth first image region in the image to be detected and the pixel mean of the second image region in the reference image, respectively, where m is the image width of the kth first image region, n is the image height of the kth first image region, (x k ,y k ) is the pixel point in the kth first image area, I represents the image to be detected, and J represents the reference image, where,
[0158]
[0159]
[0160] S304: Determine the image similarity between the image to be detected and the reference image according to the region similarities corresponding to the first image regions.
[0161] In a specific embodiment, the average similarity of the region similarities corresponding to the first image regions is determined as the image similarity between the image to be detected and the reference image.
[0162] In another specific embodiment, determining the image similarity between the image to be detected and the reference image according to the region similarities corresponding to each first image region may include:
[0163] (1) Sort the first image regions from large to small based on the region similarity to obtain a plurality of sorted first image regions.
[0164] (2) Eliminate the top-ranked first image regions and the bottom-ranked first image regions from the sorted first image regions to obtain a plurality of third image regions.
[0165] Among them, a preset proportion of first image areas with a high ranking of regional similarity and a preset proportion of first image areas with a low ranking are eliminated from the multiple first image areas to obtain multiple third image areas. The preset proportion can be 5%, 10%, etc. For example, the preset proportion is 10%. In order to reduce the interference of a very small number of local small blocks, before calculating the final image similarity, this application sorts the regional similarities s(k), removes the highest and lowest 10%, and then uses the average similarity of the remaining image areas as the similarity of the entire image.
[0166] (3) Determine the image similarity between the image to be detected and the reference image based on the region similarities corresponding to each third image region.
[0167] Specifically, the average similarity of the region similarities corresponding to each third image region is determined as the image similarity between the image to be detected and the reference image.
[0168] S305: If the image similarity is not greater than the second preset value, obtain the matching strength between each first feature point in the image to be detected and the reference image.
[0169] The second preset value T1 can be set according to specific circumstances, for example, the second preset value T1 is 80%. If the image similarity is not greater than the second preset value, it means that the two images are not very similar. However, in a high-frame-rate video stream, adjacent frames change slowly, and the pixel differences in almost every part of the image are not large. This part of the repeated image can be discovered by pixel comparison. However, as time passes, sudden changes in illumination may occur, especially when a small part of a moving object appears in the picture or the overall image rotates slightly. The difference between pixels will suddenly change. At this time, the similarity based on pixel comparison is no longer applicable. At this time, it is necessary to obtain the matching strength of each first feature point in the image to be detected and the reference image for secondary judgment. Then, the matching strength of each first feature point in the image to be detected and the reference image is obtained.
[0170] In the embodiment of the present application, the matching strength between each first feature point in the image to be detected and the reference image is obtained, which can be referred to S202 of the previous embodiment and will not be repeated here.
[0171] S306: Determine whether each first feature point is a feature point with the greatest matching strength within its corresponding preset range.
[0172] In the embodiment of the present application, the specific steps of S306 can refer to S203 of the previous embodiment and will not be repeated here.
[0173] S307 : If the first feature point is the feature point with the largest matching strength within the corresponding preset range, the first feature point is determined as the feature point to be detected, and a plurality of feature points to be detected on the image to be detected are obtained.
[0174] In the embodiment of the present application, the specific steps of S307 can refer to S204 of the previous embodiment and will not be repeated here.
[0175] S308 : Detecting the image to be detected and the reference image based on the plurality of feature points to be detected on the image to be detected to obtain a detection result.
[0176] In the embodiment of the present application, the specific steps of S308 can refer to S205 of the previous embodiment and will not be repeated here.
[0177] In order to better implement the repeated image detection method in the embodiment of the present application, based on the repeated image detection method, the embodiment of the present application also provides a repeated image detection device, such as Figure 4 As shown, the repeated image detection device 400 includes:
[0178] A first acquisition unit 401 is used to acquire an image to be detected and a reference image;
[0179] The second acquisition unit 402 is used to obtain the matching strength between each first feature point in the image to be detected and the reference image;
[0180] A judging unit 403 is configured to judge whether each first feature point is a feature point with the greatest matching strength within its corresponding preset range, wherein the first feature point is within the corresponding preset range;
[0181] A determining unit 404 is configured to determine the first feature point as a feature point to be detected if the first feature point is the feature point with the greatest matching strength within the corresponding preset range, thereby obtaining a plurality of feature points to be detected on the image to be detected;
[0182] The detection unit 405 is configured to detect the image to be detected and the reference image based on a plurality of feature points to be detected on the image to be detected, and obtain a detection result.
[0183] Optionally, the second acquiring unit 402 is configured to:
[0184] Extracting feature points from the image to be detected and the reference image to obtain a plurality of first feature points in the image to be detected and a plurality of second feature points in the reference image;
[0185] Determine each first feature point as a first target feature point;
[0186] Calculating the similarity between the first target feature point and each second feature point;
[0187] Sort the second feature points according to their similarity from large to small, and determine the first two second feature points after sorting as the third feature point and the fourth feature point of the first target feature point respectively;
[0188] The matching strength between the first target feature point and the reference image is determined based on the third feature point and the fourth feature point, and the matching strength between each first feature point and the reference image is obtained.
[0189] Optionally, the preset range is a circular range, and the judgment unit 403 is configured to:
[0190] Determine the first feature points as second target feature points respectively;
[0191] Obtaining the position and preset radius of the second target feature point;
[0192] The preset range corresponding to the second target feature point is generated by taking the position of the second target feature point as the center of the preset range and the preset radius as the radius of the preset range;
[0193] Determine whether the second target feature point is the feature point with the highest matching strength within the corresponding preset range.
[0194] Optionally, the detection unit 405 is configured to:
[0195] Determine the number of matching feature point pairs based on a plurality of feature points to be detected on the image to be detected;
[0196] Determine whether the number of matching feature point pairs is greater than a first preset value;
[0197] If the number of matching feature point pairs is greater than a first preset value, the detection result is determined to be image duplication.
[0198] Optionally, the second acquiring unit 402 is configured to:
[0199] Dividing the image to be detected into a plurality of first image areas, and dividing the reference image into a plurality of second image areas corresponding to the plurality of first image areas;
[0200] Performing pixel-level matching on each first image region and its corresponding second image region to obtain a region similarity between each first image region and its corresponding second image region;
[0201] Determining the image similarity between the image to be detected and the reference image based on the region similarities corresponding to each first image region;
[0202] If the image similarity is not greater than the second preset value, the matching strength between each first feature point in the image to be detected and the reference image is obtained.
[0203] Optionally, the second acquiring unit 402 is configured to:
[0204] sorting the first image regions from large to small based on the region similarity to obtain a plurality of sorted first image regions;
[0205] Eliminating the top-ranked first image regions and the bottom-ranked first image regions from the sorted first image regions to obtain a plurality of third image regions;
[0206] The image similarity between the image to be detected and the reference image is determined according to the region similarities corresponding to each third image region.
[0207] Optionally, the first acquiring unit 401 is configured to:
[0208] Obtaining a video to be detected, wherein the video to be detected is captured by a camera installed on a vehicle while the vehicle is moving;
[0209] Extracting multiple target images and the vehicle moving speed when each target image is taken from the video to be detected;
[0210] If the vehicle moving speed when the target image is captured is not greater than the preset speed, the target image is determined as the image to be detected.
[0211] The present application also provides a computer device that integrates any of the repeated image detection devices provided in the present application. The computer device includes:
[0212] one or more processors;
[0213] Memory; and
[0214] One or more applications, wherein the one or more applications are stored in the memory and are configured to execute, by the processor, the steps of the method for detecting repeated images in any of the above-mentioned embodiments of the method for detecting repeated images.
[0215] like Figure 5 , which shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0216] The computer device may include one or more processing cores of a processor 501, one or more computer-readable storage media of a memory 502, a power supply 503, an input unit 504, and other components. Those skilled in the art will appreciate that the computer device structure shown in the figure does not limit the computer device, and may include more or fewer components than shown, or combine certain components, or arrange the components differently. Among them:
[0217] The processor 501 is the control center of the computer device. It connects the various parts of the entire computer device using various interfaces and lines. By running or executing software programs and / or modules stored in the memory 502 and calling data stored in the memory 502, it performs various functions of the computer device and processes data, thereby monitoring the computer device as a whole. Optionally, the processor 501 may include one or more processing cores; the processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Preferably, the processor 501 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and application programs, and the modem processor primarily processes wireless communications. It is understood that the modem processor may not be integrated into the processor 501.
[0218] The memory 502 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing by running the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 502 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.
[0219] The computer device also includes a power supply 503 for supplying power to various components. Preferably, the power supply 503 can be logically connected to the processor 501 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 503 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0220] The computer device may further include an input unit 504 , which may be configured to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0221] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 501 in the computer device will load the executable files corresponding to one or more application processes into the memory 502 according to the following instructions, and the processor 501 will run the application stored in the memory 502 to implement various functions as follows:
[0222] Obtaining an image to be detected and a reference image;
[0223] Obtaining the matching strength between each first feature point in the image to be detected and the reference image;
[0224] Determining whether each first feature point is a feature point with the greatest matching strength within its corresponding preset range, wherein the first feature point is within the corresponding preset range;
[0225] If the first feature point is the feature point with the largest matching strength within the corresponding preset range, the first feature point is determined as the feature point to be detected, and a plurality of feature points to be detected on the image to be detected are obtained;
[0226] The image to be detected and the reference image are detected based on a plurality of feature points to be detected on the image to be detected to obtain a detection result.
[0227] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0228] To this end, embodiments of the present application provide a computer-readable storage medium, which may include a read-only memory (ROM), random access memory (RAM), a disk, or an optical disk. A computer program is stored on the computer-readable storage medium, and the computer program is loaded by a processor to execute the steps of any of the duplicate image detection methods provided in embodiments of the present application. For example, the computer program loaded by the processor may execute the following steps:
[0229] Obtaining an image to be detected and a reference image;
[0230] Obtaining the matching strength between each first feature point in the image to be detected and the reference image;
[0231] Determining whether each first feature point is a feature point with the greatest matching strength within its corresponding preset range, wherein the first feature point is within the corresponding preset range;
[0232] If the first feature point is the feature point with the largest matching strength within the corresponding preset range, the first feature point is determined as the feature point to be detected, and a plurality of feature points to be detected on the image to be detected are obtained;
[0233] The image to be detected and the reference image are detected based on a plurality of feature points to be detected on the image to be detected to obtain a detection result.
[0234] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above and will not be repeated here.
[0235] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to implement as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments and will not be repeated here.
[0236] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0237] The above is a detailed introduction to a method and device for detecting repeated images provided in an embodiment of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, based on the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for detecting repeated images, characterized in that: include: Obtaining an image to be detected and a reference image; Obtaining the matching strength between each first feature point in the image to be detected and the reference image; Determining whether each first feature point is a feature point with the greatest matching strength within its corresponding preset range, wherein the first feature point is within the corresponding preset range; If the first feature point is the feature point with the largest matching strength within the corresponding preset range, the first feature point is determined as the feature point to be detected, and a plurality of feature points to be detected on the image to be detected are obtained; Determining the number of matching feature point pairs based on a plurality of feature points to be detected on the image to be detected; Determining whether the number of matching feature point pairs is greater than a first preset value; If the number of the matching feature point pairs is greater than a first preset value, determining that the detection result is an image duplication; The obtaining of the matching strength between each first feature point in the image to be detected and the reference image includes: Extracting feature points from the image to be detected and the reference image to obtain a plurality of first feature points in the image to be detected and a plurality of second feature points in the reference image; Determine each first feature point as a first target feature point; Calculating the similarity between the first target feature point and each second feature point; Sort the second feature points according to their similarity from large to small, and determine the first two second feature points after sorting as the third feature point and the fourth feature point of the first target feature point respectively; The matching strength between the first target feature point and the reference image is determined based on the third feature point and the fourth feature point, and the matching strength between each first feature point and the reference image is obtained.
2. The method for detecting repeated images according to claim 1, wherein: The preset range is a circular range, and the step of determining whether each first feature point is a feature point with the greatest matching strength within the corresponding preset range includes: determining the first feature points as second target feature points respectively; Obtaining the position and preset radius of the second target feature point; Taking the position of the second target feature point as the center of the preset range and the preset radius as the radius of the preset range, generating a preset range corresponding to the second target feature point; Determine whether the second target feature point is the feature point with the highest matching strength within the corresponding preset range.
3. The method for detecting repeated images according to claim 1, wherein: The step of obtaining the matching strength between each first feature point in the image to be detected and the reference image further includes: Dividing the image to be detected into a plurality of first image areas, and dividing the reference image into a plurality of second image areas corresponding to the plurality of first image areas; Performing pixel-level matching on each first image region and its corresponding second image region to obtain a region similarity between each first image region and its corresponding second image region; determining the image similarity between the image to be detected and the reference image based on the region similarities corresponding to the respective first image regions; If the image similarity is not greater than a second preset value, the matching strength between each first feature point in the image to be detected and the reference image is obtained.
4. The method for detecting repeated images according to claim 3, wherein: The determining the image similarity between the image to be detected and the reference image according to the region similarities corresponding to the respective first image regions includes: sorting the first image regions from large to small based on the region similarity to obtain a plurality of sorted first image regions; Eliminating the top-ranked first image regions and the bottom-ranked first image regions from the sorted first image regions to obtain a plurality of third image regions; The image similarity between the image to be detected and the reference image is determined according to the region similarities corresponding to each third image region.
5. The method for detecting repeated images according to claim 1, wherein: The obtaining of the image to be detected and the reference image comprises: Acquire a video to be detected, wherein the video to be detected is captured by a camera installed on the vehicle while the vehicle is moving; Extracting multiple target images and the vehicle moving speed when each target image is captured from the video to be detected; If the vehicle moving speed when the target image is captured is not greater than a preset speed, the target image is determined as the image to be detected.
6. A device for detecting repeated images, characterized in that: The repeated image detection device comprises: A first acquisition unit, configured to acquire an image to be detected and a reference image; A second acquiring unit, configured to acquire a matching strength between each first feature point in the image to be detected and the reference image; A judging unit, configured to judge whether each first feature point is a feature point with the greatest matching strength within a corresponding preset range, wherein the first feature point is within the corresponding preset range; a determining unit, configured to determine the first feature point as a feature point to be detected if the first feature point is a feature point with the greatest matching strength within a corresponding preset range, thereby obtaining a plurality of feature points to be detected on the image to be detected; a detection unit, configured to determine a number of matching feature point pairs based on a plurality of feature points to be detected on the image to be detected; determine whether the number of matching feature point pairs is greater than a first preset value; and determine that a detection result is an image duplication if the number of matching feature point pairs is greater than the first preset value; The second acquiring unit is further configured to: Extracting feature points from the image to be detected and the reference image to obtain a plurality of first feature points in the image to be detected and a plurality of second feature points in the reference image; Determine each first feature point as a first target feature point; Calculating the similarity between the first target feature point and each second feature point; Sort the second feature points according to their similarity from large to small, and determine the first two second feature points after sorting as the third feature point and the fourth feature point of the first target feature point respectively; The matching strength between the first target feature point and the reference image is determined based on the third feature point and the fourth feature point, and the matching strength between each first feature point and the reference image is obtained.
7. A computer device, characterized in that: The computer device comprises: one or more processors; Memory; and One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the repeated image detection method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the method for detecting repeated images according to any one of claims 1 to 5.
Citation Information
Patent Citations
A splicing method of multi-repeat texture images
CN109598675A
Image detection method and device, electronic equipment and storage medium
CN111476780A