Snapshot type hyperspectral image analysis algorithm

Through the mean filtering and information entropy algorithm developed by MATLAB, the problems of low energy utilization and complex system of traditional spectral imagers are solved, and the non-destructive detection of fruit quality is realized, and image clarity and detection efficiency are improved.

CN119314172APending Publication Date: 2025-01-14CHANGCHUN INST OF ELECTRONIC TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411460010.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

Traditional prism dispersion, grating diffraction and Michaelson interference spectroscopy imagers have problems with low energy utilization and complex system structure, and it is difficult to effectively conduct non-destructive testing of fruit quality.

Method used

Using the mean filtering algorithm and information entropy principle based on MATLAB, a snapshot hyperspectral image analysis algorithm is developed, through the noise reduction program and image quality evaluation program, the image clarity is calculated using the mean filter and information entropy to find the position and image of the imaging plane. The relationship between clarity enables image denoising and quality evaluation.

Benefits of technology

The image clarity and imaging rate are improved, and the non-destructive detection of fruit quality is achieved, proving the feasibility and accuracy of the detection method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119314172A_ABST
    Figure CN119314172A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of image analysis, and discloses a snapshot type hyperspectral image analysis algorithm. Under the mean filtering algorithm, the GISC hyperspectral image analysis technology is applied to nondestructive testing of fruit and vegetable quality, and nondestructive testing of fruits and vegetables in different ripening periods is achieved. According to the method, the principle of a GISC hyperspectral imaging technology is introduced, and on the basis of research on spectral characteristics of different types of fruits, the imaging rate of correlated imaging is improved on the premise of obtaining a three-dimensional image and a multispectral image by combining a compressed sensing theory and a correlated imaging technology; on the basis of a mean filtering algorithm, a matlab writing program is utilized, periodic and high-frequency denoising is carried out on feature signal data, the mean value and variance of pixels are calculated through a convolution kernel, meanwhile, the overall trend of signals is reserved, image denoising is achieved, and the image definition is improved. And finally, carrying out image quality evaluation by using information entropy, and proving the feasibility and accuracy of the nondestructive testing method through numerical simulation and experimental results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image analysis, and in particular to a snapshot type hyperspectral image analysis algorithm. Background Art

[0002] Fruits play an important role in people's diet and are inextricably linked to human health. In today's fast-paced world, people are paying more and more attention to the demand and quality of fruits. According to surveys, most farmers use visual inspection as an evaluation method to control crop growth and quality, but what the human eye can perceive is limited and subjective. There are many quality assessments that are beyond not only human vision but also traditional RGB color imaging. Therefore, under the dual influence of huge fruit production and increased demand standards, there is a need for convenient and fast non-destructive fruit testing methods.

[0003] Multispectral imaging is a method used to acquire and analyze image data from different spectral bands. Unlike traditional color images, multispectral imaging is able to capture information across a wider spectrum, including bands beyond visible light, such as infrared and ultraviolet light. These different bands correspond to different wavelength ranges, and different substances and materials reflect, absorb, or transmit light differently in these bands. Studies have shown that for the inspection of fruit and vegetable products, multispectral imaging can provide a combination of visible and invisible light wavelengths to measure and analyze external characteristics (such as color, texture, surface damage, shape, and size) and internal characteristics (such as mineral content, maturity, moisture content, sugar and fat content). Summary of the invention

[0004] The purpose of the present invention is to provide a snapshot hyperspectral image analysis algorithm, which aims to solve the problems of low energy utilization, mutual restriction of spectral resolution and signal-to-noise ratio in traditional prism dispersion, grating diffraction and spatial modulation interference spectrometers, as well as the complex system structure based on Michelson interference spectrometers.

[0005] To achieve this object, the present invention adopts the following technical solutions:

[0006] A snapshot hyperspectral image analysis algorithm comprises the following steps:

[0007] Create a script based on Matlab and mean filter algorithm to write a noise reduction program;

[0008] Create scripts based on MATLAB and information entropy principles and write image quality evaluation programs;

[0009] The clarity of a series of images is evaluated by information entropy, and the relationship between the position of the imaging surface and the image clarity is found.

[0010] Preferably, the noise reduction procedure includes:

[0011] Read the image and use the imread function to read a three-dimensional TIF grayscale image;

[0012] Check if the image is a three-dimensional grayscale image; if so, the program continues; if not, the script copies it as a three-dimensional image;

[0013] Display the original image, use subplot and imshow functions to display the first layer of channels of the original image, and add a title;

[0014] Perform filtering processing through a for loop for each filter size.

[0015] Preferably, the three-dimensional image is realized by a repmat function, which replicates a two-dimensional image matrix multiple times to form a three-dimensional matrix.

[0016] Preferably, the filtering process includes: using the fspecial function to create an average filter, using the imfilter function to apply the created average filter to the image, the imfilter function will convolve the image according to the specified filter, the replicate option means filling the image by copying pixels outside the image boundary, using the subplot and imshow functions to display the first layer of the filtered image, and adding a corresponding title.

[0017] Preferably, the image quality evaluation procedure comprises the following steps:

[0018] Run the program to read the image. The code uses the imread function to read the image file in the specified path and convert the read image data into a double-precision floating point number.

[0019] Calculate the image clarity and calculate the information entropy of each image by calling the custom entr function;

[0020] Normalize the data. The code uses normalization to scale the entropy value to the range of [0,1].

[0021] Draw the fitting curve. Use the plot function to draw the original data points and the fitting curve to show the relationship between the imaging surface position and the image clarity.

[0022] Beneficial effects of the present invention: This article reviews the application of GISC hyperspectral image analysis technology in the non-destructive testing of fruit and vegetable quality under the mean filtering algorithm, with the aim of achieving non-destructive testing of fruits and vegetables at different maturity periods. The article first introduces the principle of GISC hyperspectral imaging technology. Based on the study of the spectral characteristics of different types of fruits, it combines compressed sensing and correlation imaging technology to achieve the goal of improving the imaging rate of correlation imaging on the premise of obtaining three-dimensional images and multi-spectral images. Then, based on the mean filtering algorithm, a program is written using MATLAB to perform periodic and high-frequency denoising on the characteristic signal data, calculate the mean and variance of the pixels through the convolution kernel, and retain the overall trend of the signal, ultimately achieving image denoising and improving image clarity. Finally, information entropy is used to evaluate image quality, and the feasibility and accuracy of the proposed non-destructive testing method are proved through numerical simulation and experimental results. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the contents of the embodiments of the present invention and these drawings without paying any creative work.

[0024] Figure 1 It is a schematic diagram of a noise reduction program based on MATLAB and a filter of a snapshot hyperspectral image analysis algorithm of the present invention;

[0025] Figure 2 is an image after noise reduction of the present invention;

[0026] Figure 3 It is a schematic diagram of an image quality evaluation program based on MATLAB and information entropy of the present invention;

[0027] Figure 4 It is an image quality evaluation diagram based on entropy of the present invention. DETAILED DESCRIPTION

[0028] 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.

[0029] In the description of the present invention, unless otherwise clearly specified and limited, the terms "connected", "connected", and "fixed" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0030] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may include that the first and second features are in direct contact, or may include that the first and second features are not in direct contact but are in contact through another feature between them. Moreover, a first feature being "above", "above" and "above" a second feature includes that the first feature is directly above and obliquely above the second feature, or simply indicates that the first feature is higher in level than the second feature. A first feature being "below", "below" and "below" a second feature includes that the first feature is directly below and obliquely below the second feature, or simply indicates that the first feature is lower in level than the second feature.

[0031] In the description of this embodiment, the terms "upper", "lower", "left", "right" and other directions or positional relationships are based on the directions or positional relationships shown in the drawings, and are only for the convenience of description and simplification of operation, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operate in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first" and "second" are only used to distinguish in the description and have no special meaning.

[0032] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.

[0033] This paper adopts the mean filtering algorithm to perform periodic and high-frequency denoising on the imaging results. The final imaging result is that the filtered image is smoother and clearer than the original image.

[0034] like Figure 1-4 As shown, the present invention provides a snapshot hyperspectral image analysis algorithm, creates a script based on Matlab and mean filter algorithm, and writes a noise reduction program. The specific workflow is as follows Figure 1 As shown:

[0035] According to the flowchart, we can specifically analyze the content of the noise reduction program:

[0036] First, read the image and use the imread function to read a three-dimensional TIF grayscale image. TIF (TaggedImageFileFormat) is a flexible bitmap image format that can support multiple channels (such as RGB) and different compression methods. Then check whether the image is a three-dimensional grayscale image. If it is, the program continues. If not, the script will copy it as a three-dimensional image. This is achieved by the repmat function, which copies the two-dimensional image matrix multiple times to form a three-dimensional matrix. This is done to ensure that subsequent filtering operations can be performed consistently on the three channels. Then, display the original image, use the subplot and imshow functions to display the first layer (channel) of the original image, and add a title. Define the filter size. The script defines a filterSizes array, which contains the dimensions of the average filters of different sizes to be used. Then perform the filtering process. Through the for loop, perform the following operations for each filter size: Use the fspecial function to create an average filter. fspecial is a function specifically used to create predefined filters. The created average filter is applied to the image using the imfilter function. The imfilter function performs a convolution operation on the image according to the specified filter. The replicate option means that the image is filled by copying pixels outside the image boundary to avoid boundary effects. The subplot and imshow functions are used to display the first layer of the filtered image and add the corresponding title.

[0037] The whole program is based on MATLAB's image processing toolbox, which provides a wealth of functions to read, process and display images. Through these functions, we can easily perform image processing experiments and analysis. The simulation results are shown in Figure 2. Figure 2 As shown in the figure, in this way, the program shows the effect of different sized average filters on the image smoothing effect. Generally speaking, the size of the filter determines the degree of smoothing: a larger filter will produce a stronger smoothing effect, reducing more noise and details; while a smaller filter will retain more image details, but the denoising effect may be weaker. It can be seen that the filtered image is smoother than the original image, and the larger the filter, the smoother the image and the better the denoising effect.

[0038] Create a script based on the principle of matlab and information entropy to write an image quality evaluation program. The specific workflow is as follows: Figure 3 As shown in the flowchart, we can analyze the following contents:

[0039] First, run the program to read the image. The code uses the imread function to read the image file in the specified path and converts the read image data into double-precision floating-point numbers for subsequent mathematical operations. Secondly, calculate the image clarity by calling the custom entr function to calculate the information entropy of each image, such as Figure 3 As shown in the light blue part. Information entropy is calculated based on the grayscale value distribution of each pixel in the image. If the grayscale distribution of an image is more uniform, then its entropy value will be higher, indicating that the image contains more information, so it can be considered that the image is clearer. Then, normalization is performed. The calculated information entropy value may have a wide range. In order to facilitate comparison and subsequent processing, the code uses normalization to scale the entropy value to the range of [0,1]. The normalization method is to subtract the minimum entropy value from each entropy value, and then divide it by the difference between the maximum entropy value and the minimum entropy value; curve fitting: Use the polyfit function to perform a second-order polynomial fit on the normalized image clarity evaluation value. This can help understand the relationship between the imaging surface position and image clarity, and predict the image clarity at different imaging surface positions. Finally, draw the fitting curve, and use the plot function to draw the original data points and the fitting curve to intuitively show the relationship between the imaging surface position and image clarity. Sub-function entr, such as Figure 3 The middle curve is a subroutine in the program, which is a custom MATLAB function used to calculate the entropy of an image. It first counts the frequency of each gray level in the image, and then calculates the probability of each gray level. After that, for each gray level with non-zero probability, the information entropy formula is used to calculate its contribution to the total entropy, and the contributions of all gray levels are accumulated to obtain the entropy of the entire image.

[0040] The purpose of the whole code is to evaluate the clarity of a series of images by information entropy, and try to find the relationship between the position of the imaging surface and the image clarity. This is very useful in certain image processing tasks, such as autofocus or image quality assessment.

[0041] In image processing, entropy is often used as an evaluation index of image clarity. A clear image tends to have a higher entropy value because information such as edges, textures, and details in the image make the distribution of pixel values ​​more diverse. On the contrary, a blurred or low-contrast image may have more concentrated pixel values, resulting in a lower entropy value.

[0042] like Figure 4 , entropy is used as an evaluation function to evaluate the image clarity at different imaging surface positions. By calculating the entropy of the image corresponding to each imaging surface position, the imaging surface position with the largest entropy value (i.e., the highest clarity) can be selected as the optimal solution.

[0043] Suppose the original clarity data is (A) and the normalized clarity data is (X). A is a 1x5 array that stores the clarity evaluation values ​​of five pictures. These values ​​are calculated by the entr function and represent the entropy of each picture. The larger the value, the richer the content of the picture and the clearer the texture. X is the result of normalization of A, and normalization converts the original data to a specific range (usually 0 to 1) for easy comparison and analysis. The normalization formula is (AD) / E, where D is the minimum value in A and E is the difference between the maximum and minimum values ​​in A. Each value in X is the relative position of the original clarity data in the overall range.

[0044] Let the curve fitting result be (p, S): p is the coefficient of the fitted quadratic polynomial, and S is the statistical information related to the fit. Using p and x_fit (the uniformly distributed x value within the fitting range), y_fit (the y value obtained by the fit) can be calculated.

[0045] Use matlab to evaluate the image quality of the denoised image. By observing X, you can understand the relative position of the clarity of each image in the overall range. Then look at the chart to see the trend of clarity changing with the position of the imaging surface. If the fitting curve is close to the original data points, it means that the quadratic polynomial is a good model to describe this trend. If the shape or direction of the fitting curve is in line with expectations or theory, then this may verify our hypothesis. If the fitting curve is significantly different from the original data points, other models or methods may be needed to better describe the relationship between clarity and imaging surface position. In addition, by performing curve fitting on these entropy values, the relationship between the imaging surface position and image clarity can be further analyzed.

[0046] Based on the above theory, we can see that the chart shows the original clarity data points and the fitting curve. The x-axis represents the position of the imaging surface (which may be the change of a parameter in the image acquisition device or processing process), and the y-axis represents the normalized image clarity evaluation value. By observing the chart, you can intuitively see the trend of changes in clarity with the position of the imaging surface, as well as the degree of fit of the fitting curve to the original data. By comparing the values ​​in A, we can see that the 9*9 image has the highest clarity, while the original image has the lowest clarity. Therefore, we evaluate the image quality of the denoised image in order, and finally fit the image as follows Figure 3 By comparing the values ​​in A, we can see that the filtered (9*9) image has the highest clarity, while the original image has the lowest clarity.

[0047] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, various obvious changes, readjustments and substitutions can be made without departing from the protection scope of the present invention. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.

Claims

1. A snapshot hyperspectral image analysis algorithm, characterized in that: The steps include: Create a script based on Matlab and mean filter algorithm to write a noise reduction program; Create scripts based on MATLAB and information entropy principles and write image quality evaluation programs; The clarity of a series of images is evaluated by information entropy, and the relationship between the position of the imaging surface and the image clarity is found.

2. A snapshot hyperspectral image analysis algorithm according to claim 1, characterized in that: The noise reduction procedure includes: Read the image and use the imread function to read a three-dimensional TIF grayscale image; Check if the image is a three-dimensional grayscale image; if so, the program continues; if not, the script copies it as a three-dimensional image; Display the original image, use subplot and imshow functions to display the first layer of channels of the original image, and add a title; Perform filtering processing through a for loop for each filter size.

3. A snapshot hyperspectral image analysis algorithm according to claim 2, characterized in that: The three-dimensional image is realized by the repmat function, which replicates the two-dimensional image matrix multiple times to form a three-dimensional matrix.

4. The snapshot hyperspectral image analysis algorithm according to claim 1, characterized in that: The filtering process includes: using the fspecial function to create an average filter, using the imfilter function to apply the created average filter to the image, the imfilter function will convolve the image according to the specified filter, the replicate option means filling the image by copying pixels outside the image boundary, using the subplot and imshow functions to display the first layer of the filtered image, and adding a corresponding title.

5. The snapshot hyperspectral image analysis algorithm according to claim 1, characterized in that: The image quality evaluation procedure comprises the following steps: Run the program to read the image. The code uses the imread function to read the image file in the specified path and convert the read image data into a double-precision floating point number. Calculate the image clarity and calculate the information entropy of each image by calling the custom entr function; Normalize the data. The code uses normalization to scale the entropy value to the range of [0,1]. Draw the fitting curve. Use the plot function to draw the original data points and the fitting curve to show the relationship between the imaging surface position and the image clarity.