An image enhancement method for sizing state detection

By dynamically adjusting the filter window size, combined with the grayscale difference of multiple frame images, adaptive filtering processing, the problem of poor noise suppression caused by fixed window size in the non-local mean filtering algorithm is solved, and more efficient image enhancement and detection are achieved accuracy.

CN118822869BActive Publication Date: 2024-11-22SHAANXI BOYU TEXTILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411303944.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-11-22
Estimated Expiration
2044-09-19

AI Technical Summary

Technical Problem

In the prior art, the non-local mean filtering algorithm uses a fixed-size filtering window in image processing, resulting in poor noise suppression effect, affecting image quality and detection accuracy.

Method used

By analyzing the noise possibilities and texture characteristics of each pixel point, the filtering window size is dynamically adjusted, combined with the grayscale differences of multiple frame images, adaptive filtering is adaptively used to enhance the image.

Benefits of technology

Effectively remove noise, preserve image details, improve image quality and detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118822869B_ABST
    Figure CN118822869B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to an image enhancement method for detecting a sizing state, comprising: obtaining grayscale images of multiple frames of sizing images, taking any pixel point in the current grayscale image as a target pixel point, determining a first demand degree of the target pixel point for a filter window size according to the possibility that the target pixel point is noise, calculating a first possibility that the target pixel point belongs to a sizing area, taking the product of the sum of grayscale differences of a local area of ​​the target pixel point in multiple consecutive grayscale images and the first possibility as a second possibility that the target pixel point belongs to the sizing area, calculating a second demand degree of the target pixel point for a filter window size, using the second demand degree to adaptively adjust the size of the filter window of the target pixel point, and performing adaptive filtering based on the adjusted filter windows of all target pixels to enhance the image, thereby improving the filtering effect and image quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an image enhancement method for detecting sizing state. Background Art

[0002] With the development of industrial automation and intelligent manufacturing technology, quality monitoring of textiles has become particularly important, especially in the sizing process. In order to ensure the consistency and stability of product quality, it is necessary to carry out quality inspection of the sizing during the production process. The existing technology is to collect images of the sizing, and then perform image analysis and processing to achieve quality inspection of the sizing.

[0003] During the image acquisition process, due to the electromagnetic interference between devices, the image transmission will be affected by signal interference, which will lead to additional noise in the image, thus affecting the image quality and subsequent detection results. Therefore, it is necessary to filter the acquired sizing image to remove noise to achieve image enhancement. For example, the existing Chinese patent application document with application number CN117974610A discloses a yarn break detection method in the reed tooth area of ​​the sizing machine based on an image processing algorithm, which includes the following steps: a. First, an industrial camera arranged at the top of the reed tooth area of ​​the sizing machine is used to capture a picture of the reed tooth area of ​​the sizing machine, the captured picture is cropped to obtain the area of ​​interest, and the average grayscale value of the picture after subtraction is obtained; b. After pre-processing the picture, the left and right boundaries of the yarn are determined by the small rectangle traversal method, and the contrast value of the picture in the vertical direction is obtained by the grayscale co-occurrence matrix method; c. The first ten pictures in the folder are read, the ten pictures in the folder are filtered by mean filtering, and the last nine pictures are subtracted from the first picture in turn, the height, width and area of ​​the contour are screened, and the fault is determined by the horizontal coordinate position of the contour.

[0004] The non-local mean filtering algorithm is often used for image denoising. The non-local mean filtering algorithm uses a fixed-size filtering window to process each pixel. If the fixed window is too large, it will lead to over-smoothing and easy loss of important image details. If the fixed window is too small, it cannot fully suppress the influence of noise. In short, using the same fixed-size filtering window to filter all pixels affects the filtering effect, resulting in poor image enhancement and reducing the accuracy of subsequent quality inspection results of the sizing image. Summary of the invention

[0005] In order to solve the problem that the same fixed-size filtering window is used for all pixel points to perform non-local mean filtering, which affects the filtering effect and reduces the accuracy of the subsequent quality detection results of the sizing image, the present invention proposes an image enhancement method for sizing state detection, comprising:

[0006] Obtaining grayscale images of multiple frames of sizing images, taking any pixel point in the current grayscale image as a target pixel point, and determining a first requirement degree of the target pixel point for the size of the filtering window according to the possibility that the target pixel point is noise, wherein the first requirement degree is positively correlated with the possibility;

[0007] Calculate the first possibility that the target pixel belongs to the sizing area , is the standard deviation of the gradient amplitude of all pixels in the local area of ​​the target pixel, is the variance of the absolute value of the sine value of the angle between the gradient direction and the horizontal direction of all pixels with gradient changes in the local area, It is the sum of the number of pixels with the same gradient amplitude on the extension line of the main gradient direction of all pixels with gradient changes. is the natural exponential function;

[0008] The product of the sum of grayscale differences of the local area of ​​the target pixel in a plurality of continuous grayscale images and the first possibility is used as the second possibility that the target pixel belongs to the sizing area, and the second requirement degree of the target pixel for the filter window size is calculated. , For the first level of demand, For the second possibility, are preset adjustment parameters;

[0009] The size of the filter window of the target pixel is adaptively adjusted using the second demand level, and adaptive filtering is performed based on the adjusted filter window of all target pixels to enhance the image.

[0010] The above technical scheme can obtain more stable and reliable data through multiple frames of images, which helps to reduce the impact of random noise in a single frame image. The first demand degree for the filter window size is determined according to the possibility that each target pixel is noise. This method can identify noise points, which makes the filtering operation more targeted. By evaluating the first possibility that each target pixel belongs to the sizing area, it is helpful to preliminarily distinguish the sizing area and the background area in the sizing image. The sizing area usually contains important image details. The second possibility that the target pixel belongs to the sizing area is obtained by analyzing the grayscale difference in multiple frames of images in the time dimension, so as to more comprehensively evaluate whether the target pixel belongs to the sizing area, and better identify the sizing area. The second demand degree of the target pixel for the filter window size is obtained by combining the above first demand degree and second possibility. The second demand degree is used to dynamically adjust the filter window size of each target pixel to obtain the most suitable filter window size for each target pixel. This method can adopt different filtering strategies for different image areas. By adaptively adjusting the filter window size, the details and texture features of the image can be retained to the maximum extent while removing noise, thereby improving the image quality and further improving the accuracy of subsequent detection.

[0011] Furthermore, the first demand level , is the possibility that the target pixel is noise, is the number of all pixels in the current grayscale image that have the same grayscale value as the target pixel.

[0012] The above technical solution not only considers the noise possibility of a single pixel, but also considers its distribution in the image, so that the first requirement level more accurately reflects the actual filtering requirement of the pixel.

[0013] Furthermore, the method for adaptively adjusting the size of the filter window of the target pixel point using the second demand level is: taking the product of the second demand level and the preset filter window size rounded down as the size of the filter window after the target pixel point is adjusted.

[0014] The above technical solution combines local features and global settings, so that the size of the filter window can be adaptively adjusted according to the characteristics of different pixels, thereby better preserving the details and texture features of the image while denoising.

[0015] Furthermore, the method for determining all pixel points with gradient changes in the local area is as follows: in the local area, if the grayscale value of a pixel point is completely consistent with the grayscale values ​​of its four neighboring pixel points, the pixel point is a pixel point with no gradient change; if there is a pixel point in the four neighborhoods whose grayscale value is inconsistent with the grayscale value of the pixel point, the pixel point is a pixel point with gradient change; the four neighborhood pixel points include two neighboring pixel points in the vertical direction and two neighboring pixel points in the horizontal direction.

[0016] The above technical solution analyzes the grayscale difference between a pixel and its direct neighborhood to distinguish between pixels with gradient changes and pixels without gradient changes, thereby being able to accurately identify detailed features in the image and improve the specificity of subsequent filtering processing.

[0017] Furthermore, the method for obtaining the possibility that the target pixel is noise is: taking the sum of the grayscale differences between the target pixel and its eight neighboring pixels as the possibility that the target pixel is noise.

[0018] Furthermore, the adaptive filtering adopts a non-local mean filtering algorithm.

[0019] Further, if the product of the second demand level and the preset filter window size is rounded down to an even number, the value of the even number incremented by 1 is used as the size of the adjusted filter window of the target pixel.

[0020] Furthermore, the local area of ​​the target pixel is centered on the target pixel and includes the target pixel and its surroundings. A rectangular area of ​​pixels, The preset quantity.

[0021] Furthermore, the method for obtaining the main gradient direction of the pixel point with directional gradient change is:

[0022] Calculate the horizontal gradient amplitude of the pixel and the vertical gradient amplitude , and and The gradient direction corresponding to the maximum value in is taken as the main gradient direction of the pixel.

[0023] The above technical scheme can quickly determine the main gradient direction of the pixel point by comparing the gradient amplitudes in the horizontal and vertical directions. The main gradient direction is the horizontal or vertical direction, which usually reflects the texture direction of the yarn in the sizing area, and helps to identify key features such as the edge and texture of the sizing area in the image.

[0024] The present invention has the following effects:

[0025] This scheme analyzes the grayscale images of multiple frames of images, combines the evaluation of the noise possibility and texture possibility of pixels, and dynamically adjusts the filter window size of each pixel in the process of filtering the grayscale images using the non-local mean filtering algorithm. The non-local mean filtering algorithm is optimized. This method can not only effectively remove noise, but also retain important details of the image, achieve more accurate image enhancement effects, improve the overall quality of the image, and to a certain extent ensure the accuracy and reliability of subsequent detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0027] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0029] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0030] Reference Figure 1 , an image enhancement method for sizing state detection, comprising steps S1 to S5, specifically as follows:

[0031] S1: Collect the sizing yarn image in the sizing yarn manufacturing process and pre-process it to obtain a grayscale image.

[0032] In this step, a high-definition camera is used to collect the sizing images in the sizing process in real time. The collection frequency is determined by the frequency of the camera. Each frame of the collected sizing image is then grayed out for subsequent analysis of image features.

[0033] S2: Taking any pixel point in the current grayscale image as the target pixel point, determining the first requirement degree of the target pixel point for the filter window size according to the possibility that the target pixel point is noise.

[0034] The grayscale image corresponding to the sizing image at the current analysis moment is used as the current grayscale image. This step aims to analyze the grayscale value performance of each pixel in the current grayscale image, and preliminarily evaluate the first demand degree of the pixel for the filter window size during filtering. Therefore, this step first takes any pixel in the current grayscale image as the target pixel, and then performs subsequent analysis.

[0035] In image processing, if a pixel is noise, the grayscale value of the pixel usually shows characteristics different from normal pixels in its vicinity, and noise pixels usually appear randomly and accidentally, so the number of pixels with the same grayscale value as the noise in the current grayscale is small. This step identifies noise pixels by analyzing the grayscale value difference between each target pixel and its neighborhood, as well as the number of pixels with the same grayscale as the target pixel, and quantifies the first demand degree of the target pixel for the filter window size. The larger the first demand degree, the larger the filter window needs to be set for the target pixel when filtering, and the smaller the first demand degree, the smaller the filter window needs to be set for the target pixel when filtering.

[0036] For each target pixel in the current grayscale image, calculate the first requirement of the target pixel for the filter window size:

[0037]

[0038] In the formula, is the first requirement of the target pixel for the filter window size, is the possibility that the target pixel is noise, is the number of all pixels in the current grayscale image that have the same grayscale value as the target pixel, where: The value of is the sum of the grayscale differences between the target pixel and its eight neighboring pixels. The grayscale difference is the absolute value of the grayscale difference, and, It is a whole, not the product of three characters.

[0039] If the grayscale value difference between the target pixel and its eight neighboring pixels is greater, it indicates that the target pixel is significantly different from the neighboring pixels nearby, which increases the possibility that the target pixel is noise. If the number of pixels that are consistent with its grayscale value in the current grayscale map is less, it indicates that the frequency of the target pixel in the current grayscale map is lower, which further increases the possibility that the target pixel is noise. Therefore, if the grayscale value difference between a target pixel and its eight neighboring pixels is large, and the number of pixels that are consistent with its grayscale value in the current grayscale map is small, that is, the first demand degree is greater, the target pixel is more likely to be noise, and a larger filter window is needed for filtering and smoothing in the subsequent filtering process. If the grayscale value difference between a target pixel and its eight neighboring pixels is small, and the number of pixels that are consistent with its grayscale value in the current grayscale map is large, that is, the first demand degree is smaller, the target pixel is more likely to be a normal pixel, and a smaller filter window is needed in the subsequent filtering process to retain the real details. It can be seen that the first requirement degree of the target pixel for the filter window size is positively correlated with the possibility that the target pixel is noise, and negatively correlated with the number of pixels in the current grayscale image that have the same grayscale value as the target pixel.

[0040] S3: Evaluate the possibility that the target pixel point belongs to the sizing area.

[0041] Through the analysis in step S2, the first demand degree of each target pixel for the filter window size is obtained. This indicator is mainly obtained based on the grayscale value performance of each target pixel. This indicator can distinguish noise pixels from most normal pixels. However, if the size of the filter window is set based on this indicator alone to filter the grayscale image, there is still a problem of poor filtering effect. This is because, if a target pixel is noise, but it is located in an area containing important image information (i.e., the texture of the yarn), at this time, although the first demand degree of the target pixel for the filter window size is calculated to be too large, that is, a larger filter window needs to be set, but in order to improve the filtering effect, the important image information in the original image (the texture area of ​​the yarn) should be retained as much as possible during the filtering process. It cannot be filtered too drastically, because too drastic filtering will lead to the loss of important information and affect the filtering effect.

[0042] In the process of sizing the fabric surface, the characteristics of the fabric surface will change, making it more uniform and smooth. This change in physical properties will be directly reflected in the collected image, which is manifested as more consistent gradient changes and texture directions of the pixels in the image. Specifically, after the sizing treatment, the irregularities of the fabric surface are reduced, resulting in a gentler gradient change of the pixels in the image, and a certain degree of consistency in the texture direction. These characteristics enable the sizing area to be identified in the image through a specific image processing algorithm. Therefore, this step obtains the first possibility that the target pixel belongs to the sizing area based on the gradient change characteristics of the pixels in the local area of ​​each target pixel, and then analyzes the grayscale value change characteristics of the local area of ​​the target pixel at the same position under multiple frames of images to obtain the second possibility that the target pixel belongs to the sizing area.

[0043] S31: Calculate the first possibility that each target pixel belongs to the sizing area.

[0044] In the current grayscale image, take any target pixel as the center and transform the target pixel and its surroundings The rectangular area of ​​pixels is taken as the local area of ​​the target pixel. is the preset number, this step is set to =19.

[0045] The first probability that each target pixel belongs to the sizing area is analyzed from the following two dimensions:

[0046] The first is the consistency of gradient changes: In the field of image processing, gradients are usually used to capture edge and texture information in images. Therefore, the pixels in the sizing area should show a lower gradient change amplitude, and the directions of these gradients should be coherent, indicating the consistency of the texture. In the current grayscale image, the gradients of all pixels can be calculated by the Sobel operator, the gradient directions of all pixels in the local area of ​​the target pixel can be obtained, and the gradient directions of these pixels can be analyzed to see if they are consistent. If the gradient directions of all pixels in the local area of ​​the target pixel are similar, it means that the change of pixel values ​​in the local area of ​​the target pixel is relatively uniform. Such an area is likely to be the part of the sizing image where the surface becomes smooth and uniform (sizing area), and the target pixel is more likely to be a pixel in the sizing area.

[0047] The second is the consistency of the texture extension direction: the texture extension direction refers to the main arrangement direction of the texture elements in the image. When the texture extension direction in the local area of ​​the target pixel is consistent, it means that these textures are arranged in the same direction, which is more in line with the texture characteristics of the sizing yarn, which means that the target pixel may be a pixel in the sizing yarn area. In addition, in order to analyze the texture extension direction, it is first determined here that there are pixels with gradient changes in the local area of ​​the target pixel: in this local area, if the grayscale value of a pixel is completely consistent with the grayscale values ​​of its four neighboring pixels, the pixel is a pixel without gradient changes; if there is a pixel in the four neighboring pixels whose grayscale value is inconsistent with the grayscale value of the pixel, the pixel is a pixel with gradient changes, where the four neighboring pixels include two neighboring pixels in the vertical direction and two neighboring pixels in the horizontal direction. For example, if the grayscale value of a pixel in a local area is 60, and the grayscale values ​​of the pixels in its four neighborhoods are also 60, then the pixel is a pixel with no gradient change. If the grayscale values ​​of its four neighborhood pixels are 60, 60, 60, and 62 respectively, then the pixel is a pixel with gradient change.

[0048] Therefore, combining the above two dimensions, the first possibility that each target pixel in the current grayscale image belongs to the sizing area is calculated:

[0049]

[0050] In the formula, is the first possibility that the target pixel belongs to the sizing area, is the standard deviation of the gradient amplitude of all pixels in the local area of ​​the target pixel, is the variance of the absolute value of the sine value of the angle between the gradient direction and the horizontal direction of all pixels with gradient changes in the local area of ​​the target pixel. is the natural exponential function, is the sum of the number of pixels with the same gradient amplitude on the extension line of the main gradient direction of all pixels with gradient changes in the local area of ​​the target pixel, and Including the target pixel itself, that is The minimum value is 1.

[0051] In this formula, The smaller it is, the more consistent the gradient amplitudes of all pixels in the local area of ​​the target pixel in the current grayscale image are, which means that the probability that the target pixel belongs to the sizing area is greater, that is, The bigger. The larger it is, the more pixels on the extension line of the main gradient direction of the gradient-changing pixel in the local area of ​​the target pixel in the current grayscale are consistent with the gradient value of the pixel. This can indicate that the texture extension direction of all the gradient-changing pixels in the local area is more consistent. It can also indicate that the denser the texture in the local area, the more likely the target pixel belongs to the sizing area. The bigger. The smaller it is, the stronger the consistency of the gradient direction of all pixels with gradient changes in the local area of ​​the target pixel in the current grayscale image is. This indicates that the consistency of the texture change direction in the local area of ​​the target pixel is stronger. Correspondingly, the greater the first possibility that the target pixel belongs to the sizing area, that is, The bigger.

[0052] For example, assuming that the number of pixels with gradient changes in the local area is 3, there are 5 pixels with the same gradient amplitude on the extension line of the main gradient direction of the first pixel with gradient changes in the local area, 6 pixels with the same gradient amplitude on the extension line of the main gradient direction of the second pixel with gradient changes in the local area, and 8 pixels with the same gradient amplitude on the extension line of the main gradient direction of the third pixel with gradient changes in the local area. Then, the number of pixels with the same gradient amplitude on the extension line of the main gradient direction of all pixels with gradient changes in the local area is . indivual.

[0053] The main gradient direction of the pixel with gradient change is obtained by calculating the horizontal gradient amplitude of the pixel. and the vertical gradient amplitude , Indicates the amount of change in the horizontal direction. Indicates the amount of change in the vertical direction. Compare the two gradient amplitudes. The direction with the larger gradient amplitude is considered to be the main gradient direction of the pixel. For example, if the horizontal gradient amplitude of a pixel is 5 and the vertical gradient amplitude is 10, then the main gradient direction of the pixel is the vertical direction. Since the gradient direction of the pixel is already known, the gradient direction is a vector synthesized from the horizontal direction and the vertical direction. Analyzing the main gradient direction of the pixel here is equivalent to decomposing the gradient direction of the pixel in the horizontal direction and the vertical direction, and then determining the main gradient direction of the pixel.

[0054] S32: Calculate the second possibility that the target pixel point belongs to the sizing area.

[0055] When only the current grayscale image is used as the benchmark for analysis, there may be some image background areas (such as machines) with texture change characteristics similar to those of the sizing area. The difference between the two is that the sizing area will have more drastic grayscale changes in multiple frames, but the image background area is often static and has fewer grayscale changes. If the grayscale value of the pixel points in the local area of ​​a target pixel point changes more drastically in multiple grayscale images, it can be said that the target pixel point is more likely to belong to the sizing area, so the target pixel point should be retained as much as possible during the filtering process, so the target pixel point should require a smaller filtering window to retain more information of the original image.

[0056] Therefore, this step analyzes the grayscale change characteristics of the local area of ​​each target pixel under multiple consecutive grayscale images, and optimizes the first possibility that the target pixel belongs to the sizing area to obtain the second possibility that the target pixel belongs to the sizing area.

[0057] First, obtain the coordinates of all pixels in the local area of ​​each target pixel in the current grayscale image, and then select Grayscale images, including the current grayscale image and its previous ones A grayscale image, is a preset value, which is set to 6 here. A local area corresponding to the target pixel in the current grayscale image is obtained in these multiple continuous grayscale images.

[0058] Calculate the sum of the grayscale differences of the local area of ​​the target pixel in multiple consecutive grayscale images, expressed as DIFF. For example, take the sum of the grayscale differences of 3 pixels in the local area of ​​the target pixel in two consecutive grayscale images (the current grayscale image and the previous grayscale image) as an example:

[0059] Assume that the grayscale values ​​of the three pixels in the local area of ​​the target pixel in the current grayscale image are 50 (the target pixel itself), 55, and 56; the grayscale values ​​of these three pixels in the previous grayscale image are 52, 53, and 54, respectively. Then the sum of the grayscale differences of these three pixels in two consecutive grayscale images is: |50-52|+|55-53|+|56-54|=6. Similarly, the sum of the grayscale differences of the local area of ​​the target pixel (all the pixels included) in multiple consecutive grayscale images is also obtained in the same way as in the example.

[0060] Next, the product of the sum of the grayscale differences of the local area of ​​the target pixel in a plurality of consecutive grayscale images and the first possibility that the target pixel belongs to the sizing area is used as the second possibility that the target pixel belongs to the sizing area, which is expressed by the formula:

[0061]

[0062] In the formula, is the second possibility that the target pixel belongs to the sizing area, is the first possibility that the target pixel belongs to the sizing area, is the sum of the grayscale differences of the local area of ​​the target pixel in multiple consecutive grayscale images, and As a whole, not the product of multiple characters.

[0063] To sum up, step S31-step S32 is to preliminarily determine the first possibility that the target pixel belongs to the sizing area by analyzing the consistency of gradient changes and the consistency of texture extension direction in the local area of ​​each target pixel in a single-frame image, and then combine the analysis of grayscale changes in multiple frame images to increase the accuracy of recognition, and obtain the second possibility that the target pixel belongs to the sizing area. This method is based on the basic principles of image processing and takes into account the changing factors that may be encountered in the actual sizing process. In this way, the pixels in the image that belong to the sizing area can be accurately identified, and these pixels constitute the sizing area and provide accurate reference information for subsequent image processing or quality assessment.

[0064] S4: Calculate the second requirement degree of each target pixel point for the filter window size according to the first requirement degree of each target pixel point for the filter window size and the possibility that the target pixel point belongs to the sizing area.

[0065]

[0066] In this formula, is the second requirement degree of the target pixel for the filter window size, is the first requirement of the target pixel for the filter window size, is the second possibility that the target pixel belongs to the sizing area, are the preset adjustment parameters. , used to adjust the value range of the second requirement degree of the target pixel point for the filtering window size to Within the range.

[0067] In the formula, It reflects the basic requirement of the filter window size required by the target pixel during the filtering process. The larger the value, the larger the filter window required by the target pixel during the filtering process. This is usually because the target pixel is more likely to be considered a noise point and a larger filter window is needed to remove the noise. It reflects the possibility that the target pixel belongs to the sizing area. The larger the value, the higher the possibility that the target pixel belongs to the sizing area. This type of pixel usually needs to retain more detailed information and needs to be retained as much as possible during the filtering process, so the target pixel should require a smaller filtering window.

[0068] The formula scientifically balances the demand for the filter window size by combining the first demand degree of the target pixel point for the filter window size and the second possibility that the target pixel point belongs to the sizing area. When the probability that the target pixel point belongs to the sizing area is high, even if the probability that it is considered to be a noise point is also high, its detail information needs to be retained as much as possible, so a smaller filter window is required, which can better retain the important detail information of the sizing area during the filtering process. When the second probability that the target pixel point belongs to the sizing area is large, even if the first demand degree of the target pixel point for the filter window size is large, a smaller filter window will eventually be set for it to retain more details. When the second probability that the target pixel point belongs to the sizing area is smaller, it means that the probability that the target pixel point belongs to the sizing area is low, so the target pixel point may be more like a general noise point or background area. In this case, even if the first demand degree of the target pixel point for the filter window size is small, since the second probability that the target pixel point belongs to the sizing area is small, the second demand degree of the target pixel point for the filter window size will be calculated to be large, thereby making the filter window larger to better remove noise.

[0069] This formula can effectively distinguish the sizing area from other areas, and adjust the filter window size according to the specific situation during the filtering process, so as to retain important details while removing noise and improve the overall filtering effect.

[0070] S5: Adaptively adjust the size of the filter window of the target pixel point using the second demand level, and perform adaptive filtering based on the adjusted filter window of all target pixels to enhance the image.

[0071] The second requirement degree of each target pixel for the filter window size is obtained In this step, the filter window size of each target pixel in the filtering process is adaptively adjusted according to the index. Since the shape of the filter window of each target pixel is a square, it is only necessary to adaptively adjust the side length of the filter window of each target pixel to achieve the adaptive adjustment of the filter window size of each target pixel.

[0072] According to the above logic, the adjusted filter window size of each target pixel is calculated:

[0073]

[0074] In the formula, Indicates the adjusted filter window size of the target pixel (the side length of the filter window), Indicates the second requirement of the target pixel for the filter window size. Indicates the preset filter window size, that is, the uniform filter window size preset for all target pixels. , this value is an empirical value, Indicates the floor symbol.

[0075] Since the size of the filter window is generally set to an odd number, when When the calculated result is an odd number, no adjustment is made. When the result of is an even number, Need to increase by 1, The value incremented by 1 is used as the adaptive filter size of the target pixel.

[0076] The above steps are intended to optimize the non-local mean filtering algorithm by calculating the adaptive filtering size of each target pixel point, and finally use the non-local mean filtering algorithm to filter based on the adaptive filtering size of all target pixels, and filter the grayscale image of the collected sizing image to obtain a grayscale image with better enhancement effect, thereby improving the overall quality of the image, and the accuracy of sizing quality detection based on the enhanced image is higher.

[0077] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.

[0078] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

Claims

1. An image enhancement method for sizing state detection, characterized in that: include: Obtaining grayscale images of multiple frames of sizing images, taking any pixel point in the current grayscale image as a target pixel point, and determining a first requirement degree of the target pixel point for the size of the filtering window according to the possibility that the target pixel point is noise, wherein the first requirement degree is positively correlated with the possibility; Calculate the first probability that the target pixel belongs to the sizing area , is the standard deviation of the gradient amplitude of all pixels in the local area of ​​the target pixel, is the variance of the absolute value of the sine value of the angle between the gradient direction and the horizontal direction of all pixels with gradient changes in the local area, It is the sum of the number of pixels with the same gradient amplitude on the extension line of the main gradient direction of all pixels with gradient changes. is the natural exponential function; The product of the sum of grayscale differences of the local area of ​​the target pixel in a plurality of continuous grayscale images and the first possibility is taken as the second possibility that the target pixel belongs to the sizing area, and the second requirement degree of the target pixel for the filter window size is calculated. , For the first level of demand, For the second possibility, are preset adjustment parameters; The size of the filter window of the target pixel is adaptively adjusted using the second demand level, and the current grayscale image is adaptively filtered based on the adjusted filter window of all target pixels to enhance the image.

2. The image enhancement method for sizing state detection according to claim 1, characterized in that: The first level of demand , is the possibility that the target pixel is noise, is the number of all pixels in the current grayscale image that have the same grayscale value as the target pixel.

3. The image enhancement method for sizing state detection according to claim 1, characterized in that: The method for adaptively adjusting the size of the filtering window of the target pixel point by using the second demand level is: A value obtained by rounding down the product of the second demand level and a preset filter window size is used as the size of the adjusted filter window of the target pixel.

4. The image enhancement method for sizing state detection according to claim 1, characterized in that: The method for determining all pixel points with gradient changes in the local area is as follows: in the local area, if the grayscale value of a pixel point is completely consistent with the grayscale values ​​of its four neighboring pixel points, the pixel point is a pixel point with no gradient change; if there is a pixel point in the four neighborhoods whose grayscale value is inconsistent with the grayscale value of the pixel point, the pixel point is a pixel point with gradient change; the four neighborhood pixel points include two neighboring pixel points in the vertical direction and two neighboring pixel points in the horizontal direction.

5. The image enhancement method for sizing state detection according to claim 2, characterized in that: The method for obtaining the possibility that the target pixel is noise is: taking the sum of the grayscale differences between the target pixel and its eight neighboring pixels as the possibility that the target pixel is noise.

6. The image enhancement method for sizing state detection according to claim 3, characterized in that: The adaptive filtering adopts a non-local mean filtering algorithm.

7. The image enhancement method for sizing state detection according to claim 3, characterized in that: If the product of the second demand level and the preset filter window size is rounded down to an even number, the value of the even number incremented by 1 is used as the size of the adjusted filter window of the target pixel.

8. The image enhancement method for sizing state detection according to claim 4, characterized in that: The local area of ​​the target pixel is centered on the target pixel and includes the target pixel and its surroundings. A rectangular area of ​​pixels, The preset quantity.

9. The image enhancement method for sizing state detection according to claim 4, characterized in that: The method for obtaining the main gradient direction of the pixel point with gradient change is: Calculate the horizontal gradient amplitude of the pixel and the vertical gradient magnitude , and and The gradient direction corresponding to the maximum value in is taken as the main gradient direction of the pixel.