A scanning frequency-based terahertz near-field imaging parameter adaptive optimization method and system

By adjusting parameters P and I at different scanning frequencies, a quantitative relationship model was established to optimize terahertz near-field imaging parameters, resolving the contradiction between scanning speed and image quality, and achieving fast and high-quality imaging results.

CN122109006APending Publication Date: 2026-05-29INST OF ENERGY HEFEI COMPREHENSIVE NAT SCI CENT (ANHUI ENERGY LAB)
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INST OF ENERGY HEFEI COMPREHENSIVE NAT SCI CENT (ANHUI ENERGY LAB)
Filing Date
2026-03-13
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Traditional terahertz near-field imaging systems struggle to balance scanning speed and image quality, and the lack of systematic parameter adjustment leads to cumbersome operation and low efficiency.

Method used

By adjusting the scaling parameter P and the integral parameter I at different scanning frequencies, terahertz images are acquired and no-reference image quality is evaluated. A quantitative relationship model between scanning frequency, scaling parameter P, integral parameter I and image quality score is established. This model is then used to predict the optimal combination of PI parameters to optimize imaging parameters.

Benefits of technology

It achieves the goal of maintaining or improving image quality while increasing scanning frequency, providing a fast, high-quality terahertz near-field imaging solution suitable for multiple scanning frequency ranges.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122109006A_ABST
    Figure CN122109006A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on scanning frequency's terahertz near-field imaging parameter optimization method and system, belong to terahertz near-field imaging technical field.The method includes: at least two different scanning frequencies, respectively using control variable method changes the combination of proportion parameter P and integral parameter I to carry out scanning, obtains terahertz image and carries out image quality score, and based on the proportion parameter P, integral parameter I and image quality score S data under multiple scanning frequencies, the quantitative relationship model between scanning frequency w, P, I parameter and S is established by regression analysis;Optimal PI parameter combination under given scanning frequency is predicted using the model, while improving scanning frequency, image quality is maintained or improved by parameter optimization.The application solves the contradiction between scanning speed and image quality, and provides scientific basis for fast, high-quality terahertz near-field imaging.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of terahertz near-field imaging technology, specifically relating to a method and system for optimizing terahertz near-field imaging parameters based on scanning frequency. Background Technology

[0002] Terahertz near-field imaging technology scans the sample surface with nanoscale probes, breaking the diffraction limit and achieving ultra-high spatial resolution from nanometer to submicrometer scales. It has wide applications in biomedical detection, materials science, and other fields. However, traditional terahertz near-field imaging systems face a trade-off between scanning speed and image quality: increasing the scanning frequency can shorten imaging time and improve detection efficiency, but usually leads to a decrease in image quality; decreasing the scanning frequency, while achieving better image quality, significantly extends the imaging time.

[0003] In existing technologies, the adjustment of imaging parameters (proportional parameter P and integral parameter I) is mostly based on empirical optimization at a fixed scanning frequency, lacking a systematic parameter optimization method for different scanning frequencies. When the scanning frequency changes, operators need to conduct a large number of trial-and-error experiments to determine the appropriate PI parameter, which is cumbersome and inefficient, making it difficult to improve scanning speed while ensuring image quality. Summary of the Invention

[0004] To address the inherent trade-off between scanning speed and image quality in existing terahertz near-field imaging technologies, this invention proposes an adaptive optimization method and system for terahertz near-field imaging parameters based on scanning frequency.

[0005] The first aspect discloses a terahertz near-field parameter adaptive optimization method based on scanning frequency, the method comprising:

[0006] In a terahertz near-field imaging system, at least two different scanning frequencies are set, and at each scanning frequency, the scaling parameter P and the integral parameter I are adjusted to obtain terahertz images with different combinations of PI parameters. The acquired terahertz images are then subjected to a no-reference image quality evaluation to obtain an image quality score. A quantitative relationship model between the scanning frequency, scaling parameter P, integral parameter I, and image quality score is established through regression analysis. For a target scanning frequency, the optimal PI parameter combination corresponding to the optimal image quality score is calculated using the quantitative relationship model, so that the terahertz near-field imaging system can scan the sample at the target scanning frequency using the optimal PI parameter combination.

[0007] The second aspect discloses a terahertz near-field parameter adaptive optimization system based on scanning frequency, the system comprising:

[0008] The terahertz image acquisition module is used to set at least two different scanning frequencies in a terahertz near-field imaging system, and adjust the scaling parameter P and integral parameter I at each scanning frequency to acquire terahertz images with different combinations of PI parameters. The image quality score calculation module is used to perform a referenceless image quality evaluation on the acquired terahertz images to obtain an image quality score. The quantitative relationship model determination module is used to establish a quantitative relationship model between scanning frequency, scaling parameter P, integral parameter I and image quality score through regression analysis. The optimal PI parameter combination acquisition module is used to calculate the optimal PI parameter combination corresponding to the optimal image quality score for a target scanning frequency through the quantitative relationship model, so that the terahertz near-field imaging system can scan the sample with the optimal PI parameter combination at the target scanning frequency.

[0009] As can be seen from the above technical solutions, the present invention has the following beneficial effects:

[0010] This invention acquires terahertz images and scores their quality by scanning at at least two different scanning frequencies, using a controlled variable method to change the combination of the proportional parameter P and the integral parameter I. Based on the proportional parameter P, integral parameter I, and image quality score S data at multiple scanning frequencies, a quantitative relationship model between the scanning frequency w, P, I parameters, and S is established through regression analysis. This model is used to predict the optimal combination of P and I parameters at a given scanning frequency, achieving the goal of maintaining or improving image quality while increasing the scanning frequency through parameter optimization. This invention resolves the contradiction between scanning speed and image quality, providing a scientific basis for rapid, high-quality terahertz near-field imaging.

[0011] The core contribution of this invention lies in transforming the previously experience-based parameter adjustment process into a calculable and predictable optimization problem. When a higher scanning speed is required, simply substituting the target frequency into the model yields the optimal PI parameters, thereby improving imaging efficiency while ensuring that image quality is not degraded or even improved. This method is not only applicable to the experimentally tested frequencies of 0.4Hz and 0.5Hz, but its modeling framework can be extended to a wider frequency range, providing reliable technical support for the rapid and standardized development of terahertz near-field imaging. Attached Figure Description

[0012] Figure 1 This is a flowchart of an adaptive optimization method for terahertz near-field imaging parameters based on scanning frequency, provided by the present invention.

[0013] Figure 2 This is a comparison of experimental data points and model prediction surfaces showing the relationship between PI parameters and image quality scores at scanning frequencies of 0.4Hz and 0.5Hz, provided by this invention.

[0014] Figure 3 This is a graph showing the relationship between scanning frequency and optimal PI parameters calculated based on the quantitative relationship model of this invention.

[0015] Figure 4 This is a comparison chart of terahertz image quality obtained at different scanning frequencies before and after optimization using the method of this invention.

[0016] Figure 5 This is a schematic diagram of a terahertz near-field imaging parameter adaptive optimization system framework based on scanning frequency provided by the present invention. Detailed Implementation

[0017] To make the objectives, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Several embodiments of the present invention are shown in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that the disclosure of the present invention will be thorough and complete.

[0018] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0019] It should be noted that when an element is referred to as being "fixed to" another element, it can be directly on the other element or there may be an intervening element. When an element is considered to be "connected to" another element, it can be directly connected to the other element or there may be an intervening element. The terms "vertical," "horizontal," "left," "right," "up," "down," and similar expressions used herein are for illustrative purposes only and are not intended to indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as limiting the invention.

[0020] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances. The term "and / or" as used herein includes any and all combinations of one or more of the related listed items.

[0021] In traditional imaging processes, increasing the scanning frequency often leads to a decrease in image quality. Operators must weigh speed against quality, and each change in scanning frequency requires trial and error to adjust the proportional parameter P and integral parameter I based on experience. This process is cumbersome, inefficient, and yields inconsistent results. The proportional parameter P is used by the feedback circuit to calculate the error between the actual probe-sample force and the set reference point at regular intervals. The proportional parameter P controls the speed at which this error is compensated; a larger P results in more sensitive feedback. The integral parameter I is used to compensate for accumulated system errors; a larger I also results in more sensitive feedback. To address the inherent trade-off between scanning speed and image quality in existing terahertz near-field imaging technology, this invention proposes an adaptive optimization method and system for terahertz near-field imaging parameters based on scanning frequency.

[0022] In one embodiment, the present invention provides an adaptive optimization method for terahertz near-field imaging parameters based on scanning frequency, such as... Figure 1 As shown, this method specifically includes the following steps:

[0023] S101. In a terahertz near-field imaging system, at least two different scanning frequencies are set, and at each scanning frequency, the proportional parameter P and the integral parameter I are adjusted respectively to obtain terahertz images under different combinations of PI parameters.

[0024] First, in a terahertz near-field imaging system, paraffin sections of papillary thyroid carcinoma cells were used as samples, and experiments were conducted at two scanning frequencies: 0.4 Hz and 0.5 Hz. It should be noted that more experimental data at different scanning frequencies can be added according to actual needs. The scaling parameter P and the integral parameter I both range from 100 to 1000, with a step size of 50. A step size that is too large will result in drastic changes, while a step size that is too small will result in insignificant changes.

[0025] Specifically, at each scanning frequency, the controlled variable method is used to fix the integral parameter I and scan the proportional parameter P from 100 to 1000 in increments of 50. Then, the proportional parameter P is fixed and the integral parameter I is scanned in the same manner to obtain terahertz images under different combinations of PI parameters.

[0026] It should be noted that the terahertz near-field imaging system in this embodiment of the invention is a system based on scattering scanning near-field optical microscopy technology, and its working mode is tapping atomic force microscopy mode.

[0027] S102. Perform a no-reference image quality assessment on the acquired terahertz image to obtain an image quality score;

[0028] Specifically, high-quality natural images exhibit specific statistical regularities in the spatial domain. Image distortion alters these statistical characteristics. By measuring the degree of deviation between the image to be evaluated and the statistical model of natural images, a quantitative score of image quality can be obtained. A no-reference quality evaluation is performed on each acquired terahertz image to obtain an image quality score S. Preferably, this invention employs the Brisque algorithm for objective quality evaluation of terahertz images, where a lower image quality score S indicates better image quality.

[0029] In another embodiment, the step of performing a no-reference image quality assessment on the acquired terahertz image to obtain an image quality score specifically includes:

[0030] S1021. Convert the terahertz image into a grayscale image and perform normalization processing to obtain the processed terahertz image.

[0031] Specifically, the specific noise introduced by probe scanning in the grayscale image converted from the terahertz image is removed by the local mean subtraction and variance normalization method, thereby obtaining the processed terahertz image.

[0032] First, the acquired raw terahertz near-field image is converted into a grayscale image. Since terahertz images may contain specific noise introduced by probe scanning, the image is normalized before performing a no-reference image quality assessment to eliminate the influence of illumination differences and contrast variations on the assessment results. Normalization employs local mean subtraction and variance normalization methods, calculated using the following formula:

[0033] (1)

[0034] in, These are the original image pixel values. and These are the mean and standard deviation within a local window centered on a pixel, respectively, with C being a constant (set to 1) to avoid the denominator being zero.

[0035] S1022. Extract the spatial domain features of the processed terahertz image at different scales to obtain the first spatial domain feature vector;

[0036] In another embodiment, this step specifically includes:

[0037] Spatial domain features of the image are extracted at the first and second scales respectively to obtain the second spatial domain feature vector and the third spatial domain feature vector. The first scale is the original scale of the terahertz image, and the second scale is twice the downsampling scale of the first scale.

[0038] The first spatial domain feature vector is obtained by concatenating the second spatial domain feature vector and the third spatial domain feature vector.

[0039] It should be noted that spatial domain features include shape parameters, variance parameters, and neighborhood product coefficients used to describe the statistical distribution characteristics of the image. The neighborhood product coefficients include the mean, variance, left shape parameter, and right shape parameter in the four directions: horizontal, vertical, main diagonal, and secondary diagonal. Based on the normalized image, two sets of spatial domain features are extracted:

[0040] Generalized Gaussian distribution fitting parameters: The normalized coefficients are fitted with a generalized Gaussian distribution (GGD) to obtain shape parameters and variance parameters, which are used to describe the statistical distribution characteristics of the image.

[0041] Neighborhood product coefficients: Calculate the product of the normalized coefficients of adjacent pixels (horizontal, vertical, main diagonal, and secondary diagonal directions), and fit these product coefficients with an asymmetric generalized Gaussian distribution (AGGD) to obtain the mean, variance, left shape parameter, and right shape parameter for each direction.

[0042] Furthermore, in order to capture image distortion features at different scales, the image is downsampled (usually by 2x downsampling). The spatial domain feature extraction process is repeated at the original scale (first scale) and the downsampled scale (second scale) to obtain the second spatial domain feature vector and the third spatial domain feature vector. After concatenation, a 36-dimensional feature vector (i.e., the first spatial domain feature vector) is obtained, with 18 dimensions at each scale.

[0043] S1023. Input the spatial domain feature vector into the trained regression model to obtain the image quality score.

[0044] After extracting the 36-dimensional first spatial domain feature vector, it needs to be mapped to an image quality score S. This invention uses a pre-trained regression model based on support vector regression (SVR) to achieve this mapping. This model has been trained on a large number of natural images and their distorted versions, and can effectively evaluate the degree of deviation between the statistical features of the image and the natural image.

[0045] Let the 36-dimensional spatial domain feature vector of the current image be... The decision function of the SVR model is:

[0046] (2)

[0047] in, Support vectors are representative feature vectors selected from the training set. , This represents the number of support vectors. and is the Lagrange multiplier, obtained through training and optimization; b is the bias term.

[0048] For the kernel function, this model uses the radial basis function (RBF), as shown in the formula:

[0049] (3)

[0050] in, The kernel parameter controls the complexity of the feature space mapping. This represents the Euclidean distance.

[0051] The final output of the regression model is the image quality score S. The score typically ranges from 0 to 100. A lower score indicates better image quality and a closer approximation to the statistical characteristics of a natural image; a higher score indicates more severe image distortion and lower quality.

[0052] This method enables objective and quantitative quality assessment of terahertz near-field images without the need for a reference image, avoiding the randomness and instability of subjective evaluation and providing a unified and repeatable evaluation benchmark for subsequent PI parameter optimization. This invention achieves objective evaluation of terahertz images through the aforementioned standardized process, ensuring the reliability of experimental data and the accuracy of model establishment, thus guaranteeing its applicability to the specific field of terahertz near-field imaging.

[0053] S103. Establish a quantitative relationship model between scanning frequency, proportional parameter P, integral parameter I and image quality score through regression analysis;

[0054] In another embodiment, the above steps specifically include:

[0055] S1031. Construct multiple quadruple data based on scanning frequency, scaling parameter P, integral parameter I, and image quality score, and remove outliers.

[0056] S1032. Construct an initial quantitative relationship model using linear terms, quadratic terms, interaction terms, and undetermined coefficients;

[0057] S1033. Based on the multiple quaternion data and the initial quantitative relationship model, the undetermined coefficients are solved by the least squares method to obtain the quantitative relationship model.

[0058] Specifically, multiple quadruples of data are constructed by obtaining all scanning frequencies w, scaling parameters P, integral parameters I, and image quality scores S. A total of 722 data points were collected. To address potential transient noise interference in terahertz near-field imaging, [the following was employed]. Outlier removal criteria: Calculate the residual between each data point and the mean of its local neighborhood, remove points whose residuals exceed 3 times the standard deviation, and retain valid data for modeling.

[0059] Furthermore, to characterize the nonlinearity and interaction between parameters, a polynomial model containing linear, quadratic, and interaction terms is selected to obtain an initial quantitative relationship model:

[0060] (4)

[0061] in, to These are coefficients to be determined.

[0062] In addition, to distinguish it from traditional single-frequency modeling, this invention specifically introduces interaction terms. , , and third-order terms To capture the variation pattern of the optimal value of the PI parameter at different frequencies.

[0063] Next, the 722 sets of quadruplet experimental data were substituted into the above formula (4), and the coefficients were solved using the least squares (OLS) method. Specifically, a matrix X and an observation vector y were constructed, where each row of matrix X contains the values ​​of the basis functions, and the basis function values ​​refer to the values ​​of the original independent variables. After transformation using the selected model form, specific numerical values ​​are used to construct the linear regression equation. Finally, the coefficient vector is obtained by solving the normal equation. The specific formula is as follows:

[0064] (5)

[0065] Wherein, coefficient vector To ensure numerical stability, the QR decomposition method is used to solve the problem, avoiding errors caused by matrix inversion.

[0066] After fitting, the specific values ​​of the coefficients are obtained as follows:

[0067] ;

[0068] Substituting the coefficient values ​​into the initial quantitative relationship model yields the final quantitative relationship model. This model reveals the complex coupling relationship between the parameters, namely, changes in the scanning frequency not only directly affect image quality but also alter the optimal value ranges of P and I.

[0069] The quantitative relationship model specifically includes:

[0070] (6)

[0071] Furthermore, to evaluate the fit, the coefficient of determination of the model is calculated. The root mean square error (RMSE) was calculated, and the model's generalization ability was tested using cross-validation. Through calculation, the results in this embodiment... The RMSE=5.8 indicates that the model can effectively explain image quality variations. Figure 2 The experiment data points showing the relationship between the PI parameter and the image quality score S at scanning frequencies of 0.4Hz and 0.5Hz are compared with the model prediction surface. It can be seen that the model can fit the experimental data well.

[0072] S104. For the target scanning frequency, the optimal PI parameter combination corresponding to the optimal image quality score is calculated through the quantitative relationship model, so that the terahertz near-field imaging system can scan the sample using the optimal PI parameter combination at the target scanning frequency.

[0073] Specifically, using the established quantitative relationship model, for a given target scanning frequency, it is possible to solve... and The system of equations is used to calculate the optimal PI parameter combination (P,I) corresponding to the optimal image quality score S. Figure 3 The relationship between scanning frequency and optimal PI parameters calculated based on the quantitative relationship model of this invention is shown. It can be seen that the optimal PI parameter combination changes as the scanning frequency increases. For example, when the scanning frequency increases from 0.4Hz to 0.5Hz, the optimal proportional parameter P adjusts from approximately 550 to approximately 150, and the optimal integral parameter I adjusts from approximately 580 to approximately 220. Through this model, for any target scanning frequency, the PI parameter combination that minimizes the image quality score S (i.e., achieves optimal quality) can be quickly solved through mathematical optimization, thereby realizing coordinated optimization of "frequency increase - parameter follow-up adjustment".

[0074] To verify the effectiveness of this invention, imaging experiments were conducted using both the conventional method and the method of this invention at different scanning frequencies for comparison. Using the conventional method, a relatively optimal set of PI parameters (P=380, I=320) was obtained through trial and error at a scanning frequency of 0.4Hz, resulting in a Brisque score (image quality score S) of 42.3. When the scanning frequency increased to 0.5Hz, using the same set of PI parameters, the Brisque score S rose to 48.7, indicating a significant decrease in image quality. Using the method of this invention, based on model prediction, the optimal combination of PI parameters at a scanning frequency of 0.5Hz is (P=150, I=220). Imaging with this set of parameters yielded a Brisque score (image quality score) of 41.5, which is not only superior to the image obtained by the conventional method at 0.5Hz but also even superior to the image obtained by the conventional method at 0.4Hz. Figure 4 The invention demonstrates a comparison of terahertz image quality obtained at different scanning frequencies before and after optimization using the method of the present invention. It can be clearly seen that after optimizing the parameters using the method of the present invention, higher quality images are obtained while increasing the scanning frequency.

[0075] The method of this invention is not only applicable to scanning frequencies of 0.4Hz and 0.5Hz, but by adding more experimental data at different scanning frequencies, the model can be further improved and its applicability expanded.

[0076] like Figure 5 As shown, in another embodiment, the present invention provides a terahertz near-field parameter adaptive optimization system based on scanning frequency, corresponding to the above-described embodiment of the terahertz near-field parameter adaptive optimization method based on scanning frequency. Since the system embodiment is basically similar to the method embodiment, it is described simply. For details of the relevant technical features and the effects of implementation, please refer to the corresponding description of the method embodiment provided above. The terahertz near-field parameter adaptive optimization system based on scanning frequency provided by the present invention includes:

[0077] The terahertz image acquisition module is used to set at least two different scanning frequencies in a terahertz near-field imaging system, and to adjust the scaling parameter P and the integral parameter I at each scanning frequency to acquire terahertz images under different combinations of PI parameters.

[0078] The image quality score calculation module is used to perform no-reference image quality evaluation on the acquired terahertz images and obtain the image quality score.

[0079] The quantitative relationship model determination module is used to establish a quantitative relationship model between scanning frequency, proportional parameter P, integral parameter I and image quality score through regression analysis.

[0080] The optimal PI parameter combination acquisition module is used to calculate the optimal PI parameter combination corresponding to the optimal image quality score for the target scanning frequency through the quantitative relationship model, so that the terahertz near-field imaging system can scan the sample using the optimal PI parameter combination at the target scanning frequency.

[0081] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, specific embodiments have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0082] It should be understood that the above description of the preferred embodiments is quite detailed and should not be construed as a limitation on the scope of protection of the present invention. Those skilled in the art can make substitutions or modifications under the guidance of the present invention without departing from the scope of protection of the claims of the present invention, and all such substitutions or modifications fall within the scope of protection of the present invention. The scope of protection of the present invention should be determined by the appended claims.

Claims

1. A terahertz near-field parameter adaptive optimization method based on scanning frequency, characterized in that, The method includes: In a terahertz near-field imaging system, at least two different scanning frequencies are set, and at each scanning frequency, the scaling parameter P and the integral parameter I are adjusted respectively to obtain terahertz images under different combinations of PI parameters. The acquired terahertz images are subjected to a no-reference image quality assessment to obtain an image quality score; A quantitative relationship model between scanning frequency, proportional parameter P, integral parameter I and image quality score was established through regression analysis. For the target scanning frequency, the optimal PI parameter combination corresponding to the optimal image quality score is calculated through the quantitative relationship model, so that the terahertz near-field imaging system can scan the sample using the optimal PI parameter combination at the target scanning frequency.

2. The method according to claim 1, characterized in that, The process of performing a no-reference image quality assessment on the acquired terahertz image to obtain an image quality score includes: The acquired terahertz image is converted into a grayscale image and then normalized to obtain the processed terahertz image. The spatial domain features of the processed terahertz image at different scales are extracted to obtain the first spatial domain feature vector; The first spatial domain feature vector is input into the trained regression model to obtain the image quality score.

3. The method according to claim 2, characterized in that, The acquired terahertz image is converted into a grayscale image and then normalized to obtain the processed terahertz image, including: The specific noise introduced by scanning in the grayscale image converted from the terahertz image is removed by the local mean subtraction and variance normalization method, thus obtaining the processed terahertz image.

4. The method according to claim 1, characterized in that, The spatial domain features include shape parameters, variance parameters, and neighborhood product coefficients used to describe the statistical distribution characteristics of the image. The neighborhood product coefficients include the mean, variance, left shape parameter, and right shape parameter in four directions: horizontal, vertical, main diagonal, and secondary diagonal. Extracting the spatial domain features of the processed terahertz image at different scales yields a first spatial domain feature vector, including: Spatial domain features of the image are extracted at the first and second scales respectively to obtain the second spatial domain feature vector and the third spatial domain feature vector. The first scale is the original scale of the terahertz image, and the second scale is twice the downsampling scale of the first scale. The first spatial domain feature vector is obtained by concatenating the second spatial domain feature vector and the third spatial domain feature vector.

5. The method according to claim 1, characterized in that, The quantitative relationship model established through regression analysis between scanning frequency, scaling parameter P, integral parameter I, and image quality score includes: Multiple quadruples of data are constructed based on scanning frequency, scaling parameter P, integral parameter I, and image quality score, and outliers are removed. An initial quantitative relationship model is constructed using linear terms, quadratic terms, interaction terms, and undetermined coefficients. Based on the multiple quadruple data and the initial quantitative relationship model, the undetermined coefficients are solved by the least squares method to obtain the quantitative relationship model.

6. The method according to claim 5, characterized in that, The quantitative relationship model specifically includes: (6); in, Indicates the scan frequency. Indicates the proportional parameter. Indicates the integration parameter. This indicates the image quality score.

7. The method according to claim 5, characterized in that, The process of removing outliers includes: Calculate the residual between each quadruple data point and the local neighborhood mean, and remove data points whose residuals exceed 3 times the standard deviation.

8. The method according to claim 1, characterized in that, The method includes: the values ​​of the proportional parameter P and the integral parameter I are both in the range of 100 to 1000, and the variation step size is 50.

9. The method according to claim 1, characterized in that, The terahertz near-field imaging system is based on scattering scanning near-field optical microscopy technology, and its working mode is tapping atomic force microscopy mode.

10. A terahertz near-field parameter adaptive optimization system based on scanning frequency, characterized in that, The system includes: The terahertz image acquisition module is used to set at least two different scanning frequencies in a terahertz near-field imaging system, and to adjust the scaling parameter P and the integral parameter I at each scanning frequency to acquire terahertz images under different combinations of PI parameters. The image quality score calculation module is used to perform no-reference image quality evaluation on the acquired terahertz images and obtain the image quality score. The quantitative relationship model determination module is used to establish a quantitative relationship model between scanning frequency, proportional parameter P, integral parameter I and image quality score through regression analysis. The optimal PI parameter combination acquisition module is used to calculate the optimal PI parameter combination corresponding to the optimal image quality score for the target scanning frequency through the quantitative relationship model, so that the terahertz near-field imaging system can scan the sample using the optimal PI parameter combination at the target scanning frequency.