CN-121999249-A - Image similarity detection method, device, equipment and storage medium
Abstract
The application discloses an image similarity detection method, device, equipment and storage medium, and relates to the field of image processing. The method comprises the steps of respectively detecting the brightness and contrast of images of a target image and a reference image, carrying out brightness difference compensation and contrast limiting enhancement, carrying out front background separation on to-be-processed areas of two preprocessed images through a sliding window, selecting an ith target area of the target image, traversing all to-be-compared areas in the reference image, carrying out similarity calculation on the front background images to obtain an ith area score, sliding traversing all target areas of the target image, carrying out weighted aggregation on all area scores, and outputting an image global similarity value. According to the scheme, through brightness difference compensation and contrast limitation enhancement preprocessing and combining a foreground and background separated region similarity calculation mechanism, the adaptability and accuracy of the algorithm in complex scenes are improved.
Inventors
- Request for anonymity
- Request for anonymity
- Request for anonymity
Assignees
- 深存科技(无锡)有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260104
Claims (10)
- 1. An image similarity detection method, the method comprising: respectively detecting the brightness and contrast of the images of the target image and the reference image, and carrying out brightness difference compensation and contrast limitation enhancement; Sequentially separating foreground and background of the areas to be processed of the two preprocessed images through the sliding window; Selecting an ith target area in the target graph, sliding and traversing all areas to be compared in the reference graph, and respectively carrying out similarity calculation on the foreground image and the background image to obtain an ith area score; and sliding and traversing all target areas of the target graph, carrying out weighted aggregation on all area scores, and outputting an image global similarity value.
- 2. The method of claim 1, wherein the performing similarity calculation on the foreground image and the background image comprises: Respectively calculating brightness similarity Contrast similarity And structural texture similarity ; Based on brightness similarity Contrast similarity And structural texture similarity Calculating block similarity The following is indicated: Wherein, the Representing the weight coefficient; And calculating and obtaining the ith region score based on the foreground similarity and the background similarity.
- 3. The method of claim 2, wherein the computing the i-th region score based on foreground similarity and background similarity comprises: Respectively calculating the foreground similarity and the background similarity of the ith target region and each region to be compared in the reference map, and calculating a similarity score by combining the foreground similarity and the background similarity; And sequencing all the similarity scores, and determining the highest similarity score as the ith region score of the ith target region.
- 4. A method according to claim 3, wherein said calculating a similarity score in combination with said foreground similarity and said background similarity comprises: Respectively obtaining the number of non-0 pixel points in two image blocks And (3) with And calculates a foreground difference compensation value The expression is as follows: obtaining a similarity score based on the foreground difference compensation value, the foreground similarity and the background similarity weighted calculation The expression is as follows: Wherein, the Respectively representing a foreground similarity value, a foreground difference compensation value and a background similarity value; is a proportionality coefficient.
- 5. The method of claim 1, wherein the sliding through all target regions of the target graph and weighting and aggregating all region scores, outputting an image global similarity value, comprises: As a value of the global similarity it is, For the number of sliding traversal regions in the target graph, The region score for the i-th target region is represented.
- 6. The method of any one of claims 1-5, wherein the compensating for brightness differences comprises: Calculating the image brightness of the target image and the reference image respectively And calculates the image brightness difference The expression is as follows: A weak brightness image therein based on the image brightness difference Image enhancement is performed as follows: Wherein, the Representing pixel points in RGB images Is set to the maximum channel brightness value of (a), The size of the image is indicated and, And Representing the brightness of two images; Representing the brightness of the image after brightness enhancement.
- 7. The method of claim 6, wherein contrast-limited enhancement comprises: dividing the image after brightness difference compensation into a plurality of sub-image blocks, and calculating contrast limiting coefficients The expression is as follows: obtaining an original histogram for each sub-tile Will exceed And uniformly reassigning the redundant pixels to all gray levels to obtain a clipping histogram ; Based on the cutout histogram integration and the luminance map, a contrast-limited enhanced output image is calculated, represented as follows: Wherein, the As the contrast-limiting coefficient(s), As the pixel points in the sub-tile, For the gray scale level of the image, For gray levels in sub-tiles not exceeding the initial pixel value Is added to the total number of pixels of (a), To limit the balanced pixel values of the enhanced output for contrast, Representing a rounding function.
- 8. An image similarity detection apparatus, characterized in that the apparatus comprises: The image preprocessing module is used for respectively detecting the brightness and the contrast of the images of the target image and the reference image and carrying out brightness difference compensation and contrast limitation enhancement processing; the front background separation module is used for sequentially separating the foreground from the background of the to-be-processed areas of the two preprocessed images through the sliding window; the similarity calculation module is used for selecting an ith target area in the target image, sliding and traversing all areas to be compared in the reference image, and respectively carrying out similarity calculation on the foreground image and the background image to obtain an ith area score; And the weighted aggregation module is used for sliding through all target areas of the target graph, carrying out weighted aggregation on all area scores and outputting an image global similarity value.
- 9. A computer device comprising a processor and a memory having stored therein at least one instruction, at least one program, code set, or instruction set that is loaded and executed by the processor to implement the image similarity detection method of any one of claims 1 to 7.
- 10. A computer readable storage medium having stored therein at least one instruction, at least one program, code set, or instruction set, the at least one instruction, the at least one program, the code set, or instruction set being loaded and executed by a processor to implement the image similarity detection of any of claims 1 to 7.
Description
Image similarity detection method, device, equipment and storage medium Technical Field The present application relates to the field of image processing, and in particular, to a method, apparatus, device, and storage medium for detecting image similarity. Background In the field of image processing, image similarity calculation is a core technology for supporting applications such as image retrieval, content auditing, copyright protection and the like. Related technologies are mainly divided into two major categories, namely a traditional algorithm based on pixels and a deep learning method based on data driving. The traditional algorithm relies on a manually designed feature extractor and a metric function, realizes similarity evaluation through brightness, contrast and structural information of deconstructed images, and has the advantages of high calculation efficiency, strong logic interpretability, prominent robustness in special scenes, no need of training data and the like. However, the method faces multiple challenges in practical application, namely when noise interference exists in an image, the algorithm output is easy to be interfered to cause result distortion, misjudgment is easy to occur in a scene with similar texture characteristics and different content semantics, meanwhile, the algorithm performance is highly dependent on manually set parameters such as a threshold value, weight and the like, the parameter adjustment process is complicated and lacks universality, and the use threshold and uncertainty are obviously increased. Although the deep learning method can improve the feature distinguishing capability through data driving and has strong adaptability in complex scenes, the training process is dependent on large-scale labeling of data sets, and the pre-condition is difficult to meet in the scenes of data scarcity or specific fields, so that the flexibility of actual deployment is limited. The problems cause that the traditional method has insufficient reliability of similarity calculation results when processing images with inconsistent brightness, obvious contrast difference or mixed foreground and background, and is difficult to achieve both precision and efficiency. In view of the above, there is a need in the art for improvements. Disclosure of Invention The application provides an image similarity detection method, an image similarity detection device, image similarity detection equipment and a storage medium, which are used for improving the adaptability and accuracy of an algorithm in a complex scene by combining a foreground and background separated region similarity calculation mechanism through brightness difference compensation and contrast limitation enhancement pretreatment. In one aspect, the present application provides an image similarity detection method, the method comprising: respectively detecting the brightness and contrast of the images of the target image and the reference image, and carrying out brightness difference compensation and contrast limitation enhancement; Sequentially separating foreground and background of the areas to be processed of the two preprocessed images through the sliding window; Selecting an ith target area in the target graph, sliding and traversing all areas to be compared in the reference graph, and respectively carrying out similarity calculation on the foreground image and the background image to obtain an ith area score; and sliding and traversing all target areas of the target graph, carrying out weighted aggregation on all area scores, and outputting an image global similarity value. Specifically, the calculating the similarity between the foreground image and the background image includes: Respectively calculating brightness similarity Contrast similarityAnd structural texture similarity; Based on brightness similarityContrast similarityAnd structural texture similarityCalculating block similarityThe following is indicated: Wherein, the Representing the weight coefficient; And calculating and obtaining the ith region score based on the foreground similarity and the background similarity. Specifically, the calculating to obtain the i-th region score based on the foreground similarity and the background similarity includes: Respectively calculating the foreground similarity and the background similarity of the ith target region and each region to be compared in the reference map, and calculating a similarity score by combining the foreground similarity and the background similarity; And sequencing all the similarity scores, and determining the highest similarity score as the ith region score of the ith target region. Specifically, the calculating the similarity score by combining the foreground similarity and the background similarity includes: Respectively obtaining the number of non-0 pixel points in two image blocks And (3) withAnd calculates a foreground difference compensation valueThe expression is as follows: obtaining a