An image contrast method, device, electronic equipment and storage medium

By constructing a three-dimensional pixel matrix of the image and performing texture feature fusion and discrete point removal, the problem of inaccurate image difference comparison in the prior art is solved, and more accurate image comparison results are achieved.

CN116958596BActive Publication Date: 2026-02-13CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310967369.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-31
Publication Date
2026-02-13
Estimated Expiration
2043-07-31

AI Technical Summary

Technical Problem

Existing technologies cannot accurately acquire image features, resulting in inaccurate image difference comparison results.

Method used

By acquiring the three-dimensional pixel matrix of the image, texture feature matrices are set in the horizontal and vertical directions respectively. After feature fusion, discrete points are removed to obtain the target texture matrix, and then the differences are compared.

Benefits of technology

It achieves accurate determination of image differences, avoids the influence of discrete points, and improves the accuracy of image comparison.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116958596B_ABST
    Figure CN116958596B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image processing, and provides an image comparison method and device, electronic equipment and a storage medium. The method comprises the following steps: obtaining a texture feature matrix of an image in a horizontal axis direction and a texture feature matrix of the image in a vertical axis direction; performing feature fusion on the texture feature matrix in the horizontal axis direction and the texture feature matrix in the vertical axis direction to obtain a fused texture feature matrix corresponding to the image, so that the fused texture feature matrix can accurately express the features of the image in the horizontal axis and the vertical axis; removing discrete points in the fused texture feature matrix to obtain a target texture matrix corresponding to the image, so that the target texture matrix can more accurately express the texture features of the image, thereby avoiding the influence of the discrete points in the image on the image comparison result; and finally, performing difference comparison on the target texture matrix of the image and a target texture matrix of a to-be-compared image, so that the obtained difference comparison is accurate.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of picture processing, and in particular to an image comparison method and device, an electronic device, and a storage medium. BACKGROUND

[0002] With the development of the Internet, various applications have entered people's work and life, and man-machine interaction interfaces in the applications are everywhere in work and life, such as computer software interaction interfaces, mobile phone interfaces, vehicle-mounted center screens, and other various display screens. Such interfaces have obvious boundaries, obvious region partitioning, regular sizes, and are not sensitive to a single or small number of scattered pixels. In the interface design and development and acceptance process, image comparison is usually required to verify whether there is a difference between the actual product of the interface and the design state of the interface.

[0003] At present, there are many algorithms for image comparison in the related art, and the general directions are as follows: 1. Calculate the color distribution of each channel, and use the histogram method, that is, calculate the histograms of two images respectively, normalize the histograms, and then measure the similarity according to a certain distance measurement standard. The histogram reflects the probability distribution of the image gray value, and does not have the spatial position information of the image, so false judgments often occur; from the information theory, a large amount of information is lost through the histogram conversion, so it is a little unsatisfactory to use the histogram alone for matching; 2. Gray image comparison: the gray image is converted from a color image into a gray space, and then compared. This method has a smaller amount of calculation, but it is obvious that the color difference cannot be accurately judged. SUMMARY

[0004] Therefore, the embodiments of the present application provide an image comparison method and device, an electronic device, and a storage medium to solve the problem that the existing technology cannot accurately obtain image features, resulting in inaccurate difference comparison results when comparing two images.

[0005] In a first aspect, the embodiments of the present application provide an image comparison method, which includes: obtaining a three-dimensional pixel matrix corresponding to an image according to pixels of the image; setting a texture feature matrix of the image in a horizontal axis direction and a vertical axis direction according to the three-dimensional pixel matrix; performing feature fusion on the texture feature matrix in the horizontal axis direction and the texture feature matrix in the vertical axis direction to obtain a fused texture feature matrix corresponding to the image; removing discrete points in the fused texture feature matrix to obtain a target texture matrix corresponding to the image; and performing difference comparison on the target texture matrix of the image and a target texture matrix of a to-be-compared image to determine a difference degree of the image and the to-be-compared image.

[0006] In a second aspect, the embodiment of the present application provides an image comparison device, which comprises: a matrix obtaining module, configured to obtain a three-dimensional pixel matrix corresponding to an image according to pixels of the image; a feature obtaining module, configured to set a texture feature matrix of the image in a horizontal axis direction and a texture feature matrix of the image in a vertical axis direction respectively according to the three-dimensional pixel matrix; a feature fusion module, configured to perform feature fusion on the texture feature matrix in the horizontal axis direction and the texture feature matrix in the vertical axis direction to obtain a fused texture feature matrix corresponding to the image; and a feature optimization module, configured to remove discrete points in the fused texture feature matrix to obtain a target texture matrix corresponding to the image, and perform difference comparison on the target texture matrix of the image and a target texture matrix of a to-be-compared image to determine a difference degree of the image and the to-be-compared image.

[0007] In a third aspect, the embodiment of the present application provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above method when executing the computer program.

[0008] In a fourth aspect, the embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the above method when executed by a processor.

[0009] Compared with the prior art, the embodiment of the present application has the beneficial effects that: in the embodiment of the present application, a three-dimensional pixel matrix corresponding to an image is obtained according to pixels of the image; a texture feature matrix of the image in a horizontal axis direction and a texture feature matrix of the image in a vertical axis direction are set respectively according to the three-dimensional pixel matrix; feature fusion is performed on the texture feature matrix in the horizontal axis direction and the texture feature matrix in the vertical axis direction to obtain a fused texture feature matrix corresponding to the image; discrete points in the fused texture feature matrix are removed to obtain a target texture matrix corresponding to the image, and difference comparison is performed on the target texture matrix of the image and a target texture matrix of a to-be-compared image to determine a difference degree of the image and the to-be-compared image; the texture feature matrix in the horizontal axis direction and the texture feature matrix in the vertical axis direction are obtained respectively, then feature fusion is performed on the texture feature matrix in the horizontal axis direction and the texture feature matrix in the vertical axis direction to obtain the fused texture feature matrix, so that the fused texture feature matrix can accurately express the features of the image in the horizontal axis and the vertical axis, then the discrete points in the fused texture feature matrix are removed to obtain the target texture matrix corresponding to the image, so that the target texture matrix can more accurately express the texture features of the image, thereby avoiding the influence of the discrete points in the image on the image comparison result, and finally the difference comparison is performed on the target texture matrix of the image and the target texture matrix of the to-be-compared image, so that the obtained difference comparison is accurate, and the problem that the difference comparison result is inaccurate when two images are compared in difference in the related art is avoided. BRIEF DESCRIPTION OF DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0011] Figure 1 is a scene schematic diagram of an application scenario provided by the embodiments of the present application;

[0012] Figure 2 is a flow schematic diagram of an image comparison method provided by the embodiments of the present application;

[0013] Figure 3 is a flow schematic diagram of another image comparison method provided by the embodiments of the present application;

[0014] Figure 4 is a flow schematic diagram of still another image comparison method provided by the embodiments of the present application;

[0015] Figure 5 is a flow schematic diagram of yet another image comparison method provided by the embodiments of the present application;

[0016] Figure 6 is a flow schematic diagram of still another optional image comparison method provided by the embodiments of the present application;

[0017] Figure 7 is a basic schematic diagram of a discrete point provided by the embodiments of the present application;

[0018] Figure 8 is a basic schematic diagram of a continuous point provided by the embodiments of the present application;

[0019] Figure 9 is a flow schematic diagram of another optional image comparison method provided by the embodiments of the present application;

[0020] Figure 10 is a flow schematic diagram of another optional image comparison method provided by the embodiments of the present application;

[0021] Figure 11 is a structural schematic diagram of an image comparison device provided by the embodiments of the present application;

[0022] Figure 12 is a structural schematic diagram of an electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0023] In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular architectures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, circuits, and

[0024] An image contrast method and device according to embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0025] Figure 1 is a scenario diagram of an application scenario of embodiments of the present application. The application scenario can include terminal devices 1, 2, and 3, a server 4, and a network 5.

[0026] The terminal devices 1, 2, and 3 can be hardware or software. When the terminal devices 1, 2, and 3 are hardware, they can be various electronic devices with display screens and supporting communication with the server 4, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like; when the terminal devices 1, 2, and 3 are software, they can be installed in the electronic devices as above. The terminal devices 1, 2, and 3 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present application do not limit this. Further, various applications can be installed on the terminal devices 1, 2, and 3, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, and the like.

[0027] The server 4 can be a server that provides various services, for example, a background server that receives requests sent by terminal devices that establish communication connections therewith. The background server can receive and analyze the requests sent by the terminal devices, and generate processing results. The server 4 can be a single server, a server cluster composed of several servers, or a cloud computing service center, and the embodiments of the present application do not limit this.

[0028] It should be noted that the server 4 can be hardware or software. When the server 4 is hardware, it can be various electronic devices that provide various services for the terminal devices 1, 2, and 3. When the server 4 is software, it can be multiple software or software modules that provide various services for the terminal devices 1, 2, and 3, or a single software or software module that provides various services for the terminal devices 1, 2, and 3, and the embodiments of the present application do not limit this.

[0029] The network 5 can be a wired network using coaxial cables, twisted-pair cables and optical fibers, or a wireless network that enables interconnection of various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), Infrared, etc., and the embodiments of the present application do not limit the same.

[0030] The user can establish a communication connection with the server 4 via the network 5 through the terminal devices 1, 2 and 3 to receive or send information, etc.

[0031] It should be noted that the specific types, numbers and combinations of the terminal devices 1, 2 and 3, the server 4 and the network 5 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present application do not limit the same.

[0032] The image comparison method and device according to the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0033] Figure 2 is a flowchart of an image comparison method provided by the embodiments of the present application, as shown in Figure 2 The image comparison method comprises:

[0034] S201, obtaining a three-dimensional pixel matrix corresponding to an image according to pixels of the image;

[0035] S202, setting a texture feature matrix in a horizontal axis direction and a texture feature matrix in a vertical axis direction of the image respectively according to the three-dimensional pixel matrix;

[0036] S203, performing feature fusion on the texture feature matrix in the horizontal axis direction and the texture feature matrix in the vertical axis direction to obtain a fused texture feature matrix corresponding to the image;

[0037] S204, removing discrete points in the fused texture feature matrix to obtain a target texture matrix corresponding to the image, and performing difference comparison according to the target texture matrix of the image and a target texture matrix of a to-be-compared image to determine a difference degree of the image and the to-be-compared image.

[0038] Specifically, each pixel point in the horizontal axis direction (X direction) and the vertical axis direction (Y direction) of the image is obtained, the coordinates of each pixel point are determined, and a three-dimensional pixel matrix is constructed according to the coordinates of each pixel point; for example, the pixel point at the lower left corner of the image is taken as the origin coordinate, and the matrix element corresponding to the origin coordinate in the three-dimensional pixel matrix is denoted as V 1,1 For example, the matrix element corresponding to the i-th item of the pixel along the X direction and the j-th item of the pixel along the Y direction in the image in the three-dimensional pixel matrix is denoted as V i,j(i∈1-image horizontal pixels, j∈1-image vertical pixels); It is understood that this embodiment does not limit the origin coordinates to the bottom left pixel point only, and the specific origin coordinates and their values ​​can be flexibly set by relevant personnel.

[0039] Continuing the previous example, after obtaining the coordinates of each pixel in the image, the coordinates of each pixel are directly used as matrix elements of a 3D pixel matrix. Each pixel corresponds to a matrix element in the 3D pixel matrix, and the matrix element is assigned a value based on the RGB values ​​of each pixel. Specifically, the value of each matrix element consists of the values ​​of the pixel's R, G, and B channels. The pixel at the i-th position along the x-direction and the j-th position along the y-direction is used as the matrix element V. i,j For example, the values ​​of the R, G, and B channels corresponding to this pixel are R... i,j G i,j B i,j Then the matrix element V i,j Its composition is as follows: V i,j =[R i,j G i,j B i,j By setting each pixel in the image to the original matrix included in the three-dimensional pixel matrix, and assigning values ​​to the matrix elements using the RGB values ​​of each pixel, a complete three-dimensional pixel matrix is ​​constructed.

[0040] After constructing the three-dimensional pixel matrix corresponding to the image according to the above steps, the texture feature matrices of the image in the horizontal and vertical directions are set according to the three-dimensional pixel matrix. That is, the texture feature matrix of the image in the horizontal direction is set according to the three-dimensional pixel matrix, and the texture feature matrix of the image in the vertical direction is set according to the three-dimensional pixel matrix. It should be understood that the texture feature matrix of the image in the horizontal direction can represent the texture features of the image in the horizontal direction, and the texture feature matrix of the image in the vertical direction can represent the texture features of the image in the vertical direction. It should be understood that the specific method of setting the texture feature matrices of the image in the horizontal and vertical directions according to the three-dimensional pixel matrix will be explained in detail later, and will not be repeated here.

[0041] After obtaining the texture feature matrices along the horizontal and vertical axes of the image, this example performs feature fusion on the texture feature matrices along the horizontal and vertical axes to obtain the fused texture feature matrix corresponding to the image. This allows the fused texture feature matrix to represent the features of the image along the horizontal and vertical axes. It is understood that the specific steps of feature fusion of the texture feature matrices along the horizontal and vertical axes will be explained in detail later, and will not be repeated here.

[0042] It can be understood that, considering that there may be some particles (for example, noise) in the image, the present example avoids the influence of image particles on the image contrast result by removing the discrete points in the fused texture feature matrix, and therefore, after obtaining the fused texture feature, the present example removes the discrete points in the fused texture feature matrix to obtain the target texture matrix corresponding to the image, wherein the discrete points are isolated points in the image, and the discrete points are non-continuous points.

[0043] According to the target texture matrix of the image and the target texture matrix of the image to be compared, difference comparison is performed to determine the difference degree of the image and the image to be compared.

[0044] According to the target texture matrix of the image and the target texture matrix of the image to be compared, difference comparison is performed to determine the difference degree of the image and the image to be compared.

[0045] It can be understood that, in some examples, the difference degree of the image and the image to be compared can also be determined by directly performing difference comparison on the fused texture feature matrix of the image and the fused texture feature matrix of the image to be compared.

[0046] In some embodiments, as shown in Figure 3 According to the target texture matrix of the image and the target texture matrix of the image to be compared, difference comparison is performed to determine the difference degree of the image and the image to be compared.

[0047] S301, constructing a texture feature matrix in the horizontal axis direction of the image according to the matrix elements in the three-dimensional pixel matrix;

[0048] S302, determining the corresponding adjacent matrix element of each matrix element in the three-dimensional pixel matrix in the horizontal axis direction;

[0049] S303, assigning values to the matrix elements in the texture feature matrix in the horizontal axis direction according to the values of the current matrix element in the three-dimensional pixel matrix and the corresponding adjacent matrix element in the horizontal axis direction.

[0050] Specifically, in some examples, the three-dimensional pixel matrix is directly copied as the texture feature matrix in the horizontal axis direction, wherein the matrix elements in the three-dimensional pixel matrix are denoted as V i,j , the texture feature matrix in the horizontal axis direction is denoted as Vx j,j , and V i,j corresponds to Vx i,j , thereby achieving the construction of the texture feature matrix in the horizontal axis direction of the image, and further making the texture feature matrix in the horizontal axis direction contain each pixel point in the image pixels, avoiding the problem of missing pixel points. After the construction is completed, each matrix element in the texture feature matrix in the horizontal axis direction is then assigned values through steps S302 and S303.

[0051] Specifically, the corresponding adjacent matrix element of each matrix element in the three-dimensional pixel matrix in the horizontal axis direction is determined, wherein the above determination of the corresponding adjacent matrix element of each matrix element in the three-dimensional pixel matrix in the horizontal axis direction can be achieved through the positional relationship between the pixel points in the image. For example, taking the previous pixel point of the current pixel point in the horizontal axis direction as the adjacent pixel point of the current pixel point as an example, the pixel point along the x direction i and the Y direction j in the image is taken as the current pixel point, and the pixel point along the x direction i-1 and the Y direction j is the adjacent pixel point of the current pixel point, wherein the matrix element in the three-dimensional pixel matrix corresponding to the pixel point along the x direction i and the Y direction j in the image is V i,j , the matrix element in the three-dimensional pixel matrix corresponding to the pixel point along the x direction i-1 and the Y direction j is V i-1,j , and the corresponding adjacent matrix element of the current matrix element is V i-1,j ; similarly, if it is determined that the corresponding matrix element of the current pixel point in the three-dimensional pixel matrix is V i+1,j , the corresponding adjacent matrix element of V i+1,j is V i,j . It can be understood that the present embodiment does not limit the specific rules for determining the adjacent pixel point of the current pixel point, and in some examples, the next pixel point of the current pixel point in the horizontal axis direction can also be taken as the adjacent pixel point of the current pixel point.

[0052] In the above example, if the position relationship between the pixel points in the image fails to achieve the determination of the corresponding adjacent matrix element of the current matrix element in the horizontal axis extension direction in the three-dimensional pixel matrix, the current matrix element in the texture feature matrix in the horizontal axis direction is directly assigned a value. The direct assignment of the current matrix element in the texture feature matrix in the horizontal axis direction includes: determining whether the pixel point corresponding to the current matrix element in the three-dimensional pixel matrix is the original coordinate. If the pixel point corresponding to the current matrix element is the original coordinate, the value of the corresponding matrix element in the texture feature matrix in the horizontal axis direction is directly set to 1. If the pixel point corresponding to the current matrix element is not the original coordinate, the value of the corresponding matrix element in the texture feature matrix in the horizontal axis direction is directly set to 0. For example, taking the lower left corner pixel point of the image as the original coordinate, and taking the matrix element corresponding to the original coordinate in the three-dimensional pixel matrix as V 1,1 , and taking the previous pixel point of the current pixel point in the horizontal axis direction as the adjacent pixel point of the current pixel point as an example, if the pixel point in the i-th along the x direction and the j-th along the y direction in the image is taken as the current pixel point, it can be known that the original coordinate point of the pixel point in the first along the x direction and the first along the y direction in the image is (0, 0, 0). The pixel point in the i-th along the x direction and the j-th along the y direction in the image has no previous pixel point in the horizontal axis direction, and the pixel point is the original coordinate. In addition, V 1,1 in the texture feature matrix in the vertical axis direction corresponds to V 1,1 in the three-dimensional pixel matrix, the value of V 1,1 in the texture feature matrix in the horizontal axis direction is directly set to 1. At the same time, since there is no adjacent element in V 1,j (j∈2-image vertical pixels), and the pixel point corresponding to V 1,j is not the original coordinate, the value of V i,1 in the texture feature matrix in the vertical axis direction is directly set to 0.

[0053] In the above example, if the position relationship between the pixel points in the image fails to achieve the determination of the corresponding adjacent matrix element of the current matrix element in the three-dimensional pixel matrix, the current matrix element in the texture feature matrix in the horizontal axis direction is directly assigned a value. The direct assignment of the current matrix element in the texture feature matrix in the horizontal axis direction includes: determining whether the pixel point corresponding to the current matrix element in the three-dimensional pixel matrix is the original coordinate. If the pixel point corresponding to the current matrix element is the original coordinate, the value of the corresponding matrix element in the texture feature matrix in the horizontal axis direction is directly set to 1. If the pixel point corresponding to the current matrix element is not the original coordinate, the value of the corresponding matrix element in the texture feature matrix in the horizontal axis direction is directly set to 0. For example, taking the lower left corner pixel point of the image as the original coordinate, and taking the matrix element corresponding to the original coordinate in the three-dimensional pixel matrix as V i+1,j , V i+1,j corresponding adjacent matrix element is V i,jFor example, in a three-dimensional pixel matrix V i+1,j = [R i+1,j , G i+1,j , B i+1,j ], V i,j = [R i,j , G i,j , B i,j ], the difference between the value of the adjacent matrix element and the arithmetic square of the current matrix element in the three-dimensional pixel matrix is Then the arithmetic square difference is compared with the texture threshold K, if the value of the matrix element Vx i+1,j in the texture feature matrix in the horizontal direction is set to 1, otherwise, the value of the matrix element Vx i+1,j in the texture feature matrix in the horizontal direction is set to 0.

[0054] In the above example, the matrix elements in the texture feature matrix in the horizontal direction are assigned by the above method, and the texture feature matrix in the horizontal direction is constructed, and the texture feature matrix in the horizontal direction is denoted as: M x

[0055] According to the technical scheme provided in the embodiments of the present application, the texture feature matrix of the image in the horizontal direction is constructed according to the matrix elements in the three-dimensional pixel matrix; the corresponding adjacent matrix elements of each matrix element in the three-dimensional pixel matrix in the horizontal direction are determined; and the matrix elements in the texture feature matrix in the horizontal direction are assigned according to the values of the current matrix element and the corresponding adjacent matrix elements in the three-dimensional pixel matrix, thereby realizing the assignment of the texture feature matrix in the horizontal direction by determining the corresponding adjacent matrix elements of each matrix element in the three-dimensional pixel matrix in the horizontal direction, so that the texture feature matrix in the horizontal direction can accurately express the texture feature of the image in the horizontal direction, improving the accuracy of the subsequent difference comparison based on the texture feature in the horizontal direction, and avoiding the problem that the difference comparison result is inaccurate when two images are compared in the related art due to the inability to accurately obtain the image feature.

[0056] In some embodiments, as shown in Figure 4 , the texture feature matrices of the image in the horizontal direction and the vertical direction are respectively set according to the three-dimensional pixel matrix, and the method further comprises:

[0057] S401, constructing a texture feature matrix of the image in the vertical direction according to the matrix elements in the three-dimensional pixel matrix;

[0058] S402, determining the corresponding adjacent matrix elements of each matrix element in the three-dimensional pixel matrix in the vertical direction;

[0059] ​S403, according to the value of the current matrix element in the three-dimensional pixel matrix and the corresponding adjacent matrix element in the longitudinal axis direction, assigning values to the matrix elements in the texture feature matrix in the longitudinal axis direction.

[0060] Specifically, in some examples, the three-dimensional pixel matrix is directly copied as the texture feature matrix in the longitudinal axis direction, where the matrix elements in the three-dimensional pixel matrix are denoted as V i,j , and the texture feature matrix in the transverse axis direction is denoted as Vy i,j , and then V i,j is obtained. i,j Correspondingly, the texture feature matrix in the longitudinal axis direction is constructed, so that the texture feature matrix in the longitudinal axis direction contains each pixel point in the image, avoiding the problem of missing pixel points. After the construction is completed, each matrix element in the texture feature matrix in the longitudinal axis direction is assigned a value through steps S402 and S403.

[0061] Specifically, the corresponding adjacent matrix element of each matrix element in the three-dimensional pixel matrix in the longitudinal axis direction is determined, where the corresponding adjacent matrix element of each matrix element in the three-dimensional pixel matrix in the longitudinal axis direction can be determined through the positional relationship between the pixel points in the image. For example, taking the previous pixel point of the current pixel point in the longitudinal axis direction as the adjacent pixel point of the current pixel point as an example, the pixel point in the i-th along the x direction and the j-th along the Y direction in the image is taken as the current pixel point, and the pixel point in the i-th along the x direction and the j-1-th along the Y direction is the adjacent pixel point of the current pixel point, where the matrix element in the three-dimensional pixel matrix corresponding to the pixel point in the i-th along the x direction and the j-th along the Y direction in the image is V i,j , the matrix element in the three-dimensional pixel matrix corresponding to the pixel point in the i-th along the x direction and the j-1-th along the Y direction is V i,j-1 , and the corresponding adjacent matrix element of the current matrix element is V i,j-1 ; similarly, if it is determined that the corresponding matrix element of the current pixel point in the three-dimensional pixel matrix is V i,j+1 , then V i,j+1 , the corresponding adjacent matrix element is V i,j It can be understood that the present embodiment does not limit the specific rules for determining the adjacent pixel point of the current pixel point, and in some examples, the next pixel point of the current pixel point in the longitudinal axis direction can also be taken as the adjacent pixel point of the current pixel point.

[0062] In the case that the position relationship between the pixel points in the image fails to achieve the determination of the adjacent matrix element corresponding to the current matrix element in the vertical axis direction in the three-dimensional pixel matrix, the current matrix element in the texture feature matrix in the vertical axis direction is directly assigned a value. The direct assignment of the current matrix element in the texture feature matrix in the vertical axis direction includes: determining whether the pixel point corresponding to the current matrix element in the three-dimensional pixel matrix is the original coordinate. If the pixel point corresponding to the current matrix element is the original coordinate, the value of the corresponding matrix element in the texture feature matrix in the vertical axis direction is directly set to 1. If the pixel point corresponding to the current matrix element is not the original coordinate, the value of the corresponding matrix element in the texture feature matrix in the vertical axis direction is directly set to 0. For example, the pixel point at the lower left corner of the image is taken as the original coordinate, and the matrix element corresponding to the original coordinate in the three-dimensional pixel matrix is denoted as V 1,1 , and the pixel point above the current pixel point in the vertical axis direction is taken as the adjacent pixel point of the current pixel point. If the pixel point in the i-th row along the x direction and the j-th row along the y direction in the image is taken as the current pixel point, and i = 1 and j = 1, it can be known that the original coordinate point of the pixel point in the first row along the x direction and the first row along the y direction in the image is (0, 0, 0). The pixel point in the i-th row along the x direction and the j-th row along the y direction in the image has no pixel point above it in the vertical axis direction, and the pixel point is the original coordinate. In addition, the V 1,1 in the three-dimensional pixel matrix corresponds to Vy 1,1 in the texture feature matrix in the vertical axis direction. Therefore, the value of Vy 1,1 in the texture feature matrix in the vertical axis direction is directly set to 1. At the same time, since the three-dimensional pixel matrix V i,1 (i ∈ 2-image horizontal pixels) does not have adjacent elements, and the pixel point corresponding to V i,1 is not the original coordinate, the value of Vy i,1 in the texture feature matrix in the vertical axis direction is directly set to 0.

[0063] After determining each current matrix element and the adjacent matrix element in the three-dimensional pixel matrix, the matrix element in the texture feature matrix in the vertical axis direction is assigned a value according to the value of the current matrix pixel and the corresponding adjacent matrix element in the three-dimensional pixel matrix. The specific assignment includes: the value of the adjacent matrix element in the three-dimensional pixel matrix is subtracted from the RGB value of the current matrix element to obtain a difference value, and the arithmetic square root of the difference value is calculated. When the arithmetic square root is greater than a set texture threshold, the value of the matrix element in the texture feature matrix in the vertical axis direction is set to “1”, otherwise, it is set to “0”. Specifically, the current matrix element in the three-dimensional pixel matrix is denoted as V i,j+1 , and the adjacent matrix element corresponding to V i,j+1 is denoted as V i,j . In the three-dimensional pixel matrix, V i,j+1 = [Ri,j+1 G i,j+1 B i,j+1 ], V i,j =[R i,j G i,j B i,j If the values ​​of adjacent matrix elements in the three-dimensional pixel matrix are different from the arithmetic squared difference of the current matrix element, then the difference is... Then, the arithmetic squared difference is compared with the texture threshold K. If the arithmetic squared difference is greater than K, then the matrix element Vy in the texture feature matrix along the vertical axis is... i,j+1 The value is set to 1; otherwise, the element Vy in the texture feature matrix along the vertical axis is set to 1. i,j+1 The value is set to 0.

[0064] Continuing with the previous example, we assign values ​​to the matrix elements in the texture feature matrix along the vertical axis using the method described above, constructing the texture feature matrix along the vertical axis. This texture feature matrix along the vertical axis is denoted as: M y ,but

[0065] According to the technical solution provided in the embodiments of this application, a texture feature matrix of an image in the vertical direction is constructed based on the matrix elements in the three-dimensional pixel matrix; the adjacent matrix elements corresponding to each matrix element in the three-dimensional pixel matrix in the vertical direction are determined; and the matrix elements in the texture feature matrix in the vertical direction are assigned values ​​based on the values ​​of the current matrix element and the corresponding adjacent matrix elements in the three-dimensional pixel matrix. This achieves the goal of assigning values ​​to the texture feature matrix in the vertical direction by determining the adjacent matrix elements corresponding to each matrix element in the three-dimensional pixel matrix in the vertical direction, so that the texture feature matrix in the vertical direction can accurately express the texture features of the image in the vertical direction. This improves the accuracy of subsequent difference comparison based on the texture features in the vertical direction and avoids the problem in related technologies where the difference comparison results are inaccurate when comparing two images due to the inability to accurately obtain image features.

[0066] In some examples, feature fusion is performed on the texture feature matrices along the horizontal and vertical axes to obtain the fused texture feature matrix corresponding to the image. Specifically, each pixel in the texture feature matrix along the vertical axis and the texture feature matrix along the horizontal axis is ORed to obtain the fused texture feature matrix. The resulting fused texture feature matrix is ​​as follows:

[0067]

[0068] In some embodiments, such as Figure 5 As shown, by removing discrete points from the fused texture feature matrix, the target texture matrix corresponding to the image is obtained, including:

[0069] S501, convert the fused texture feature matrix into a plurality of analysis units, the plurality of analysis units do not overlap;

[0070] S502, determine discrete points in each analysis unit, and construct an optimized texture matrix based on the analysis unit obtained after removing the discrete points;

[0071] S503, obtain a target texture matrix corresponding to the image based on the optimized texture matrix.

[0072] Specifically, the fused texture feature matrix is converted into a plurality of analysis units, each analysis unit contains a plurality of matrix elements, and the matrix elements in the plurality of analysis units do not overlap. It can be understood that in actual pictures, the difference of a small number of element points cannot be distinguished by the naked eye; the difference of a single pixel point or a small number of pixel points in a region is ignored and considered as "consistent". Therefore, isolated point optimization is to "ignore" isolated difference points that do not affect the overall effect, and set the difference value to "0".

[0073] The specific steps of converting the fused texture feature matrix into a plurality of analysis units are as follows: first, set a certain analysis range, define a square matrix element with a length of d as an analysis unit, that is, each analysis unit contains d rows of matrix elements and d columns of matrix elements, thereby realizing the segmentation of the above-mentioned fused texture feature matrix M into analysis units with a width of d, wherein when the length or width of the edge is insufficient, it is segmented into a rectangle instead.

[0074] Then determine the discrete points in each analysis unit, and construct an optimized texture matrix based on the analysis unit obtained after removing the discrete points, wherein the discrete points are points that do not have a continuous relationship, such as Figure 6 as shown in Figure 6 , the values of the points and the adjacent positions and the diagonal positions are different, therefore, Figure 6 the points in are discrete points; the continuous points are points that have a continuous relationship, such as Figure 7 as shown in Figure 7 , in each image, each point has the same value as at least one of the adjacent positions or the diagonal positions, therefore, Figure 7 the points in are continuous points, wherein how to determine the continuous points and the discrete points will be described in detail later, and will not be described here.

[0075] After determining the discrete points in each analysis unit, an optimized texture matrix is constructed based on the analysis unit obtained after removing the discrete points, and then a target texture matrix corresponding to the image is obtained based on the optimized texture matrix, so that the discrete points are removed in the target texture matrix.

[0076] According to the technical scheme provided in the embodiments of the present application, the fused texture feature matrix is converted into a plurality of analysis units, and the plurality of analysis units do not overlap; discrete points in each analysis unit are determined, and an optimized texture matrix is constructed based on the analysis unit obtained after removing the discrete points; a target texture matrix corresponding to the image is obtained based on the optimized texture matrix, and then the discrete points in the fused texture feature matrix are removed to obtain the target texture matrix corresponding to the image, so that the target texture matrix can more accurately reflect the texture features of the image, thereby avoiding the influence of the discrete points in the image on the image contrast result; finally, difference contrast is performed according to the target texture matrix of the image and the target texture matrix of the image to be compared, so that the obtained difference contrast is accurate, and the problem that the difference contrast result is inaccurate when two images are compared in the related art due to the inability to accurately obtain the image features is avoided.

[0077] In some examples, as shown in Figure 8 The determination of the discrete points in each analysis unit includes:

[0078] S801, according to the value of each matrix element in the analysis unit, the continuous length of each matrix element is determined; the continuous length of the matrix element is compared with the preset erasing length, if the continuous length of the matrix element is lower than the preset erasing length, the matrix element is taken as a discrete point;

[0079] S802, the average value of the matrix elements in the analysis unit is obtained, the average value is compared with the aggregation optimization threshold, and the discrete points in the analysis unit are determined according to the comparison result.

[0080] Specifically, the above step S801 and the above S802 are in a relationship of and / or, that is, in some examples, the discrete points in the analysis unit can be removed only by step S801, the discrete points in the analysis unit can also be removed only by step S802, and the discrete points in the above analysis unit can also be removed by step S801 and step S802 together.

[0081] With the above example, take step S801 as an example, first obtain the value of each matrix element in the analysis unit, and then determine the continuous length of each matrix element according to the value of each matrix element in the analysis unit; specifically, knowing the value of each matrix element in the analysis unit, if the value of the matrix element at a certain place in the analysis unit is 1, it indicates that there is a point at that place in the analysis unit, and then all the points in the analysis unit are obtained; then the outward expansion is performed on all the points in the analysis unit, and within the range of 1 unit expanded from all the points to the surrounding, if there are other points in the profile, all the newly added points also need to continue to expand to the surrounding, and are superimposed with the profile to form a new profile, and this is repeated until the expanded profile has no new points or all the points in the analysis unit have been traversed, at this time the profile is recorded as an independent profile. At this time, the continuous length is the number of all points in the independent profile that meet the conditions; it can be understood that if the number of all points in the independent profile that meet the conditions after expansion is n, and the expansion exceeds the original graph or the original matrix boundary, the part exceeding the boundary is not included, and thus a profile range is formed. If the profile has no other points that meet the conditions, the continuous length of these continuous points is n, that is, the continuous length of the matrix element corresponding to the point is n.

[0082] Then compare the continuous length of the matrix element with the preset erasing length, if the continuous length of the matrix element is lower than the preset erasing length, the matrix element is regarded as a discrete point, wherein the above-mentioned preset erasing length is a value set by relevant personnel according to actual needs, and the embodiment does not limit the specific value of the above-mentioned preset erasing length; wherein if the continuous length of the matrix element is lower than the preset erasing length, the matrix element is regarded as a discrete point, and the value corresponding to the matrix element is reset to 0, realizing the removal of the discrete points in the analysis unit.

[0083] Take step S802 as an example, obtain the average value of the matrix elements in the analysis unit, compare the average value with the aggregation optimization threshold, and determine the discrete points in the analysis unit according to the comparison result; specifically, sum the values of each matrix element in the analysis unit, then divide the summed value by the number of matrix elements in the analysis unit, and then obtain the average value of the matrix elements in the analysis unit, then compare the average value with the aggregation optimization threshold, and then determine the discrete points in the analysis unit according to the comparison result; specifically, when the comparison result indicates that the average value is less than k c , all the matrix elements in the analysis unit are regarded as discrete points, then the value of the matrix element of the analysis unit is set to "0" in the subsequent steps, realizing the removal of the discrete points in the analysis unit; when the comparison result indicates that the average value is between k c ~1-k c , the value of the matrix element in the analysis unit is retained; when the comparison result indicates that the average value is greater than k cIf the value of each matrix element in the analysis unit is set to "1", the value of each matrix element in the analysis unit is set to "1". It can be understood that the clustering optimization threshold is a value set by relevant personnel according to actual needs, and preferably, the clustering optimization threshold k is set to 0 c The value of k is in the range of 0-0.5.

[0084] It can be understood that in some examples, only based on the above step S801 to determine the discrete points in the analysis unit, then the subsequent reconstruction of the optimization texture matrix based on each analysis unit after removing the discrete points, the optimization texture matrix is denoted as M1, and M1 is directly used as the target texture matrix corresponding to the image; similarly, if only based on the above step S802 to determine the discrete points in the analysis unit, then the subsequent reconstruction of the optimization texture matrix based on each analysis unit after removing the discrete points, the optimization texture matrix is denoted as M2, and M2 is directly used as the target texture matrix corresponding to the image; if the discrete points are determined by the above step S801 and the above step S802 respectively, then the optimization texture matrix is reconstructed based on each analysis unit after removing the discrete points after step S801, and the optimization texture matrix is denoted as M1, the optimization texture matrix is reconstructed based on each analysis unit after removing the discrete points after step S802, and the optimization texture matrix is denoted as M2, and then the target texture matrix corresponding to the image is obtained based on M1 and M2. For example, the values of each matrix element in M1 and M2 are ORed, and then the target texture matrix corresponding to the image is obtained.

[0085] According to the technical scheme provided by the embodiment of the present application, in some examples, according to the value of each matrix element in the analysis unit, the continuous length of each matrix element is determined; the continuous length of the matrix element is compared with the preset erasing length, and if the continuous length of the matrix element is lower than the preset erasing length, the matrix element is regarded as a discrete point, which realizes the effect of accurately determining the discrete points of the analysis unit according to the continuous length, and then the target texture matrix obtained based on the discrete points removed subsequently can more accurately reflect the texture features of the image, and the accuracy of the image difference comparison is improved. In some examples, the average value of the matrix elements in the analysis unit is obtained, the average value is compared with the clustering optimization threshold, and the discrete points in the analysis unit are determined according to the comparison result, which realizes the effect of accurately determining the discrete points of the analysis unit according to the comparison result, and then the target texture matrix obtained based on the discrete points removed subsequently can more accurately reflect the texture features of the image, and the accuracy of the image difference comparison is improved.

[0086] In some examples, as shown in Figure 9 , the difference comparison is performed between the target texture matrix of the image and the target texture matrix of the image to be compared to determine the difference degree of the image and the image to be compared, which includes:

[0087] S901. Obtain the target texture matrix corresponding to the image to be compared;

[0088] S902. Construct a difference matrix based on the target texture matrix corresponding to the image and the target texture matrix corresponding to the image to be compared.

[0089] S903. Determine the degree of difference between the image and the image to be compared based on the value of each matrix element in the difference matrix.

[0090] Specifically, the target texture matrix corresponding to the acquired image to be compared is denoted as M2, and the target texture matrix of the image is denoted as M1. An XOR operation is performed on all elements of the two target texture matrices (if the values ​​of the two matrix elements being compared are the same, the comparison result is "0"; otherwise, if the values ​​of the two matrix elements are the same, the comparison result is "1"), thus obtaining a new difference matrix M. d ;

[0091] After obtaining the difference matrix, the degree of difference between the image and the image to be compared is determined based on the values ​​of each matrix element in the difference matrix, the values ​​of each matrix element in the target texture matrix corresponding to the image, and the values ​​of each matrix element in the target texture matrix corresponding to the image to be compared. Specifically, the values ​​of each matrix element in the difference matrix, the values ​​of each matrix element in the target texture matrix corresponding to the image, and the values ​​of each matrix element in the target texture matrix corresponding to the image to be compared are input into the difference value determination formula to determine the degree of difference between the image and the image to be compared. The difference value determination formula is as follows:

[0092]

[0093] Where f represents the degree of difference between the determined image and the image to be compared, and V d(i,j) M in the difference matrix d The value of the (i,j)th matrix element, V 1(i,j) V represents the value of the (i,j)th element in the target texture matrix M1 corresponding to the image. 2(i,j) Let be the value of the (i,j)th matrix element in the target texture matrix M2 corresponding to the image.

[0094] According to the technical scheme provided in the embodiment of the present application, the target texture matrix corresponding to the image to be compared is obtained, the difference matrix is constructed according to the target texture matrix corresponding to the image and the target texture matrix corresponding to the image to be compared, and the difference degree of the image and the image to be compared is determined based on the value of each matrix element in the difference matrix. The difference matrix is constructed by the target texture matrix corresponding to the image and the target texture matrix corresponding to the image to be compared, and finally the difference degree is determined based on the difference matrix. The texture features of the image and the texture features of the image to be compared are comprehensively considered, so that the obtained difference comparison is accurate, and the problem that the difference comparison result is inaccurate when two images are compared in the related art due to the inability to accurately obtain the image features is avoided.

[0095] In some examples, as shown in Figure 10 The difference comparison is performed according to the target texture matrix of the image and the target texture matrix of the image to be compared to determine the difference degree of the image and the image to be compared, including:

[0096] S1001, obtaining a target texture matrix corresponding to an image to be compared;

[0097] S1002, determining a color texture matrix corresponding to the image based on the target texture matrix corresponding to the image and a three-dimensional pixel matrix corresponding to the image, and determining a color texture matrix corresponding to the image to be compared based on the target texture matrix corresponding to the image to be compared and a three-dimensional pixel matrix corresponding to the image to be compared;

[0098] S1003, constructing a difference matrix according to the color texture matrix corresponding to the image and the color texture matrix corresponding to the image to be compared;

[0099] S1004, determining the difference degree of the image and the image to be compared based on the value of each matrix element in the difference matrix.

[0100] Specifically, the obtained target texture matrix corresponding to the image to be compared is denoted as M2, the target texture matrix of the image is denoted as M1, the three-dimensional pixel matrix corresponding to the image is denoted as P1, and the three-dimensional pixel matrix corresponding to the image to be compared is denoted as P2. The specific steps of determining the color texture matrix corresponding to the image based on the target texture matrix corresponding to the image and the three-dimensional pixel matrix corresponding to the image are as follows: the matrix elements of the color texture matrix are constructed according to the pixel points of the image, wherein each pixel point corresponds to a matrix element of the color texture matrix (the matrix element corresponding to the pixel point of the i-th item along the X direction and the j-th item along the Y direction in the image in the color texture matrix is denoted as M1 ci,j(i∈1 - horizontal pixels of the image, j∈1 - vertical pixels of the image)), and then assign values ​​to the matrix elements of the color texture matrix corresponding to the image based on the values ​​of the matrix elements in the target texture matrix corresponding to the image and the matrix elements of the three-dimensional pixel matrix corresponding to the image. The values ​​of the matrix elements of the color texture matrix are the product of the values ​​of the matrix elements in the target texture matrix corresponding to the image and the matrix elements of the three-dimensional pixel matrix corresponding to the image. Specifically, let M1 be the matrix element corresponding to the i-th pixel along the X direction and the j-th pixel along the Y direction in the target texture matrix. i,j The matrix elements of the i-th pixel along the X direction and the j-th pixel along the Y direction in the corresponding 3D pixel matrix are P1. i,j Then, the matrix element M1 corresponding to the i-th pixel along the X direction and the j-th pixel along the Y direction in the color texture matrix of the image is... ci,j The value is M1 c(i,j) =P1 i,j M1 i,j =[R1 i,j M1 i,j G1 i,j M1 i,j B1 i,j M1 i,j The above method is used to assign values ​​to each element of the color texture matrix corresponding to the image, thereby determining the color texture matrix corresponding to the image. Similarly, the above method is used to determine the color texture matrix corresponding to the image to be compared, which will not be elaborated here.

[0101] Then, a difference matrix is ​​constructed based on the color texture matrix corresponding to the image and the color texture matrix corresponding to the image to be compared; specifically, the color texture matrix corresponding to the image is denoted as M1. c The color texture matrix corresponding to the image to be compared is denoted as M2. c By analyzing M1 c and M2 c Perform an XOR operation to construct the difference matrix M. cd .

[0102] In obtaining the difference matrix M cd Then, based on the values ​​of each element in the difference matrix, the values ​​of each element in the target texture matrix corresponding to the image, and the values ​​of each element in the target texture matrix corresponding to the image to be compared, the degree of difference between the image and the image to be compared is determined. Specifically, the values ​​of each element in the difference matrix, the values ​​of each element in the target texture matrix corresponding to the image, and the values ​​of each element in the target texture matrix corresponding to the image to be compared are input into the difference value determination formula to determine the degree of difference between the image and the image to be compared. The difference value determination formula is as follows:

[0103]

[0104] wherein, f is the difference degree of the image and the image to be compared, M cd(i,j) is the value of the (i, j)th matrix element in the difference matrix M cd is the value of the (i, j)th matrix element in the target texture matrix M1 corresponding to the image, V 1(i,j) is the value of the (i, j)th matrix element in the target texture matrix M2 corresponding to the image. 2(i,j) is the value of the (i, j)th matrix element in the target texture matrix M2 corresponding to the image.

[0105] According to the technical scheme provided in the embodiments of the present application, the target texture matrix corresponding to the image to be compared is obtained; the color texture matrix corresponding to the image is determined based on the target texture matrix corresponding to the image and the three-dimensional pixel matrix corresponding to the image, and the color texture matrix corresponding to the image to be compared is determined based on the target texture matrix corresponding to the image to be compared and the three-dimensional pixel matrix corresponding to the image to be compared; the difference matrix is constructed according to the color texture matrix corresponding to the image and the color texture matrix corresponding to the image to be compared; and the difference degree of the image and the image to be compared is determined based on the value of each matrix element in the difference matrix. The color texture matrix corresponding to the image is constructed based on the texture feature matrix of the image and the three-dimensional pixel matrix of the image, the texture feature and the color feature are fully considered, and thus the difference comparison obtained is accurate, and the problem that the difference comparison result is inaccurate when two images are compared in the related art due to the inability to accurately obtain the image feature is avoided.

[0106] All the optional technical solutions described above can be combined to form optional embodiments of the present application, which will not be described one by one here.

[0107] The following is an apparatus embodiment of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the apparatus embodiments of the present application, please refer to the method embodiments of the present application.

[0108] The present embodiment also provides an image comparison device, as shown in Figure 11 The device comprises:

[0109] The matrix acquisition module 1101 is configured to acquire the three-dimensional pixel matrix corresponding to the image according to the pixels of the image.

[0110] The feature acquisition module 1102 is configured to set the texture feature matrix of the image in the horizontal axis direction and the vertical axis direction, respectively, according to the three-dimensional pixel matrix.

[0111] The feature fusion module 1103 is configured to perform feature fusion on the texture feature matrix in the horizontal axis direction and the texture feature matrix in the vertical axis direction to obtain the fusion texture feature matrix corresponding to the image.

[0112] The feature optimization module 1104 is configured to remove the discrete points in the fused texture feature matrix to obtain a texture matrix corresponding to the image, and perform difference comparison on the target texture matrix of the image and the target texture matrix of the image to be compared to determine the difference between the image and the image to be compared.

[0113] In some examples, the feature acquisition module 1102 is further configured to construct a texture feature matrix of the image in the horizontal axis direction according to the matrix elements in the three-dimensional pixel matrix, determine the corresponding adjacent matrix elements of each matrix element in the three-dimensional pixel matrix in the horizontal axis direction, and assign values to the matrix elements in the texture feature matrix in the horizontal axis direction according to the values of the current matrix element and the corresponding adjacent matrix elements in the horizontal axis direction in the three-dimensional pixel matrix.

[0114] In some examples, the feature acquisition module 1102 is further configured to construct a texture feature matrix of the image in the horizontal axis direction according to the matrix elements in the three-dimensional pixel matrix, determine the corresponding adjacent matrix elements of each matrix element in the three-dimensional pixel matrix in the horizontal axis direction, and assign values to the matrix elements in the texture feature matrix in the horizontal axis direction according to the values of the current matrix element and the corresponding adjacent matrix elements in the horizontal axis direction in the three-dimensional pixel matrix.

[0115] The feature optimization module 1104 is further configured to convert the fused texture feature matrix into a plurality of analysis units, the plurality of analysis units do not overlap, determine the discrete points in each analysis unit, and construct an optimized texture matrix based on the analysis units obtained after removing the discrete points. The target texture matrix corresponding to the image is obtained based on the optimized texture matrix.

[0116] The feature optimization module 1104 is further configured to determine the continuous length of each matrix element according to the value of each matrix element in the analysis unit, compare the continuous length of the matrix element with a preset erasing length, and if the continuous length of the matrix element is lower than the preset erasing length, the matrix element is regarded as a discrete point, or the average value of the matrix elements in the analysis unit is obtained, the average value is compared with a clustering optimization threshold, and the discrete points in the analysis unit are determined according to the comparison result.

[0117] The feature optimization module 1104 is further configured to obtain a target texture matrix corresponding to the image to be compared, construct a difference matrix according to the target texture matrix corresponding to the image and the target texture matrix corresponding to the image to be compared, and determine the difference degree between the image and the image to be compared based on the value of each matrix element in the difference matrix.

[0118] The feature optimization module 1104 is also configured to: obtain the target texture matrix corresponding to the image to be compared; determine the color texture matrix corresponding to the image based on the target texture matrix corresponding to the image and the three-dimensional pixel matrix corresponding to the image; determine the color texture matrix corresponding to the image to be compared based on the target texture matrix corresponding to the image to be compared and the three-dimensional pixel matrix corresponding to the image to be compared; construct a difference matrix based on the color texture matrix corresponding to the image and the color texture matrix corresponding to the image to be compared; and determine the degree of difference between the image and the image to be compared based on the value of each matrix element in the difference matrix.

[0119] According to the technical solution provided in the embodiments of this application, the above-mentioned device obtains the three-dimensional pixel matrix corresponding to the image based on the pixels of the image; sets texture feature matrices of the image in the horizontal and vertical directions respectively based on the three-dimensional pixel matrix; performs feature fusion on the texture feature matrix in the horizontal and vertical directions to obtain the fused texture feature matrix corresponding to the image; removes discrete points in the fused texture feature matrix to obtain the target texture matrix corresponding to the image, and performs a difference comparison based on the target texture matrix of the image and the target texture matrix of the image to be compared to determine the degree of difference between the image and the image to be compared. This is achieved by obtaining the texture feature matrix of the image in the horizontal and vertical directions respectively, and then... The texture feature matrices along the horizontal and vertical axes are fused to obtain a fused texture feature matrix corresponding to the image. This allows the fused texture feature matrix to accurately represent the image's features along the horizontal and vertical axes. Then, discrete points in the fused texture feature matrix are removed to obtain the target texture matrix corresponding to the image. This allows the target texture matrix to more accurately represent the image's texture features, thus avoiding the influence of discrete points in the image on the image comparison results. Finally, a difference comparison is performed based on the target texture matrix of the image and the target texture matrix of the image to be compared. This ensures accurate difference comparison and avoids the problem in related technologies where the inability to accurately obtain image features leads to inaccurate difference comparison results when comparing two images.

[0120] Figure 12 This is a schematic diagram of the electronic device 12 provided in an embodiment of this application. Figure 12 As shown, the electronic device 12 of this embodiment includes: a processor 1201, a memory 1202, and a computer program 1203 stored in the memory 1202 and executable on the processor 1201. When the processor 1201 executes the computer program 1203, it implements the steps in the various method embodiments described above. Alternatively, when the processor 1201 executes the computer program 1203, it implements the functions of each module / unit in the various device embodiments described above.

[0121] The electronic device 12 can be an electronic device such as a desktop computer, a notebook computer, a palm computer, a cloud server, and the like. The electronic device 12 can include, but is not limited to, a processor 1201 and a memory 1202. Those skilled in the art can understand that Figure 12 The electronic device 12 is merely an example and does not limit the electronic device 12, and can include more or less components or different components than those shown.

[0122] The processor 1201 can be a central processing unit (CPU), and can also be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like.

[0123] The memory 1202 can be an internal storage unit of the electronic device 12, for example, a hard disk or a memory of the electronic device 12. The memory 1202 can also be an external storage device of the electronic device 12, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, or the like. The memory 1202 can also include both the internal storage unit and the external storage device of the electronic device 12. The memory 1202 is used to store computer programs and other programs and data required by the electronic device.

[0124] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0125] The integrated modules / units, if implemented in the form of software functional units and sold or used as independent products, can be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the above-mentioned embodiment methods can also be completed by a computer program instructing related hardware, and the computer program can be stored in a computer readable storage medium. The computer program can be executed by a processor to implement the steps of the above-mentioned various method embodiments. The computer program can include computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electric carrier signals and telecommunication signals.

[0126] The above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. An image comparison method, characterized in that, The method includes: Obtain the three-dimensional pixel matrix corresponding to the image based on the image's pixels; Setting texture feature matrices for the image along the horizontal and vertical axes based on the three-dimensional pixel matrix includes: constructing texture feature matrices corresponding to the image along the horizontal and vertical axes based on the matrix elements in the three-dimensional pixel matrix; determining the adjacent matrix elements corresponding to each matrix element in the horizontal axis; assigning values ​​to the matrix elements in the texture feature matrix along the horizontal axis based on the values ​​of the current matrix element and the corresponding adjacent matrix elements along the horizontal axis; determining the adjacent matrix elements corresponding to each matrix element in the vertical axis; and assigning values ​​to the matrix elements in the texture feature matrix along the vertical axis based on the values ​​of the current matrix element and the corresponding adjacent matrix elements along the vertical axis. The texture feature matrix along the horizontal axis and the texture feature matrix along the vertical axis are fused to obtain the fused texture feature matrix corresponding to the image. Remove discrete points from the fused texture feature matrix to obtain the target texture matrix corresponding to the image. Perform a difference comparison between the target texture matrix of the image and the target texture matrix of the image to be compared to determine the degree of difference between the image and the image to be compared.

2. The method according to claim 1, characterized in that, Removing discrete points from the fused texture feature matrix to obtain the target texture matrix corresponding to the image includes: The fused texture feature matrix is ​​transformed into multiple analysis units, and the multiple analysis units do not overlap. Determine the discrete points in each of the analysis units, and construct an optimized texture matrix based on the analysis units obtained after removing the discrete points; The target texture matrix corresponding to the image is obtained based on the optimized texture matrix.

3. The method according to claim 2, characterized in that, Determining discrete points in each of the analysis units includes: Based on the value of each matrix element in the analysis unit, the continuous length of each matrix element is determined; the continuous length of the matrix element is compared with the preset erasure length, and if the continuous length of the matrix element is lower than the preset erasure length, the matrix element is treated as a discrete point. or, The average value of the matrix elements in the analysis unit is obtained, the average value is compared with the clustering optimization threshold, and the discrete points in the analysis unit are determined based on the comparison result.

4. The method according to claim 1, characterized in that, A difference comparison is performed between the target texture matrix of the image and the target texture matrix of the image to be compared to determine the degree of difference between the image and the image to be compared, including: Obtain the target texture matrix corresponding to the image to be compared; Construct a difference matrix based on the target texture matrix corresponding to the image to be compared; The degree of difference between the image and the image to be compared is determined based on the value of each element in the difference matrix.

5. The method according to claim 1, characterized in that, A difference comparison is performed between the target texture matrix of the image and the target texture matrix of the image to be compared to determine the degree of difference between the image and the image to be compared, including: Obtain the target texture matrix corresponding to the image to be compared; The color texture matrix corresponding to the image is determined based on the target texture matrix corresponding to the image and the three-dimensional pixel matrix corresponding to the image; the color texture matrix corresponding to the image to be compared is determined based on the target texture matrix corresponding to the image to be compared and the three-dimensional pixel matrix corresponding to the image to be compared. A difference matrix is ​​constructed based on the color texture matrix corresponding to the image and the color texture matrix corresponding to the image to be compared. The degree of difference between the image and the image to be compared is determined based on the value of each element in the difference matrix.

6. An image comparison device, characterized in that, The device includes: A matrix acquisition module is used to acquire the three-dimensional pixel matrix corresponding to the image based on the pixels of the image; The feature acquisition module is used to set texture feature matrices of the image in the horizontal and vertical directions according to the three-dimensional pixel matrix. Setting texture feature matrices of the image in the horizontal and vertical directions according to the three-dimensional pixel matrix includes: constructing texture feature matrices corresponding to the image in the horizontal and vertical directions according to the matrix elements in the three-dimensional pixel matrix; determining the adjacent matrix elements corresponding to each matrix element in the three-dimensional pixel matrix in the horizontal direction; assigning values ​​to the matrix elements in the texture feature matrix in the horizontal direction according to the values ​​of the current matrix element in the three-dimensional pixel matrix and its corresponding adjacent matrix elements in the horizontal direction; determining the adjacent matrix elements corresponding to each matrix element in the three-dimensional pixel matrix in the vertical direction; and assigning values ​​to the matrix elements in the texture feature matrix in the vertical direction according to the values ​​of the current matrix element in the three-dimensional pixel matrix and its corresponding adjacent matrix elements in the vertical direction. The feature fusion module is used to fuse the texture feature matrix in the horizontal axis direction and the texture feature matrix in the vertical axis direction to obtain the fused texture feature matrix corresponding to the image. The feature optimization module is used to remove discrete points from the fused texture feature matrix to obtain the texture matrix corresponding to the image, and to perform a difference comparison between the target texture matrix of the image and the target texture matrix of the image to be compared to determine the degree of difference between the image and the image to be compared.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Quantitative description method of PET image nasopharyngeal carcinoma intra-tumor heterogeneity

    CN108805892A

  • Texture feature measurement method based on particle roughness

    CN110728253A