A hyperspectral image particle segmentation method and device

By constructing a preset matrix of hyperspectral images and combining spectral and spatial dimension information, candidate edge pixels are selected for segmentation, solving the accuracy problem of mineral particle segmentation in hyperspectral images and achieving higher segmentation accuracy.

CN120747144BActive Publication Date: 2025-12-12CHINA UNIV OF PETROLEUM (BEIJING)
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511211844.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-28
Publication Date
2025-12-12
Estimated Expiration
2045-08-28

AI Technical Summary

Technical Problem

Existing hyperspectral image particle segmentation methods have low segmentation accuracy in rock thin sections due to large differences in mineral particle size, overlapping spectral signals, and blurred edges, making it difficult to effectively segment mineral particles.

Method used

By acquiring the spectral vector of the local region of the image to be processed, a preset matrix is ​​constructed and feature values ​​are calculated. Candidate edge pixels are screened, and binarization is performed by combining spectral and spatial dimension information to segment the granular region.

Benefits of technology

It improves the accuracy of hyperspectral image particle segmentation, enhances the accuracy of edge detection, reduces false positives, and achieves more accurate mineral particle segmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747144B_ABST
    Figure CN120747144B_ABST
Patent Text Reader

Abstract

The application discloses a hyperspectral image particle segmentation method and device, relates to the field of image processing, and aims to improve the accuracy of particle segmentation based on a hyperspectral image. The method comprises the following steps: selecting a local region corresponding to a pixel and constructing a preset matrix of the pixel, the preset matrix being formed by the covariance of any two spectral vectors in the spectral vector of the pixel in the local region corresponding to the pixel; judging whether the pixel is a candidate edge pixel according to the eigenvalue of the preset matrix; combining the spatial dimension and spectral dimension features to judge whether the pixel is a candidate edge pixel; compared with the existing edge detection method which only uses the spatial gradient information of the image, the method can improve the accuracy of detecting edge pixels; further segmenting the particle region according to the candidate edge pixel; realizing the joint detection of the spatial dimension and spectral dimension features of the edge pixel and the segmentation of the particle region according to the edge pixel; and improving the accuracy of particle segmentation based on the hyperspectral image.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of image processing, in particular to a hyperspectral image particle segmentation method and device. BACKGROUND

[0002] The hyperspectral imaging technology can be applied to imaging and analyzing rock thin sections, and the obtained hyperspectral image includes characteristic data of spatial dimensions and spectral dimensions of the rock thin section, and through image analysis, mineral composition recognition, particle boundary division or spatial distribution quantification can be realized, thereby providing key data support for the analysis of reservoir micro features.

[0003] One of the core technologies is to perform mineral particle segmentation according to the obtained hyperspectral image, however, the rock matrix background in the rock thin section is complex, and the mineral contact boundary is gradual, and the mineral particles often have large particle size difference, overlapping spectral signals, fuzzy edges and noise interference, which leads to extremely high difficulty in segmentation. The existing edge detection method detects the particle edge by using the spatial gradient information in the image, and the accuracy of the mineral particle segmentation according to the obtained image is low, for example, it is difficult to segment the particles with fuzzy edges but different mineral compositions. SUMMARY

[0004] In view of this, the purpose of the present application is to provide a hyperspectral image particle segmentation method and device, which can improve the accuracy of particle segmentation according to the hyperspectral image.

[0005] To achieve the above-mentioned purpose, the present application provides the following technical scheme:

[0006] A hyperspectral image particle segmentation method, comprising:

[0007] Obtaining a to-be-processed image, any pixel of the to-be-processed image including data of multiple spectral bands;

[0008] For any pixel of the to-be-processed image, a local area corresponding to the pixel in the to-be-processed image is selected, the local area corresponding to the pixel is a local area containing the pixel, and multiple spectral vectors corresponding to the pixel are obtained, the multiple spectral vectors corresponding to the pixel are spectral vectors of pixels contained in the local area corresponding to the pixel, and the spectral vector of the pixel is formed by the data of the multiple spectral bands of the pixel;

[0009] For any pixel of the to-be-processed image, a preset matrix of the pixel is obtained, the preset matrix of the pixel is formed by the covariance of any two spectral vectors in the multiple spectral vectors corresponding to the pixel, and multiple eigenvalues of the preset matrix of the pixel are obtained, if the size difference of the multiple eigenvalues of the pixel meets a first preset requirement, the pixel is determined as a candidate edge pixel;

[0010] binarizing the to-be-processed image according to whether any pixel of the to-be-processed image is the candidate edge pixel, to obtain an edge image, wherein in the edge image, a pixel is determined to be an in-particle-region pixel or an edge pixel of a particle region according to a gray value of the pixel, and the particle region is segmented out.

[0011] In some embodiments, selecting a local region corresponding to the current pixel in the to-be-processed image comprises:

[0012] In the to-be-processed image, a local region centered at the current pixel is selected as the local region corresponding to the current pixel.

[0013] In some embodiments, obtaining the preset matrix of the current pixel comprises:

[0014] obtaining a data matrix of the current pixel, wherein the data matrix of the current pixel is formed by a plurality of spectral vectors corresponding to the current pixel;

[0015] multiplying a transpose matrix of the data matrix of the current pixel and the data matrix of the current pixel to obtain the preset matrix of the current pixel.

[0016] In some embodiments, the size difference of the plurality of eigenvalues of the current pixel is represented by a coherence value of the current pixel, wherein the coherence value of the current pixel is a ratio of an absolute value of a maximum eigenvalue in the plurality of eigenvalues of the current pixel to a sum of absolute values of the plurality of eigenvalues.

[0017] The size difference of the plurality of eigenvalues of the current pixel satisfying the first preset requirement comprises that the coherence value of the current pixel is greater than a first threshold.

[0018] In some embodiments, the step of determining, in the edge image, a pixel to be an in-particle-region pixel or an edge pixel of a particle region according to a gray value of the pixel, and segmenting out the particle region comprises:

[0019] In the edge image, a seed is selected from pixels other than the candidate edge pixel, and a target region is grown from the seed, wherein for a neighboring pixel of the target region, the neighboring pixel is determined to be an in-target-region pixel or an edge pixel of the target region according to a gray value of the neighboring pixel, and the grown target region is determined as the particle region.

[0020] In some embodiments, the selecting the seeds from the pixels other than the candidate edge pixels in the edge image comprises: for any non-candidate edge pixel in the edge image, obtaining a distance from the non-candidate edge pixel to the nearest candidate edge pixel, selecting the non-candidate edge pixel whose distance satisfies a second preset requirement as a seed pixel, and obtaining a connected domain formed by the seed pixels as the seeds.

[0021] In some embodiments, for any pixel in the image to be processed, before selecting a local region corresponding to the pixel in the image to be processed, the method further comprises:

[0022] For any pixel in the image to be processed, a spectral similarity weight and a spatial distance weight of the pixel with respect to any pixel in the neighborhood of the pixel are obtained, wherein the spectral similarity weight of the pixel is obtained according to a first ratio of the pixel, the first ratio of the pixel being a ratio of a dot product of the spectral vector of the pixel and the spectral vector of any pixel in the neighborhood of the pixel to a product of a length of the spectral vector of the pixel and a length of the spectral vector of any pixel in the neighborhood of the pixel, and the spatial distance weight of the pixel is obtained according to a distance between the pixel and any pixel in the neighborhood of the pixel.

[0023] For any pixel in the image to be processed, the spectral vectors of the pixels in the neighborhood of the pixel are weighted and averaged using the spectral similarity weight and the spatial distance weight corresponding to the pixels in the neighborhood of the pixel to obtain a vector as the spectral vector of the pixel.

[0024] In some embodiments, the weighted and averaged using the spectral similarity weight and the spatial distance weight corresponding to the pixels in the neighborhood of the pixel comprises:

[0025] A first summation result and a second summation result are calculated, the first summation result being a sum of first products of the pixels in the neighborhood of the pixel, the first product being a product of the spectral vector of the pixel, the spectral similarity weight corresponding to the pixel, and the spatial distance weight corresponding to the pixel, and the second summation result being a sum of second products of the pixels in the neighborhood of the pixel, the second product being a product of the spectral similarity weight corresponding to the pixel and the spatial distance weight corresponding to the pixel.

[0026] A ratio of the first summation result and the second summation result is obtained, and a vector obtained as the spectral vector of the pixel.

[0027] In some embodiments, before determining, in the edge image, whether a pixel is a pixel in the particle region or an edge pixel of the particle region according to a gray value of the pixel, the method further comprises:

[0028] The first preset operation on the edge image includes: traversing pixels of the edge image with a first preset structure element, when the first preset structure element moves to any pixel of the edge image, if there is at least one candidate edge pixel in the coverage of the first preset structure element, the any pixel is determined as a candidate edge pixel;

[0029] The second preset operation on the edge image after the first preset operation includes: traversing pixels of the edge image with a second preset structure element, when the second preset structure element moves to any pixel of the edge image, if all the pixels in the coverage of the second preset structure element are candidate edge pixels, the any pixel is determined as a candidate edge pixel, if there is at least one non-candidate edge pixel in the coverage of the second preset structure element, the any pixel is determined as a non-candidate edge pixel.

[0030] A hyperspectral image particle segmentation device, comprising:

[0031] A memory for storing a computer program;

[0032] A processor for executing the computer program to realize the steps of the hyperspectral image particle segmentation method according to any one of the above.

[0033] According to the above technical solution, the hyperspectral image particle segmentation method and device provided by the application, the method comprises: acquiring a to-be-processed image, any pixel of the to-be-processed image comprising data of multiple spectral bands; for any pixel of the to-be-processed image, selecting a local region corresponding to the pixel in the to-be-processed image, and acquiring multiple spectral vectors corresponding to the pixel, the multiple spectral vectors corresponding to the pixel being spectral vectors of pixels contained in the local region corresponding to the pixel, the spectral vector of the pixel being formed by the data of the multiple spectral bands of the pixel; for any pixel of the to-be-processed image, obtaining a preset matrix of the pixel, the preset matrix of the pixel being formed by the covariance of any two spectral vectors in the multiple spectral vectors corresponding to the pixel, and obtaining multiple eigenvalues of the preset matrix of the pixel, if the size difference of the multiple eigenvalues of the pixel meets a first preset requirement, the pixel is determined as a candidate edge pixel; according to whether any pixel of the to-be-processed image is a candidate edge pixel, the to-be-processed image is binarized to obtain an edge image, in the edge image, according to the gray value of the pixel, the pixel is determined as a pixel in a particle region or an edge pixel of the particle region, and thus the particle region is segmented.

[0034] The application has the advantages that the local area corresponding to the pixel is selected, the preset matrix of the pixel is constructed according to the spectral vector of the pixel in the local area, the preset matrix of the pixel reflects the changes of the spatial dimension information and the spectral dimension information of the local area corresponding to the pixel, the eigenvalue of the preset matrix is used to determine whether the pixel is a candidate edge pixel, the spatial dimension and the spectral dimension are combined to determine whether the pixel is a candidate edge pixel, compared with the prior edge detection method which only uses the spatial gradient information of the image to detect the edge, the accuracy of detecting the edge pixel is improved, the particle region is further segmented according to the candidate edge pixel, and the accuracy of segmenting the particle region is improved. Therefore, the hyperspectral image particle segmentation method and device can improve the accuracy of detecting the edge pixel and the accuracy of segmenting the particle according to the hyperspectral image. BRIEF DESCRIPTION OF DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description only show some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.

[0036] Figure 1 A flow chart of a hyperspectral image particle segmentation method provided by an embodiment;

[0037] Figure 2-1 A three-dimensional data cube of a quartz-containing rock thin section obtained for a specific example;

[0038] Figure 2-2 A three-dimensional data cube of a feldspar quartz-containing rock thin section obtained for a specific example;

[0039] Figure 3-1 Three single-band images of a quartz-containing rock thin section obtained for a specific example;

[0040] Figure 3-2 Three single-band images of a feldspar quartz-containing rock thin section obtained for a specific example;

[0041] Figure 4-1 An image of a quartz-containing rock thin section obtained for a specific example, in which candidate edge pixels are screened out;

[0042] Figure 4-2 An image of a feldspar quartz-containing rock thin section obtained for a specific example, in which candidate edge pixels are screened out;

[0043] Figure 5-1 An image of a quartz-containing rock thin section obtained for a specific example, in which particles are segmented;

[0044] Figure 5-2 An image of a feldspathic quartzite rock thin section after particle segmentation obtained for a specific example. DETAILED DESCRIPTION

[0045] In order to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work should fall within the protection scope of the present application.

[0046] Reference can be made to Figure 1 , Figure 1 A flowchart of a hyperspectral image particle segmentation method provided for an embodiment is shown in the figure. The hyperspectral image particle segmentation method includes the following steps.

[0047] S11: An image to be processed is obtained. Any pixel of the image to be processed includes data of multiple spectral bands.

[0048] The image to be processed includes spatial dimension data and spectral dimension data. The data of multiple spectral bands included by any pixel forms the spectral dimension data, and the data included by each pixel of the image to be processed forms the spatial dimension data.

[0049] S12: For any pixel of the image to be processed, a local region corresponding to the pixel in the image to be processed is selected, the local region corresponding to the pixel is a local region containing the pixel, and multiple spectral vectors corresponding to the pixel are obtained, the multiple spectral vectors corresponding to the pixel are spectral vectors of pixels contained by the local region corresponding to the pixel, and the spectral vector of the pixel is formed by the data of the multiple spectral bands of the pixel.

[0050] For any pixel, the spectral vector of the pixel is formed by the data of the multiple spectral bands of the pixel.

[0051] For any pixel, the local region corresponding to the pixel in the image to be processed is selected, and further, the multiple spectral vectors corresponding to the pixel are obtained, that is, the spectral vectors of each pixel contained by the local region corresponding to the pixel are obtained.

[0052] S13: For any pixel of the image to be processed, a preset matrix of the pixel is obtained, the preset matrix of the pixel is formed by the covariance of any two spectral vectors in the multiple spectral vectors corresponding to the pixel, and multiple eigenvalues of the preset matrix of the pixel are obtained. If the size difference of the multiple eigenvalues of the pixel meets a first preset requirement, the pixel is determined as a candidate edge pixel.

[0053] For any pixel, the preset matrix of the pixel is formed by the covariance between any two spectral vectors corresponding to the pixel. The covariance between the two spectral vectors reflects the degree of linear correlation between the two spectral vectors. The eigenvalues of the preset matrix of the pixel can measure the consistency of the gradients of the pixels in the local region corresponding to the pixel in the direction.

[0054] For any pixel, if the pixel is in the non-edge region, i.e., the internal region, of the particle, the spatial data and the spectral data of the local region corresponding to the pixel change little, the sizes of the plurality of eigenvalues of the pixel are uniform, and the difference between the sizes of the plurality of eigenvalues of the pixel is small. If the pixel is at the edge of the particle, the spatial data and / or the spectral data of the local region corresponding to the pixel change greatly, the sizes of the plurality of eigenvalues of the pixel are not uniform, and the difference between the sizes of the plurality of eigenvalues of the pixel is large. According to this, if the difference between the sizes of the plurality of eigenvalues of the pixel meets a first preset requirement, the pixel is determined as a candidate edge pixel.

[0055] S14: According to whether any pixel of the to-be-processed image is the candidate edge pixel, the to-be-processed image is binarized to obtain an edge image. In the edge image, according to the gray value of a pixel, the pixel is determined as a pixel in a particle region or an edge pixel of the particle region, and the particle region is segmented.

[0056] For any pixel, according to whether the pixel is a candidate edge pixel, the pixel is binarized.

[0057] In the edge image, according to the gray value of a pixel in the edge image, the pixel is determined as a pixel in a particle region or an edge pixel of the particle region, and thus the particle region is segmented according to the edge image.

[0058] The hyperspectral image particle segmentation method of the embodiment selects a local region corresponding to a pixel and constructs a preset matrix of the pixel according to the spectral vectors of the pixels in the local region. The preset matrix of the pixel reflects the changes of the spatial dimension information and the spectral dimension information of the local region corresponding to the pixel. Whether the pixel is a candidate edge pixel is determined according to the eigenvalues of the preset matrix, so that whether the pixel is a candidate edge pixel is determined by combining the features of the spatial dimension and the spectral dimension. Compared with the existing edge detection method that only uses the spatial gradient information of an image to detect an edge, the accuracy of detecting an edge pixel can be improved, and the accuracy of segmenting a particle region according to the candidate edge pixel can be improved. Therefore, the hyperspectral image particle segmentation method of the embodiment can improve the accuracy of detecting an edge pixel and the accuracy of segmenting a particle region according to a hyperspectral image.

[0059] In some embodiments, the image to be processed can be considered as a three-dimensional data cube including spatial dimension data and spectral dimension data. Any pixel of the image to be processed includes data of a plurality of spectral bands, such an image is usually referred to as a hyperspectral image, a spectral vector I(x) of a pixel x is formed by the data of the plurality of spectral bands of the pixel, the data of the plurality of spectral bands of the pixel x can be extracted from the three-dimensional data cube of the image to be processed, and the spectral vector I(x) can be obtained by arranging the data of the plurality of spectral bands in a band order.

[0060] In some embodiments, the local region corresponding to the current pixel in the image to be processed is selected by selecting a local region centered at the current pixel in the image to be processed as the local region corresponding to the current pixel. For example, a region including MxM pixels centered at the current pixel can be selected as the local region corresponding to the current pixel, where M is a positive integer greater than or equal to 3. The local region corresponding to the current pixel can also be referred to as a local window of the current pixel.

[0061] In some embodiments, obtaining the preset matrix of the current pixel includes: obtaining a data matrix of the current pixel, the data matrix of the current pixel being formed by a plurality of spectral vectors corresponding to the current pixel; and multiplying a transpose matrix of the data matrix of the current pixel with the data matrix of the current pixel to obtain the preset matrix of the current pixel. The plurality of spectral vectors corresponding to the current pixel are spectral vectors of a plurality of pixels included in the local region corresponding to the current pixel, and the data matrix of the current pixel is obtained according to the plurality of spectral vectors corresponding to the current pixel. For example, the data matrix of the current pixel can be denoted as W, and the multiplication of the transpose matrix of the data matrix of the current pixel with the data matrix of the current pixel can be denoted as: A = W T W; A represents the preset matrix. Any element in the preset matrix A represents the covariance between any pair of spectral vectors in the plurality of spectral vectors corresponding to the current pixel. The preset matrix A can reflect the changes in the spatial dimension information and the spectral dimension information of the local region corresponding to the pixel, and measure the gradient of the fusion feature of the spatial dimension data and the spectral dimension data of the local region corresponding to the pixel. The preset matrix A can be referred to as a self-covariance matrix, which simultaneously captures the changes in the spectral dimension and the spatial dimension feature by the covariance of any two spectral vectors in the plurality of spectral vectors corresponding to the pixel.

[0062] In some embodiments, the size difference of the plurality of eigenvalues of the current pixel is represented by a coherence value of the current pixel, the coherence value of the current pixel being a ratio of an absolute value of a maximum eigenvalue in the plurality of eigenvalues of the current pixel to a sum of absolute values of the plurality of eigenvalues. The size difference of the plurality of eigenvalues of the current pixel satisfying the first preset requirement includes that the coherence value of the current pixel is greater than a first threshold.

[0063] In the method of the embodiment, the preset matrix of the pixel is formed by the covariance between any two spectral vectors of the local region corresponding to the pixel, and the preset matrix can reflect the changes of the spatial dimension information and the spectral dimension information of the local region corresponding to the pixel. Compared with the method of separately calculating the gradient of each spectral band and each direction and then fusing the gradients, the method can statistically analyze the local region corresponding to the pixel at one time, can stably suppress noise, and can naturally fuse the spatial data gradient and the spectral data gradient into the same degree, and further use the coherence value to simply express the consistency of the local multidimensional changes. The differential calculation in the calculation of the gradient of each spectral band and each direction can amplify random noise.

[0064] For example, the coherence value of the pixel can be expressed as:

[0065] (1)

[0066] wherein c represents the coherence value, λ max represents the maximum eigenvalue, λ i represents the i-th eigenvalue. The preset matrix A can be subjected to eigenvalue decomposition to obtain a plurality of eigenvalues, the eigenvalues are arranged in descending order according to the absolute values, and the coherence value is calculated according to the above formula (1).

[0067] The coherence can measure the consistency of the local gradient in a certain direction. The size difference of the plurality of eigenvalues of the preset matrix of the pixel determines the coherence. If all the gradient vectors in the local region change in almost the same direction (corresponding to the edge position), the preset matrix has a large main eigenvalue, and the other eigenvalues are relatively small, and the coherence value is large (close to 1). If it is a non-edge region, the size of all the eigenvalues is close, and the coherence value is small. If the pixel is at the edge of the particle, the spatial data or / and the spectral data of the local region corresponding to the pixel change greatly, the maximum eigenvalue is much larger than the other eigenvalues, and the coherence value tends to 1. If the pixel is at the internal region of the particle, the spatial data and the spectral data of the local region corresponding to the pixel change slightly, the eigenvalues are uniformly distributed, and the coherence value tends to 0.

[0068] In practical applications, the coherent value matrix consistent with the size of the original to-be-processed image can be generated by traversing the pixels of the to-be-processed image, and then the candidate edge pixels are screened according to the coherent value matrix, the pixels with a coherent value greater than the first threshold value are marked as candidate edge pixels, and the preliminary edge detection result is obtained. The method of the embodiment can be considered as using a coherent edge detection method, the local region corresponding to a pixel is selected, the preset matrix of the pixel is constructed, the structure tensor of the local neighborhood of the pixel is analyzed, and the coherent value reflecting the joint characteristics of space and spectrum is calculated to realize the detection of the edge, the spectral gradient and the spatial gradient information of the to-be-processed image are organically fused, the boundary positioning error of the spectral similar mineral is significantly reduced, compared with the existing edge detection method which only uses the spatial information of the image to detect the edge, the problem that the spectral information is not fully utilized is overcome, the misjudgment is reduced, and the accuracy of the edge detection is improved.

[0069] In some embodiments, the binarization processing of the to-be-processed image according to whether any pixel of the to-be-processed image is the candidate edge pixel to obtain the edge image includes: for any pixel of the to-be-processed image, if the pixel is the candidate edge pixel, setting the value of the pixel to 1, and if the pixel is not the candidate edge pixel, setting the value of the pixel to 0 to obtain the edge image. The non-candidate edge pixel refers to a pixel that is not determined as the candidate edge pixel, that is, a pixel other than the candidate edge pixel. After the binarization processing of the to-be-processed image, the pixels with the value of 1 and the value of 0 can be respectively assigned corresponding gray values to obtain the edge image. For example, the pixel with the value of 1 is assigned a gray value of 255, and the pixel with the value of 0 is assigned a gray value of 1.

[0070] In some embodiments, the determination of the pixel as the pixel in the particle region or the edge pixel of the particle region in the edge image according to the gray value of the pixel to segment the particle region includes: in the edge image, selecting a seed from the pixels other than the candidate edge pixels and growing a target region from the seed, and for the adjacent pixels of the target region, determining whether the adjacent pixels belong to the target region or are the edge pixels of the target region according to the gray values of the adjacent pixels, and determining the target region obtained by the growth as the particle region.

[0071] The seed growing target region includes that the target region expands from the seed to the adjacent pixels, and for the adjacent pixels of the current target region, if the adjacent pixels are determined to belong to the target region of the seed according to the gray values of the adjacent pixels, the target region continues to expand to the adjacent pixels of the target region after the growth, and if the adjacent pixels are determined to be the edge pixels according to the gray values of the adjacent pixels, the growth is stopped, and the target region obtained after the growth is stopped is determined as the particle region.

[0072] In some embodiments, determining whether a pixel in the edge image is a pixel in the particle region or an edge pixel of the particle region according to the gray value of the pixel in the edge image can include: if the gray value of the pixel satisfies a first preset condition, determining the pixel as a pixel in the particle region; and if the gray value of the pixel satisfies a second preset condition, determining the pixel as an edge pixel of the particle region. Accordingly, growing a target region from a seed includes: expanding the target region from the seed to neighboring pixels; if the gray value of a neighboring pixel of the current target region satisfies the first preset condition, including the neighboring pixel in the target region of the seed; if the gray value of the neighboring pixel of the current target region satisfies the second preset condition, stopping the growing and taking the neighboring pixel as an edge pixel of the target region of the seed; and determining the target region obtained after the stopping of the growing as the particle region. In some embodiments, the first preset condition can be that the gray value of the pixel is less than a third threshold, and the first preset condition is a low gradient condition. The second preset condition can be that the gray value of the pixel is greater than a fourth threshold, and the second preset condition is a high gradient condition.

[0073] In the present embodiment, the binaryzation processing is performed on the image to be processed according to whether a pixel is a candidate edge pixel, to obtain an edge image, and the particle region is segmented according to the gray value of a pixel in the edge image and the growth of a region, with the candidate edge pixel as a constraint condition to limit the growth of the region across the edge, so as to ensure that the segmentation boundary is consistent with the real particle edge. In the method of the present embodiment, the adjacent pixels with a small gradient are assimilated from a seed according to the change of the gray value of a pixel in the edge image, the region is grown according to the change of the gray value of the pixel, and the growth is stopped when a candidate edge pixel is encountered, and different particle regions are gradually expanded with the progress of the growing process. The present embodiment adopts a watershed segmentation method. If the method of the present embodiment is applied to the image of a mineral thin section, each target region obtained by the growth corresponds to an independent mineral particle according to the watershed segmentation result, so that the accurate segmentation of the mineral particles in a complex rock phase background is realized. In some embodiments, the fourth threshold can be set according to the gray value corresponding to the candidate edge pixel in the edge image.

[0074] In some embodiments, the selecting the seeds from the pixels other than the candidate edge pixels in the edge image comprises: obtaining, in the edge image, for any non-candidate edge pixel, a distance from the non-candidate edge pixel to the nearest candidate edge pixel, selecting the non-candidate edge pixel whose distance satisfies a second preset requirement as a seed pixel, and obtaining a connected domain formed by the seed pixel as the seeds. The non-candidate edge pixel refers to a pixel that is not determined as a candidate edge pixel, i.e., a pixel other than the candidate edge pixel. For any non-candidate edge pixel, the distance from the non-candidate edge pixel to the nearest candidate edge pixel is calculated. The greater the distance from the non-candidate edge pixel to the nearest candidate edge pixel, the farther the non-candidate edge pixel is from the edge and the higher the possibility that the non-candidate edge pixel is inside a particle. Therefore, if the distance corresponding to the non-candidate edge pixel satisfies the second preset requirement, the non-candidate edge pixel is selected as a seed pixel.

[0075] In some embodiments, the distance of the non-candidate edge pixel satisfying the second preset requirement can be that the distance of the non-candidate edge pixel is greater than a second threshold. In the edge image, for any non-candidate edge pixel, the distance from the non-candidate edge pixel to the nearest candidate edge pixel is obtained, a distance image is obtained, the value of any pixel in the distance image is the distance value corresponding to the pixel (i.e., the distance value from the pixel to the nearest candidate edge pixel), and further, the distance image can be subjected to a binaryzation operation according to the second threshold, and the pixel whose distance value is greater than the second threshold is marked as a seed pixel. In actual applications, the second threshold can be set accordingly according to the situation. In some embodiments, obtaining the distance from the non-candidate edge pixel to the nearest candidate edge pixel can be obtaining the Euclidean distance from the non-candidate edge pixel to the nearest candidate edge pixel.

[0076] In some embodiments, the connected domain analysis can be performed on the seed pixels to obtain a connected domain formed by the seed pixels. For any seed, i.e., any independent connected domain formed by the seed pixels, a label can be assigned, and a unique label is assigned to the seed to distinguish different seeds. Different seeds grow into different particle regions, and thus, assigning labels to the seeds facilitates subsequent differentiation of different particle regions.

[0077] In some embodiments, for any pixel of the image to be processed, before selecting a local region corresponding to the pixel in the image to be processed, the following steps are further included:

[0078] S101: obtaining, for any pixel of the image to be processed, a spectral similarity weight and a spatial distance weight of the pixel with respect to any pixel in a neighborhood of the pixel, wherein the spectral similarity weight of the pixel is obtained according to a first ratio of the pixel, and the first ratio of the pixel is a ratio of a dot product of the spectral vector of the pixel and the spectral vector of any pixel in the neighborhood of the pixel to a product of a length of the spectral vector of the pixel and a length of the spectral vector of any pixel in the neighborhood of the pixel, and the spatial distance weight of the pixel is obtained according to a distance between the pixel and any pixel in the neighborhood of the pixel;

[0079] S102: for any pixel of the image to be processed, performing a weighted average on the spectral vectors of the pixels in the neighborhood of the pixel using the spectral similarity weight and the spatial distance weight corresponding to the pixels in the neighborhood of the pixel to obtain a vector as the spectral vector of the pixel.

[0080] In the embodiment, the spectral similarity weight and the spatial distance weight of the pixels in the neighborhood of the pixel of the image to be processed are obtained, and the spectral vector of the pixel is obtained by performing a weighted average on the spectral vectors of the pixels in the neighborhood of the pixel using the spectral similarity weight and the spatial distance weight corresponding to the pixels in the neighborhood of the pixel, so that the image to be processed is preprocessed by fusing the spatial distance weight and the spectral similarity weight, and noise suppression and edge preservation are achieved.

[0081] In some embodiments, the performing a weighted average on the spectral vectors of the pixels in the neighborhood of the pixel using the spectral similarity weight and the spatial distance weight corresponding to the pixels in the neighborhood of the pixel includes: calculating a first summation result and a second summation result, the first summation result being a summation of first products of the pixels in the neighborhood of the pixel, the first product being a product of the spectral vector of the pixel, the spectral similarity weight corresponding to the pixel, and the spatial distance weight, and the second summation result being a summation of second products of the pixels in the neighborhood of the pixel, the second product being a product of the spectral similarity weight corresponding to the pixel and the spatial distance weight; and obtaining a ratio of the first summation result and the second summation result, and a vector obtained as the spectral vector of the pixel.

[0082] For example, for any pixel x of the image to be processed, the spectral similarity weight of a neighborhood pixel x' of the pixel x can be defined as:

[0083] ; (2)

[0084] wherein ω r (x, x') represents the spectral similarity weight of the pixel x with respect to the neighborhood pixel x', I(x) represents the spectral vector of the pixel x, and I(x') represents the spectral vector of the neighborhood pixel x'. denotes the cosine similarity between the spectral vector of pixel x and the spectral vector of the neighborhood pixel x´, and β denotes a spectral similarity adjustment parameter, β > 0.

[0085] The spatial distance weight can be defined as:

[0086] ; (3)

[0087] where ω s (x, x´) denotes the spatial distance weight of pixel x with respect to the neighborhood pixel x´, |x-x´| denotes the distance between pixel x and the neighborhood pixel x´, and σ s denotes the standard deviation of the spatial domain Gaussian kernel, which can be set as σ s = 1. The spatial distance weight is expressed by a Gaussian kernel function.

[0088] The weighted average of the spectral vectors of each pixel in the neighborhood of the current pixel using the spectral similarity weight and the spatial distance weight corresponding to the pixels in the neighborhood of the current pixel can be expressed as:

[0089] ; (4)

[0090] where I flee (x) denotes the obtained spectral vector of the current pixel, and Ω(x) denotes the neighborhood of pixel x. The neighborhood of pixel x can be a local area centered on pixel x.

[0091] The distance between the current pixel and any pixel in the neighborhood of the current pixel can be the Euclidean distance between the current pixel and any pixel in the neighborhood of the current pixel. That is, |x-x´| can be the Euclidean distance between pixel x and the neighborhood pixel x´.

[0092] In the method of the present embodiment, the spectral similarity weight ω r The spectral similarity is measured by the cosine distance between the spectral vectors of pixel x and the neighborhood pixel x´. The more similar the spectral vectors of pixel x and the neighborhood pixel x´, the closer ω r tends to 1, and when the spectral difference is large, ω r tends to 0. The spatial distance weight ω s is expressed by a Gaussian kernel function. The closer the distance between pixel x and the neighborhood pixel x´, the higher the spatial distance weight, and the farther the distance, the lower the spatial distance weight. After the weighted average of the spectral vectors of each pixel in the neighborhood of the pixel using the spectral similarity weight and the spatial distance weight, the characteristics of giving high weight to pixels with similar spectra and close spatial distance and giving low weight to pixels with large spectral difference or far spatial distance are comprehensively reflected. The present embodiment quantifies the spectral similarity by cosine distance, gives low weight to pixels with large spectral difference, avoids edge blurring, applies high weight to pixels with similar spectra, effectively suppresses sensor noise and rock matrix texture interference, and provides a high signal-to-noise ratio spatial spectral feature basis for subsequent edge detection.

[0093] In some embodiments, before determining, according to the gray value of a pixel in the edge image, whether the pixel is a pixel in the particle region or an edge pixel of the particle region, further comprising: performing a first preset operation on the edge image, comprising: traversing the pixels of the edge image with a first preset structuring element, when the first preset structuring element moves to any pixel of the edge image, if there is at least one candidate edge pixel in the coverage range of the first preset structuring element, the any pixel is determined as a candidate edge pixel.

[0094] The first preset structuring element moving to any pixel of the edge image means that the origin of the first preset structuring element coincides with the any pixel of the edge image. The origin of the first preset structuring element is the center reference point of the first preset structuring element. In the embodiment, by performing the first preset operation on the edge image, adjacent candidate edge pixels that are broken are connected.

[0095] In some embodiments, traversing the pixels of the edge image with the first preset structuring element comprises: moving a structuring element after reflection of the first preset structuring element about its origin to any pixel of the edge image, when the structuring element after reflection moves to the any pixel of the edge image, if there is at least one candidate edge pixel in the coverage range of the structuring element after reflection, the any pixel is determined as a candidate edge pixel.

[0096] The reflection of the first preset structuring element about its origin means that the first preset structuring element is mirror transformed with the origin of the first preset structuring element as the center of symmetry, that is, the first preset structuring element is mirror flipped in two-dimensional space with the origin of the first preset structuring element as the point of symmetry (i.e., center-symmetric transformation), so that the position of each point in the first preset structuring element is symmetrically mapped relative to the origin, and a new structuring element symmetric to the shape of the first preset structuring element is obtained. The origin of the first preset structuring element is the geometric center of the first preset structuring element. By traversing the edge image with the structuring element after reflection of the first preset structuring element about its origin, the structuring element is position-aligned and operated with the edge image during translation. The first preset operation on the edge image can be considered as a dilation operation. Exemplarily, it can be represented as:

[0097] ; (5)

[0098] Wherein, E represents the edge image, S1 represents the first preset structuring element, and represents the dilation operator, represents the region where the structuring element after reflection translates to the pixel z, and represents the set intersection, represents the empty set. E dilate represents the image after the first preset operation on the edge image E.

[0099] In some embodiments, before determining whether a pixel is a pixel in the particle region or an edge pixel of the particle region according to the gray value of the pixel in the edge image, further comprising: performing a second preset operation on the edge image subjected to the first preset operation, comprising: traversing pixels of the edge image with a second preset structuring element, when the second preset structuring element moves to any pixel of the edge image, if all pixels in the coverage range of the second preset structuring element are the candidate edge pixels, the any pixel is determined as a candidate edge pixel, if there is at least one non-candidate edge pixel in the coverage range of the second preset structuring element, the any pixel is determined as a non-candidate edge pixel.

[0100] In the embodiment, the second preset operation is performed on the edge image to remove isolated noise points. The second preset operation performed on the edge image can be considered as an erosion operation. Exemplarily, it can be represented as:

[0101] ; (6)

[0102] wherein, represents an erosion operator, S2 represents the second preset structuring element, S2 z represents a region where the second preset structuring element moves to pixel z. represents a subset relationship. E erode represents the image E dilate subjected to the second preset operation.

[0103] In the embodiment, through the closing operation of first dilation and then erosion, the edge continuity can be further optimized, the internal micro-holes can be filled, and the profile can be smoothed. The closing operation of first dilation and then erosion can be defined as:

[0104] (7)

[0105] In some embodiments, the first preset structuring element S1 and the second preset structuring element S2 can be the same structuring element, i.e., S1=S2=S. Then, the first preset operation performed on the edge image E can be represented as:

[0106] ; (8)

[0107] wherein, represents a region where the reflected structuring element moves to pixel z.

[0108] The second preset operation performed on the edge image E dilate subjected to the first preset operation can be represented as:

[0109] (9)

[0110] where S z represents the region where the structuring element S is translated to pixel z.

[0111] The closing operation on the edge image E can be represented as:

[0112] (10)

[0113] Exemplarily, the first preset structuring element or the second preset structuring element can be a rectangular kernel or a square kernel, such as a rectangular kernel of 3x3 or 5x5.

[0114] In some embodiments, before determining, according to the gray value of a pixel, whether the pixel is a pixel in the particle region or an edge pixel of the particle region in the edge image, the method further comprises: repeatedly performing an operation on the edge image multiple times, each time of performing the operation on the edge image comprising: performing a first preset operation on the edge image, and performing a second preset operation on the edge image subjected to the first preset operation; wherein the first preset operation on the edge image comprises: traversing pixels of the edge image with a first preset structuring element, and determining any pixel of the edge image as a candidate edge pixel when the first preset structuring element moves to the pixel if there is at least one candidate edge pixel within the coverage range of the first preset structuring element; and the second preset operation on the edge image comprises: traversing pixels of the edge image with a second preset structuring element, and determining any pixel of the edge image as a candidate edge pixel when the second preset structuring element moves to the pixel if all the pixels within the coverage range of the second preset structuring element are candidate edge pixels, or determining any pixel of the edge image as a non-candidate edge pixel if there is at least one non-candidate edge pixel within the coverage range of the second preset structuring element. The dilation operation on the edge image will expand the region of non-candidate edge pixels and bridge adjacent but broken candidate edge pixels. The subsequent erosion operation can restore the non-candidate edge pixel region to its original state, but fill the holes in the filled region. The repeated dilation operation and erosion operation can help form a more accurate continuous and complete closed edge profile. In this embodiment, the edge structure is optimized by performing morphological post-processing on the image of the determined candidate edge pixels, including dilation, erosion and closing operations. Through the above operations, the broken true edge is effectively connected, the isolated noise points are removed, and the small holes in the edge are filled, forming a continuous and complete closed edge profile, which provides an accurate edge constraint condition for subsequent watershed segmentation, and significantly improves the integrity of the particle boundary and the robustness of the segmentation.

[0115] If the hyperspectral image particle segmentation method of the present embodiment is applied to a rock thin section, the image to be processed is an image obtained by acquiring the rock thin section, which includes spatial information and spectral information of the rock thin section.

[0116] The embodiment also provides a hyperspectral image particle segmentation device, comprising:

[0117] a memory for storing a computer program;

[0118] a processor for implementing the steps of the hyperspectral image particle segmentation method according to any one of the above embodiments when the computer program is executed.

[0119] The hyperspectral image particle segmentation device according to the embodiment can improve the accuracy of detecting edge pixels, and can improve the accuracy of particle segmentation based on the hyperspectral image.

[0120] Exemplarily, in a specific example, a polarized microscope and a hyperspectral camera are used to build a collection system, the spectral range is 400-1000 nm, and the resolution is 2.5 nm; a PC platform is used for data processing. A rock slice sample containing quartz and feldspar is selected, and a 480×480×300 hyperspectral three-dimensional data cube is obtained. Referring to Figure 2-1 and Figure 2-2 , Figure 2-1 a three-dimensional data cube of a rock slice containing quartz obtained in a specific example, Figure 2-2 a three-dimensional data cube of a rock slice containing feldspar quartz obtained in a specific example. Referring to Figure 3-1 and Figure 3-2 , Figure 3-1 three single-band images of a rock slice containing quartz obtained in a specific example, which are images of 50th, 150th and 250th bands in turn, Figure 3-2 three single-band images of a rock slice containing feldspar quartz obtained in a specific example, which are images of 50th, 150th and 250th bands in turn.

[0121] A 3×3 local window is used, and the spatial distance and spectral similarity are weighted (β=1.0, σ s= 1.0), and the data was pre-processed for 3 iterations to suppress noise and preserve edges. Structure tensor analysis was performed based on a 3x3 local window to calculate the coherence value c and mark the candidate edge pixels after thresholding. A 5x5 circular kernel was used for dilation, erosion, and closing operations to optimize edge continuity and fill holes. Referring to Figure 4-1 and Figure 4-2 , Figure 4-1 An image of a quartz-containing rock thin section with the candidate edge pixels screened out, obtained for a specific example, Figure 4-2 An image of a feldspar-quartz-containing rock thin section with the candidate edge pixels screened out, obtained for a specific example.

[0122] The internal seed pixels were marked by distance transformation, and region growing and segmentation were completed with the morphologically optimized edges as constraints. Referring to Figure 5-1 and Figure 5-2 , Figure 5-1 An image of a quartz-containing rock thin section after particle segmentation, obtained for a specific example, Figure 5-2 An image of a feldspar-quartz-containing rock thin section after particle segmentation, obtained for a specific example.

[0123] The hyperspectral image particle segmentation method of the present embodiment is based on a spatial-spectral joint feature edge detection method of structure tensor. By calculating the coherence value of the local window, the spectral gradient and spatial gradient information of the hyperspectral image are fused to solve the boundary misjudgment problem of similar minerals in the spectrum, achieve high-precision edge positioning in a complex background, and realize continuous and complete mineral edge extraction in a complex background. The hyperspectral image segmentation device adapted to rock thin section data acquisition integrates a microscopic hyperspectral imaging system and an edge-guided watershed segmentation algorithm, supports real-time processing and integrated segmentation of multi-scale mineral particle images, and breaks through the adaptability limitations of traditional methods in high-noise and fuzzy boundary scenes. The hyperspectral image segmentation device adapted to rock thin section data acquisition supports real-time processing of multi-scale mineral particle images collected, and realizes integrated and efficient processing from data acquisition to complete particle segmentation.

[0124] The hyperspectral image particle segmentation method and device provided by the present application are described in detail above. In this paper, specific examples are applied to explain the principles and implementation modes of the present application. The above examples are only used to help understand the method and its core idea. It should be noted that for ordinary skilled persons in the technical field, without departing from the principles of the present application, the present application can be improved and modified in several ways, and these improvements and modifications also fall within the protection scope of the present application.

Claims

1. A hyperspectral image particle segmentation method, characterized in that, The method comprises: acquiring a to-be-processed image, any pixel of the to-be-processed image comprising data of a plurality of spectral bands; for any pixel of the to-be-processed image, selecting a local region corresponding to the pixel in the to-be-processed image, the local region corresponding to the pixel being a local region containing the pixel, and acquiring a plurality of spectral vectors corresponding to the pixel, the plurality of spectral vectors corresponding to the pixel being spectral vectors of pixels contained in the local region corresponding to the pixel, the spectral vectors of the pixels being formed by the data of the plurality of spectral bands of the pixels; for any pixel of the to-be-processed image, obtaining a preset matrix of the pixel, the preset matrix of the pixel being formed by the covariance of any two spectral vectors in the plurality of spectral vectors corresponding to the pixel, and obtaining a plurality of eigenvalues of the preset matrix of the pixel, if the size difference of the plurality of eigenvalues of the pixel meets a first preset requirement, the pixel is determined as a candidate edge pixel, wherein the size difference of the plurality of eigenvalues of the pixel is represented by a coherence value of the pixel, the coherence value of the pixel being the ratio of the absolute value of the maximum eigenvalue in the plurality of eigenvalues of the pixel to the sum of the absolute values of the plurality of eigenvalues; according to whether any pixel of the to-be-processed image is the candidate edge pixel, performing binaryzation processing on the to-be-processed image to obtain an edge image, in the edge image, according to the gray value of a pixel, the pixel is determined as a pixel in a particle region or an edge pixel of the particle region, and the particle region is segmented out.

2. The hyperspectral image particle segmentation method of claim 1, wherein, The selecting of the local region corresponding to the pixel in the to-be-processed image comprises: in the to-be-processed image, a local region centered on the pixel is selected as the local region corresponding to the pixel.

3. The hyperspectral image particle segmentation method of claim 1, wherein, The obtaining of the preset matrix of the pixel comprises: obtaining a data matrix of the pixel, the data matrix of the pixel being formed by the plurality of spectral vectors corresponding to the pixel; multiplying the transpose matrix of the data matrix of the pixel and the data matrix of the pixel to obtain the preset matrix of the pixel.

4. The hyperspectral image particle segmentation method of claim 1, wherein, The size difference of the plurality of eigenvalues of the pixel meeting the first preset requirement comprises: the coherence value of the pixel being greater than a first threshold.

5. The hyperspectral image particle segmentation method of claim 1, wherein, The determining of the pixel as a pixel in a particle region or an edge pixel of the particle region in the edge image and the segmentation of the particle region comprise: in the edge image, a seed is selected from pixels other than the candidate edge pixels, and a target region is grown from the seed, in the target region grown from the seed, for a neighboring pixel of the target region, according to the gray value of the neighboring pixel, the neighboring pixel is determined as a pixel in the target region or an edge pixel of the target region, and the target region obtained by the growth is determined as the particle region.

6. The hyperspectral image particle segmentation method of claim 5, wherein, The seed is selected from the pixels other than the candidate edge pixels in the edge image, including: in the edge image, for any non-candidate edge pixel, obtaining a distance from the non-candidate edge pixel to the nearest candidate edge pixel, selecting the non-candidate edge pixel satisfying a second preset requirement as a seed pixel, and obtaining a connected domain formed by the seed pixel as the seed.

7. The hyperspectral image particle segmentation method according to any one of claims 1 to 6, characterized in that, For any pixel of the image to be processed, before selecting a local region corresponding to the pixel in the image to be processed, the method further includes: For any pixel of the image to be processed, obtaining a spectral similarity weight and a spatial distance weight of the pixel with respect to any pixel in a neighborhood of the pixel, wherein the spectral similarity weight of the pixel is obtained according to a first ratio of the pixel, the first ratio of the pixel being a ratio of a dot product of the spectral vector of the pixel and the spectral vector of any pixel in the neighborhood of the pixel to a product of a length of the spectral vector of the pixel and a length of the spectral vector of any pixel in the neighborhood of the pixel, and the spatial distance weight of the pixel is obtained according to a distance between the pixel and any pixel in the neighborhood of the pixel; For any pixel of the image to be processed, performing a weighted average on the spectral vectors of the pixels in the neighborhood of the pixel by using the spectral similarity weight and the spatial distance weight corresponding to the pixels in the neighborhood of the pixel, and obtaining a vector as the spectral vector of the pixel.

8. The hyperspectral image particle segmentation method of claim 7, wherein, The weighted average on the spectral vectors of the pixels in the neighborhood of the pixel by using the spectral similarity weight and the spatial distance weight corresponding to the pixels in the neighborhood of the pixel includes: calculating a first summation result and a second summation result, the first summation result being a sum of first products of the pixels in the neighborhood of the pixel, the first product being a product of the spectral vector of the pixel, the spectral similarity weight and the spatial distance weight corresponding to the pixel, and the second summation result being a sum of second products of the pixels in the neighborhood of the pixel, the second product being a product of the spectral similarity weight and the spatial distance weight corresponding to the pixel; obtaining a ratio of the first summation result and the second summation result, and obtaining a vector as the spectral vector of the pixel.

9. The hyperspectral image particle segmentation method according to any one of claims 1 to 6, characterized in that, Before determining, in the edge image, whether a pixel is an edge pixel of the particle region or an in-particle-region pixel according to a gray value of the pixel, the method further includes: performing a first preset operation on the edge image, including: traversing the pixels of the edge image by using a first preset structural element, and when the first preset structural element moves to any pixel of the edge image, if there is at least one candidate edge pixel in a coverage range of the first preset structural element, determining the any pixel as a candidate edge pixel. The second preset operation on the edge image subjected to the first preset operation comprises: traversing pixels of the edge image with a second preset structure element, when the second preset structure element moves to any pixel of the edge image, if all pixels in a coverage range of the second preset structure element are the candidate edge pixels, the any pixel is determined as a candidate edge pixel, if there is at least one non-candidate edge pixel in the coverage range of the second preset structure element, the any pixel is determined as a non-candidate edge pixel.

10. A hyperspectral image particle segmentation apparatus, characterized by, The method comprises: a memory for storing a computer program; a processor for executing the computer program to realize steps of the hyperspectral image particle segmentation method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Engineering rock group remote sensing classification method and system based on space and spectrum combined characteristics

    CN116758361A