A distance coding diversity method for measuring the spatial orderliness of images
Through the distance coding diversity method, the frequency ratio of the distance coding values of each gray value category in the image is calculated using sliding windows and closed-loop distance coding, which solves the problem that the existing technology is difficult to reflect the spatial orderly distribution characteristics of image texture primitives, and realizes a simple and effective measurement of the orderly image space.
Patent Information
- Application Number
- CN202211600454.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-12
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2042-12-12
AI Technical Summary
The prior art is difficult to effectively reflect the spatially ordered distribution characteristics of image texture primitives, and the algorithm is complex, the computing efficiency is low, and the application is limited.
Through the distance encoding diversity method, the frequency ratio of the distance encoding values of each gray value category in the image is calculated using sliding windows and closed-loop distance encoding, and the distance encoding diversity is calculated using the Simpson index or Shannon-Winer index.
The effect of not only reflecting the spatial distribution properties of the target, but also further reflecting the spatially ordered distribution characteristics of the target. The method is simple, easy to implement and has wide applicability.
Smart Images

Figure CN115984608B_ABST
Abstract
Description
Technical Field
[0001] A Distance Encoding Diversity Method for Measuring the Spatial Orderliness of Images Background Art
[0002] Image features are the basis for image target recognition. Image features can be divided into spectral features, spatial features, and scene features. Spectral features, also known as color features, are manifested as the brightness and color of an image, reflecting the spectral properties of the target. Spatial features can be further subdivided into texture features and shape features: Texture features are manifested as the repeated appearance of local targets in an image over a larger spatial range, reflecting the spatial distribution properties of the target; Shape features are manifested as the geometric shape of an image, reflecting the spatial geometric properties of the target. Scene features, also known as spatial relationship features or spatial structure features, are manifested as the mutual spatial positions or relative direction relationships between multiple targets in an image, reflecting the spatial relationships between multiple targets.
[0003] The spatial orderliness feature of an image is a type of texture feature of the image, manifested as the orderly appearance of local targets in the image over a larger spatial range according to a certain rule, reflecting the characteristics of the spatial orderly distribution of the target. Currently, the methods for describing texture features include statistical methods, geometric methods, model methods, and signal processing methods. The statistical method describes texture features based on the gray-level attributes of pixels and their neighborhoods. The typical representative is the gray-level co-occurrence matrix. It is based on the characteristic of repeated appearance of texture. By statistically calculating the probability of the occurrence of each gray-level value pair in two windows, and then calculating measure indexes for describing texture such as information entropy, correlation, and second-order moment based on the probability of each gray-level value pair; this type of method is simple and easy to implement, but it cannot reflect the spatial orderly distribution characteristics of texture primitives (basic texture elements). The geometric method believes that complex textures can be composed of several simple texture primitives arranged repeatedly according to a certain rule. More influential geometric methods include the Voronio checkerboard feature method, syntactic texture description algorithm, and mathematical morphology method; this type of method can reflect the spatial orderly distribution characteristics of texture primitives, but the algorithm is relatively complex, and the changes in the structure are frequent and diverse, so its application is limited. The model method assumes that the texture is formed by a distribution model controlled by certain parameters, so the parameters of the model are used as measure indexes for describing texture. Representative methods include the Markov random field (MRF) model, Gibbs random field model, etc.; this type of method can take into account the local randomness and overall regularity of the texture, with great flexibility, but the solution of the model coefficients is difficult, the operation efficiency is low, and the parameter adjustment is difficult. The signal processing method is based on time-domain, frequency-domain analysis, and multi-scale analysis. First, a certain transformation is performed on a local area of the image, and then the relatively stable eigenvalue is extracted, and this eigenvalue is used as the measure index for describing texture features. Representative algorithms include window Fourier transform, wavelet transform, etc.; this type of method can represent the texture at multiple resolutions and can analyze the texture at a finer scale, but the calculation amount is large, and the effect on natural images with complex backgrounds is not good.
[0004] In summary, existing methods for describing texture features either fail to reflect the spatial ordered distribution characteristics of texture primitives, or have complex algorithms, low operation efficiency, and high application difficulty.
[0005] If texture primitives show regular repeated arrangements in space, it means that the distances between texture primitives will be relatively constant, the distance coding values will be relatively single, that is, the diversity of distances will be low. Therefore, we can perform distance coding on the gray values of various types of images according to this characteristic, and use the diversity of distance coding to measure the spatial order of the image. The lower the diversity of distance coding, the more orderly the distribution of texture primitives on the image. Summary of the Invention
[0006] In view of the deficiencies of existing methods for measuring image texture features, the present invention proposes a distance coding diversity method for measuring the spatial order of an image, aiming to not only reflect the spatial distribution properties of the target, but also further reflect the spatial ordered distribution characteristics of the target, and the method is simple and easy to implement.
[0007] To achieve this purpose, the present invention adopts the following technical solutions:
[0008] A distance coding diversity method for measuring the spatial order of an image, comprising the following steps:
[0009] A. Input an image, input a remote sensing image or a thematic classification image.
[0010] B. Calculate the operational taxonomic units (OTUs), so that each gray value of the calculated two-dimensional OTU image represents a category.
[0011] If the input image is a single-band remote sensing image and the number of gray levels is small, such as byte-type data with at most 256 gray levels, each gray value can be directly regarded as a category, and at this time the single-band remote sensing image can be directly used as the two-dimensional OTU image; or the gray levels of the single-band remote sensing image can be compressed or image classification can be performed to calculate the two-dimensional OTU image. If the input image is a multi-band remote sensing image, the two-dimensional OTU image can be calculated by using an image classification method. If the input image is a thematic classification image, since each gray value already represents a category, the thematic classification image can be directly used as the two-dimensional OTU image at this time; or the categories of the thematic classification image can be further processed, such as merging similar categories, to calculate the two-dimensional OTU image.
[0012] C. Set a sliding window, set a sliding window of N columns × M rows.
[0013] The number of columns N and the number of rows M of the sliding window can be the same or different, and their values are preferably odd numbers, so as to ensure that the sliding window has a central pixel.
[0014] D. Extract the grayscale value array, and extract the grayscale value array of the OTU image within the range of the sliding window.
[0015] E. Perform closed-loop distance encoding on each grayscale value category in the two-dimensional grayscale value array of the sliding window. Closed-loop distance encoding refers to calculating the pixel distance between the positions where a certain grayscale value category appears twice adjacent to each other in the closed loop. The specific steps of closed-loop distance encoding are as follows:
[0016] (1) Construct a closed-loop grayscale value arrangement, and connect the two-dimensional grayscale value array end to end in the row direction or column direction to form a closed loop.
[0017] (2) Perform distance encoding for each grayscale value category. For each grayscale value category in the closed loop, calculate the pixel distance between the positions where it appears twice adjacent to each other. For a grayscale value category that appears only once in the closed loop, since it is connected end to end by itself, it has only one distance encoding value, and this value is the number of pixels in the closed loop, that is, the number of pixels in the sliding window.
[0018] F. Calculate the frequency proportion of the distance encoding values, and calculate the frequency proportion of the distance encoding values in the sliding window. The frequency proportion of the distance encoding values is the proportion of the frequency of each distance encoding value in each grayscale value category to the total frequency of all distance encoding values in the sliding window. The specific calculation steps are as follows:
[0019] (1) Count the frequency of each distance encoding value in each grayscale value category, and count the frequency of each distance encoding value for each grayscale value category respectively. It should be especially noted here that the statistics are carried out for each grayscale value category separately. For two distance encoding values under different grayscale value categories, even if their numerical values are the same, they belong to two different distance encoding values, and they need to be counted separately according to each grayscale value category when counting the frequency, and the distance encoding values with the same numerical value under different grayscale value categories cannot be accumulated.
[0020] (2) Calculate the frequency proportion of each distance encoding value appearing. Divide the frequency of each distance encoding value appearing by the total frequency of all distance encoding values appearing in the sliding window to obtain the frequency proportion of each distance encoding value.
[0021] G. Calculate the distance encoding diversity. Based on the frequency proportion of each distance encoding value in the sliding window, use the Simpson index or the Shannon-Weiner index to calculate the distance encoding diversity of this sliding window.
[0022] The calculation formula of the Simpson index is:
[0023]
[0024] In the formula, D represents the Simpson index, i represents a certain distance coding value of a certain gray value category, S represents the total number of all distance coding values in the sliding window, and Pi represents the frequency proportion of a certain distance coding value of a certain gray value category.
[0025] The calculation formula of the Shannon-Wiener index is:
[0026]
[0027] In the formula, H represents the Shannon-Wiener index, i represents a certain distance coding value of a certain gray value category, S represents the total number of all distance coding values in the sliding window, Pi represents the frequency proportion of a certain distance coding value of a certain gray value category, and ln represents the natural logarithm operation.
[0028] H, output the distance coding diversity image. Slide the sliding window pixel by pixel in the row direction or column direction on the OTU image starting from the upper left corner or the lower right corner. Each time it slides one step, calculate the distance coding diversity value of the sliding window according to the above steps D, E, F, and G, and traverse the entire OTU image pixel by pixel in turn to obtain the distance coding diversity image.
[0029] The present invention has the following characteristics:
[0030] (1) It can not only reflect the spatial distribution properties of the target, but also further reflect the characteristics of the spatial ordered distribution of the target.
[0031] (2) The method is simple and easy to implement.
[0032] (3) It has a wide range of applicability and can be widely used for the recognition of image targets with spatial order characteristics. Description of the Drawings
[0033] Figure 1 is the original WorldView-2 satellite panchromatic image.
[0034] Figure 2 is a schematic diagram of the distance coding of the sliding window gray value and its diversity calculation.
[0035] Figure 3 is the calculation result of the distance coding diversity (Shannon-Wiener index). Detailed Embodiment
[0036] The technical implementation scheme of the present invention will be further described below in conjunction with the drawings.
[0037] Currently, distance - coding diversity calculation is carried out based on a small subset image of the WorldView - 2 satellite panchromatic image. This image is a single - band image with a spatial resolution of 0.5 meters, consisting of 600 columns × 600 rows of pixels, with a gray - scale value range of 0 - 255 and byte - type data.
[0038] A. Input image: Input a remote - sensing image or a thematic classification image.
[0039] In this case, a small subset image (600 columns × 600 rows) of the WorldView - 2 satellite panchromatic image is input.
[0040] B. Calculate the operational taxonomic units (OTUs): Calculate the OTUs so that each gray - scale value in the resulting two - dimensional OTU image represents a category.
[0041] In this case, the original gray - scale value range of 0 - 255 is compressed to a gray - scale range of 0 - 15 using a linear function, resulting in 16 gray - scale value categories.
[0042] C. Set the sliding window: Set a sliding window of N columns × M rows.
[0043] In this case, the sliding window is set to 3 columns × 3 rows.
[0044] D. Extract the gray - scale value array: Extract the gray - scale value array of the OTU image within the sliding window range.
[0045] In this case, the 3 - column × 3 - row sliding window is overlaid on the OTU image, and a two - dimensional gray - scale value array of 3 columns × 3 rows is extracted from the OTU image. Figure 2 The schematic diagram shows a two - dimensional gray - scale value array of 3 columns × 3 rows extracted from a certain sliding window.
[0046] E. Carry out closed - loop distance coding: Carry out closed - loop distance coding for each gray - scale value category in the two - dimensional gray - scale value array of the sliding window. Closed - loop distance coding refers to calculating the pixel distance between the positions where a certain gray - scale value category appears twice in the closed loop. The specific steps of closed - loop distance coding are as follows:
[0047] (1) Construct a closed - loop gray - scale value arrangement: Connect the two - dimensional gray - scale value array head - to - tail in the row direction or column direction to form a closed loop.
[0048] (2) Carry out distance coding for each gray - scale value category: For each gray - scale value category in the closed loop, calculate the pixel distance between the positions where it appears twice. For a gray - scale value category that appears only once in the closed loop, since it is connected head - to - tail with itself, it has only one distance - coding value, and this value is the number of pixels in the closed loop, that is, the number of pixels in the sliding window.
[0049] In this case, a two-dimensional grayscale value array of 3 columns × 3 rows is connected end to end in the row direction to form a closed loop. Figure 2 The two-dimensional grayscale value array shown in the schematic diagram has 4 grayscale value categories: 1, 2, 4, and 5. For the grayscale value category 1, it appears 3 times in the closed loop, and the pixel distances between every two adjacent appearances are 4, 1, and 4 respectively. Similarly, the pixel distances between every two adjacent appearances of the grayscale value categories 2 and 4 can be calculated. For the grayscale value category 5, it appears only 1 time in the closed loop. Since it is connected end to end by itself, it has only one distance encoding value, which is 9.
[0050] F. Calculate the frequency proportion of the distance encoding values, and calculate the frequency proportion of the distance encoding values in the sliding window. The frequency proportion of the distance encoding values is the proportion of the frequencies of the distance encoding values in each grayscale value category to the total frequency of all the distance encoding values in the sliding window. The specific calculation steps are as follows:
[0051] (1) Count the frequencies of the distance encoding values in each grayscale value category, and count the frequencies of the distance encoding values in each grayscale value category respectively. It should be especially noted here that the statistics are carried out for each grayscale value category separately. For two distance encoding values under different grayscale value categories, even if their numerical values are the same, they belong to two different distance encoding values, and they need to be counted separately according to each grayscale value category when counting the frequencies, and the distance encoding values with the same numerical value under different grayscale value categories cannot be accumulated.
[0052] (2) Calculate the frequency proportion of the distance encoding values, divide the frequency of each distance encoding value by the total frequency of all the distance encoding values in the sliding window, so as to obtain the frequency proportion of each distance encoding value.
[0053] In this case Figure 2 The grayscale value category 1 in the schematic diagram has 3 encoding distances 4, 1, and 4, but there are only two distance encoding values 4 and 1 for this category, and the encoding distance 4 appears 2 times and the encoding distance 1 appears 1 time. Therefore, the grayscale value category 1 has two distance encoding values 4 and 1, and their frequencies of appearance are 2 and 1 respectively. Similarly, the frequencies of appearance of the distance encoding values of other grayscale value categories can be calculated. The total frequency of all the distance encoding values in the sliding window is equal to the number of pixels in the sliding window. In this case, the size of the sliding window is 3 columns × 3 rows, with a total of 9 pixels. Therefore, the total frequency of all the distance encoding values in the sliding window is 9. Therefore, the frequency proportion of each distance encoding value is to divide the frequency of each distance encoding value by 9.
[0054] G. Calculate the distance coding diversity. Based on the frequency proportion of each distance coding value in the sliding window, use the Simpson index or the Shannon-Weiner index to calculate the distance coding diversity of the sliding window.
[0055] In this case Figure 2 For the 3-column × 3-row two-dimensional grayscale value array shown in the schematic diagram, the Simpson index calculated based on the frequency proportion of its respective distance coding values is 0.864, and the Shannon-Weiner index is 2.043.
[0056] H. Output the distance coding diversity image. Slide the sliding window pixel by pixel in the row direction or column direction on the OTU image starting from the upper left corner or the lower right corner. For each step of sliding, calculate the distance coding diversity value of the sliding window according to the above steps D, E, F, and G. Traverse the entire OTU image pixel by pixel in sequence to obtain the distance coding diversity image.
[0057] In this case, slide the sliding window pixel by pixel in the row direction on the OTU image starting from the upper left corner, from left to right and from top to bottom in sequence. For each step of sliding, calculate the distance coding diversity value (the Shannon-Weiner index in this case) of the sliding window according to the above steps D, E, F, and G. Traverse the entire OTU image pixel by pixel in sequence to obtain the distance coding diversity image ( Figure 3 ).
[0058] As described above, it is only a specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those familiar with the technology within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A distance - coding diversity method for measuring the spatial order of an image, characterized in that, it includes the following steps: A. Input an image, input a remote - sensing image or a thematic classification image; B. Calculate operational taxonomic units (OTUs), so that each gray - level value of the calculated two - dimensional OTU image represents a category; C. Set a sliding window, set a sliding window of N columns × M rows; D. Extract the gray - level value array, extract the gray - level value array of the OTU image within the range of the sliding window; E. Conduct closed - loop distance coding, conduct closed - loop distance coding on each gray - level value category in the two - dimensional gray - level value array of the sliding window; F. Calculate the frequency proportion of the distance - coding values, calculate the frequency proportion of the distance - coding values in the sliding window; G. Calculate the distance - coding diversity, based on the frequency proportion of each distance - coding value in the sliding window, use the Simpson index or the Shannon - Wiener index to calculate the distance - coding diversity of the sliding window; H. Output the distance - coding diversity image, slide the sliding window pixel - by - pixel in the row direction or column direction on the OTU image starting from the upper - left corner or the lower - right corner. Each time it slides one step, calculate the distance - coding diversity value of the sliding window according to the above steps D, E, F, and G, and traverse the entire OTU image pixel - by - pixel in turn to obtain the distance - coding diversity image.
2. The distance - coding diversity method for measuring the spatial order of an image according to claim 1, characterized in that, in step E, the closed - loop distance coding refers to calculating the pixel distance between the positions where a certain gray - level value category appears twice adjacent to each other in the closed loop. It is characterized in that it includes the following steps: A. Construct a closed - loop gray - level value arrangement, connect the two - dimensional gray - level value array head - to - tail in the row direction or column direction to form a closed loop; B. Conduct distance coding for each gray - level value category. For each gray - level value category in the closed loop, calculate the pixel distance between the positions where it appears twice adjacent to each other. For the gray - level value category that appears only once in the closed loop, because it is connected head - to - tail by itself, it has only one distance - coding value, and this value is the number of pixels in the closed loop, that is, the number of pixels in the sliding window.
3. The distance - coding diversity method for measuring the spatial order of an image according to claim 1, characterized in that, in step F, the frequency proportion of the distance - coding values is the proportion of the frequency of each distance - coding value appearing in each gray - level value category to the total frequency of all distance - coding values in the sliding window. It is characterized in that it includes the following steps: A. Count the frequency of each distance - coding value appearing in each gray - level value category, and respectively count the frequency of each distance - coding value appearing in each gray - level value category; B. Calculate the frequency proportion of each distance - coding value appearing, divide the frequency of each distance - coding value appearing by the total frequency of all distance - coding values appearing in the sliding window, so as to obtain the frequency proportion of each distance - coding value.