Power image similarity recognition method and device based on discrete cosine transform

The fingerprint features of the power image are extracted through discrete cosine transformation and average hashing algorithms, which solves the problem of poor identification of existing methods under light changes and occlusion, and achieves efficient and accurate similarity recognition of power image, reducing the computation and storage complexity.

CN120495697APending Publication Date: 2025-08-15STATE GRID INFORMATION & TELECOMM BRANCH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510655126.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-21
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The existing power image matching method based on statistical features and deep learning is not effective in light changes, occlusion, etc., and the calculation complexity is high, making it difficult to meet real-time computing and hardware requirements. The scarcity of power image samples leads to limited neural network training.

Method used

The power image is preprocessed by discrete cosine transformation, a preset scale grayscale map is generated, and the upper left corner matrix is ​​extracted after discrete cosine transformation is performed, and a mean hash algorithm is used to convert it into a binary integer, and similar images are identified using Heming distance.

Benefits of technology

It realizes efficient identification of power image samples, reduces redundancy, improves calculation and storage efficiency, and has a recognition accuracy of 92.3%, saving the workload of business personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120495697A_ABST
    Figure CN120495697A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image recognition, and particularly provides a power image similarity recognition method and device based on discrete cosine transform, and the method comprises the steps: carrying out the preprocessing of a power image, and obtaining a preset-scale gray-scale image corresponding to the power image; performing discrete cosine transform on the preset scale grey-scale map to obtain a discrete cosine transform matrix corresponding to the power image; acquiring an upper left corner matrix of the discrete cosine transform matrix, and converting the upper left corner matrix into a binary integer by using an average hash algorithm to obtain fingerprint features of the power image; and taking the image with the Hamming distance between the fingerprint features smaller than a threshold value as a similar power graph. According to the technical scheme provided by the invention, efficient identification of similarity of the electric power image samples is realized, and support is provided for reducing the redundancy of an electric power image sample library.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a method and device for similarity recognition of electric power images based on discrete cosine transform. Background Art

[0002] During the construction of the power image sample set, due to its high professionalism and multiple business scenarios, problems such as category imbalance and low labeling quality are prone to occur. Therefore, there are higher requirements for image diversity. The sample set should cover various scenarios and conditions, such as different lighting conditions, different resolutions, different shooting angles, different background environments, different occlusion levels, etc., to reduce the similarity between images and improve the generalization ability of the training model.

[0003] Therefore, quickly identifying images with identical or similar content from a large number of power image samples is particularly important for improving the efficiency of constructing power image sample sets. Existing image similarity recognition technologies include image matching based on statistical features and feature similarity calculation based on deep learning. Image matching based on statistical features extracts mathematical features that represent global statistical laws in images (such as color histograms, texture distribution, gradient direction histograms, etc.), establishes a similarity measurement model between feature vectors, and achieves correspondence matching between images. It is characterized by strong interpretability and clear physical meaning corresponding to statistical features. For example, texture features reflect the surface state of power equipment, and histogram features reflect the ambient light intensity. Feature similarity calculation based on deep learning extracts high-dimensional semantic features through neural networks and optimizes the feature space distribution through metric learning. It can adaptively adjust the feature layer weights through sample training according to task requirements, for example, strengthening high-frequency texture features in power equipment defect detection.

[0004] However, existing methods such as statistical feature-based image matching and deep learning-based feature similarity calculation have the following limitations in power scenarios:

[0005] (1) Image matching methods based on statistical features use the statistical laws of the entire image as features for calculation. Therefore, they are not effective for local feature points, especially when feature points fail due to lighting changes, object occlusion, and equipment surface stains. At the same time, methods based on pixels or grayscale histograms need to process a large amount of redundant data, which makes it difficult to meet the needs of real-time calculation.

[0006] (2) The feature similarity calculation method based on deep learning requires the training of deep neural networks and relies on large-scale annotated datasets. However, the scarcity of scene-specific samples of power images makes it impossible to train neural networks, which limits the scope of application of this method. At the same time, the high computational complexity of deep learning feature extraction and the certain hardware requirements also limit the application of this method. Summary of the Invention

[0007] In order to overcome the above-mentioned defects, the present invention proposes a method and device for power image similarity recognition based on discrete cosine transform.

[0008] In a first aspect, a method for similarity recognition of power images based on discrete cosine transform is provided, wherein the method comprises:

[0009] Preprocessing the power image to obtain a preset scale grayscale image corresponding to the power image;

[0010] Performing discrete cosine transform on the preset scale grayscale image to obtain a discrete cosine transform matrix corresponding to the power image;

[0011] Obtaining the upper left corner matrix of the discrete cosine transform matrix, and converting the upper left corner matrix into a binary integer using an average hash algorithm to obtain a fingerprint feature of the power image;

[0012] The images with Hamming distance between fingerprint features less than a threshold are regarded as similar power graphs.

[0013] Preferably, the preprocessing includes grayscale processing and scaling processing.

[0014] Furthermore, during the grayscale processing, the grayscale value corresponding to the pixel at position (x, y) in the power image is as follows:

[0015] Gray(x,y)=0.299×R(x,y)+0.578×G(x,y)+0.114×B(x,y)

[0016] In the above formula, x is the horizontal position of the pixel in the power image, y is the vertical position of the pixel in the power image, Gray(x,y) is the grayscale value corresponding to the pixel at position (x,y) in the power image, R(x,y) is the red channel pixel value at position (x,y) in the power image, G(x,y) is the green channel pixel value at position (x,y) in the power image, and B(x,y) is the blue channel pixel value at position (x,y) in the power image.

[0017] Furthermore, during the scaling process, the pixel value at position (x, y) in the scaled image is as follows:

[0018]

[0019] In the above formula, x is the horizontal position of the pixel in the zoom image, y is the vertical position of the pixel in the zoom image, f(x,y) is the pixel value of position (x,y) in the zoom image, (x0,y0), (x0,y1), (x1,y0), and (x1,y1) are the four pixel positions closest to the power image and position (x,y) in the zoom image, x0 and x1 are the two horizontal positions closest to the power image and position (x,y) in the zoom image, and y0 and y1 are the two vertical positions closest to the power image and position (x,y) in the zoom image.

[0020] Preferably, performing discrete cosine transform on the preset scale grayscale image includes:

[0021] The pixel at position (x, y) in the preset scale grayscale image is subjected to discrete cosine transform according to the following formula:

[0022]

[0023] In the above formula, x is the horizontal position of the pixel in the preset scale grayscale image, y is the vertical position of the pixel in the preset scale grayscale image, F(x,y) is the discrete cosine transform result corresponding to the pixel at position (x,y) in the preset scale grayscale image, c(x) is the compensation coefficient of the horizontal position of the pixel in the preset scale grayscale image, c(y) is the compensation coefficient of the vertical position of the pixel in the preset scale grayscale image, N is the number of pixels in the horizontal direction of the image, M is the number of pixels in the vertical direction of the image, f(x,y) is the pixel value at position (x,y) in the preset scale grayscale image, and the compensation coefficient of the horizontal position of the pixel in the preset scale grayscale image is Compensation coefficient of the vertical position of the pixel in the preset scale grayscale image

[0024] Preferably, when the preset scale is 32×32, the upper left corner matrix of the discrete cosine transform matrix is a matrix with a size of 8×8 in the upper left corner direction of the discrete cosine transform matrix.

[0025] Preferably, the converting the upper left corner matrix into a binary integer using an average hashing algorithm comprises:

[0026] Obtain the average value of the elements in the upper left corner matrix;

[0027] The elements in the upper left corner matrix whose values are greater than or equal to the element average are recorded as 1, and the elements whose values are less than the element average are recorded as 0, to obtain the binary integer.

[0028] Preferably, the binary integer is converted into a hexadecimal string for storing the fingerprint feature of the power image.

[0029] In a second aspect, a power image similarity recognition device based on discrete cosine transform is provided, wherein the power image similarity recognition device based on discrete cosine transform comprises:

[0030] A preprocessing module is used to preprocess the power image to obtain a preset scale grayscale image corresponding to the power image;

[0031] a transformation module, configured to perform discrete cosine transform on the preset scale grayscale image to obtain a discrete cosine transform matrix corresponding to the power image;

[0032] an extraction module, configured to obtain an upper left corner matrix of the discrete cosine transform matrix, and convert the upper left corner matrix into a binary integer using an average hash algorithm to obtain a fingerprint feature of the power image;

[0033] The recognition module is used to regard the images whose Hamming distance between fingerprint features is less than a threshold as similar power patterns.

[0034] The above one or more technical solutions of the present invention have at least one or more of the following beneficial effects:

[0035] The present invention relates to the field of image recognition technology, and specifically provides a method and device for identifying similarity of power images based on discrete cosine transform, comprising: pre-processing the power image to obtain a preset scale grayscale image corresponding to the power image; performing discrete cosine transform on the preset scale grayscale image to obtain a discrete cosine transform matrix corresponding to the power image; obtaining the upper left corner matrix of the discrete cosine transform matrix, and using the average value hashing algorithm to convert the upper left corner matrix into a binary integer to obtain the fingerprint feature of the power image; and treating the image with a Hamming distance between the fingerprint features less than a threshold as a similar power image. The technical solution provided by the present invention realizes efficient identification of similar power image samples and provides support for reducing the redundancy of the power image sample library. Specifically:

[0036] (1) This method proposes a fingerprint feature based on discrete cosine transform, which can generate a 64-bit binary number based on the content of the power image and store it in hexadecimal, occupying only 8 bytes of storage space and containing only 1 / 2 of the original image information. 16 , greatly improving computing and storage efficiency;

[0037] (2) Using the power image dataset, the effectiveness of the power image similarity method based on discrete cosine transform fingerprint features was tested. The recognition accuracy reached 92.3%, which saved a lot of work for business personnel compared with manual screening of similar images. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 11 is a flow chart showing the main steps of a method for similarity recognition of power images based on discrete cosine transform according to an embodiment of the present invention;

[0039] Figure 2 is a schematic diagram of a three-channel form of a power image according to an embodiment of the present invention;

[0040] Figure 3 is a grayscale processing result diagram of an embodiment of the present invention;

[0041] Figure 4 is a diagram showing the principle of scaling processing according to an embodiment of the present invention;

[0042] Figure 5 is a diagram showing a result of a scaling process according to an embodiment of the present invention;

[0043] Figure 6 2 is a schematic diagram of a discrete cosine transform process according to an embodiment of the present invention;

[0044] Figure 7 is a schematic diagram of the upper left corner matrix of an embodiment of the present invention;

[0045] Figure 8 This is a conversion principle diagram using the average value hash algorithm according to an embodiment of the present invention;

[0046] Figure 9 This is an application scenario diagram of an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0048] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0049] Example 1

[0050] See attached Figure 1 , Figure 1 FIG. 1 is a flow chart showing the main steps of a method for similarity recognition of power images based on discrete cosine transform according to an embodiment of the present invention. Figure 1 As shown, the power image similarity recognition method based on discrete cosine transform in the embodiment of the present invention mainly includes the following steps:

[0051] Step S101: pre-processing the power image to obtain a preset scale grayscale image corresponding to the power image;

[0052] Step S102: performing discrete cosine transform on the preset scale grayscale image to obtain a discrete cosine transform matrix corresponding to the power image;

[0053] Step S103: obtaining the upper left corner matrix of the discrete cosine transform matrix, and converting the upper left corner matrix into a binary integer using an average hash algorithm to obtain the fingerprint feature of the power image;

[0054] Step S104: The images whose Hamming distances between fingerprint features are less than a threshold are regarded as similar power patterns.

[0055] In this embodiment, the preprocessing includes grayscale processing and scaling processing.

[0056] like Figure 2 As shown in Figure 1, power images are stored in a three-dimensional matrix in a three-channel format based on the image's width and height. The first dimension, C, represents the red, green, and blue colors; the second dimension, W, represents the image's width; and the third dimension, H, represents its height. Power image preprocessing includes grayscale processing and scaling. This process converts the original image into the data format required for discrete cosine transform (DCT).

[0057] Grayscale processing is the process of converting color images into grayscale images. Each pixel in a grayscale image only requires one byte to store the pixel value. Compared with color images, grayscale images take up less memory and run faster. At the same time, grayscale images can increase visual contrast and highlight the image content.

[0058] There are three common methods for image grayscale processing: maximum value method, average value method, and weighted average method. Given that the human eye is most sensitive to green and least sensitive to blue, in this embodiment, during the grayscale processing, the grayscale value corresponding to the pixel at position (x, y) in the power image is as follows:

[0059] Gray(x,y)=0.299×R(x,y)+0.578×G(x,y)+0.114×B(x,y)

[0060] In the above formula, x is the horizontal position of the pixel in the power image, y is the vertical position of the pixel in the power image, Gray(x,y) is the grayscale value corresponding to the pixel at position (x,y) in the power image, R(x,y) is the red channel pixel value at position (x,y) in the power image, G(x,y) is the green channel pixel value at position (x,y) in the power image, and B(x,y) is the blue channel pixel value at position (x,y) in the power image. The grayscale processing result is as follows: Figure 3 shown.

[0061] In one embodiment, scaling is to change the width and height of an image while keeping the image content unchanged. Image pixels are considered as discrete points, and image scaling is to estimate the pixel values of the scaled image based on the pixel values of the original image. This method uses the following interpolation method on the grayscale image to scale the image, and considers the horizontal and vertical directions of the image as the x-axis and y-axis, respectively, as follows: Figure 4 As shown, during the scaling process, the pixel value at position (x, y) in the scaled image is as follows:

[0062]

[0063] In the above formula, x is the horizontal position of the pixel in the scaled image, y is the vertical position of the pixel in the scaled image, f(x,y) is the pixel value of position (x,y) in the scaled image, (x0,y0), (x0,y1), (x1,y0), (x1,y1) are the four pixel positions closest to the power image and position (x,y) in the scaled image, x0 and x1 are the two horizontal positions closest to the power image and position (x,y) in the scaled image, y0 and y1 are the two vertical positions closest to the power image and position (x,y) in the scaled image, f(x0,y) is the pixel value of position (x0,y) in the scaled image, and f(x1,y) is the pixel value of position (x1,y) in the scaled image. The above algorithm is used to uniformly scale grayscale images of different sizes into images of 32x32 size. The scaling results are shown as follows: Figure 5 shown.

[0064] In this embodiment, the discrete cosine transform can transform an image from the pixel domain to the frequency domain. Generally, there is a large amount of correlation between the pixels of an image. After converting the image to the frequency domain, it is possible to retain fewer frequency components based on the frequency amplitude and remove most of the frequency components with smaller amplitudes, thereby obtaining important information in the image. The discrete cosine transform of the preset scale grayscale image includes:

[0065] The pixel at position (x, y) in the preset scale grayscale image is subjected to discrete cosine transform according to the following formula:

[0066]

[0067] In the above formula, x is the horizontal position of the pixel in the preset scale grayscale image, y is the vertical position of the pixel in the preset scale grayscale image, F(x,y) is the discrete cosine transform result corresponding to the pixel at position (x,y) in the preset scale grayscale image, c(x) is the compensation coefficient of the horizontal position of the pixel in the preset scale grayscale image, c(y) is the compensation coefficient of the vertical position of the pixel in the preset scale grayscale image, N is the number of pixels in the horizontal direction of the image, M is the number of pixels in the vertical direction of the image, f(x,y) is the pixel value at position (x,y) in the preset scale grayscale image, and the compensation coefficient of the horizontal position of the pixel in the preset scale grayscale image is Compensation coefficient of the vertical position of the pixel in the preset scale grayscale image

[0068] Through discrete cosine transform, a matrix with the same size as the input image is obtained. Discrete cosine transform is symmetrical. The inverse transform of the discrete cosine transformed value can be restored to the original image. This is the basis for discrete cosine transform to be used as image fingerprint. The discrete cosine transform (DTC) process is as follows: Figure 6 shown.

[0069] In this embodiment, when the preset scale is 32×32, the upper left corner matrix of the discrete cosine transform matrix is a matrix with a size of 8×8 in the upper left corner direction of the discrete cosine transform matrix, such as Figure 7 shown.

[0070] The output of the discrete cosine transform is a 32x32 matrix that retains all information about the input image. Directly using the discrete cosine transform results as image features would be highly complex in terms of storage and computation. To further extract image features, the primary frequency components of the discrete cosine transform results are used as the image's fingerprint. Analysis of the discrete cosine transform results reveals that frequency components with large amplitudes are primarily concentrated in the upper left corner of the matrix.

[0071] In this embodiment, the use of the average hash algorithm to convert the upper left corner matrix into a binary integer includes:

[0072] Obtain the average value of the elements in the upper left corner matrix;

[0073] The elements in the upper left corner matrix whose values are greater than or equal to the element average are recorded as 1, and the elements whose values are less than the element average are recorded as 0, to obtain the binary integer.

[0074] In this embodiment, the binary integer is converted into a hexadecimal string for storing the fingerprint feature of the power image.

[0075] Since the main frequency components are extracted after discrete cosine transform, which contain the main content information of the image, the fingerprint feature is highly resistant to changes in image size, brightness, saturation, etc. As long as the overall structure of the image remains unchanged, the fingerprint feature will not change. The fingerprint feature based on discrete cosine transform can accurately identify images with a deformation degree of less than 25%. The conversion principle of the average hash algorithm is as follows: Figure 8 As stated.

[0076] In a specific embodiment, when calculating the similarity between two images, the binary fingerprint features of the two images are first obtained through the above algorithm, and then the difference of the fingerprints is calculated using the Hamming distance. If the difference is less than a certain threshold, the two images are considered to have similar content. If the difference is 0, it means that the content of the two images is the same.

[0077] The Hamming distance is the number of different corresponding bits of two binary fingerprint features. For example, 10101 and 00110 have three different bits starting from the first bit, namely the 1st bit, the 4th bit, and the 5th bit, and the Hamming distance is 3.

[0078] like Figure 9 As shown in FIG, after the fingerprint features of the two images are obtained, the difference between the two images is calculated by Hamming distance, which is 34. 34 bits of the 64-bit binary value are different, indicating that the two images are significantly different and are not similar images.

[0079] According to the characteristics of fingerprints and the calculation method of Hamming distance, a Hamming distance less than or equal to 8 is used as the threshold for similar images.

[0080] The above method can be used to determine whether there are images with similar content in the power image dataset, thereby achieving the purpose of image redundancy recognition.

[0081] Example 2

[0082] Based on the same inventive concept, the present invention also provides a power image similarity recognition device based on discrete cosine transform, the power image similarity recognition device based on discrete cosine transform comprising:

[0083] A preprocessing module is used to preprocess the power image to obtain a preset scale grayscale image corresponding to the power image;

[0084] a transformation module, configured to perform discrete cosine transform on the preset scale grayscale image to obtain a discrete cosine transform matrix corresponding to the power image;

[0085] an extraction module, configured to obtain an upper left corner matrix of the discrete cosine transform matrix, and convert the upper left corner matrix into a binary integer using an average hash algorithm to obtain a fingerprint feature of the power image;

[0086] The recognition module is used to regard the images whose Hamming distance between fingerprint features is less than a threshold as similar power patterns.

[0087] Preferably, the preprocessing includes grayscale processing and scaling processing.

[0088] Furthermore, during the grayscale processing, the grayscale value corresponding to the pixel at position (x, y) in the power image is as follows:

[0089] Gray(x,y)=0.299×R(x,y)+0.578×G(x,y)+0.114×B(x,y)

[0090] In the above formula, x is the horizontal position of the pixel in the power image, y is the vertical position of the pixel in the power image, Gray(x,y) is the grayscale value corresponding to the pixel at position (x,y) in the power image, R(x,y) is the red channel pixel value at position (x,y) in the power image, G(x,y) is the green channel pixel value at position (x,y) in the power image, and B(x,y) is the blue channel pixel value at position (x,y) in the power image.

[0091] Furthermore, during the scaling process, the pixel value at position (x, y) in the scaled image is as follows:

[0092]

[0093] In the above formula, x is the horizontal position of the pixel in the zoom image, y is the vertical position of the pixel in the zoom image, f(x,y) is the pixel value of position (x,y) in the zoom image, (x0,y0), (x0,y1), (x1,y0), and (x1,y1) are the four pixel positions closest to the power image and position (x,y) in the zoom image, x0 and x1 are the two horizontal positions closest to the power image and position (x,y) in the zoom image, and y0 and y1 are the two vertical positions closest to the power image and position (x,y) in the zoom image.

[0094] Preferably, performing discrete cosine transform on the preset scale grayscale image includes:

[0095] The pixel at position (x, y) in the preset scale grayscale image is subjected to discrete cosine transform according to the following formula:

[0096]

[0097] In the above formula, x is the horizontal position of the pixel in the preset scale grayscale image, y is the vertical position of the pixel in the preset scale grayscale image, F(x,y) is the discrete cosine transform result corresponding to the pixel at position (x,y) in the preset scale grayscale image, c(x) is the compensation coefficient of the horizontal position of the pixel in the preset scale grayscale image, c(y) is the compensation coefficient of the vertical position of the pixel in the preset scale grayscale image, N is the number of pixels in the horizontal direction of the image, M is the number of pixels in the vertical direction of the image, f(x,y) is the pixel value at position (x,y) in the preset scale grayscale image, and the compensation coefficient of the horizontal position of the pixel in the preset scale grayscale image is Compensation coefficient of the vertical position of the pixel in the preset scale grayscale image

[0098] Preferably, when the preset scale is 32×32, the upper left corner matrix of the discrete cosine transform matrix is a matrix with a size of 8×8 in the upper left corner direction of the discrete cosine transform matrix.

[0099] Preferably, the converting the upper left corner matrix into a binary integer using an average hashing algorithm comprises:

[0100] Obtain the average value of the elements in the upper left corner matrix;

[0101] The elements in the upper left corner matrix whose values are greater than or equal to the element average are recorded as 1, and the elements whose values are less than the element average are recorded as 0, to obtain the binary integer.

[0102] Preferably, the binary integer is converted into a hexadecimal string for storing the fingerprint feature of the power image.

[0103] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0104] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0105] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.

[0107] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the claims of the present invention.

Claims

1. A method for similarity recognition of power images based on discrete cosine transform, characterized in that: The method comprises: Preprocessing the power image to obtain a preset scale grayscale image corresponding to the power image; Performing discrete cosine transform on the preset scale grayscale image to obtain a discrete cosine transform matrix corresponding to the power image; Obtaining the upper left corner matrix of the discrete cosine transform matrix, and converting the upper left corner matrix into a binary integer using an average hash algorithm to obtain a fingerprint feature of the power image; The images with Hamming distance between fingerprint features less than a threshold are regarded as similar power graphs.

2. The method according to claim 1, wherein The pre-processing includes grayscale processing and scaling processing.

3. The method according to claim 2, wherein During the grayscale processing, the grayscale value corresponding to the pixel at position (x, y) in the power image is as follows: Gray(x,y)=0.299×R(x,y)+0.578×G(x,y)+0.114×B(x,y) In the above formula, x is the horizontal position of the pixel in the power image, y is the vertical position of the pixel in the power image, Gray(x,y) is the grayscale value corresponding to the pixel at position (x,y) in the power image, R(x,y) is the red channel pixel value at position (x,y) in the power image, G(x,y) is the green channel pixel value at position (x,y) in the power image, and B(x,y) is the blue channel pixel value at position (x,y) in the power image.

4. The method according to claim 2, wherein During the scaling process, the pixel value at position (x, y) in the scaled image is as follows: In the above formula, x is the horizontal position of the pixel in the zoom image, y is the vertical position of the pixel in the zoom image, f(x,y) is the pixel value of position (x,y) in the zoom image, (x0,y0), (x0,y1), (x1,y0), and (x1,y1) are the four pixel positions closest to the power image and position (x,y) in the zoom image, x0 and x1 are the two horizontal positions closest to the power image and position (x,y) in the zoom image, and y0 and y1 are the two vertical positions closest to the power image and position (x,y) in the zoom image.

5. The method according to claim 1, wherein The performing discrete cosine transform on the preset scale grayscale image includes: The pixel at position (x, y) in the preset scale grayscale image is subjected to discrete cosine transform according to the following formula: In the above formula, x is the horizontal position of the pixel in the preset scale grayscale image, y is the vertical position of the pixel in the preset scale grayscale image, F(x,y) is the discrete cosine transform result corresponding to the pixel at position (x,y) in the preset scale grayscale image, c(x) is the compensation coefficient of the horizontal position of the pixel in the preset scale grayscale image, c(y) is the compensation coefficient of the vertical position of the pixel in the preset scale grayscale image, N is the number of pixels in the horizontal direction of the image, M is the number of pixels in the vertical direction of the image, f(x,y) is the pixel value at position (x,y) in the preset scale grayscale image, and the compensation coefficient of the horizontal position of the pixel in the preset scale grayscale image is Compensation coefficient of the vertical position of the pixel in the preset scale grayscale image 6. The method according to claim 1, wherein When the preset scale is 32×32, the upper left corner matrix of the discrete cosine transform matrix is a matrix with a size of 8×8 in the upper left corner direction of the discrete cosine transform matrix.

7. The method according to claim 1, wherein The method of converting the upper left corner matrix into a binary integer by using an average hashing algorithm includes: Obtain the average value of the elements in the upper left corner matrix; The elements in the upper left corner matrix whose values are greater than or equal to the element average are recorded as 1, and the elements whose values are less than the element average are recorded as 0, to obtain the binary integer.

8. The method according to claim 1, wherein The binary integer is converted into a hexadecimal string for storing the fingerprint feature of the power image.

9. A device based on the method for similarity recognition of power images based on discrete cosine transform according to any one of claims 1 to 8, characterized in that: The device comprises: A preprocessing module is used to preprocess the power image to obtain a preset scale grayscale image corresponding to the power image; a transformation module, configured to perform discrete cosine transform on the preset scale grayscale image to obtain a discrete cosine transform matrix corresponding to the power image; an extraction module, configured to obtain an upper left corner matrix of the discrete cosine transform matrix, and convert the upper left corner matrix into a binary integer using an average hash algorithm to obtain a fingerprint feature of the power image; The recognition module is used to regard the images whose Hamming distance between fingerprint features is less than a threshold as similar power patterns.