A method for enhancing the contrast of a nylon thread surface microscopic image
By constructing a pixel-level structural tensor matrix and anisotropic diffusion tensor, the problem of texture direction information loss in the microscopic image of nylon thread surface was solved, achieving high contrast enhancement and improved detail readability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- YIBIN HONGQU THREAD CO LTD
- Filing Date
- 2026-06-17
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies, when enhancing the microscopic images of nylon thread surfaces, struggle to effectively distinguish between genuine high-frequency textures and random noise, leading to the loss of texture direction information, boundary breakage, and the proliferation of pseudo-textures, which affects defect identification and dimensional measurement.
By constructing a pixel-level structural tensor matrix, performing eigenvalue decomposition to generate texture coherence distribution factors, combining eigenvectors to construct an anisotropic diffusion tensor, iteratively evolving and updating grayscale values, dividing a multi-scale grid within a sliding window, calculating the local fractional dimensions, generating a roughness gain map, and finally separating the detail and background components to output a high-contrast enhanced image.
It achieves enhanced texture direction consistency, reveals local roughness differences, improves visual readability after separating details from the background, and reduces the impact of random noise and the risk of pseudo-textures.
Smart Images

Figure CN122391044A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image enhancement technology, and more particularly to a method for enhancing the contrast of a microscopic image of a nylon thread surface. Background Technology
[0002] Existing technologies often rely on global grayscale stretching or local contrast enhancement at a single scale during actual enhancement processes. The enhancement intensity typically changes directly with the grayscale distribution, resulting in texture direction information not being explicitly incorporated into the computational chain. When dealing with nylon fibers with clearly defined stripe structures, enhancement operations can easily introduce unnecessary grayscale transitions in the normal direction, causing stripe boundaries to break, jagged, or exhibit localized halos. This, in turn, affects defect orientation interpretation and dimensional measurement. If micro-scratches and grain noise coexist in the image, the enhancement process struggles to distinguish between genuine high-frequency texture and random noise. The synchronous amplification of high-frequency components leads to pseudo-texture proliferation, distorting the surface roughness representation. For example, a originally uniform area may be enhanced into a speckled undulation. Therefore, improvements are needed. Summary of the Invention
[0003] The purpose of this invention is to overcome the shortcomings of existing technologies and propose a method for enhancing the contrast of microscopic images on the surface of nylon threads.
[0004] To achieve the above objectives, the present invention employs the following technical solution: a method for enhancing the contrast of a microscopic image of a nylon thread surface, comprising the following steps:
[0005] A microscopic grayscale image of the nylon thread surface is acquired, the horizontal and vertical gradient values of the pixels in the microscopic grayscale image of the nylon thread surface are calculated, a pixel-level structural tensor matrix is constructed, and eigenvalue decomposition operation is performed on the pixel-level structural tensor matrix to generate the nylon thread texture coherence distribution factor.
[0006] The nylon thread texture coherence distribution factor is invoked, and an anisotropic diffusion tensor with the same feature vector as the structure tensor is constructed by combining the feature vector. Iterative evolution operation is performed on the micro grayscale image of the nylon thread surface to update the pixel grayscale value and output the structure tensor guided smoothing image.
[0007] A sliding window is set to traverse the structure tensor-guided smoothing image. Multi-scale grids are divided within the sliding window, and the number of gray-scale surface covering grid boxes is counted. The local fractal dimension value is calculated, and the magnitude of the local fractal dimension value and the two-dimensional topological plane reference value are determined. For the part exceeding the two-dimensional topological plane reference value, calculation is performed to generate a nylon line roughness gain mapping map.
[0008] The detail component and background component of the structure tensor-guided smoothing image are separated, and the nylon line roughness gain map is multiplied by the detail component to output a high-contrast enhanced image of the nylon line surface.
[0009] Preferably, the steps for obtaining the pixel-level structural tensor matrix are as follows:
[0010] Obtain a microscopic grayscale image of the nylon thread surface, traverse the grayscale values of adjacent pixels of each pixel in the microscopic grayscale image of the nylon thread surface, calculate the grayscale difference along the horizontal direction to form a horizontal gradient value sequence, calculate the grayscale difference along the vertical direction to form a vertical gradient value sequence, and obtain the horizontal and vertical gradient values of the pixel.
[0011] Based on the horizontal and vertical gradient values of the pixels, the elements of the gradient outer product matrix are calculated for each pixel and arranged into a matrix field according to the pixel position. Gaussian window weights are then used to perform local weighted summation and normalization operations on the gradient outer product matrix field to form a pixel-level structural tensor matrix.
[0012] Preferably, the step of obtaining the nylon thread texture coherence distribution factor is as follows:
[0013] Based on the pixel-level structure tensor matrix, the eigenvalue decomposition of the structure tensor of each pixel is calculated and the maximum eigenvalue, minimum eigenvalue and corresponding eigenvector are extracted. The difference between the maximum eigenvalue and the minimum eigenvalue is calculated and the difference is squared to obtain the nylon line texture coherence distribution factor.
[0014] Preferably, the step of obtaining the structure tensor-guided smoothing image is as follows:
[0015] The nylon line texture coherence distribution factor value is read according to the pixel position. The diffusion intensity is segmented and weighted according to the nylon line texture coherence distribution factor value. Tangential direction diffusion coefficient sequence and normal direction diffusion coefficient sequence are generated respectively to obtain an anisotropic diffusion coefficient set.
[0016] Based on the set of anisotropic diffusion coefficients, feature vectors are called and feature vector directions are matched according to pixel positions. The tangent direction diffusion coefficient sequence is projected onto the feature vector direction to form a first direction tensor component. The normal direction diffusion coefficient sequence is projected onto the orthogonal direction of the feature vector to form a second direction tensor component. The tensor components of each direction are synthesized to form an anisotropic diffusion tensor.
[0017] The anisotropic diffusion tensor is substituted into the divergence operator to calculate the net thermal flux divergence of each pixel. The gray values of the pixels in the micro grayscale image of the nylon thread surface are updated incrementally according to a preset iteration step. A grayscale increment convergence judgment is set, and the iteration is terminated when the convergence condition is met. The structure tensor guided smoothing image is output.
[0018] Preferably, the step of obtaining the local fractional dimension values is as follows:
[0019] Set a sliding window to traverse the structure tensor-guided smoothing image, fix the pixel coverage of the sliding window, repeatedly divide the pixel region within the sliding window according to multiple sets of grid side length parameters, count the number of grid boxes actually covered by the grayscale surface for each set of grid side length parameters, and record the correspondence between each set of grid side length parameters and the corresponding number of grid boxes covered by the grayscale surface to form a local multi-scale grid box number relationship set.
[0020] Calculate the local fractional dimension values based on the local multi-scale grid box number relationship set.
[0021] Preferably, the step of obtaining the nylon wire roughness gain mapping map is as follows:
[0022] Read the pixel position corresponding to the local fractal dimension value in each sliding window, compare the local fractal dimension value with the two-dimensional topological plane reference value pixel by pixel, subtract the two-dimensional topological plane reference value from the local fractal dimension value to obtain the difference result, retain the positive part of the difference result and write it into the difference table, and write the non-positive part into zero value to form the super-reference difference matrix.
[0023] Iterate through the super-reference difference value at each pixel position in the super-reference difference matrix and calculate the roughness gain value of the nylon line;
[0024] The roughness gain value of the nylon line corresponding to each pixel position is mapped to the pixel coordinate system of the structure tensor guided smoothing image. Neighborhood integrity is checked at the image boundary position and invalid gain values are removed. The gain values in the overlapping area of the sliding window are fused pixel by pixel to form a nylon line roughness gain mapping map.
[0025] Preferably, the step of acquiring the high-contrast enhanced image of the nylon thread surface is as follows:
[0026] The detail component and background component of the structure tensor guided smoothing image are separated. The gray value of each pixel in the structure tensor guided smoothing image is traversed and a local gray-level reference surface is established. The residual of the pixel gray value relative to the local gray-level reference surface is calculated and collected into the detail component. The local gray-level reference surface is stitched together in the whole image to form the background component, thus obtaining the detail component and the background component.
[0027] Based on the detail component and the background component, the nylon line roughness gain map is aligned to the detail component according to the pixel coordinates. For each pixel position, the value of the nylon line roughness gain map is multiplied point by point with the grayscale residual of the detail component. The point-by-point multiplication results are summarized to form the high-frequency component. The high-frequency component is then linearly superimposed point by point with the background component according to the pixel position to generate a grayscale superimposed result image.
[0028] Preferably, the step of acquiring the high-contrast enhanced image of the nylon thread surface further includes:
[0029] The minimum and maximum gray values of the gray-scale overlay result image are statistically analyzed, and a target gray-scale range is established. The gray-scale overlay result image is linearly scaled according to pixel position and boundary truncation is performed to output a high-contrast enhanced image of the nylon line surface.
[0030] Compared with the prior art, the advantages and positive effects of the present invention are as follows:
[0031] In this invention, after acquiring a microscopic grayscale image of the nylon thread surface, a pixel-level structural tensor matrix is established around the horizontal and vertical gradient values of each pixel. Eigenvalue decomposition is then performed on the pixel-level structural tensor matrix to form a nylon thread texture coherence distribution factor, allowing both the principal direction of the texture and the difference in texture intensity to be quantified simultaneously. Subsequently, the nylon thread texture coherence distribution factor is called and combined with eigenvectors to construct an anisotropic diffusion tensor. Pixel grayscale values are updated through iterative evolution, ensuring texture continuity along the nylon fiber tangent direction and suppressing cross-texture diffusion in the normal direction. This reduces random noise and particle disturbance while decreasing the probability of texture boundaries being smoothed out. Furthermore, a sliding window is set to traverse the structural tensor to guide image smoothing. Within the sliding window, a multi-scale grid is divided and unified... The number of grayscale surface covering mesh boxes is counted, the local fractal dimension value is calculated and compared with the two-dimensional topological plane reference value, and nonlinear gain calculation is performed only for regions exceeding the two-dimensional topological plane reference value to generate a nylon line roughness gain map. This allows the subtle undulations in rough regions to be directionally amplified while flat regions remain stable. Finally, the detail component and background component of the structure tensor-guided smoothing image are separated. The nylon line roughness gain map is multiplied by the detail component and reconstructed with the background component to output a high-contrast enhanced image of the nylon line surface. This allows the contrast enhancement to focus on real texture details and reduces the risk of pseudo-textures caused by background grayscale drift and over-enhancement. At the same time, it achieves enhanced texture direction consistency, enhanced local roughness differences, and improved visual readability after the separation of details and background. Attached Figure Description
[0032] Figure 1 This is a schematic diagram of the steps of the present invention. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0034] Please see Figure 1 This invention provides a technical solution: a method for enhancing the contrast of a microscopic image of a nylon thread surface, comprising the following steps:
[0035] Acquire a microscopic grayscale image of the nylon thread surface, calculate the horizontal and vertical gradient values of the pixels in the microscopic grayscale image of the nylon thread surface, construct a pixel-level structure tensor matrix, perform eigenvalue decomposition operation on the pixel-level structure tensor matrix, and generate the texture coherence distribution factor of the nylon thread.
[0036] The texture coherence distribution factor of the nylon thread is called, and an anisotropic diffusion tensor with the same feature vector as the structure tensor is constructed by combining the feature vector. Iterative evolution operation is performed on the micro grayscale image of the nylon thread surface to update the pixel grayscale value and output the structure tensor guided smoothing image.
[0037] Set a sliding window to traverse the structure tensor-guided smoothing image, divide the multi-scale grid within the sliding window and count the number of gray-scale surface covering grid boxes, calculate the local fractal dimension value, determine the size of the local fractal dimension value and the two-dimensional topological plane reference value, calculate the part exceeding the two-dimensional topological plane reference value, and generate a nylon line roughness gain mapping map.
[0038] The detail component and background component of the separated structure tensor-guided smoothing image are multiplied by the detail component of the nylon line roughness gain map to output a high-contrast enhanced image of the nylon line surface.
[0039] The steps to obtain the pixel-level structure tensor matrix are as follows:
[0040] Obtain a microscopic grayscale image of the nylon thread surface, traverse the grayscale values of adjacent pixels of each pixel in the microscopic grayscale image of the nylon thread surface, calculate the grayscale difference along the horizontal direction to form a horizontal gradient value sequence, calculate the grayscale difference along the vertical direction to form a vertical gradient value sequence, and obtain the horizontal and vertical gradient values of the pixel.
[0041] Based on the horizontal and vertical gradient values of each pixel, the elements of the gradient outer product matrix are calculated for each pixel and arranged into a matrix field according to the pixel position. Gaussian window weights are then used to perform local weighted summation and normalization operations on the gradient outer product matrix field to form a pixel-level structure tensor matrix.
[0042] Specifically, acquire microscopic grayscale images of the nylon thread surface, set the magnification of the industrial microscope to the range of 1000x to 2000x, adjust the light source brightness to medium intensity to avoid excessive surface reflection, and set the image acquisition resolution to [missing information]. The process converts the acquired RGB color image into a single-channel grayscale image, with the grayscale level range set to 0 to 255, where 0 represents pure black and 255 represents pure white. A two-dimensional pixel coordinate system is established, with the horizontal direction as the x-axis and the vertical direction as the y-axis. The process iterates through each coordinate position in the image. For each pixel, the image boundary processing strategy is set to mirror fill. This means that for points where adjacent pixels cannot be obtained at the image edge, the value of the outermost pixel is copied as a virtual adjacent pixel. This is applied to the coordinates... The center pixel at that location is read from its horizontal left-side adjacent pixel. The grayscale value and the adjacent pixel on the right The grayscale value is used to calculate the horizontal gradient using the central difference method. The calculation formula is as follows: ,in, Representing coordinates The horizontal gradient value at that location. Represents the grayscale value of the adjacent pixel to the right. This represents the grayscale value of the left adjacent pixel, and the constant 2 represents the span distance between the two pixels. It also reads the vertically adjacent pixel above. The grayscale value and the adjacent pixels below The grayscale value is used to calculate the vertical gradient. The calculation formula is as follows: ,in, Representing coordinates The vertical gradient value at that point. This represents the grayscale value of the adjacent pixel below. The grayscale value of the adjacent pixel above is represented by the gradient value. All the calculated gradient values are stored in two independent two-dimensional floating-point arrays according to their original coordinate positions, corresponding to the horizontal gradient map and the vertical gradient map respectively, so as to obtain the horizontal and vertical gradient values of the pixel.
[0043] Based on the horizontal and vertical gradient values of each pixel, an empty matrix field with the same size as the original image is constructed to store the corresponding values for each pixel. A positive semi-definite symmetric matrix, for any pixel position Read its corresponding horizontal gradient value and vertical gradient value Construct the gradient outer product matrix, the calculation formula is as follows: ,in, This represents the unsmoothed initial structure tensor. It is the square of the horizontal gradient. The square of the vertical gradient. The product of the horizontal and vertical gradients is then used, and the size of the Gaussian weighted window is set to... For example, setting Set the standard deviation of the Gaussian distribution. Generate Gaussian convolution kernel The formula for calculating each weight value within the kernel is as follows: ,in, The coordinates relative to the center of the window The weight value at that location, Pi The base of the natural logarithm, and These represent the local horizontal and vertical coordinate offsets within the window, with a value range of [value missing]. Up to [2], the generated convolution kernel is normalized so that the sum of all weights equals 1. The normalized Gaussian convolution kernel is then used to perform a sliding window operation on the gradient outer product matrix field. The corresponding components of the initial structure tensor matrix within the window coverage area are weighted and summed. The calculation formula is as follows: ,in, This represents the target matrix after smoothing. The initial structure tensor represents the neighborhood pixels covered by the window. By independently performing the above weighted averaging operation on each element in the matrix field, the interference of local noise on the gradient direction is eliminated, forming a pixel-level structure tensor matrix.
[0044] The steps for obtaining the coherence distribution factor of nylon thread texture are as follows:
[0045] Based on the pixel-level structure tensor matrix, the eigenvalue decomposition of the structure tensor of each pixel is calculated and the maximum eigenvalue, minimum eigenvalue and corresponding eigenvector are extracted. The difference between the maximum eigenvalue and the minimum eigenvalue is calculated and the difference is squared to obtain the nylon line texture coherence distribution factor.
[0046] Specifically, each pixel is read based on the pixel-level structural tensor matrix. place Structure tensor matrix ,in , , Construct the characteristic equation for each element component of the matrix. ,in The trace of the matrix is calculated, representing the eigenvalues to be solved. and the determinant of a matrix The eigenvalues of two real numbers can be directly calculated analytically using the quadratic formula. The formula is as follows: as well as ,in This represents the maximum eigenvalue, corresponding to the principal direction intensity of the local structure in the image. This represents the smallest eigenvalue, corresponding to the intensity perpendicular to the principal direction. This represents the square root operation, which simultaneously calculates the eigenvector corresponding to the largest eigenvalue. ,when hour, The values are then normalized, and the difference between the two eigenvalues is calculated. This difference is used as a basic indicator to measure the degree of local texture anisotropy. A square operation is performed on this difference to enhance the signal response in high-coherence regions. The calculation formula is as follows: ,in This is the texture coherence distribution factor of the current pixel. The larger the value of this factor, the more consistent the nylon line texture direction at that position. The closer the value is to zero, the more flat the position is or the isotropic noise region. After calculating for all pixels in the entire image, the nylon line texture coherence distribution factor is obtained.
[0047] The steps for obtaining the structure tensor-guided smoothing image are as follows:
[0048] Read the coherence distribution factor value of nylon line texture according to pixel position, and assign segmented weights to the diffusion intensity according to the coherence distribution factor value of nylon line texture, generate tangential direction diffusion coefficient sequence and normal direction diffusion coefficient sequence respectively, and obtain an anisotropic diffusion coefficient set.
[0049] Based on the set of anisotropic diffusion coefficients, feature vectors are called and feature vector directions are matched according to pixel positions. The tangent direction diffusion coefficient sequence is projected onto the feature vector direction to form the first direction tensor component. The normal direction diffusion coefficient sequence is projected onto the orthogonal direction of the feature vector to form the second direction tensor component. The tensor components of each direction are synthesized to form an anisotropic diffusion tensor.
[0050] The anisotropic diffusion tensor is substituted into the divergence operator to calculate the net thermal flux divergence of each pixel. The gray values of the pixels in the micro grayscale image of the nylon thread surface are updated incrementally according to the preset iteration step. The grayscale increment convergence judgment is set and the iteration is terminated when the convergence condition is met. The structure tensor guided smoothing image is output.
[0051] Specifically, the texture coherence distribution factor values of the nylon threads are read according to pixel positions, and a two-dimensional numerical matrix corresponding one-to-one with the pixel coordinates of the original image is established. To achieve precise control over different texture feature regions, the distribution of all non-zero nylon thread texture coherence distribution factors in the entire image is first statistically analyzed. The mean and standard deviation of these distribution factor values are calculated. Based on the statistical characteristics of the nylon thread surface texture, segmentation thresholds are set. The mean value is set as the noise suppression threshold, and the sum of the mean value and three times the standard deviation is set as the texture preservation threshold. The texture coherence distribution factor value at each pixel position is iterated and compared with the above... Two thresholds are compared to determine the diffusion strategy. Pixels with values less than the noise suppression threshold are identified as background noise or flat regions, and both the tangent and normal diffusion coefficients are directly assigned a value of 1.0, i.e., isotropic diffusion is performed to maximize the smoothing effect. Pixels with values greater than the texture preservation threshold are identified as strong edge regions, and the tangent diffusion coefficient is assigned a value of 1.0 to maintain edge continuity, while the normal diffusion coefficient is assigned a value of 0.01 to block blurring across edges. For pixels with values between the noise suppression threshold and the texture preservation threshold, a non-linear transition weighting is performed, calculated using the following formula: ,in, This represents the normal direction diffusion coefficient at pixel p. This represents the value of the nylon line texture coherence distribution factor at pixel p. Indicates the noise suppression threshold. The formula represents the texture preservation threshold. This formula causes the normal diffusion coefficient to decrease quadratically as the texture coherence increases, while always keeping the tangential diffusion coefficient at 1.0. The calculated coefficients are stored in two independent matrices according to their positions, generating tangential diffusion coefficient sequences and normal diffusion coefficient sequences respectively. These two sequences are combined and stored to obtain the anisotropic diffusion coefficient set.
[0052] Based on the set of anisotropic diffusion coefficients, and simultaneously using the feature vector data obtained in the structural tensor decomposition step, the tangential diffusion coefficient is extracted for each pixel location in the image. and normal direction diffusion coefficient And extract the eigenvector corresponding to the minimum eigenvalue of the structure tensor. As the tangent direction vector, extract the eigenvector corresponding to the largest eigenvalue. As normal direction vectors, these two eigenvectors are orthogonal to each other and have a magnitude of 1. Based on tensor composition theory, an anisotropic diffusion tensor for this pixel is constructed, calculated using the following formula: ,in, Indicates the synthesized Anisotropic diffusion tensor matrix, The outer product matrix representing the tangent direction vectors is used to define the diffusion channels along the direction of the nylon thread texture. The outer product matrix representing the normal direction vector is used to define the diffusion channel perpendicular to the nylon thread texture direction. and These are the scalar diffusion coefficients calculated in the preceding steps. Specifically, during the calculation, the eigenvectors are first calculated at... shaft and The product of the components of the axis, for example, for the tangent direction vector. The elements of their outer product matrix are respectively , , , These components and their corresponding coefficients Multiplication involves performing the same operation on the normal direction vector and multiplying by . Finally, the corresponding elements of the two weighted outer product matrices are added together to obtain the four components of the diffusion tensor. ,in To ensure the symmetry of the tensor, the tangent direction diffusion coefficient sequence is projected onto the eigenvector direction to form the first directional tensor component, and the normal direction diffusion coefficient sequence is projected onto the orthogonal direction of the eigenvector to form the second directional tensor component. The tensor components in each direction are then synthesized to form an anisotropic diffusion tensor.
[0053] The anisotropic diffusion tensor is substituted into the divergence operator to calculate the net heat flux divergence of each pixel. First, the gray-level gradient vector of each pixel in the current image is calculated using the central difference method. , to each pixel position Anisotropic diffusion tensor Multiplying this by the gradient vector yields the heat flux density vector. The calculation formula is: ,in, Represents the heat flux density vector. For the anisotropic diffusion tensor, and These are the partial derivatives of the image grayscale in the horizontal and vertical directions, respectively. Then, the divergence of the heat flux density vector is calculated using the following formula: ,in, Indicates net heat dissipation. and The horizontal and vertical components of the heat flux density vector are used to iteratively update the image using this divergence value, with the update formula being: ,in, For the updated pixel grayscale values, The pixel grayscale value at the current iteration step. The time step is set to ensure the stability of the numerical calculation. The grayscale values of pixels in the microscopic grayscale image of the nylon thread surface are incrementally updated according to a preset iterative step. The maximum number of iterations is set to 50, and the root mean square error between two adjacent iterations is calculated as the convergence criterion. The calculation formula is as follows: ,in, This represents the convergence error value. This represents the total number of pixels in the image. For the pixel index, set the convergence threshold to 0.1, and when the calculated error value... When the number of iterations is less than the convergence threshold or the maximum number of iterations is reached, the operation is stopped, a grayscale increment convergence criterion is set, and the iteration is terminated when the convergence condition is met, and the structure tensor guided smoothing image is output.
[0054] The steps to obtain the local fractal dimension values are as follows:
[0055] Set a sliding window to traverse the structure tensor-guided smoothing image, fix the pixel coverage of the sliding window, repeatedly divide the pixel region within the sliding window according to multiple sets of grid side length parameters, count the number of grid boxes actually covered by the grayscale surface for each set of grid side length parameters, and record the correspondence between each set of grid side length parameters and the corresponding number of grid boxes covered by the grayscale surface to form a local multi-scale grid box number relationship set.
[0056] Based on the local multi-scale grid box number relationship set, the local fractal dimension value is calculated using the following formula:
[0057] ;
[0058] in, The fractional dimension values of the local area. This represents the total number of mesh side length parameters in the local multi-scale mesh box number relation set. This represents the logarithmic scaling variable calculated from the i-th grid side length parameter, which is calculated by taking the natural logarithm of the reciprocal of the grid side length parameter. This represents the logarithmic count variable calculated from the number of mesh boxes covering the i-th grayscale surface. The calculation method is to take the natural logarithm of the number of mesh boxes covering the grayscale surface. This represents the weight value corresponding to the i-th scale sample, calculated using the following formula: , Represents the logarithmic scaling variable for all scales. The average value, This parameter represents the degree of dispersion control of the logarithmic scale variable distribution, used to limit the concentration range of the weights in the scale sequence.
[0059] Specifically, a sliding window is used to traverse the structure tensor-guided smoothing image. To obtain statistically significant roughness features while preserving the micro-texture details of the nylon thread surface, the size of the sliding window is defined as follows: The pixel size is primarily chosen based on the imaging width of a nylon monofilament fiber under a 2000x microscope lens. Typically, the diameter of a monofilament corresponds to 25 to 30 pixels in the image. The sliding window ensures that it primarily reflects the undulations of the textured surface rather than the overall geometric contours of the fibers, thus avoiding interference from the background area in roughness calculations. The sliding window is set to start from the top left corner of the image. Initially, the system moves horizontally in 1-pixel increments. After each row scan, it moves vertically downwards by 1 pixel and continues scanning until the entire image is covered. Within the local pixel region locked by each sliding window, fractal features are extracted using the differential box-dimensionality (DBC) method. First, multiple sets of grid side length parameters are established, and the parameter sequence is set as follows: These five scale parameters cover a spatial span from subtle noise to major texture grain, for each side length parameter in the sequence. ,Will The local image region is divided into multiple [areas] in the horizontal and vertical planes. The grid is small, and to match the dynamic range of grayscale values, the height of the grid in the direction perpendicular to the grayscale axis of the image plane is set to [value missing]. The calculation formula is: Where 255 is the maximum gray level and 17 is the window side length, this setting ensures the grid's proportional consistency across the three dimensions, traversing each division within the window. A small grid is used to read the grayscale values of all pixels within the grid area and extract the maximum grayscale value. and minimum gray value Calculate the number of boxes required for this small grid location. The calculation method is as follows Where floor is the floor function, which rounds down the number of boxes calculated from all the smaller grids within the window. Accumulate to obtain the result at the current scale. Total number of mesh boxes required to cover the entire grayscale surface For example, when If the total number of boxes obtained by accumulation is 2400, then record this set of correspondences. Repeat the above statistical process for all 5 scale parameters in the sequence. Finally, pair each set of grid side length parameters with its corresponding total number of grid boxes to form a local multi-scale grid box number relationship set.
[0060] In the formula for calculating the local fractional dimension, the weighted least squares method is used to fit data points in a double logarithmic coordinate system to estimate the local fractional dimension value. Compared to the traditional ordinary least squares method, this method introduces weights. It can effectively suppress data bias at both ends of the scale (too small a scale is affected by noise, and too large a scale is affected by window boundary effect), so that the fitted slope can better reflect the self-similarity characteristics of the texture essence.
[0061] This represents the total number of grid side length parameters in the local multi-scale grid box relation set. This parameter determines the number of data points used when estimating the fractal dimension. In this embodiment, it is based on the grid side length parameter sequence set in the aforementioned steps. ,Sure The value is 5. This value is selected based on the degree of freedom requirement in statistics. At least 5 data points are required to ensure that the linear regression analysis has a basic confidence level, while avoiding an exponential increase in the amount of calculation due to too many points. This parameter is obtained directly from the number of set elements generated in the statistical preliminary steps.
[0062] This represents the logarithmic scaling variable calculated from the edge length parameter of the i-th grid. This parameter maps nonlinear scaling changes to a log-linear space and is the abscissa input for fractal dimension calculation. Its calculation formula is as follows: ,in For the i-th grid side length parameter, for example, for the first parameter in the scale sequence Its corresponding logarithmic scaling variable is This parameter is obtained by relying on a preset scale sequence and is directly derived through mathematical logarithmic operations. It is dimensionless and its value ranges from -3.0 to -0.5.
[0063] This represents the logarithmic count variable calculated from the number of mesh boxes covering the i-th grayscale surface. This parameter serves as the ordinate input for calculating the fractal dimension, reflecting the space-occupying capacity of the textured surface at different scales. Its calculation formula is as follows: ,in The statistical results obtained in the aforementioned steps are based on the scale. The total number of grid boxes, for example, if in The number of boxes counted at that time ,but This parameter is obtained by performing a natural logarithmic transformation on the actual statistical box count data, and its value increases with the increase of texture complexity;
[0064] Represents the logarithmic scaling variable for all scales. The average value of this parameter serves as an indicator of the central location of the data distribution and is used for centering in subsequent weight calculations. Its calculation formula is: That is, for all calculated results The average value is obtained by first performing a logarithmic transformation on all scale parameters, then summing the results and dividing by the total number of values. , which represents the geometric center of the current scale window in the logarithmic field;
[0065] The parameter representing the dispersion control of the logarithmic scaling variable distribution is used to limit the central range of the weights in the scaling sequence; essentially, it is... The standard deviation of a sequence is calculated using the following formula: This parameter reflects the width of the selected scale sequence distribution on the logarithmic coordinate axis and is used to control the decay rate of the Gaussian weights. The smaller the value, the more pronounced the tendency for weights to concentrate at the central scale. This parameter is calculated... The variance of the data is obtained by taking the square root.
[0066] This represents the weight value corresponding to the sample at the i-th scale. This parameter is used to assign confidence values at different scales in regression calculations, and is related to the distance from the center scale. The closer the data point, the greater its weight, and vice versa. The calculation formula is as follows: This formula uses a Gaussian function to restrict the weights of the data to the interval (0, 1), ensuring that the regression line is mainly determined by reliable data at the intermediate scale, reducing errors caused by fluctuations in marginal scale data. This is achieved by substituting the values into the aforementioned calculations. , and Obtain the results through point-by-point calculation;
[0067] The value of the local fractional dimension is the core indicator that ultimately characterizes the local roughness of the nylon thread surface. Its geometric meaning is the opposite of the slope of the fitted straight line in the double logarithmic coordinate system. The larger the value, the rougher and more complex the surface; the smaller the value, the smoother the surface. This parameter is calculated by substituting all the above intermediate variables into the weighted least squares formula, and its theoretical value range is between 2.0 and 3.0.
[0068] Calculations based on parameters:
[0069] Select a sliding window representing a typical textured region for calculation, and set... The grid side length parameter sequence is .
[0070] The first step is to calculate the logarithmic scaling variable. :
[0071] ;
[0072] ;
[0073] ;
[0074] ;
[0075] ;
[0076] The second step is to obtain the actual number of grid boxes counted. And calculate the logarithmic count variable. :
[0077] ;
[0078] ;
[0079] ;
[0080] ;
[0081] ;
[0082] The third step is to calculate the average value. and standard deviation :
[0083] ;
[0084] Calculate the variance term:
[0085] ;
[0086] ;
[0087] ;
[0088] ;
[0089] ;
[0090] ;
[0091] ;
[0092] ;
[0093] Step 4: Calculate the weights :
[0094] ;
[0095] ;
[0096] ;
[0097] ;
[0098] ;
[0099] Fifth step: Summing up the terms in the formula:
[0100] ;
[0101] ;
[0102] ;
[0103] ;
[0104] ;
[0105] Step 6, Substitute Formula for calculating numerator and denominator:
[0106] molecular ;
[0107] denominator ;
[0108] ;
[0109] The results show that the local fractal dimension of the nylon thread surface region covered by the current sliding window is 2.2572, which is within a reasonable range of 2.0 to 3.0. This indicates that the region has a moderate degree of rough texture characteristics, and is neither a completely smooth plane (corresponding to dimension 2.0) nor an extremely noisy surface (corresponding to dimension close to 3.0). This value will be used to generate a roughness gain map in the future, which will serve as the basis for the local adaptive gain of the enhancement algorithm.
[0110] The steps for obtaining the roughness gain mapping map of nylon thread are as follows:
[0111] Read the local fractal dimension values at the corresponding pixel positions in each sliding window, compare the local fractal dimension values with the two-dimensional topological plane reference values pixel by pixel, subtract the two-dimensional topological plane reference values from the local fractal dimension values to obtain the difference results, retain the positive parts of the difference results and write them into the difference table, and write the non-positive parts into zero values to form the super-reference difference matrix.
[0112] Iterate through the super-reference difference matrix to find the super-reference difference value at each pixel position, and calculate the roughness gain value of the nylon thread. The calculation formula is as follows:
[0113] ;
[0114] in, This represents the roughness gain value of the nylon line corresponding to the u-th pixel position. This represents the super-reference difference value corresponding to the u-th pixel position. The super-reference difference value is obtained by subtracting the local fractal dimension value from the two-dimensional topological plane reference value. This represents the maximum difference between all pixel locations and the baseline in the entire structure tensor-guided smoothed image. The texture saliency adaptive index corresponding to the u-th pixel position is calculated using the following formula: , This represents the average of all over-reference differences within a neighborhood window centered at the u-th pixel position. This represents the global non-zero variance of the over-reference difference in the entire structure tensor-guided smoothed image;
[0115] The nylon line roughness gain value corresponding to each pixel position is mapped to the pixel coordinate system of the structure tensor guided smoothing image. Neighborhood integrity is checked at the image boundary position and invalid gain values are removed. The gain values in the overlapping area of the sliding window are fused pixel by pixel to form a nylon line roughness gain mapping map.
[0116] Specifically, the fractal dimension values of the local area are read to correspond to the pixel positions within each sliding window. Since the local fractal dimension values are calculated based on the sliding window, their values spatially correspond to the geometric center point of the sliding window. A two-dimensional matrix container with the same resolution as the original image is constructed to store the difference data generated by subsequent calculations. To accurately distinguish between the effective texture undulations of the nylon thread surface and the inherent noise of the smooth background area, the setting logic of the two-dimensional topological plane reference value is established. This reference value is not simply based on the mathematically defined Euclidean plane dimension of 2.0, but needs to be obtained through an actual calibration process. A section of clean nylon thread sample with no physical wear is selected, and 30 reference images are acquired under the same microscopic imaging environment. The average fractal dimension of the flat areas in these reference images is calculated. Statistical results show that due to the dark current noise of the CCD sensor and the influence of optical path diffraction, the calculated values of the flat areas are usually distributed between 2.01 and 2.03. To construct a robust filtering threshold, the statistical mean was increased by twice the standard deviation, ultimately determining the two-dimensional topological plane baseline value to be 2.05. A double-loop structure was used to traverse the center point of each sliding window in the entire image, extracting the local fractal dimension value corresponding to that position. A subtraction operation was performed, that is, the dimension value of the current position was subtracted from the set baseline value of 2.05. A non-linear threshold filtering was performed on the difference result. If the difference result was greater than 0, it indicated that there were texture details beyond the baseline plane at that position. The positive difference value was retained and written to the corresponding coordinate position of the matrix container. If the difference result was less than or equal to 0, the position was determined to be background or noise, and the value at the corresponding position in the matrix container was forcibly set to 0. This process is equivalent to performing a high-pass filter in the fractal dimension domain, removing low-dimensional background signal interference. After traversal, only the positive incremental data representing the coarse texture features were retained in the matrix container, forming a super-baseline difference matrix.
[0117] The formula for calculating the roughness gain of nylon thread incorporates an adaptive index for texture saliency. This means that the calculation of the gain value depends not only on the current local difference intensity, but also on the joint regulation of neighborhood texture consistency and global data distribution. When the local texture and its neighborhood simultaneously exhibit high differences, the exponent... Decreasing the base (less than 1) makes the result of the operation tend to 1, thus obtaining a larger gain, and vice versa, obtaining a smaller gain. This achieves the protection of weak textures and the reasonable enhancement of strong textures, avoiding oversaturation.
[0118] This represents the super-reference difference value corresponding to the u-th pixel position. This parameter reflects the degree to which the single-point position deviates from the smooth reference surface. It is directly read from the super-reference difference matrix generated in the previous step. Specifically, it is obtained by reading the current coordinates. The local fractal dimension value at the location Subtract the preset two-dimensional topological plane reference value (e.g., 2.05), that is... If the calculation result is negative, it is taken as 0. This parameter is the basic input for calculating the gain. The larger the value, the more complex the local geometry of the point.
[0119] This parameter represents the maximum value of the difference between all pixel positions and the reference value in the entire tensor-guided smoothed image. This parameter is used to perform global normalization on local differences to ensure that the base part is always within the interval [0, 1] to prevent overflow of exponentiation. It is obtained by traversing the entire difference matrix and finding the maximum element value in the matrix through a comparison algorithm. For example, the maximum difference data recorded in a complete full-image scan. This parameter is a fixed constant in the processing of a single image.
[0120] This represents the average of all super-reference differences within a neighborhood window centered at the u-th pixel location. This parameter introduces spatial context information to evaluate the continuity of the current texture feature. Its setting is based on the premise that real nylon thread surface scratches or bumps typically occupy continuous pixel areas, rather than isolated points. It is obtained by defining a... Given a neighborhood template, iterate through the 25 pixels covered by the template and read the corresponding values of these pixels. The values are then averaged. If the current point is in a high-texture area, the average value is higher, and vice versa.
[0121] This represents the global non-zero variance of the out-of-reference difference in the entire structure tensor-guided smoothed image. This parameter measures the dispersion of the roughness distribution in the entire image and serves as the denominator term for adjusting the exponential sensitivity. Its existence allows the algorithm to adapt to the surface characteristics of different batches of nylon thread. It is obtained by extracting all values greater than 0 from the matrix. The values form a set, and the statistical variance of this set is calculated using the following formula: ,in The number of non-zero points. The mean is the value of the non-zero points, and this parameter ensures the consistency of the dimensions of the exponential adjustment.
[0122] Calculations based on parameters:
[0123] Select a specific texture pixel in the image Calculations are performed, such as full-image statistics and local extraction, to obtain the following parameter values:
[0124] Read the difference at the current point from the benchmark difference matrix: (Corresponding local dimension 2.50, baseline 2.05).
[0125] Maximum difference obtained from full-image scan: .
[0126] calculate The average difference within the neighborhood, for example, in neighborhoods with richer textures: .
[0127] Statistical analysis of the variance of non-zero differences across the entire graph: .
[0128] The first step is to calculate the normalized base:
[0129] Ratio = ;
[0130] The second step is to calculate the numerator of the exponent:
[0131] Numerator = ;
[0132] The third step is to calculate the texture saliency adaptive index. :
[0133] Inside the index = ;
[0134] ;
[0135] The fourth step is to calculate the final roughness gain value. :
[0136] ;
[0137] Using logarithms to aid calculation: ;
[0138] ;
[0139] ;
[0140] This result indicates that although the absolute difference of this pixel is only half of the maximum value (0.50), its neighborhood texture features are significant (high mean), making the adaptive index... The gain was reduced to 0.2231, thus increasing the final gain to 0.8568. This demonstrates that the algorithm can effectively identify and enhance large areas of statistically significant texture, rather than nonlinearly amplifying isolated noise points or weak signals. This gain value will be used for subsequent high-frequency component weighting.
[0141] The nylon line roughness gain value corresponding to each pixel position is mapped to the pixel coordinate system of the structure tensor guided smoothing image. A floating-point single-channel image buffer of the same size as the original image is initialized as the carrier of the mapping map. Since the gain value is calculated based on a sliding window in the previous step, its value logically belongs to the area covered by the window rather than a single point. Therefore, a region back-projection strategy is adopted to traverse all calculated gain values. , each Numerical projection covers the area with its corresponding window center as the origin. Within a pixel region, this process inevitably leads to spatial overlap between different sliding windows. That is, the same pixel coordinate will receive gain projection values from multiple different sliding windows. To eliminate the uncertainty caused by this overlap and retain the most salient features, pixel-wise maximum value fusion processing is implemented for each pixel coordinate in the image. A comparison register is set up. When a new projection gain value is received, it is compared with the existing value in the register. If the new value is greater than the old value, the register content is updated; otherwise, it remains unchanged. For example, if a pixel is simultaneously located within the coverage area of windows A and B, and window A contributes a gain of 0.6 while window B contributes a gain of 0.8, then the pixel will ultimately retain 0.8 as the effective gain. Simultaneously, a neighborhood integrity check is performed, monitoring in real time whether the target pixel coordinates cross the physical boundary of the image during projection. Is it in and Is it in Within the range, invalid gain values whose calculated coordinates exceed the range are directly discarded without being written to prevent memory access from exceeding the limit. After the gain values of all windows have been projected and fused, the image data in the buffer is smoothed to fill the gaps that may be caused by the boundary step size, and finally a nylon wire roughness gain mapping map with continuous gray level that can accurately reflect the surface roughness distribution weight of the nylon wire is formed.
[0142] The steps for obtaining a high-contrast enhanced image of the nylon thread surface are as follows:
[0143] The detail component and background component of the structure tensor guided smoothing image are separated. The gray value of each pixel in the structure tensor guided smoothing image is traversed and a local gray-level reference surface is established. The residual of the pixel gray value relative to the local gray-level reference surface is calculated and collected into the detail component. The local gray-level reference surface is stitched together in the whole image to form the background component, thus obtaining the detail component and the background component.
[0144] Based on the detail component and the background component, the nylon line roughness gain map is aligned to the detail component according to the pixel coordinates. For each pixel position, the nylon line roughness gain map value is multiplied point by point with the grayscale residual of the detail component. The point-by-point multiplication results are summarized to form the high-frequency component. The high-frequency component is then linearly superimposed point by point with the background component according to the pixel position to generate a grayscale superimposed result image.
[0145] The minimum and maximum gray values of the gray-scale overlay result image are statistically analyzed and a target gray-scale range is established. The gray-scale overlay result image is linearly scaled according to pixel position and boundary truncation is performed to output a high-contrast enhanced image of the nylon line surface.
[0146] Specifically, to accurately extract the minute texture undulations on the nylon thread surface and eliminate low-frequency background effects caused by uneven lighting or overall fiber curvature, a strategy for constructing a local grayscale reference surface is defined. A floating-point matrix with the same size as the original image is created to store the calculation results. A rectangular filtering window is set, and the window's size parameters are specified. The pixel width is set based on the nylon thread diameter at the current magnification. Through multiple experiments, it was determined that the optimal pixel width is selected at a magnification of 2000x. Pixels can effectively cover the local geometric surfaces of the fiber without including excessive texture details, i.e., setting the window size to... Iterate through the coordinates of each pixel in the structure tensor-guided smoothing image. Using this coordinate as the center point, extract the surrounding area. For the neighboring pixels within the range, calculate the average grayscale value of all pixels within that neighborhood. The calculation formula is as follows: ,in, Representing coordinates The local grayscale reference value at that location This indicates the total number of pixels within the window (i.e., 961). Let be the window radius (taken as 15). The input structure tensor is used to smooth the grayscale value of the image. This calculation process is equivalent to performing a low-pass filter on the image to obtain the background surface that reflects the overall illumination and shape. Then, a residual extraction operation is performed to read the original smoothed grayscale value of the current pixel. Subtract the local grayscale reference value that was just calculated from it. The calculation formula is: ,in The grayscale residual contains texture information. Since this residual value may be negative, double-precision floating-point space is allocated in memory for storage, preserving all sign information and minor differences without truncation. After traversing all pixels of the entire image to complete the above calculations, all... The set of matrices composed of all values is defined as the background component. The set of matrices composed of values is defined as the detail component, and the detail component and background component are obtained.
[0147] Based on the detail and background components, a pre-stored nylon thread roughness gain map in memory is retrieved. Its size is checked to ensure it strictly matches the detail component matrix. If they match, a pixel-by-pixel index mapping is established. To convert the normalized values in the roughness gain map into actual contrast enhancement coefficients, a global enhancement intensity control parameter is defined. The parameter is set based on the goal of stretching the contrast of areas with significant texture to the optimal dynamic range perceptible to the human eye. Referring to common standards for image enhancement in industrial endoscopes, the parameter is set by comparing the image histogram entropy values under different parameters. This means that a maximum of 3.5 times local contrast magnification is allowed, traversing every pixel position of the image. Read the corresponding roughness gain value and detail component grayscale residual Calculate the weighted high-frequency texture components using the following formula: ,in, This indicates the enhanced high-frequency component values. For the original detail residual, The preset global enhancement strength control parameter (value is 3.5). This represents the roughness gain value at that location (ranging from 0 to 1). The mechanism of this formula is that for smooth areas with a roughness gain value close to 0, the enhancement coefficient is close to 1, meaning the original details remain unchanged or are slightly enhanced. However, for textured areas with a roughness gain value close to 1, the enhancement coefficient reaches 4.5 times, thus significantly amplifying the grayscale transition amplitude of the micro-texture. After completing the multiplication operation for all pixels, the corresponding background component is read. A linear overlay operation is performed to restore the tone of the image; the calculation formula is as follows. ,in This step, which generates the grayscale overlay value after synthesis, re-fits the enhanced texture details back onto the macroscopic geometric surface of the nylon thread to produce the grayscale overlay result image.
[0148] The minimum and maximum grayscale values of the resulting grayscale overlay image are statistically analyzed, and a target grayscale range is established. Since the grayscale values after weighted overlay are floating-point numbers and may exceed the standard display range of 0 to 255, dynamic range compression and quantization are required. The entire grayscale overlay image is traversed, and the minimum value is found through comparison calculations. and maximum value For example, statistics obtained in a single actual process , Set the target grayscale bit depth of the output image to 8 bits, that is, the target grayscale range is... A linear mapping function is constructed to project floating-point data onto the target range; the calculation formula is as follows. ,in, The output pixel integer value after mapping. This is the superimposed floating-point grayscale value. and These are the minimum and maximum grayscale values obtained from the entire image, respectively. 255 is the maximum value of the target grayscale level. `round` indicates rounding to the nearest integer. To prevent a very small number of pixels from overflowing due to calculation errors, a boundary truncation check is performed, i.e., all pixels less than 0 are truncated. The value is forcibly corrected to 0, and all values greater than 255 are also corrected. The value is forcibly corrected to 255. This process ensures that the enhanced image fully utilizes the dynamic range of the display device, so that the darkest texture valleys correspond to black and the brightest texture peaks correspond to white, maximizing visual contrast and outputting a high-contrast enhanced image of the nylon line surface.
[0149] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A method for enhancing the contrast of a microscopic image of a nylon thread surface, characterized in that, Includes the following steps: A microscopic grayscale image of the nylon thread surface is acquired, the horizontal and vertical gradient values of the pixels in the microscopic grayscale image of the nylon thread surface are calculated, a pixel-level structural tensor matrix is constructed, and eigenvalue decomposition operation is performed on the pixel-level structural tensor matrix to generate the nylon thread texture coherence distribution factor. The nylon thread texture coherence distribution factor is invoked, and an anisotropic diffusion tensor with the same feature vector as the structure tensor is constructed by combining the feature vector. Iterative evolution operation is performed on the micro grayscale image of the nylon thread surface to update the pixel grayscale value and output the structure tensor guided smoothing image. A sliding window is set to traverse the structure tensor-guided smoothing image. Multi-scale grids are divided within the sliding window, and the number of gray-scale surface covering grid boxes is counted. The local fractal dimension value is calculated, and the magnitude of the local fractal dimension value and the two-dimensional topological plane reference value are determined. For the part exceeding the two-dimensional topological plane reference value, calculation is performed to generate a nylon line roughness gain mapping map. The detail component and background component of the structure tensor-guided smoothing image are separated, and the nylon line roughness gain map is multiplied by the detail component to output a high-contrast enhanced image of the nylon line surface.
2. The method for enhancing the contrast of a microscopic image of a nylon thread surface according to claim 1, characterized in that, The steps for obtaining the pixel-level structural tensor matrix are as follows: Obtain a microscopic grayscale image of the nylon thread surface, traverse the grayscale values of adjacent pixels of each pixel in the microscopic grayscale image of the nylon thread surface, calculate the grayscale difference along the horizontal direction to form a horizontal gradient value sequence, calculate the grayscale difference along the vertical direction to form a vertical gradient value sequence, and obtain the horizontal and vertical gradient values of the pixel. Based on the horizontal and vertical gradient values of the pixels, the elements of the gradient outer product matrix are calculated for each pixel and arranged into a matrix field according to the pixel position. Gaussian window weights are then used to perform local weighted summation and normalization operations on the gradient outer product matrix field to form a pixel-level structural tensor matrix.
3. The method for enhancing the contrast of a microscopic image of a nylon thread surface according to claim 1, characterized in that, The steps for obtaining the coherence distribution factor of the nylon line texture are as follows: Based on the pixel-level structure tensor matrix, the eigenvalue decomposition of the structure tensor of each pixel is calculated and the maximum eigenvalue, minimum eigenvalue and corresponding eigenvector are extracted. The difference between the maximum eigenvalue and the minimum eigenvalue is calculated and the difference is squared to obtain the nylon line texture coherence distribution factor.
4. The method for enhancing the contrast of a microscopic image of a nylon thread surface according to claim 1, characterized in that, The steps for obtaining the structure tensor-guided smoothing image are as follows: The nylon line texture coherence distribution factor value is read according to the pixel position. The diffusion intensity is segmented and weighted according to the nylon line texture coherence distribution factor value. Tangential direction diffusion coefficient sequence and normal direction diffusion coefficient sequence are generated respectively to obtain an anisotropic diffusion coefficient set. Based on the set of anisotropic diffusion coefficients, feature vectors are called and feature vector directions are matched according to pixel positions. The tangent direction diffusion coefficient sequence is projected onto the feature vector direction to form a first direction tensor component. The normal direction diffusion coefficient sequence is projected onto the orthogonal direction of the feature vector to form a second direction tensor component. The tensor components of each direction are synthesized to form an anisotropic diffusion tensor. The anisotropic diffusion tensor is substituted into the divergence operator to calculate the net thermal flux divergence of each pixel. The gray values of the pixels in the micro grayscale image of the nylon thread surface are updated incrementally according to a preset iteration step. A grayscale increment convergence judgment is set, and the iteration is terminated when the convergence condition is met. The structure tensor guided smoothing image is output.
5. The method for enhancing the contrast of a microscopic image of a nylon thread surface according to claim 1, characterized in that, The steps for obtaining the local fractional dimension values are as follows: Set a sliding window to traverse the structure tensor-guided smoothing image, fix the pixel coverage of the sliding window, repeatedly divide the pixel region within the sliding window according to multiple sets of grid side length parameters, count the number of grid boxes actually covered by the grayscale surface for each set of grid side length parameters, and record the correspondence between each set of grid side length parameters and the corresponding number of grid boxes covered by the grayscale surface to form a local multi-scale grid box number relationship set. Calculate the local fractional dimension values based on the local multi-scale grid box number relationship set.
6. The method for enhancing the contrast of a microscopic image of a nylon thread surface according to claim 1, characterized in that, The steps for obtaining the roughness gain mapping map of the nylon wire are as follows: Read the pixel position corresponding to the local fractal dimension value in each sliding window, compare the local fractal dimension value with the two-dimensional topological plane reference value pixel by pixel, subtract the two-dimensional topological plane reference value from the local fractal dimension value to obtain the difference result, retain the positive part of the difference result and write it into the difference table, and write the non-positive part into zero value to form the super-reference difference matrix. Iterate through the super-reference difference value at each pixel position in the super-reference difference matrix and calculate the roughness gain value of the nylon line; The nylon line roughness gain value corresponding to each pixel position is mapped to the pixel coordinate system of the structure tensor guided smoothing image. Neighborhood integrity is checked at the image boundary position and invalid nylon line roughness gain values are removed. The nylon line roughness gain values in the overlapping area of the sliding window are fused pixel by pixel to form a nylon line roughness gain mapping map.
7. The method for enhancing the contrast of a microscopic image of a nylon thread surface according to claim 1, characterized in that, The steps for obtaining the high-contrast enhanced image of the nylon thread surface are as follows: The detail component and background component of the structure tensor guided smoothing image are separated. The gray value of each pixel in the structure tensor guided smoothing image is traversed and a local gray-level reference surface is established. The residual of the pixel gray value relative to the local gray-level reference surface is calculated and collected into the detail component. The local gray-level reference surface is stitched together in the whole image to form the background component, thus obtaining the detail component and the background component. Based on the detail component and the background component, the nylon line roughness gain map is aligned to the detail component according to the pixel coordinates. For each pixel position, the value of the nylon line roughness gain map is multiplied point by point with the grayscale residual of the detail component. The point-by-point multiplication results are summarized to form the high-frequency component. The high-frequency component is then linearly superimposed point by point with the background component according to the pixel position to generate a grayscale superimposed result image.
8. The method for enhancing the contrast of a microscopic image of a nylon thread surface according to claim 7, characterized in that, The step of acquiring the high-contrast enhanced image of the nylon thread surface further includes: The minimum and maximum gray values of the gray-scale overlay result image are statistically analyzed, and a target gray-scale range is established. The gray-scale overlay result image is linearly scaled according to pixel position and boundary truncation is performed to output a high-contrast enhanced image of the nylon line surface.