An image comparison method, system, device and computer-readable storage medium

By transforming images and extracting features, combined with soft voting decision algorithms, the problem of subjectivity and low efficiency of image comparison methods in the prior art is solved, and efficient and accurate image comparison results are achieved, which are suitable for a variety of application scenarios.

CN117809059BActive Publication Date: 2025-08-01SUZHOU WANDIANZHANG NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311867255.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2025-08-01
Estimated Expiration
2043-12-29

AI Technical Summary

Technical Problem

In the prior art, the image comparison method has the problem that manual comparison is subjective, low efficiency and labor-consuming, and neural network model comparison requires low human investment and flexibility.

Method used

By acquiring the target image and standard image, transforming and feature extraction, generating pseudo-standard images, and using soft voting decision algorithms to measure similarity, the accurate image comparison results are obtained, avoiding the training and update costs of machine learning models.

Benefits of technology

Image comparison without machine learning models is realized, which improves the applicability and accuracy of the comparison, and reduces manpower investment and training costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117809059B_ABST
    Figure CN117809059B_ABST
Patent Text Reader

Abstract

The present application discloses an image comparison method, system, device and computer-readable storage medium, relating to the technical field of image detection and recognition. A target image to be compared is obtained, and a standard image corresponding to the target image is obtained; the standard image is transformed to obtain a pseudo-standard image; features are extracted from the standard image to obtain a first feature; features are extracted from the pseudo-standard image to obtain a second feature; features are extracted from the target image to obtain a third feature; the first feature and the second feature are subjected to similarity measurement to obtain a first similarity result; the first feature and the third feature are subjected to similarity measurement to obtain a second similarity result; the first similarity result and the second similarity result are subjected to soft voting decision to obtain an image comparison result between the target image and the standard image. The present application provides a reference value for the comparison of the target image by generating a pseudo-standard image, and then applies soft voting decision to obtain an accurate and objective image comparison result, with good applicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of image detection and recognition, and more specifically, to an image comparison method, system, device, and computer-readable storage medium. Background Art

[0002] Currently, in scenarios of comparing images, such as comparing posters or comparing material photos, etc., image comparison is completed by means of manual comparison or neural network model comparison.

[0003] However, manual image comparison has a large subjective factor, is prone to missed detection, consumes a large amount of manpower, is not conducive to digital material control, and has low efficiency and poor applicability. If comparison is carried out by means of a neural network model, manpower needs to be invested in the collection and annotation of materials and the learning and training of the model, and every time the image is changed, new manpower investment is required, with low flexibility and poor applicability.

[0004] In summary, how to improve the applicability of image comparison is an urgent problem to be solved by those skilled in the art currently. Summary of the Invention

[0005] The purpose of the present application is to provide an image comparison method, which can, to a certain extent, solve the technical problem of how to improve the applicability of image comparison. The present application also provides an image comparison system, an electronic device, and a computer-readable storage medium.

[0006] To achieve the above purpose, the present application provides the following technical solutions:

[0007] An image comparison method includes:

[0008] Obtain a target image to be compared, and obtain a standard image corresponding to the target image;

[0009] Transform the standard image to obtain a pseudo-standard image;

[0010] Extract features from the standard image to obtain a first feature;

[0011] Extract features from the pseudo-standard image to obtain a second feature;

[0012] Extract features from the target image to obtain a third feature;

[0013] Perform similarity measurement on the first feature and the second feature to obtain a first similarity result;

[0014] Perform similarity measurement on the first feature and the third feature to obtain a second similarity result;

[0015] Perform soft voting decision on the first similarity result and the second similarity result to obtain the image comparison result between the target image and the standard image.

[0016] Preferably, the obtaining of the target image to be compared includes:

[0017] Obtain the initial image to be compared;

[0018] Perform perspective transformation on the initial image to obtain a perspective-transformed image;

[0019] Perform image denoising and / or image enhancement on the perspective-transformed image to obtain the target image.

[0020] Preferably, the transforming of the standard image to obtain a pseudo-standard image includes:

[0021] Convert the standard image from the RGB color space to the HSV color space to obtain an HSV image;

[0022] Perform brightness change and / or contrast change and / or color saturation change and / or image smoothing and / or image sharpening and / or image rotation on the HSV image to obtain the pseudo-standard image.

[0023] Preferably, the feature extraction of the image to be processed to obtain the features of the image to be processed, where the image to be processed includes the standard image, the pseudo-standard image, and the target image, includes:

[0024] Perform global feature extraction on the image to be processed to obtain the color feature, texture feature, and shape feature of the image to be processed;

[0025] Perform local feature extraction on the image to be processed to obtain the HOG feature, LBP feature, and SURF feature of the image to be processed.

[0026] Preferably, the similarity measurement of the features to obtain the similarity result includes:

[0027] Generate the Euclidean distance, cosine distance, and Mahalanobis distance between the features;

[0028] Take the Euclidean distance, the cosine distance, and the Mahalanobis distance as the similarity result.

[0029] Preferably, the soft voting decision on the first similarity result and the second similarity result to obtain the image comparison result between the target image and the standard image includes:

[0030] Generate the similarity values of the first similarity result and the second similarity result;

[0031] Determine the average value of the similarity values;

[0032] Judge whether the average value is greater than or equal to a preset similarity threshold;

[0033] If the average value is greater than or equal to the similarity threshold, generate the image comparison result indicating that the target image is the same as the standard image;

[0034] If the average value is less than the similarity threshold, generate the image comparison result indicating that the target image is different from the standard image.

[0035] Preferably, the similarity values for generating the first similarity result and the second similarity result include:

[0036] Generate the similarity values of the first similarity result and the second similarity result through a similarity value generation formula;

[0037] The similarity value generation formula includes:

[0038]

[0039] where, sim i represents the value corresponding to attribute i in the similarity value; max represents taking the maximum value; || represents taking the absolute value; d i represents the value corresponding to attribute i in the first similarity result; d' i represents the value corresponding to attribute i in the second similarity result; N represents the total number of attributes in the first similarity result and the second similarity result.

[0040] An image comparison system, comprising:

[0041] A first acquisition module, configured to acquire a target image to be compared and acquire the standard image corresponding to the target image;

[0042] A first transformation module, configured to transform the standard image to obtain a pseudo-standard image;

[0043] A first extraction module, configured to extract features from the standard image to obtain first features; extract features from the pseudo-standard image to obtain second features; extract features from the target image to obtain third features;

[0044] A first metric module, configured to perform similarity metric on the first features and the second features to obtain a first similarity result; perform similarity metric on the first features and the third features to obtain a second similarity result;

[0045] A first decision-making module, configured to perform a soft voting decision on the first similarity result and the second similarity result to obtain an image comparison result between the target image and the standard image.

[0046] An electronic device, comprising:

[0047] A memory, configured to store a computer program;

[0048] A processor, configured to implement the steps of any of the above image comparison methods when executing the computer program.

[0049] A computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above image comparison methods are implemented.

[0050] An image comparison method provided by the present application includes: obtaining a target image to be compared, and obtaining a standard image corresponding to the target image; performing a transformation on the standard image to obtain a pseudo-standard image; performing feature extraction on the standard image to obtain a first feature; performing feature extraction on the pseudo-standard image to obtain a second feature; performing feature extraction on the target image to obtain a third feature; performing similarity measurement on the first feature and the second feature to obtain a first similarity result; performing similarity measurement on the first feature and the third feature to obtain a second similarity result; performing a soft voting decision on the first similarity result and the second similarity result to obtain an image comparison result between the target image and the standard image. By performing a transformation on the standard image to obtain a pseudo-standard image, the present application provides a reference value for the comparison of the target image. Then, a soft voting decision is applied to process the first similarity result between the pseudo-standard image and the standard image and the second similarity result between the target image and the standard image, so as to obtain an accurate and objective image comparison result. Moreover, the entire process does not use a machine learning model for inference and prediction, and there is no need to pay the cost of model learning, training, and update iteration, and the applicability is good. An image comparison system, an electronic device, and a computer-readable storage medium provided by the present application also solve the corresponding technical problems. Description of the Drawings

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0052] Figure 1 It is a first flowchart of an image comparison method provided by an embodiment of the present application;

[0053] Figure 2The implementation flowchart of an image comparison method provided by an embodiment of the present application;

[0054] Figure 3 The generation schematic diagram of a pseudo-standard image in the present application;

[0055] Figure 4 The first schematic diagram of feature extraction in the present application;

[0056] Figure 5 The second schematic diagram of feature extraction in the present application;

[0057] Figure 6 The structural schematic diagram of an image comparison system provided by an embodiment of the present application;

[0058] Figure 7 The structural schematic diagram of an electronic device provided by an embodiment of the present application;

[0059] Figure 8 Another structural schematic diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0060] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0061] Please refer to Figure 1 , Figure 1 The first flowchart of an image comparison method provided by an embodiment of the present application.

[0062] An image comparison method provided by an embodiment of the present application may include the following steps:

[0063] Step S101: Obtain a target image to be compared and obtain a standard image corresponding to the target image.

[0064] In practical applications, the target image to be compared and the standard image corresponding to the target image can be obtained first. The standard image is also the image that the user specifies to be generated. The target image is the image generated according to the standard image. For example, the standard image can be a poster, and the target image can be the generated target poster, etc. In addition, the target image and the standard image can also be material photos, etc. The present application does not make specific limitations here.

[0065] Step S102: Transform the standard image to obtain a pseudo-standard image.

[0066] In practical applications, a pseudo-standard image can be obtained by transforming a standard image, and the pseudo-standard image can be used as a reference value for the target image to compare the target image.

[0067] Step S103: Extract features from the standard image to obtain a first feature; extract features from the pseudo-standard image to obtain a second feature; extract features from the target image to obtain a third feature.

[0068] In practical applications, after obtaining the pseudo-standard image, the features of the image can be determined by feature extraction, that is, features can be extracted from the standard image to obtain a first feature; features can be extracted from the pseudo-standard image to obtain a second feature; features can be extracted from the target image to obtain a third feature, so as to perform image comparison using the corresponding features of the image subsequently.

[0069] Step S104: Measure the similarity between the first feature and the second feature to obtain a first similarity result.

[0070] Step S105: Measure the similarity between the first feature and the third feature to obtain a second similarity result.

[0071] In practical applications, the similarity between the features of an image reflects whether the images are the same or not. Therefore, the similarity between the first feature and the second feature can be measured to obtain a first similarity result, and the similarity between the first feature and the third feature can be measured to obtain a second similarity result, so as to determine whether the target image is the same as the representative image according to the first similarity result and the second similarity result subsequently.

[0072] It should be noted that in the case of having multiple pseudo-standard images, that is, having multiple second features, the similarity between each second feature and the first feature can be measured first, and then all the results can be averaged to obtain the first similarity result, etc.

[0073] Step S106: Perform a soft voting decision on the first similarity result and the second similarity result to obtain an image comparison result between the target image and the standard image.

[0074] In practical applications, after obtaining the first similarity result and the second similarity result, a soft voting decision can be made on the first similarity result and the second similarity result to obtain an image comparison result between the target image and the standard image.

[0075] An image comparison method provided by this application obtains a target image to be compared and obtains a standard image corresponding to the target image; transforms the standard image to obtain a pseudo-standard image; extracts features from the standard image to obtain first features; extracts features from the pseudo-standard image to obtain second features; extracts features from the target image to obtain third features; measures the similarity between the first features and the second features to obtain a first similarity result; measures the similarity between the first features and the third features to obtain a second similarity result; performs a soft voting decision on the first similarity result and the second similarity result to obtain an image comparison result between the target image and the standard image. By transforming the standard image to obtain a pseudo-standard image, this application provides a reference value for the comparison of the target image. Then, a soft voting decision is applied to process the first similarity result between the pseudo-standard image and the standard image and the second similarity result between the target image and the standard image, so as to obtain an accurate and objective image comparison result. Moreover, the entire process does not use a machine learning model for inference and prediction, and there is no need to pay the costs of model learning, training, and update iteration, and the applicability is good.

[0076] Please refer to Figure 2 , Figure 2 which is a flowchart of an image comparison method provided by an embodiment of this application.

[0077] An image comparison method provided by an embodiment of this application, in the process of obtaining a target image to be compared, can obtain an initial image to be compared; perform a perspective transformation on the initial image to obtain a perspective transformation image; perform image denoising and / or image enhancement on the perspective transformation image to obtain the target image.

[0078] It should be noted that perspective transformation is a commonly used technique in computer graphics and computer vision, which is used to convert a visual scene from one perspective to another. Perspective transformation can convert an image on a two-dimensional plane into an image with a three-dimensional effect through a series of mathematical transformations and project it onto a new two-dimensional plane. It utilizes the deformation law of an object from the observer's perspective and is implemented through steps such as defining a transformation matrix, selecting reference points, calculating the transformation matrix, and applying the transformation matrix. In computer vision, perspective transformation can be used for tasks such as image correction, target detection, and image registration. In a specific application scenario, in the process of performing a perspective transformation on the initial image to obtain a perspective transformation image, a quadrilateral region pre-drawn on the initial image can be used to perform a perspective transformation on the selected initial image, and the irregular quadrilateral region can be transformed into a rectangular region consistent with the standard image. The perspective transformation can be expressed as:

[0079]

[0080] Among them, the matrix of the perspective transformation is:

[0081]

[0082] (X, Y, Z) represents the homogeneous coordinates of the original image, and (X′, Y′, Z′) represents the homogeneous coordinates of the perspective-transformed image. Since the image is in a two-dimensional plane, dividing by Z gives:

[0083]

[0084] Let a 33 = 1, and after expansion, we get:

[0085]

[0086] There are 8 unknowns a ij in this formula. Four points can be taken on the source image and the transformed image respectively. The four points on the source image are selected as the four vertices of the quadrilateral that frames the original image area, and can be set as (x0, y0), (x1, y1), (x2, y2), (x3, y3). The four points on the transformed image can be set as (0, 0), (w, 0), (w, h), (0, h), where w and h are the width and height of the standard image respectively. After the quadrilateral area framed in the original image is transformed, a rectangular image with the same width and height as the standard image can be obtained.

[0087] In a specific application scenario, in the process of performing image denoising and / or image enhancement on the perspective-transformed image to obtain the target image, operations such as Gaussian filtering, median filtering, contrast stretching, gamma correction, histogram equalization, etc. can be performed on the perspective-transformed image to obtain the target image.

[0088] Please refer to Figure 2 and Figure 3 , Figure 3 which is the schematic diagram of the generation of the pseudo-standard image in this application. In the process of transforming the standard image to obtain the pseudo-standard image, a method for image comparison provided in an embodiment of this application can convert the standard image from the RGB color space to the HSV color space to obtain the HSV image; perform brightness change and / or contrast change and / or color saturation change and / or image smoothing and / or image sharpening and / or image rotation on the HSV image to obtain the pseudo-standard image. In this process, the types of operations for performing brightness change and / or contrast change and / or color saturation change and / or image smoothing and / or image sharpening and / or image rotation on the HSV image can be determined according to the application scenario. For example, two or three operations can be selected arbitrarily for image transformation, etc., and smoothing and sharpening cannot be selected simultaneously.

[0089] It should be noted that a color space, also known as a color model or color space, is a mathematical model or coordinate system used to represent colors. It can help describe and express colors in an acceptable manner under certain standards. The essence of a color space is to describe each color point through a coordinate system and subspaces. Common color spaces include RGB, CMY, HSV, HSL, Lab, etc. The RGB color space is one of the most commonly used color spaces, which uses three components: red (R), green (G), and blue (B) to represent colors. The HSV color space pays more attention to color perception and adjustment. It divides colors into three components: hue, saturation, and value, and is more suitable for color adjustment and design. The Lab color space is a relatively scientific color space that can better describe color perception differences. Its design takes into account the color perception characteristics of the human eye, so that when measuring color differences in this space, when the measurement value is small, the visual color difference is small, and vice versa. In a specific application scenario, when converting a standard image from the RGB color space to the HSV color space to obtain an HSV image, the conversion can be performed through the following formula:

[0090] R′ = R / 255, G′ = G / 255, B′ = B / 255;

[0091] C max = max(R′, G′, B′), C min = min(R′, G′, B′);

[0092] Δ = C max - C min ;

[0093]

[0094]

[0095] V = C max .

[0096] In a specific application scenario, when performing brightness and contrast changes on an HSV image to obtain a corresponding pseudo-standard image, a linear transformation can be performed on the V channel of the HSV image to achieve changes in image brightness or contrast. The linear transformation function is as follows:

[0097] y = ax1 + b;

[0098] Among them, x1 represents the original pixel value of the V channel, y represents the transformed pixel value, a is the contrast adjustment factor, and b is the brightness adjustment factor. When a = 1 and b > 0, the image brightness increases; when a = 1 and b < 0, the image brightness decreases; when a > 1, the image contrast increases; when a < 1, the image contrast decreases.

[0099] In a specific application scenario, during the process of changing the color saturation of the HSV image to obtain the corresponding pseudo-standard image, gamma transformation can be performed on the S channel of the HSV image, and the transformation formula can be:

[0100] y = cx^2 γ ;

[0101] Among them, x2 represents the original pixel value of the S channel, y represents the transformed pixel value, c is the gray-scale scaling coefficient, usually taking 1, and γ is the contrast adjustment constant. When γ > 1, the image saturation increases; when γ < 1, the image saturation decreases.

[0102] In a specific application scenario, during the process of smoothing the HSV image to obtain the corresponding pseudo-standard image, a Gaussian filter can be used to filter the three channels of the HSV image, and the processing formula can be:

[0103]

[0104] Among them, f(x, y) represents the pixel value at the position (x, y) of the HSV image, σ represents the variance of the Gaussian function, * represents the convolution operation, g(x, y) represents the pixel value at the position (x, y) after filtering; g1(x, y) represents the pixel value at the position (x, y) of the pseudo-standard image.

[0105] In a specific application scenario, during the process of sharpening the HSV image to obtain the corresponding pseudo-standard image, a Laplacian operator can be used to filter the three channels of the HSV image, and the processing formula can be:

[0106]

[0107] g2(x, y) represents the pixel value at the position (x, y) of the pseudo-standard image; [[ID= thirty]] represents the second derivative of f(x, y) with respect to x; represents the second derivative of f(x, y) with respect to y.

[0108] Please refer to Figure 2 and Figure 4 、 Figure 5 , Figure 4 、 Figure 5Schematic diagram of feature extraction in this application. In an image comparison method provided by an embodiment of this application, when performing feature extraction on a to-be-processed image to obtain the features of the to-be-processed image, and the to-be-processed image includes a standard image, a pseudo-standard image, and a target image, global feature extraction can be performed on the to-be-processed image to obtain the color feature, texture feature, and shape feature of the to-be-processed image; local feature extraction can be performed on the to-be-processed image to obtain the HOG feature, LBP feature, and SURF feature of the to-be-processed image. That is, the types of the first feature, the second feature, and the third feature all include color feature, texture feature, shape feature, HOG feature, LBP feature, and SURF feature. In this way, the global feature and the local feature can be combined to obtain a more comprehensive and objective description of the image features.

[0109] In a specific application scenario, when performing global feature extraction on a to-be-processed image to obtain the color feature, the RGB color space can be first converted to the XYZ color space, and the conversion formula can be:

[0110]

[0111] Then convert from the XYZ color space to the Lab color space, and the conversion formula can be:

[0112]

[0113] Where X n = 95.047, Y n = 100.0, Z n = 108.883, L * , a * , b * represent the values of the three channels in the Lab color space. Then perform histogram statistics on these three channels, and use the statistical results L hist , a hist , b hist as the global color feature of the to-be-processed image.

[0114] In a specific application scenario, the gray-level co-occurrence matrix can be used to extract the texture feature of the to-be-processed image. Convert the image from RGB color to grayscale, and calculate the gray-level co-occurrence matrix P of the grayscale image:

[0115]

[0116] Where d represents the relative distance represented by the number of pixels, θ represents the calculation direction, and the four directions of 0°, 45°, 90°, and 135° can be considered. i, j = 0, 1, 2,..., L - 1, (x, y) is the pixel coordinate in the image, and L is the number of gray levels of the image;

[0117] After calculating the gray-level co-occurrence matrix of the image to be processed, calculate the following four statistics:

[0118] The angular second moment (ASM), also known as energy, is a measure of the uniformity of the image gray-level distribution and the coarseness of the texture. When the image texture is regular and uniform, this value is larger:

[0119]

[0120] Entropy (ENT) is used to measure the randomness contained in the image and characterize the complexity of the image texture. When all values in the gray-level co-occurrence matrix are equal or the pixel values show the maximum randomness, this value is the largest:

[0121]

[0122] Contrast (Con) is used to reflect the clarity of the image and the depth of the texture grooves. The clearer the texture and the greater the contrast, the larger the contrast:

[0123]

[0124] Inverse differential moment (IDM) is used to reflect the regularity of the texture. The more uniform the texture in different regions of the image and the slower the change, the larger this value:

[0125]

[0126] Take the mean of the four statistics in the four directions to obtain the global texture features of the image.

[0127] It should be noted that the gray-level co-occurrence matrix (GLCM): is a commonly used method for describing image texture features. It reflects the texture information of the image by studying the gray-level relationship between pixels in the image. The gray-level co-occurrence matrix is a two-dimensional matrix, and the elements in it represent the frequency or probability of the gray-level values of two pixels with a certain spatial position relationship. By performing statistical analysis on the gray-level co-occurrence matrix, a series of texture features can be calculated, such as energy, entropy, contrast, uniformity, correlation, etc. These features can be used in application fields such as image classification, object detection, and texture analysis.

[0128] In specific application scenarios, Hu moments can be used to extract the shape features of the image. Binarize the grayscale image converted from the RGB image. Let the number of rows and columns of the image be R and C respectively, then the p+q order origin moment can be expressed as:

[0129]

[0130] Among them, f(x, y) represents the pixel value of the image at the position (x, y). After image binarization, this value is 0 or 1, and m 00 is the zero-order moment of the image, representing the quality of the image; m 01 , m 10 is the first-order moment of the image, representing the centroid of the image. The centroid coordinates of the image can be obtained from the zero-order moment and the first-order moment:

[0131]

[0132] Furthermore, the central moments μ pq and the normalized central moments η pq can be obtained:

[0133]

[0134]

[0135] Through the second-order and third-order central moments, 7 groups of invariant moments of Hu moments can be obtained:

[0136]

[0137] Finally, by performing logarithmic processing on the 7 groups of invariant moments of Hu moments, the global shape features of the image can be obtained.

[0138] It should be noted that Hu moments are image features with translation, rotation, and scale invariance, used to describe the shape features of images. Hu moments calculate the geometric moments and central moments of images. Geometric moments are the weighted averages of image pixel intensities, while central moments are the moments relative to the centroid of the image. By normalizing and combining geometric moments and central moments, a set of invariant features can be obtained, which can be applied in the fields of image recognition, shape matching, and target tracking.

[0139] In a specific application scenario, during the process of extracting the HOG features of an image, image preprocessing can be performed first, including grayscale conversion, gamma correction, and scale scaling of the image. For example, the image can be uniformly scaled to a size of 128×128 pixels. The gradient of the preprocessed image (including gradient magnitude and direction) is calculated using a gradient operator. The image is divided into several non-overlapping cells, and the size of each cell can be 8×8 pixels. The 0 to 180 degrees are divided into 9 bins such as 0, 20, 40, ..., 160. The bin where each pixel point is located is counted to obtain the gradient histogram of each cell, that is, the HOG feature descriptor of each cell. Every 2×2 cells are grouped into a block, and the HOG feature of the block is obtained by concatenating all the cell feature descriptors within the block. Finally, the HOG feature descriptors of all the blocks in the image are concatenated to obtain the HOG feature of the image.

[0140] In a specific application scenario, during the process of extracting the LBP features of an image, the image can be divided into several non-overlapping cells, and the size of each cell can be 3×3 pixels. For each pixel in each cell, the gray values of the adjacent 8 pixels are compared with it. If the surrounding pixel value is greater than the central pixel value, the position of this pixel point is marked as 1, otherwise it is 0. In this way, an 8-bit binary number can be generated by comparing the 8 points within the 3×3 neighborhood, that is, the LBP value of the central pixel point of this window is obtained. The histogram of each cell is calculated, that is, the frequency of each number (assumed to be the decimal LBP value) appearing, and the histogram is normalized. The statistical histograms of each obtained cell are concatenated into a feature vector to obtain the LBP feature vector of the entire image.

[0141] In a specific application scenario, during the process of extracting the SURF features of an image, a scale space can be constructed using a Gaussian difference pyramid. The image is smoothed using Gaussian kernels of different scales to obtain images of different scales. At different scales, feature points in the image are detected through the determinant of the Hessian matrix, and stable feature points are extracted using scale space extreme value detection and non-maximum suppression. For each key point, the main direction is calculated through the surrounding pixels. The main direction of a key point is related to the gradient direction distribution of the surrounding pixels. Using a feature description method based on Haar wavelet transform, the pixel points around each feature point are divided into several small regions, and the Haar wavelet transform coefficients of the gray values of the pixel points in each region are calculated to obtain a long vector as the descriptor of this feature point. Finally, this descriptor is used as the SURF feature of the image.

[0142] In practical applications, during the process of measuring the similarity of features and obtaining the similarity results, the Euclidean distance, cosine distance, and Mahalanobis distance between features can be generated; the Euclidean distance, cosine distance, and Mahalanobis distance are used as the similarity results. That is, both the first similarity result and the second similarity result include the Euclidean distance, cosine distance, and Mahalanobis distance, realizing a multi-dimensional feature similarity measurement method, which can effectively avoid the result deviation that may be caused by a single distance calculation method. Among them, the Euclidean distance measures the straight-line distance between two points, and it is applicable to the case where the feature space is a Euclidean space, that is, the difference between features is mainly reflected in the absolute difference in numerical values, but it is sensitive to the scale of the data and may be affected by the dimension; the cosine distance measures the cosine value of the angle between two vectors without considering the absolute length of the vectors, and it is applicable to the case where the feature space is a vector space, that is, the difference between features is mainly reflected in the relative difference in direction, but it cannot measure the length difference between vectors and can only measure the similarity in direction; the Mahalanobis distance is a distance measurement method that considers the correlation between variables. By performing a linear transformation on the data and taking the correlation into account, a more accurate distance measurement can be obtained, which is applicable to the analysis that needs to consider the correlation between variables. However, calculating the Mahalanobis distance requires knowing the covariance matrix of the data, and when the number of samples is small, it may lead to inaccurate estimation problems

[0143] In a specific application scenario, assuming that the same type of features of different category images are X and Y respectively, the Euclidean distance between the two features can be expressed as:

[0144]

[0145] The cosine distance between the two features can be expressed as:

[0146]

[0147] The Mahalanobis distance between the two features can be expressed as:

[0148]

[0149] Please refer to Figure 2 , in a method for image comparison provided by an embodiment of the present application, during the process of performing soft voting decision on the first similarity result and the second similarity result to obtain the image comparison result between the target image and the standard image, the similarity values of the first similarity result and the second similarity result can be generated; the average value of the similarity values is determined; it is judged whether the average value is greater than or equal to a preset similarity threshold; if the average value is greater than or equal to the similarity threshold, an image comparison result indicating that the target image is the same as the standard image is generated; if the average value is less than the similarity threshold, an image comparison result indicating that the target image is different from the standard image is generated. The specific value of the similarity threshold can be determined according to the application scenario

[0150] In a specific application scenario, in the process of generating the similarity value of the first similarity result and the second similarity result, the similarity value of the first similarity result and the second similarity result can be generated through a similarity value generation formula;

[0151] The similarity value generation formula includes:

[0152]

[0153] where sim i represents the value corresponding to attribute i in the similarity value; max represents taking the maximum value; || represents taking the absolute value; d i represents the value corresponding to attribute i in the first similarity result; d' i represents the value corresponding to attribute i in the second similarity result; N represents the total number of attributes in the first similarity result and the second similarity result. For ease of understanding, assume that the first similarity result and the second similarity result both include the Euclidean distance, cosine distance, and Mahalanobis distance between color features, texture features, shape features, HOG features, LBP features, and SURF features. Then there are a total of 18 similarity values, and at this time, the value of N is 18.

[0154] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of an image comparison system provided by an embodiment of the present application.

[0155] An image comparison system provided by an embodiment of the present application may include:

[0156] A first acquisition module 101, configured to acquire a target image to be compared and acquire a standard image corresponding to the target image;

[0157] A first transformation module 102, configured to transform the standard image to obtain a pseudo-standard image;

[0158] A first extraction module 103, configured to extract features from the standard image to obtain first features; extract features from the pseudo-standard image to obtain second features; extract features from the target image to obtain third features;

[0159] A first metric module 104, configured to perform similarity metric on the first features and the second features to obtain a first similarity result; perform similarity metric on the first features and the third features to obtain a second similarity result;

[0160] A first decision module 105, configured to perform soft voting decision on the first similarity result and the second similarity result to obtain an image comparison result of the target image and the standard image.

[0161] An image comparison system provided by an embodiment of the present application, the first acquisition module may include:

[0162] A first acquisition unit, configured to acquire an initial image to be compared;

[0163] A first transformation unit, configured to perform a perspective transformation on the initial image to obtain a perspective transformation image;

[0164] A first processing unit, configured to perform image denoising and / or image enhancement on the perspective transformation image to obtain a target image.

[0165] An image comparison system provided by an embodiment of the present application, the first transformation module may include:

[0166] A first conversion unit, configured to convert a standard image from an RGB color space to an HSV color space to obtain an HSV image;

[0167] A second transformation unit, configured to perform brightness change and / or contrast change and / or color saturation change and / or image smoothing and / or image sharpening and / or image rotation on the HSV image to obtain a pseudo-standard image.

[0168] In the process that an image comparison system provided by an embodiment of the present application, the first extraction module extracts features from an image to be processed to obtain the features of the image to be processed, where the image to be processed includes a standard image, a pseudo-standard image, and a target image, it may specifically be configured to perform global feature extraction on the image to be processed to obtain the color feature, texture feature, and shape feature of the image to be processed; perform local feature extraction on the image to be processed to obtain the HOG feature, LBP feature, and SURF feature of the image to be processed.

[0169] In the process that an image comparison system provided by an embodiment of the present application, the first metric module performs similarity metric on features to obtain a similarity result, it may generate the Euclidean distance, cosine distance, and Mahalanobis distance between features; use the Euclidean distance, cosine distance, and Mahalanobis distance as the similarity result.

[0170] An image comparison system provided by an embodiment of the present application, the first decision module may include:

[0171] A first generation unit, configured to generate a similarity value between a first similarity result and a second similarity result;

[0172] A first determination unit, configured to determine the average value of the similarity value;

[0173] A first determination unit is configured to determine whether the average value is greater than or equal to a preset similarity threshold; if the average value is greater than or equal to the similarity threshold, an image comparison result indicating that the target image is the same as the standard image is generated; if the average value is less than the similarity threshold, an image comparison result indicating that the target image is different from the standard image is generated.

[0174] In an embodiment of the present application, a first generation unit may specifically be configured to: generate a similarity value of the first similarity result and the second similarity result through a similarity value generation formula;

[0175] The similarity value generation formula includes:

[0176]

[0177] wherein, sim i represents the value corresponding to attribute i in the similarity value; max represents taking the maximum value; || represents taking the absolute value; d i represents the value corresponding to attribute i in the first similarity result; d' i represents the value corresponding to attribute i in the second similarity result; N represents the total number of attributes in the first similarity result and the second similarity result.

[0178] The present application further provides an electronic device and a computer-readable storage medium, both of which have the corresponding effects of an image comparison method provided in an embodiment of the present application. Please refer to Figure 7 , Figure 7 which is a schematic structural diagram of an electronic device provided in an embodiment of the present application.

[0179] An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202. A computer program is stored in the memory 201. When the processor 202 executes the computer program, the steps of the image comparison method described in any one of the above embodiments are implemented.

[0180] Please refer to Figure 8, another electronic device provided by an embodiment of the present application may further include: an input port 203 connected to the processor 202, configured to transmit externally input commands to the processor 202; a display unit 204 connected to the processor 202, configured to display the processing result of the processor 202 to the outside; a communication module 205 connected to the processor 202, configured to implement communication between the electronic device and the outside. The display unit 204 may be a display panel, a laser scanning display, etc.; the communication methods adopted by the communication module 205 include but are not limited to Mobile High-Definition Link (MHL), Universal Serial Bus (USB), High-Definition Multimedia Interface (HDMI), wireless connections: Wireless Fidelity (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, communication technology based on IEEE 802.11s.

[0181] A computer-readable storage medium provided by an embodiment of the present application stores a computer program, and when the computer program is executed by a processor, it implements the steps of the image comparison method described in any of the above embodiments.

[0182] The computer-readable storage medium involved in the present application includes Random Access Memory (RAM), memory, Read-Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROM (Compact Disc Read-Only Memory), or any other form of storage medium well-known in the technical field.

[0183] For the description of the relevant parts in the image comparison system, electronic device, and computer-readable storage medium provided by the embodiments of the present application, please refer to the detailed description of the corresponding parts in the image comparison method provided by the embodiments of the present application, which will not be repeated here. In addition, the parts of the above technical solutions provided by the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.

[0184] It should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

[0185] The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An image comparison method, characterized in that, Including: Obtain a target image to be compared, and obtain a standard image corresponding to the target image; Transform the standard image to obtain a pseudo-standard image; Extract features from the standard image to obtain first features; Extract features from the pseudo-standard image to obtain second features; Extract features from the target image to obtain third features; Perform similarity measurement on the first features and the second features to obtain a first similarity result; Perform similarity measurement on the first features and the third features to obtain a second similarity result; Perform soft voting decision on the first similarity result and the second similarity result to obtain an image comparison result between the target image and the standard image; Among them, the performing soft voting decision on the first similarity result and the second similarity result to obtain the image comparison result between the target image and the standard image includes: Generate similarity values of the first similarity result and the second similarity result; Determine the average value of the similarity values; Judge whether the average value is greater than or equal to a preset similarity threshold; If the average value is greater than or equal to the similarity threshold, generate the image comparison result indicating that the target image is the same as the standard image; If the average value is less than the similarity threshold, generate the image comparison result indicating that the target image is different from the standard image.

2. The method according to claim 1, wherein The obtaining the target image to be compared includes: Obtain an initial image to be compared; Perform perspective transformation on the initial image to obtain a perspective transformation image; Perform image denoising and / or image enhancement on the perspective transformation image to obtain the target image.

3. The method according to claim 1, wherein The transforming the standard image to obtain a pseudo-standard image includes: Convert the standard image from the RGB color space to the HSV color space to obtain an HSV image; Perform brightness change and / or contrast change and / or color saturation change and / or image smoothing and / or image sharpening and / or image rotation on the HSV image to obtain the pseudo-standard image.

4. The method according to claim 1, characterized in that Extract features from the image to be processed to obtain features of the image to be processed, where the image to be processed includes the standard image, the pseudo-standard image, and the target image, including: Perform global feature extraction on the image to be processed to obtain color features, texture features, and shape features of the image to be processed; Perform local feature extraction on the image to be processed to obtain HOG features, LBP features, and SURF features of the image to be processed.

5. The method according to claim 1, characterized in that, Performing similarity measurement on features to obtain a similarity result includes: Generate Euclidean distance, cosine distance, and Mahalanobis distance between features; Use the Euclidean distance, the cosine distance, and the Mahalanobis distance as the similarity result.

6. The method according to claim 1, wherein The generating the similarity values of the first similarity result and the second similarity result includes: Generate the similarity values of the first similarity result and the second similarity result through a similarity value generation formula; The similarity value generation formula includes: Among them, sim i represents the value corresponding to attribute i in the similarity value; max represents taking the maximum value; || represents taking the absolute value; d i represents the value corresponding to attribute i in the first similarity result; d i ′ represents the value corresponding to attribute i in the second similarity result; N represents the total number of attributes in the first similarity result and the second similarity result.

7. An image comparison system, characterized in that, Including: A first acquisition module, configured to obtain a target image to be compared, and obtain a standard image corresponding to the target image; A first transformation module, configured to transform the standard image to obtain a pseudo-standard image; A first extraction module, configured to extract features from the standard image to obtain first features; Extract features from the pseudo-standard image to obtain second features; Extract features from the target image to obtain third features; A first metric module, configured to perform similarity metric on the first features and the second features to obtain a first similarity result; and perform similarity metric on the first features and the third features to obtain a second similarity result; A first decision module, configured to perform soft voting decision on the first similarity result and the second similarity result to obtain an image comparison result of the target image and the standard image; Wherein, the first decision module includes: A first generation unit, configured to generate similarity values of the first similarity result and the second similarity result; A first determination unit, configured to determine an average value of the similarity values; A first judgment unit, configured to judge whether the average value is greater than or equal to a preset similarity threshold; if the average value is greater than or equal to the similarity threshold, generate the image comparison result indicating that the target image is the same as the standard image; if the average value is less than the similarity threshold, generate the image comparison result indicating that the target image is different from the standard image.

8. An electronic device, characterized in that, Comprising: A memory, configured to store a computer program; A processor, configured to implement the steps of the image comparison method according to any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the image comparison method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Vehicle type identification method based on image processing

    CN114565841A

  • Method, device and equipment for detecting quality of target object and medium

    CN116309532A