A method, device, electronic device and medium for extracting cable image features
Through the combination of contour wave transformation and principal component analysis algorithm, the accuracy of cable image feature extraction is improved, the problem of cable identification errors is solved, and the safety and accuracy of cable detection is enhanced.
Patent Information
- Application Number
- CN202111081103.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-15
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-09-15
AI Technical Summary
The prior art has low accuracy in the extraction of cable image features, which can easily lead to cable identification errors, resulting in cable damage during construction and interruption of civil power.
By using the contour wave transformation algorithm and principal component analysis algorithm, the contour wave coefficients of the to-process cable image are obtained, the coefficient sample matrix is constructed, and the principal component extraction is obtained to obtain the new contour wave coefficients, and the feature extraction is performed based on the contour wave transformation algorithm to improve the cable Feature extraction accuracy of the image.
Improve the accuracy of cable identification, avoid the missed cable identification and non-cable identification as cables, and enhance the safety and accuracy of cable detection.
Smart Images

Figure CN113807365B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to image processing technology, and in particular to a method, device, electronic equipment and medium for extracting features of cable images. Background Art
[0002] Underground cables are the lifeline of the city. They are responsible for transmitting electricity and ensuring people's livelihood. In order to prevent damage to underground cable facilities during construction, underground cable detection has become an indispensable task before construction. The ground penetrating radar method is an important means of obtaining cable images. It emits high-frequency electromagnetic waves to the underground medium, and infers the internal structure and distribution characteristics of the underground medium under test based on the received electromagnetic waves that have changed.
[0003] Ground penetrating radar is used to detect underground cables and form echo images. Extracting cable features from echo images can help identify and locate cables. If the cable is identified incorrectly, it will cause cable damage during construction, seriously affecting the electricity consumption of citizens, causing paralysis of large areas, and bringing inconvenience to citizens' lives. Therefore, it is of great significance to extract features from cable images. Summary of the invention
[0004] The embodiments of the present invention provide a method, device, electronic equipment and medium for extracting features of a cable image, so as to improve the accuracy of cable identification.
[0005] In a first aspect, an embodiment of the present invention provides a method for extracting features from a cable image, the method comprising:
[0006] Acquire a cable image to be processed, obtain contourlet coefficients of the cable image to be processed according to a preset contourlet transformation algorithm, and form a coefficient sample matrix of the contourlet coefficients;
[0007] According to the coefficient sample matrix, based on a preset principal component analysis algorithm, principal components are extracted from the contourlet coefficients to obtain a principal component matrix;
[0008] According to the principal component matrix, new contourlet coefficients of the cable image to be processed are determined, and based on a preset contourlet transformation algorithm and the new contourlet coefficients, image features of the cable image to be processed are obtained.
[0009] In a second aspect, an embodiment of the present invention further provides a feature extraction device for a cable image, the device comprising:
[0010] A coefficient sample matrix determination module is used to obtain a cable image to be processed, obtain contourlet coefficients of the cable image to be processed according to a preset contourlet transformation algorithm, and form a coefficient sample matrix of the contourlet coefficients;
[0011] A principal component matrix determination module is used to extract principal components from the contourlet coefficients according to the coefficient sample matrix and based on a preset principal component analysis algorithm to obtain a principal component matrix;
[0012] The image feature determination module is used to determine the new contourlet coefficients of the cable image to be processed according to the principal component matrix, and obtain the image features of the cable image to be processed based on a preset contourlet transformation algorithm and the new contourlet coefficients.
[0013] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the feature extraction method for cable images as described in any embodiment of the present invention is implemented.
[0014] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute the feature extraction method for cable images as described in any embodiment of the present invention.
[0015] The embodiment of the present invention decomposes the cable image to be processed through the contourlet transform algorithm to obtain multiple contourlet coefficients, and constructs a coefficient sample matrix from the contourlet coefficients. According to the preset principal component analysis algorithm, the principal components of the contourlet coefficients are extracted, and the extracted principal components are constructed into a principal component matrix. New contourlet coefficients are determined according to the number of rows and columns in the coefficient sample matrix. Feature extraction is performed based on the new contourlet coefficients and the preset contourlet transform algorithm to obtain the image features of the cable image. By combining the contourlet transform algorithm and the principal component analysis algorithm, the problem of inaccurate feature extraction in the cable image is solved, the omission of cable identification and the identification of non-cable parts as cables are avoided, and the feature extraction accuracy of the cable image is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flowchart of a feature extraction method of a cable image in Embodiment 1 of the present invention;
[0017] Figure 2 It is a flow chart of a feature extraction method of a cable image in Embodiment 2 of the present invention;
[0018] Figure 3 It is a structural block diagram of a feature extraction device for a cable image in Embodiment 3 of the present invention;
[0019] Figure 4 It is a structural schematic diagram of a feature extraction device for cable images in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0020] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0021] Embodiment 1
[0022] Figure 1 The present invention provides a flow chart of a method for extracting cable image features in a first embodiment of the present invention. This embodiment is applicable to the case of performing cable identification on cable images detected by radar. The method can be performed by a device for extracting cable image features. Figure 1 As shown, the method specifically comprises the following steps:
[0023] Step 110: Acquire the cable image to be processed, obtain the contourlet coefficients of the cable image to be processed according to a preset contourlet transformation algorithm, and construct a coefficient sample matrix of the contourlet coefficients.
[0024] The cable image to be processed is an echo image drawn by detecting underground cables using ground penetrating radar and collecting data. The echo image obtained by using ground penetrating radar to detect and image different cables can be characterized by obvious parabolic radar waves, short parabolic lobes, sharp tops, detailed multiple reflection wave groups, and generally strip-shaped as a whole. The radar receiving antenna receives the reflected wave signal and digitizes it, and the computer analyzes and processes the collected data to obtain the cable echo image as the cable image to be processed.
[0025] The image feature extraction algorithm of Contourlet wavelet transform is pre-set. The transformed subband is obtained by performing Contourlet transform on the image. Contourlet transform can obtain Contourlet coefficients on subbands of different scales, namely Contourlet coefficients. The Contourlet coefficients are used as samples to construct a coefficient sample matrix.
[0026] In this embodiment, optionally, according to a preset contourlet transform algorithm, contourlet coefficients of the cable image to be processed are obtained, and a coefficient sample matrix of the contourlet coefficients is constructed, including: decomposing the cable image to be processed according to a preset contourlet transform algorithm to obtain a high-frequency information subband and a low-frequency information subband; determining the contourlet coefficients of the high-frequency information subband and the low-frequency information subband, and constructing the contourlet coefficients as a coefficient sample matrix.
[0027] Specifically, the image feature extraction algorithm of Contourlet wavelet transform is pre-set, and the cable image to be processed is decomposed by Contourlet transform to obtain high-frequency information subbands and one low-frequency information subband at each scale. The Contourlet coefficients of the high-frequency information subbands and low-frequency information subbands at each scale are processed separately, and the Contourlet coefficients obtained for each subband are used as Contourlet coefficients and transformed into vector samples. A matrix is formed by all the vector samples as a coefficient sample matrix. For example, if the number of subbands is n and the number of Contourlet coefficients obtained for each subband is p, then the coefficient sample matrix can be expressed as The beneficial effect of such a setting is that the coefficients of the sub-bands at each scale can be obtained, which facilitates principal component analysis and reconstruction of the coefficients to obtain new Contourlet coefficients, thereby extracting image features based on the new coefficients and improving the cable recognition accuracy.
[0028] Step 120: According to the coefficient sample matrix and based on a preset principal component analysis algorithm, principal components are extracted from the contourlet coefficients to obtain a principal component matrix.
[0029] Among them, according to the preset PCA (Principal Component Analysis) algorithm, the principal component of the Contourlet coefficient is extracted from the coefficient sample matrix, and the principal component matrix is obtained after extraction. The redundant components in the multidimensional data of the image are removed, the amount of calculation is reduced, and the subsequent Contourlet wavelet transform is paved.
[0030] In this embodiment, optionally, according to the coefficient sample matrix, based on a preset principal component analysis algorithm, principal components are extracted from the contour wave coefficients to obtain a principal component matrix, including: according to the coefficient sample matrix and a preset difference determination algorithm, a difference matrix is obtained; the difference matrix is transposed to obtain a covariance matrix, and candidate eigenvalues and candidate eigenvectors of the covariance matrix are determined; according to the candidate eigenvalues and preset eigenvalue screening conditions, target eigenvalues are determined from the candidate eigenvalues, and according to the target eigenvalues, a target eigenvector is determined; according to the target eigenvalues and the target eigenvector, a whitening matrix is obtained; and the whitening matrix is matrix multiplied with the difference matrix to obtain a principal component matrix to complete the principal component extraction of the contour wave coefficients.
[0031] Specifically, the coefficient sample matrix is interpolated to obtain a difference matrix, and the difference matrix is transposed to obtain a covariance matrix. For example, the difference matrix is X n ' ×p , the transpose of the difference matrix is X n ' ×p T , the covariance matrix is Vp×p , According to the covariance matrix, calculate the eigenvalue λ i and the eigenvector A i , respectively as candidate eigenvalues and candidate eigenvectors, multiple candidate eigenvalues and multiple candidate eigenvectors can be obtained. An eigenvalue screening condition is set in advance to determine whether there is a candidate eigenvalue that meets the eigenvalue screening condition. If so, the candidate eigenvalue that meets the eigenvalue screening condition is determined as the target eigenvalue. The eigenvalue and the eigenvector are in a corresponding relationship. Therefore, according to the target eigenvalue, the target eigenvector can be determined from the candidate eigenvector to achieve data dimensionality reduction. Whitening processing can remove the correlation of the signal, and the whitening matrix is calculated according to the selected target eigenvalue and target eigenvector. The obtained whitening matrix is matrix-multiplied with the difference matrix to obtain matrix Y, which is the principal component matrix, that is, the principal component extraction of the Contourlet transform coefficients is completed. The beneficial effect of this setting is that the principal component extraction of the coefficients is performed by the preset PCA algorithm, and the dimension of the data is reduced, so that the coefficients in the coefficient sample matrix are described with as little data as possible. That is, more useful data information can be represented by less data information, and the retained data information is not correlated with each other, avoiding errors caused by too many coefficients during feature extraction, and improving the efficiency and accuracy of image feature extraction.
[0032] In this embodiment, optionally, a difference matrix is obtained according to the coefficient sample matrix and a preset difference determination algorithm, including: determining the average value of any column in the coefficient sample matrix; subtracting the average value of the corresponding column from any element in any column in the coefficient sample matrix to obtain the difference matrix.
[0033] Specifically, after obtaining the coefficient sample matrix, the average value of each column element in the coefficient sample matrix is calculated. For example, the average value of the first column is The average values of the p columns are After obtaining the average value of each column, subtract the average value of each column from each element in each column of the coefficient sample matrix to obtain the difference matrix. The number of rows and columns of the difference matrix is the same as that of the coefficient sample matrix, and the difference matrix can be expressed as The beneficial effect of such a setting is that the coefficient sample matrix is calculated in a simple manner, calculation errors are reduced, the subsequent determination of the principal component matrix is facilitated, and the cable identification accuracy is improved.
[0034] In this embodiment, optionally, based on the candidate eigenvalues and preset eigenvalue screening conditions, a target eigenvalue is determined from the candidate eigenvalues, and based on the target eigenvalue, a target eigenvector is determined, including: sorting the candidate eigenvalues in descending order, and adjusting the sorting of the candidate eigenvectors based on the sorting results of the candidate eigenvalues; selecting the target eigenvalue that meets the preset eigenvalue screening conditions from the sorted candidate eigenvalues, and determining the candidate eigenvector corresponding to the target eigenvalue as the target eigenvector.
[0035] Specifically, the target eigenvalue is selected from the candidate eigenvalues. For example, the eigenvalue with a larger value can be selected from the candidate eigenvalues as the target eigenvalue. In this embodiment, the candidate eigenvalues can be sorted in descending order, and a eigenvalue screening condition can be pre-set. For example, a eigenvalue threshold can be set, and the candidate eigenvalue exceeding the eigenvalue threshold can be used as the target eigenvalue. A ranking range can also be set, and the candidate eigenvalues sorted within the preset ranking range are determined as the target eigenvalue. For example, if the ranking range is the top five, the candidate eigenvalues sorted in the top five are used as the target eigenvalue. According to the preset eigenvalue screening condition, the target eigenvalue is selected from the sorted candidate eigenvalues, and the target eigenvector is determined according to the corresponding relationship between the candidate eigenvalue and the candidate eigenvector. The beneficial effect of such a setting is that the target eigenvalue and the target eigenvector are selected, the data dimension is reduced, the data redundancy is reduced, the required data is retained through the eigenvalue screening condition, the extraction of the main features is realized, and the accuracy and efficiency of feature extraction are improved.
[0036] In this embodiment, optionally, selecting a target feature value that meets the preset feature value screening condition from the sorted candidate feature values includes: determining a target sequence number of the candidate feature value that meets the preset feature value screening condition according to the sorting of the candidate feature values; determining the candidate feature value corresponding to the target sequence number as the target feature value; and determining the target sequence number of the candidate feature value that meets the preset feature value screening condition according to the following formula:
[0037]
[0038] Among them, η m is the parameter of the preset eigenvalue screening condition, p is the number of candidate eigenvalues, m is the target sequence number, and λ is the candidate eigenvalue.
[0039] Specifically, the sorted candidate eigenvalues and the corresponding candidate eigenvectors are processed to select target eigenvalues and target eigenvectors that meet the requirements. The sorted eigenvalues can be calculated according to the following formula:
[0040]
[0041] According to η m Determine m and pre-set ηm The value of η m is the energy of the first m candidate eigenvalues after sorting, and the energy can represent the importance of the eigenvalue. In order to complete the extraction of the main features, usually more than 80% of the energy is selected, that is, η m Set to 80%. After obtaining m, select the first m eigenvalues and corresponding eigenvectors according to the size of m to form a projection matrix. The projection matrix can be expressed as The beneficial effect of such a setting is that, by the preset η m The first m target eigenvalues are determined by the value, ensuring that the characteristics of the remaining target eigenvalues are important features, avoiding the elimination of important features, improving the accuracy of principal component extraction, and thus improving the accuracy of feature extraction.
[0042] Step 130: Determine new contourlet coefficients of the cable image to be processed according to the principal component matrix, and obtain image features of the cable image to be processed based on a preset contourlet transformation algorithm and the new contourlet coefficients.
[0043] Among them, after obtaining the principal component matrix, the principal component matrix is converted into the structural form of the coefficient sample matrix. For example, the principal component matrix can be converted into a structural form consistent with the number of rows and columns of the coefficient sample matrix. The number of rows and columns of the principal component matrix can be less than the number of rows and columns of the coefficient sample matrix, and the elements in the rows and columns added by the principal component matrix can be set to 0. After the conversion, a new coefficient sample matrix is obtained, and according to the new coefficient sample matrix, new Contourlet coefficients are obtained, so as to realize the conversion and screening of Contourlet coefficients, reduce the redundancy of Contourlet coefficients, and complete the reconstruction of new Contourlet coefficients.
[0044] By selecting the Contourlet coefficients obtained by the Contourlet transform, the selected new Contourlet coefficients are reconstructed. According to the preset Contourlet transform algorithm, the new Contourlet coefficients are reconstructed to obtain the main feature information of the contour of the cable image to be processed, that is, the image features of the cable image to be processed are extracted to obtain the location of the cable.
[0045] The technical solution of this embodiment is to decompose the cable image to be processed through the contourlet transform algorithm to obtain multiple contourlet coefficients, and construct a coefficient sample matrix from the contourlet coefficients. According to the preset principal component analysis algorithm, the principal components of the contourlet coefficients are extracted, and the extracted principal components are constructed into a principal component matrix. New contourlet coefficients are determined according to the number of rows and columns in the coefficient sample matrix. Feature extraction is performed based on the new contourlet coefficients and the preset contourlet transform algorithm to obtain the image features of the cable image. By combining the contourlet transform algorithm and the principal component analysis algorithm, the complexity of calculation is reduced, the problem of inaccurate feature extraction in the cable image is solved, the omission of cable identification and the identification of non-cable parts as cables are avoided, the feature extraction accuracy of the cable image is improved, and the safety of cable detection is improved.
[0046] Embodiment 2
[0047] Figure 2 The flowchart of a cable image feature extraction method provided by the second embodiment of the present invention is further optimized based on the above embodiment. The method can be executed by a cable image feature extraction device. Figure 2 As shown, the method specifically comprises the following steps:
[0048] Step 210: Acquire the cable image to be processed, obtain the contourlet coefficients of the cable image to be processed according to a preset contourlet transformation algorithm, and construct a coefficient sample matrix of the contourlet coefficients.
[0049] Step 220: According to the coefficient sample matrix and based on a preset principal component analysis algorithm, principal components are extracted from the contourlet coefficients to obtain a principal component matrix.
[0050] Step 230: Determine new contourlet coefficients of the cable image to be processed according to the principal component matrix, and obtain image features of the cable image to be processed based on a preset contourlet transformation algorithm and the new contourlet coefficients.
[0051] Step 240: Cluster the image features according to a preset clustering algorithm to obtain categories of the image features.
[0052] After the image features are obtained, the image features can be clustered to cluster the image features of the same category into one category. The categories of image features that are obviously not cables are eliminated to improve the accuracy of cable feature determination. A preset clustering algorithm can be used for clustering, for example, a K-Means (K-Means Clustering Algorithm) algorithm can be used, and specifically, a K-Means++ algorithm can be used.
[0053] In this embodiment, the image feature data of the cable image to be processed is processed as a sample according to the preset K-Means++ clustering method, and samples of the same category are classified together to find the corresponding category for each sample. K samples can be selected from the sample set as cluster centers, and then the distances between each sample and the K centers are calculated iteratively, and the minimum distance between the sample and the cluster center is selected to determine the cluster center of the sample. When a new sample is added to a category, the sample mean of the category is recalculated, and the new sample mean is used as the new cluster center of the category. The process is repeated until the new cluster center result is no longer changed.
[0054] In the embodiment of the present invention, the K-Means++ algorithm is selected to obtain the initial cluster center. The algorithm is more stable and will not have a significant impact on the clustering results. The algorithm can reduce the number of iterations of the standard K-Means process by selecting a good cluster center, thereby quickly reaching convergence and improving the stability and accuracy of clustering. After clustering, feature categories that are obviously not cables can be eliminated, avoiding the process of sequentially judging each image feature, which is conducive to quickly finding the location of the cable from the cable image to be processed.
[0055] The embodiment of the present invention decomposes the cable image to be processed through the contourlet transform algorithm to obtain multiple contourlet coefficients, and constructs a coefficient sample matrix from the contourlet coefficients. According to the preset principal component analysis algorithm, the principal components of the contourlet coefficients are extracted, and the extracted principal components are constructed into a principal component matrix. New contourlet coefficients are determined according to the number of rows and columns in the coefficient sample matrix. The coefficients are reconstructed according to the new contourlet coefficients and the preset contourlet transform algorithm to obtain the image features of the cable image. By clustering the image features, the cable position is quickly found to avoid incorrect determination of the cable position. This embodiment combines the PCA algorithm and the image feature extraction algorithm based on the Contourlet wavelet transform, uses the improved image feature extraction algorithm to extract the "hyperbolic" features of the cable echo image, and uses the K-Means++ clustering method to process the ground penetrating radar image data. It improves the detection accuracy and work efficiency of underground cables, enables users to interpret ground penetrating radar images intuitively and effectively, solves the problem of inaccurate feature extraction in cable images, avoids the omission of cable identification, and avoids the occurrence of non-cable parts being identified as cables. It improves the feature extraction accuracy of cable images, thereby improving the safety of cable detection, and has broad application prospects.
[0056] Embodiment 3
[0057] Figure 3This is a structural block diagram of a cable image feature extraction device provided in the third embodiment of the present invention, which can execute a cable image feature extraction method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. Figure 3 As shown, the device specifically includes:
[0058] The coefficient sample matrix determination module 301 is used to obtain a cable image to be processed, obtain contourlet coefficients of the cable image to be processed according to a preset contourlet transformation algorithm, and form a coefficient sample matrix of the contourlet coefficients;
[0059] A principal component matrix determination module 302 is used to extract principal components from the contourlet coefficients according to the coefficient sample matrix based on a preset principal component analysis algorithm to obtain a principal component matrix;
[0060] The image feature determination module 303 is used to determine the new contourlet coefficients of the cable image to be processed according to the principal component matrix, and obtain the image features of the cable image to be processed based on a preset contourlet transformation algorithm and the new contourlet coefficients.
[0061] Optionally, the coefficient sample matrix determination module 301 includes:
[0062] A sub-band obtaining unit, used for decomposing the to-be-processed cable image according to a preset contourlet transform algorithm to obtain a high-frequency information sub-band and a low-frequency information sub-band;
[0063] The matrix construction unit is used to determine the contourlet coefficients of the high-frequency information subband and the low-frequency information subband, and construct the contourlet coefficients into the coefficient sample matrix.
[0064] Optionally, the principal component matrix determination module 302 includes:
[0065] A difference matrix obtaining unit, used to obtain a difference matrix according to the coefficient sample matrix and a preset difference determination algorithm;
[0066] A covariance matrix obtaining unit, used for transposing the difference matrix to obtain a covariance matrix, and determining candidate eigenvalues and candidate eigenvectors of the covariance matrix;
[0067] a target feature value determining unit, configured to determine a target feature value from the candidate feature values according to the candidate feature values and a preset feature value screening condition, and determine a target feature vector according to the target feature value;
[0068] A whitening matrix obtaining unit, used for obtaining a whitening matrix according to the target eigenvalue and the target eigenvector;
[0069] The principal component extraction unit is used to perform matrix multiplication on the whitening matrix and the difference matrix to obtain a principal component matrix to complete the principal component extraction of the contourlet coefficients.
[0070] Optionally, a difference matrix obtaining unit is used to:
[0071] Determine the average value of any column in the coefficient sample matrix;
[0072] The difference matrix is obtained by subtracting the average value of the corresponding column from any element in any column of the coefficient sample matrix.
[0073] Optionally, the target characteristic value determination unit includes:
[0074] A sorting subunit, used to sort the candidate feature values in descending order;
[0075] The eigenvalue selection subunit is used to select a target eigenvalue that meets a preset eigenvalue screening condition from the sorted candidate eigenvalues, and determine a candidate eigenvector corresponding to the target eigenvalue as a target eigenvector.
[0076] Optionally, the eigenvalue selection subunit is used to:
[0077] According to the ranking of the candidate eigenvalues, the target sequence number of the candidate eigenvalues that meet the preset eigenvalue screening conditions is determined;
[0078] Determine the candidate feature value corresponding to the target sequence number as the target feature value;
[0079] The target sequence number of the candidate eigenvalues that meet the preset eigenvalue screening conditions is determined according to the following formula:
[0080]
[0081] Among them, η m is the parameter of the preset eigenvalue screening condition, p is the number of candidate eigenvalues, m is the target sequence number, and λ is the candidate eigenvalue.
[0082] Optionally, the device further comprises:
[0083] The feature clustering module is used to cluster the image features of the cable image to be processed according to a preset clustering algorithm after obtaining the image features to obtain the categories of the image features.
[0084] The embodiment of the present invention decomposes the cable image to be processed through the contourlet transform algorithm to obtain multiple contourlet coefficients, and constructs a coefficient sample matrix from the contourlet coefficients. According to the preset principal component analysis algorithm, the principal components of the contourlet coefficients are extracted, and the extracted principal components are constructed into a principal component matrix. New contourlet coefficients are determined according to the number of rows and columns in the coefficient sample matrix. Feature extraction is performed based on the new contourlet coefficients and the preset contourlet transform algorithm to obtain the image features of the cable image. By combining the contourlet transform algorithm and the principal component analysis algorithm, the problem of inaccurate feature extraction in the cable image is solved, the omission of cable identification and the identification of non-cable parts as cables are avoided, and the feature extraction accuracy of the cable image is improved.
[0085] Embodiment 4
[0086] Figure 4 1 is a schematic diagram of the structure of a cable image feature extraction device provided by Embodiment 4 of the present invention. The cable image feature extraction device is an electronic device, Figure 4 A block diagram of an exemplary electronic device 400 suitable for implementing embodiments of the present invention is shown. Figure 4 The electronic device 400 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0087] like Figure 4 As shown, the electronic device 400 is in the form of a general computing device. The components of the electronic device 400 may include but are not limited to: one or more processors or processing units 401, a system memory 402, and a bus 403 connecting different system components (including the system memory 402 and the processing unit 401).
[0088] Bus 403 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0089] The electronic device 400 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 400, including volatile and non-volatile media, removable and non-removable media.
[0090] System memory 402 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 404 and / or cache memory 405. Electronic device 400 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 406 may be used to read and write non-removable, non-volatile magnetic media ( Figure 4 not shown, usually called a "hard drive"). Although Figure 4 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 403 via one or more data medium interfaces. Memory 402 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of various embodiments of the present invention.
[0091] A program / utility 408 having a set (at least one) of program modules 407 may be stored, for example, in memory 402, such program modules 407 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 407 generally perform the functions and / or methods of the embodiments described herein.
[0092] The electronic device 400 may also communicate with one or more external devices 409 (e.g., keyboard, pointing device, display 410, etc.), one or more devices that enable a user to interact with the electronic device 400, and / or any device that enables the electronic device 400 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 411. Furthermore, the electronic device 400 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) through a network adapter 412. Figure 4 As shown, the network adapter 412 communicates with other modules of the electronic device 400 via the bus 403. It should be understood that although Figure 4 Not shown, other hardware and / or software modules may be used in conjunction with electronic device 400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0093] The processing unit 401 executes various functional applications and data processing by running the program stored in the system memory 402, for example, implementing a feature extraction method of a cable image provided by an embodiment of the present invention, including:
[0094] Acquire a cable image to be processed, obtain contourlet coefficients of the cable image to be processed according to a preset contourlet transformation algorithm, and form a coefficient sample matrix of the contourlet coefficients;
[0095] According to the coefficient sample matrix, based on a preset principal component analysis algorithm, principal components are extracted from the contourlet coefficients to obtain a principal component matrix;
[0096] According to the principal component matrix, new contourlet coefficients of the cable image to be processed are determined, and based on a preset contourlet transformation algorithm and the new contourlet coefficients, image features of the cable image to be processed are obtained.
[0097] Embodiment 5
[0098] Embodiment 5 of the present invention further provides a storage medium containing computer executable instructions, on which a computer program is stored. When the program is executed by a processor, a feature extraction method for a cable image provided in the embodiment of the present invention is implemented, including:
[0099] Acquire a cable image to be processed, obtain contourlet coefficients of the cable image to be processed according to a preset contourlet transformation algorithm, and form a coefficient sample matrix of the contourlet coefficients;
[0100] According to the coefficient sample matrix, based on a preset principal component analysis algorithm, principal components are extracted from the contourlet coefficients to obtain a principal component matrix;
[0101] According to the principal component matrix, new contourlet coefficients of the cable image to be processed are determined, and based on a preset contourlet transformation algorithm and the new contourlet coefficients, image features of the cable image to be processed are obtained.
[0102] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.
[0103] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0104] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0105] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0106] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A feature extraction method for cable images, characterized in that: include: Acquire a cable image to be processed, obtain contourlet coefficients of the cable image to be processed according to a preset contourlet transformation algorithm, and form a coefficient sample matrix of the contourlet coefficients; Obtaining a difference matrix according to the coefficient sample matrix and a preset difference determination algorithm; Transposing the difference matrix to obtain a covariance matrix, and determining candidate eigenvalues and candidate eigenvectors of the covariance matrix; Sorting the candidate feature values in descending order; According to the ranking of the candidate eigenvalues, the target sequence number of the candidate eigenvalues that meet the preset eigenvalue screening conditions is determined; Determine the candidate feature value corresponding to the target sequence number as the target feature value; The target sequence number of the candidate eigenvalues that meet the preset eigenvalue screening conditions is determined according to the following formula: m<p; Among them, η m is the parameter of the preset feature value screening condition, p is the number of candidate feature values, m is the target sequence number, and λ is the candidate feature value; Determine a candidate feature vector corresponding to the target feature value as a target feature vector; Obtaining a whitening matrix according to the target eigenvalue and the target eigenvector; Performing matrix multiplication of the whitening matrix and the difference matrix to obtain a principal component matrix to complete the principal component extraction of the contourlet coefficients; Determine new contourlet coefficients of the cable image to be processed according to the principal component matrix, and obtain image features of the cable image to be processed based on a preset contourlet transformation algorithm and the new contourlet coefficients; After obtaining the image features of the cable image to be processed, the method further includes: The image features are clustered according to a preset clustering algorithm, image features of the same category are clustered into one category, and categories of image features that are obviously not cables are eliminated. The clustering algorithm adopts the K-Means++ algorithm.
2. The method according to claim 1, characterized in that: According to a preset contourlet transformation algorithm, the contourlet coefficients of the cable image to be processed are obtained, and a coefficient sample matrix of the contourlet coefficients is formed, including: Decomposing the to-be-processed cable image according to a preset contourlet transform algorithm to obtain a high-frequency information sub-band and a low-frequency information sub-band; Contourlet coefficients of the high-frequency information subband and the low-frequency information subband are determined, and the contourlet coefficients are constructed as the coefficient sample matrix.
3. The method according to claim 1, characterized in that: According to the coefficient sample matrix and a preset difference determination algorithm, a difference matrix is obtained, including: Determine the average value of any column in the coefficient sample matrix; The difference matrix is obtained by subtracting the average value of the corresponding column from any element in any column of the coefficient sample matrix.
4. A feature extraction device for cable images, characterized in that: include: A coefficient sample matrix determination module is used to obtain a cable image to be processed, obtain contourlet coefficients of the cable image to be processed according to a preset contourlet transformation algorithm, and form a coefficient sample matrix of the contourlet coefficients; The principal component matrix determination module includes: A difference matrix obtaining unit, used to obtain a difference matrix according to the coefficient sample matrix and a preset difference determination algorithm; A covariance matrix obtaining unit, used for transposing the difference matrix to obtain a covariance matrix, and determining candidate eigenvalues and candidate eigenvectors of the covariance matrix; The target characteristic value determination unit comprises: A sorting subunit, used to sort the candidate feature values in descending order; The feature value selection subunit is used to determine the target sequence number of the candidate feature value that meets the preset feature value screening condition according to the ranking of the candidate feature values; determine the candidate feature value corresponding to the target sequence number as the target feature value; and determine the target sequence number of the candidate feature value that meets the preset feature value screening condition according to the following formula: m<p; where η m is the parameter of the preset feature value screening condition, p is the number of candidate feature values, m is the target sequence number, and λ is the candidate feature value; A target feature vector determination subunit, used to determine a target feature vector according to the target feature value; A whitening matrix obtaining unit, used for obtaining a whitening matrix according to the target eigenvalue and the target eigenvector; A principal component extraction unit, used for performing matrix multiplication of the whitening matrix and the difference matrix to obtain a principal component matrix, so as to complete the principal component extraction of the contourlet coefficients; An image feature determination module, used to determine new contourlet coefficients of the cable image to be processed according to the principal component matrix, and obtain image features of the cable image to be processed based on a preset contourlet transformation algorithm and the new contourlet coefficients; The device also includes: a feature clustering module, which is used to cluster the image features of the cable image to be processed according to a preset clustering algorithm after obtaining the image features, clustering image features of the same category into one category, and eliminating categories of image features that are obviously not cables, and the clustering algorithm adopts the K-Means++ algorithm.
5. 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 program, the feature extraction method of the cable image as described in any one of claims 1-3 is implemented.
6. A storage medium containing computer executable instructions, characterized in that: The computer executable instructions are used to perform the feature extraction method of the cable image as described in any one of claims 1-3 when executed by a computer processor.
