Image processing method, device and equipment
By identifying and correcting noise points in the image without affecting normal pixel points, the problem of image detail damage during the denoising process in the prior art is solved, and the clarity and quality of the image are improved. It is suitable for the application of CMOS static detectors need.
Patent Information
- Application Number
- CN202011427594.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-07
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2040-12-07
AI Technical Summary
The existing image processing technology will correct normal pixel points during the denoising process, resulting in partial damage to image details, affecting imaging quality and visual effects.
By identifying noise points in the image and correcting them without correcting normal pixel points, the gray value of the pixel points is determined using preset fitting curves and difference comparisons, and the details of the image are preserved.
It effectively reduces the degree of image blurring, improves image quality, and meets the high requirements of CMOS static detectors for image details and clarity in medical or industrial non-destructive testing.
Smart Images

Figure CN114596212B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, device and equipment. Background Art
[0002] Since its introduction, CMOS (Complementary Metal-Oxide Semiconductor) static flat panel detectors have attracted widespread attention due to their advantages such as low cost, low power consumption, high resolution, and low dose to obtain clear images. However, due to its highly integrated environment and manufacturing process, random noise is inevitably introduced during the image acquisition process. For example, the difference between the grayscale value of these noises and the grayscale value of normal pixels changes with the change of grayscale, and the position of the noise is relatively random (non-fixed position), resulting in irregular bright spots in the image, which affects the image quality and image visual effects to a certain extent.
[0003] In order to remove the noise in the image, the current image processing technology is mainly based on global noise reduction to correct the image. For example, the current noise reduction methods mainly include mean filtering, median filtering, Gaussian filtering, etc. In the existing image processing process, it is inevitable to perform the same correction processing on normal pixels as noise points, that is, all pixels are corrected, resulting in changes in the grayscale values of normal pixels, which is easy to destroy the details of the image and affect the imaging quality.
[0004] Mean filtering is a typical linear filtering algorithm, which mainly uses the mean pixel value of the target pixel and its surrounding pixels to replace the pixel value of the target pixel. Mean filtering is also called linear filtering, and its main method is the neighborhood average method. The basic principle of linear filtering is to replace each pixel value in the original image with the mean pixel value, that is, to select a template for the target pixel (x, y) to be processed, the template consists of the target pixel and several neighboring pixels, calculate the mean pixel value of all pixels in the template, and then assign the mean value to the target pixel (x, y) as the gray value g(x, y) of the processed image at the target pixel, that is, g(x, y) = 1 / m∑f(x, y), m is the total number of pixels in the template including the target pixel to be processed. Mean filtering can effectively filter out additive noise in the image, but mean filtering itself has inherent defects, that is, it cannot protect the image details well, and destroys the details of the image while denoising the image, thus making the image blurred.
[0005] Median filtering is a nonlinear digital filter technology, and it is also one of the most common means of eliminating image noise, especially for eliminating salt and pepper noise (impulse noise). The effect of median filtering is better than that of mean filtering. The only difference between median filtering and mean filtering is that median filtering does not replace the pixel value of the target pixel with the mean, but sorts the target pixel and its surrounding pixels and then takes the median to replace the pixel value of the target pixel. Although the median filtering denoising method retains the details of the image to a certain extent, all pixels in the image are denoised, and the visual effect is flat, which affects the image quality.
[0006] Gaussian filter is essentially a signal filter, which is used for signal smoothing and is widely used in the noise reduction process of image processing. In layman's terms, Gaussian filtering is the process of weighted averaging the pixels of the entire image, that is, the pixel value of each pixel is obtained by weighted averaging the pixel values of itself and other pixels in the neighborhood. The specific method of Gaussian filtering is: use a template (or convolution, mask) to scan each pixel in the image, and use the weighted average grayscale value of the target pixel (i.e. the center pixel) and the pixels in its neighborhood determined by the template to replace the value of the target pixel. The template coefficient of the Gaussian filter is different from the template coefficient of the mean filter. The template coefficient of the mean filter is the same as 1, while the template coefficient of the Gaussian filter decreases as the distance from the center of the template increases. Therefore, compared with the mean filter, the image processed by the Gaussian filter is less blurred. However, the Gaussian filter essentially corrects all the pixels in the image, which will still destroy the details of the image and affect the image quality. Summary of the invention
[0007] The present application provides an image processing method, apparatus and device, which can identify noise points (such as random noise points) in an image and correct the identified noise points without correcting normal pixels in the image, thereby retaining the image details, which is beneficial to reducing the image blur and improving the image quality.
[0008] In a first aspect, the present application provides an image processing method, comprising:
[0009] Obtaining a first grayscale value of each pixel in the first image and an average of the first grayscale values of all pixels;
[0010] Inputting the first gray value mean into a preset fitting curve to obtain a first threshold value;
[0011] Respectively obtaining first differences between a first grayscale value of each pixel point in the first image and grayscale values of a preset number of pixels around it;
[0012] Comparing each of the first difference values with the first threshold value respectively, and determining a second grayscale value of each of the pixel points based on the comparison result;
[0013] Based on the second grayscale value of each pixel, a second image is output.
[0014] In one possible implementation manner, comparing each of the first difference values with the first threshold value respectively, and determining the second grayscale value of each of the pixel points based on the comparison result, includes:
[0015] respectively determining whether each of the first differences is greater than the first threshold;
[0016] If any one of the first difference values is less than the first threshold, obtaining a second grayscale value of the pixel based on the first grayscale value, wherein the second grayscale value is equal to the first grayscale value;
[0017] If each of the first difference values is greater than the first threshold, a second grayscale value of the pixel is obtained based on the grayscale values of a preset number of pixels around the pixel.
[0018] In one possible implementation, if any one of the first difference values is greater than the first threshold, the second grayscale value of the pixel is equal to the mean or median of the grayscale values of a preset number of pixels around it, or the second grayscale value of the second pixel is equal to the weighted sum of the grayscale values of a preset number of pixels around it.
[0019] In one possible implementation manner, outputting a second image based on the second grayscale value of each pixel includes:
[0020] Obtaining a grayscale value mean, standard deviation or variance based on the second grayscale value of each pixel;
[0021] Determine whether the gray value mean, standard deviation or variance is higher than a preset value;
[0022] If the gray value mean, standard deviation or variance is higher than the preset value;
[0023] Obtaining a second threshold, where the second threshold is determined by a difference between the first threshold and a preset value or a preset ratio;
[0024] Determine a third grayscale value of each pixel based on the second grayscale value of each pixel and the second threshold;
[0025] Based on the third grayscale value of each pixel, a second image is output.
[0026] In one possible implementation manner, outputting a second image based on the second grayscale value of each pixel includes:
[0027] S1, obtain the N+1th threshold;
[0028] S2, determining the N+2th grayscale value of each of the pixel points based on the N+1th grayscale value of each of the pixel points and the N+1th threshold;
[0029] S3, accumulating the number of cycles, if the number of cycles is less than the preset number, then executing steps S1-S3 in a loop;
[0030] S4: output a second image based on the N+2th grayscale value of each pixel.
[0031] In one possible implementation, obtaining the N+1th threshold includes:
[0032] Obtaining the N+1th grayscale value average of all the pixels;
[0033] The N+1th gray value mean is input into the fitting curve to obtain the N+1th threshold value.
[0034] In one possible implementation, before inputting the first gray value mean into a preset fitting curve to obtain a first threshold, the method further includes:
[0035] Acquire multiple images with different grayscales;
[0036] Respectively obtain the grayscale value mean and standard deviation or variance of the pixel points in the multiple different grayscale images;
[0037] A curve fitting is performed on the mean and standard deviation of the grayscale values of the pixels in the multiple different grayscale images to obtain a fitting curve.
[0038] In a second aspect, the present application provides an image processing device, comprising:
[0039] A grayscale acquisition module, used to obtain a first grayscale value of each pixel in the first image and an average of the first grayscale values of all pixels;
[0040] A threshold value obtaining module, used for inputting the first gray value mean into a preset fitting curve to obtain a first threshold value;
[0041] A difference calculation module, used to respectively obtain a first difference between a first grayscale value of each pixel point in the first image and grayscale values of a preset number of pixels around it;
[0042] A comparison module, used for comparing each of the first difference values with the first threshold value, and determining a second grayscale value of each of the pixel points based on the comparison result;
[0043] An output module is used to output a second image based on the second grayscale value of each pixel.
[0044] In one possible implementation, the comparison module includes:
[0045] respectively determining whether the first difference is greater than the first threshold;
[0046] If any one of the first difference values is less than the first threshold, obtaining a second grayscale value of the pixel based on the first grayscale value, wherein the second grayscale value is equal to the first grayscale value;
[0047] If the first difference values are all greater than the first threshold, a second grayscale value of the pixel is obtained based on the grayscale values of a preset number of pixels around the pixel.
[0048] In one possible implementation, if any one of the first difference values is greater than the first threshold, the second grayscale value of the pixel is equal to the mean or median of the grayscale values of a preset number of pixels around it, or the second grayscale value of the second pixel is equal to the weighted sum of the grayscale values of a preset number of pixels around it.
[0049] In one possible implementation, the output module includes:
[0050] Obtaining a grayscale value mean, standard deviation or variance based on the second grayscale value of each pixel;
[0051] Determine whether the gray value mean, standard deviation or variance is higher than a preset value;
[0052] If the gray value mean, standard deviation or variance is higher than the preset value;
[0053] Obtaining a second threshold, where the second threshold is determined by a difference between the first threshold and a preset value or a preset ratio;
[0054] Determine a third grayscale value of each pixel based on the second grayscale value of each pixel and the second threshold;
[0055] Based on the third grayscale value of each pixel, a second image is output.
[0056] In one possible implementation, the output module includes:
[0057] Get the N+1th threshold;
[0058] Determine the N+2th grayscale value of each of the pixel points based on the N+1th grayscale value of each of the pixel points and the N+1th threshold;
[0059] Accumulate the number of cycles, and if the number of cycles is less than the preset number, execute steps S1-S3 repeatedly;
[0060] Based on the N+2th grayscale value of each pixel point, a second image is output.
[0061] In one possible implementation, the device further includes:
[0062] A mean value calculation module, used to obtain the mean value of the N+1th grayscale value of all the pixels;
[0063] The threshold determination module is used to input the N+1th gray value mean into the fitting curve to obtain the N+1th threshold.
[0064] In one possible implementation, the device further includes:
[0065] An image acquisition module, used for acquiring multiple images with different grayscales;
[0066] A grayscale calculation module, used to respectively obtain the grayscale value mean and standard deviation or variance of the pixel points in the plurality of different grayscale images;
[0067] The fitting module is used to perform curve fitting on the mean and standard deviation or variance of the grayscale values of the pixels in the multiple different grayscale images to obtain a fitting curve.
[0068] In a third aspect, the present application provides an electronic device, including:
[0069] One or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the apparatus, cause the device to perform the steps of:
[0070] Obtaining a first grayscale value of each pixel in the first image and an average of the first grayscale values of all pixels;
[0071] Inputting the first gray value mean into a preset fitting curve to obtain a first threshold value;
[0072] Respectively obtaining first differences between a first grayscale value of each pixel point in the first image and grayscale values of a preset number of pixels around it;
[0073] Comparing each of the first difference values with the first threshold value respectively, and determining a second grayscale value of each of the pixel points based on the comparison result;
[0074] Based on the second grayscale value of each pixel, a second image is output.
[0075] In one possible implementation manner, when the instruction is executed by the device, the device performs the step of comparing each of the first difference values with the first threshold value respectively, and determining the second grayscale value of each of the pixel points based on the comparison result, including:
[0076] respectively determining whether each of the first differences is greater than the first threshold;
[0077] If any one of the first difference values is less than the first threshold, obtaining a second grayscale value of the pixel based on the first grayscale value, wherein the second grayscale value is equal to the first grayscale value;
[0078] If each of the first difference values is greater than the first threshold, a second grayscale value of the pixel is obtained based on the grayscale values of a preset number of pixels around the pixel.
[0079] In one possible implementation, if any one of the first difference values is greater than the first threshold, the second grayscale value of the pixel is equal to the mean or median of the grayscale values of a preset number of pixels around it, or the second grayscale value of the second pixel is equal to the weighted sum of the grayscale values of a preset number of pixels around it.
[0080] In one possible implementation manner, when the instruction is executed by the device, the device performs the step of outputting the second image based on the second grayscale value of each pixel, including:
[0081] Obtaining a grayscale value mean, standard deviation or variance based on the second grayscale value of each pixel;
[0082] Determine whether the gray value mean, standard deviation or variance is higher than a preset value;
[0083] If the gray value mean, standard deviation or variance is higher than the preset value;
[0084] Obtaining a second threshold, where the second threshold is determined by a difference between the first threshold and a preset value or a preset ratio;
[0085] Determine a third grayscale value of each pixel based on the second grayscale value of each pixel and the second threshold;
[0086] Based on the third grayscale value of each pixel, a second image is output.
[0087] In one possible implementation manner, when the instruction is executed by the device, the device performs the step of outputting the second image based on the second grayscale value of each pixel, including:
[0088] S1, obtain the N+1th threshold;
[0089] S2, determining the N+2th grayscale value of each of the pixel points based on the N+1th grayscale value of each of the pixel points and the N+1th threshold;
[0090] S3, accumulating the number of cycles, if the number of cycles is less than the preset number, then executing steps S1-S3 in a loop;
[0091] S4: output a second image based on the N+2th grayscale value of each pixel.
[0092] In one possible implementation manner, when the instruction is executed by the apparatus, the device is caused to perform the step of obtaining the N+1th threshold, including:
[0093] Obtaining the N+1th grayscale value average of all the pixels;
[0094] The N+1th gray value mean is input into the fitting curve to obtain the N+1th threshold value.
[0095] In one possible implementation manner, when the instruction is executed by the device, before the device executes the step of inputting the first gray value mean into a preset fitting curve to obtain a first threshold, the device further executes the step of:
[0096] Acquire multiple images with different grayscales;
[0097] Respectively obtain the grayscale value mean and standard deviation or variance of the pixel points in the multiple different grayscale images;
[0098] A curve fitting is performed on the mean and standard deviation of the grayscale values of the pixels in the multiple different grayscale images to obtain a fitting curve.
[0099] In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the method described in the first aspect.
[0100] In a fifth aspect, the present application provides a computer program, which, when executed by a computer, is used to execute the method described in the first aspect.
[0101] In one possible design, the program in the fifth aspect may be stored in whole or in part on a storage medium packaged together with the processor, or may be stored in whole or in part on a memory not packaged together with the processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0102] Figure 1 A schematic diagram of an embodiment of the image processing method of the present application;
[0103] Figure 2 A schematic diagram of a method for obtaining a fitting curve in an image processing method of the present application;
[0104] Figure 3A A schematic diagram of a flow chart of an embodiment of the image processing method of the present application;
[0105] Figure 3B A flowchart of another embodiment of the image processing method of the present application;
[0106] Figure 4A A comparison diagram of the original image of the line pair card (left image) and the output image of an embodiment of the image processing method of the present application (right image);
[0107] Figure 4B It is a partial enlarged comparison diagram of the original image of the line pair card (left image) and the output image of an embodiment of the image processing method of the present application (right image);
[0108] Figure 4C This is a comparison diagram of an image before processing (left picture) and an image after processing (right picture) according to an embodiment of the image processing method of the present application;
[0109] Figure 4D This is a comparison diagram of a local image of the interior of a 1 mm tungsten sheet before processing (left image) and a local image after processing (right image) in one embodiment of the image processing method of the present application;
[0110] Figure 5 This is a schematic diagram of the structure of an embodiment of the image processing device of the present application;
[0111] Figure 6 This is a structural schematic diagram of another embodiment of the image processing device of the present application;
[0112] Figure 7 This is a schematic diagram of the structure of an embodiment of the electronic device of the present application. DETAILED DESCRIPTION
[0113] The terms used in the implementation section of this application are only used to explain the specific embodiments of this application and are not intended to limit this application.
[0114] In existing image acquisition technologies (such as CMOS static flat-panel detectors), random noise is inevitably introduced during the image acquisition process due to its highly integrated environment and manufacturing process. For example, the difference between the grayscale value of these noises and the grayscale value of normal pixels changes with the change of grayscale, and the position of the noise is relatively random (non-fixed position), resulting in irregular bright spots in the image, which affects the imaging quality and image visual effect to a certain extent.
[0115] In order to remove the noise in the image, the current image processing technology is mainly based on global noise reduction to correct the image. For example, the current noise reduction methods mainly include mean filtering, median filtering, Gaussian filtering, etc. In the existing image processing process, it is inevitable to perform the same correction processing on normal pixels as on noise points, that is, all pixels are corrected, resulting in changes in the grayscale values of normal pixels, which is easy to destroy the details of the image and affect the imaging quality.
[0116] To this end, the present application proposes an image processing method, device and equipment that can identify noise points (such as random noise points) in an image and correct the identified noise points without correcting normal pixels in the image, thereby retaining the image details, which is beneficial to reducing the degree of image blur and improving image quality.
[0117] It should be pointed out that since CMOS static detectors based on X-ray irradiation are mainly used in medical (such as dentistry, etc.), industrial non-destructive testing and other fields, they have high requirements for image details and clarity when used. Due to the particularity of its product characteristics, manufacturing process, etc., random noise is prone to appear in the captured images. The grayscale value of this type of noise is brighter than the grayscale value of the normal area, and it also responds to X-rays. The time or position of the appearance of random noise is irregular and not fixed. The size of the noise varies to a certain extent with the change of the shooting dose (such as voltage or current, etc.). The existing image processing technology (such as mean filtering, median filtering, Gaussian filtering, etc.) cannot correct random noise, which is easy to destroy the details of the image, resulting in a high degree of image blur and low clarity. Therefore, it cannot meet the high requirements for image details and clarity when CMOS static detectors are used in medical or industrial non-destructive testing and other fields.
[0118] The image processing method of the present application can effectively identify noise points in the image (which may include fixed noise points or random noise points), and correct the identified noise points without correcting normal pixels, thereby retaining the image details and improving the image clarity. This is conducive to meeting the high requirements for image details and clarity when CMOS static detectors are used in fields such as medical or industrial non-destructive testing.
[0119] Figure 1 A schematic diagram of an embodiment of the image processing method of the present application is shown in FIG. Figure 1 As shown, the above image processing method may include:
[0120] S101. Obtain a first grayscale value of each pixel in a first image and an average of the first grayscale values of all pixels.
[0121] The first image may include an image to be processed acquired by a CMOS static detector or other image acquisition device. Alternatively, the first image may be acquired in a network or cloud through communication technology. Alternatively, the first image may be stored in a readable storage medium, and the first image may be acquired by reading the storage medium.
[0122] Preferably, the first image is a still image. Before step S101, the first image may be pre-processed by background correction, gain correction or bad pixel correction, etc., which is not limited here.
[0123] In step S101, the pixels in the first image may include normal pixels and noise points (such as abnormal pixels, random noise points, fixed noise points, etc.). Generally, the grayscale value of the noise points in the image is greater than the grayscale value of the normal pixels. The first grayscale value mean can be obtained by dividing the sum of the first grayscale values of all pixels in the first image by the number of all pixels.
[0124] S102: Input the first gray value mean into a preset fitting curve to obtain a first threshold value.
[0125] The fitting curve may include a mapping relationship between a grayscale value mean and a threshold. Different grayscale value means may correspond to different or the same thresholds. The fitting curve may be stored in an image processing device, an electronic device (such as a device with an image processing function), a readable storage medium, or a cloud.
[0126] In one possible implementation, Figure 2 As shown, before step S102, the method further includes:
[0127] S201, obtaining a plurality of images with different grayscales;
[0128] S202, respectively obtaining the grayscale value means and standard deviations or variances of the pixels in the plurality of different grayscale images;
[0129] S203 , performing curve fitting on the mean and standard deviation or variance of the grayscale values of the pixels in the multiple different grayscale images to obtain a fitting curve.
[0130] In step S201, a plurality of images at different doses (different voltages or currents) may be acquired by a CMOS static detector.
[0131] In step S203, the grayscale value means of the multiple images and the corresponding grayscale value standard deviations can be used to perform curve fitting to obtain the fitting curve. Alternatively, the grayscale value means of the multiple images and the corresponding grayscale value variances can be used to perform curve fitting to obtain the fitting curve. For example, in step S203, a preset curve equation can be used to perform curve fitting, and the preset curve equation can include a linear curve equation, a quadratic curve equation, a multi-curve equation, an inverse proportional curve equation, etc., which is not limited here.
[0132] S103, respectively obtaining a first difference between a first grayscale value of each pixel in the first image and grayscale values of a preset number of surrounding pixels.
[0133] It can be understood that the surrounding pixels of a certain pixel point (such as a target pixel point) may include the pixels within the neighborhood of the target pixel point, for example, the adjacent pixels above, below, left, right (or upper left, lower right, lower right, etc.) of the target pixel point.
[0134] Preferably, the preset number is 8, that is, the surrounding pixels of the target pixel are the adjacent pixels above, below, left, right, upper left, lower right, upper right, and lower right of the target pixel, that is, the target pixel and the 8 surrounding pixels can together form a 9-square grid centered on the target pixel. It should be noted that when the target pixel is at the edge or vertex of the image, the number of surrounding pixels can be less than 8, and there is no limitation here.
[0135] Accordingly, there may be 8 first differences between the grayscale value (first grayscale value) of each pixel point that is not at the edge or vertex of the image and the grayscale values of the 8 surrounding pixels. There may be less than 8 first differences between the grayscale values of each pixel point at the edge or vertex of the image and the surrounding pixels (less than 8).
[0136] Optionally, the preset number is 24, and the target pixel and its surrounding 24 pixels can form a 25-square grid centered on the target pixel. Accordingly, there can be at most 24 grayscale value differences between each pixel and its surrounding pixels (at most 24) (i.e., there are at most 24 first differences).
[0137] Those skilled in the art should understand that the preset number can be preset according to actual conditions and is not limited here.
[0138] S104: Compare each of the first difference values with the first threshold value respectively, and determine a second grayscale value of each of the pixel points based on the comparison result.
[0139] like Figure 3AAs shown, preferably, for a certain pixel point (target pixel) in the image, there are 8 first difference values, then in step S104, the 8 first difference values are all compared with the first threshold value, and 8 comparison values (i.e., the comparison result) can be obtained, and the comparison result can be used to identify whether the target pixel point is a noise point. For example, if the 8 first difference values are all greater than the first threshold value, the target pixel point is a noise point, and if any one of the 8 first difference values is less than the first threshold value, the target pixel point is not a noise point, or the target pixel point is a normal pixel point. Optionally, if a certain pixel point in the image has 24 first difference values, the 24 first difference values are all compared with the first threshold value to obtain 24 comparison values, i.e., the comparison result.
[0140] In step S104, it is possible to identify whether the pixel is a noise point by comparing the results, and to correct the identified noise point, thereby determining the second grayscale value of the pixel. It should be noted that if the pixel is identified as a noise point, the grayscale value of the pixel can be corrected so that the first grayscale value of the pixel is changed to the second grayscale value, and the second grayscale value is not equal to the first grayscale value. If the pixel is identified as not a noise point, the grayscale value of the pixel can be kept unchanged, that is, the second grayscale value can be equal to the first grayscale value, thereby avoiding changes in the grayscale values of normal pixels in the image, thereby retaining the image details and helping to improve image clarity.
[0141] Further, in step S104, all the pixels in the image can be traversed to obtain the comparison result corresponding to each pixel, and each pixel in the image can be identified as a noise point. If a certain pixel is a noise point, the grayscale value of the noise point is corrected (such as changing the first grayscale value of the noise point to the second grayscale value). If a certain pixel is not a noise point (that is, the pixel is a normal pixel), the grayscale value of the normal pixel is kept unchanged (that is, the second grayscale value of the normal pixel is equal to the first grayscale value). Therefore, the method described in this embodiment can effectively identify noise points such as fixed noise points, random noise points or abnormal pixels in the image, and correct the identified noise points without affecting the grayscale value of the normal pixels, thereby retaining the image details and helping to improve the image clarity.
[0142] S105: Output a second image based on the second grayscale value of each pixel.
[0143] That is, the first grayscale value of each pixel in the first image can be replaced by the second grayscale value to obtain the second image. The grayscale value of the normal pixel in the second image remains unchanged (i.e., the second grayscale value is equal to the first grayscale value), while the grayscale value of the noise point in the second image changes (i.e., the second grayscale value is not equal to the first grayscale value).
[0144] It can be seen that in the image processing method of the present application, the noise points in the image (which may include fixed noise points or random noise points) can be effectively identified, and the identified noise points can be corrected without correcting the normal pixels, thereby retaining the image details, making the image less likely to blur, and improving the image clarity, which is conducive to meeting the high requirements for image details and clarity when CMOS static detectors are used in fields such as medical or industrial non-destructive testing.
[0145] like Figure 4A A comparison diagram of the original image of the line pair card (left image) and the output image of an embodiment of the image processing method of the present application (right image); Figure 4B It is a partial enlarged comparison diagram of the original image of the line pair card (left image) and the output image of an embodiment of the image processing method of the present application (right image); Figure 4C This is a comparison diagram of an image before processing (left picture) and an image after processing (right picture) according to an embodiment of the image processing method of the present application; Figure 4D This is a comparison diagram of a local image of the inside of a 1mm tungsten sheet before processing (left image) and a local image after processing (right image) according to an embodiment of the image processing method of the present application. From the above comparison diagram, it can be seen that the noise points (such as random noise points) in the image output after processing by the image processing method of the present application are significantly reduced, and the image quality is improved.
[0146] In one possible implementation, step S103 includes:
[0147] S301, respectively determining whether the first difference is greater than the first threshold;
[0148] S302: If any one of the first difference values is less than the first threshold, obtaining a second grayscale value of the pixel based on the first grayscale value, wherein the second grayscale value is equal to the first grayscale value;
[0149] S303: If the first difference values are all greater than the first threshold value, obtaining a second grayscale value of the pixel point based on the grayscale values of a preset number of pixel points around the pixel point.
[0150] For example, there are 8 first differences between a certain pixel point (target pixel point) and its surrounding 8 pixel points in the image. In step S301, it is determined whether the 8 first differences are greater than the first threshold value. In step S302, if one of the first differences is less than the first threshold value, the target pixel point is determined to be a normal pixel point, and the grayscale value of the target pixel point is kept unchanged, that is, the second grayscale value is equal to the first grayscale value. In step S303, if the 8 first differences are all greater than the first threshold value, the target pixel point is determined to be a noise point, and the second grayscale value of the target pixel point is obtained based on the grayscale values of the 8 pixel points around the target pixel point, that is, the first grayscale value of the target pixel point is replaced by the second grayscale value.
[0151] In one possible implementation, in step S303, the second grayscale value of the pixel is equal to the mean or median of the grayscale values of a preset number of pixels around it, or the second grayscale value of the second pixel is equal to the weighted sum of the grayscale values of a preset number of pixels around it and a preset weight.
[0152] Specifically, in step S303, the grayscale value mean of the eight pixels around the target pixel is calculated, and the second grayscale value is determined to be the grayscale value mean. Alternatively, the grayscale values of the eight pixels around the target pixel are arranged in order of size, and the middle grayscale value (such as the fourth grayscale value or the fifth grayscale value) is taken as the second grayscale value. Alternatively, the grayscale values of the eight pixels around the target pixel are weighted and summed with preset weights, and the weighted sum result is taken as the second grayscale value. The preset weights can be preset according to the actual application scenario or the number of pixels around the target pixel, and are not limited here.
[0153] In one possible implementation, step S105 includes:
[0154] S401, obtaining a gray value mean, standard deviation or variance based on the second gray value of each pixel;
[0155] S402, determining whether the gray value mean, standard deviation or variance is higher than a preset value;
[0156] S403, if the gray value mean, standard deviation or variance is higher than the preset value;
[0157] S404: Obtain a second threshold, where the second threshold is determined by a difference or a ratio between the first threshold and a preset value;
[0158] S405, determining a third grayscale value of each pixel based on the second grayscale value of each pixel and the second threshold;
[0159] S406: Output a second image based on the third grayscale value of each pixel.
[0160] In one possible implementation, step S105 includes:
[0161] S1, obtain the N+1th threshold;
[0162] S2, determining the N+2th grayscale value of each of the pixel points based on the N+1th grayscale value of each of the pixel points and the N+1th threshold;
[0163] S3, accumulating the number of cycles, if the number of cycles is less than the preset number, then executing steps S1-S3 in a loop;
[0164] S4: output a second image based on the N+2th grayscale value of each pixel.
[0165] For example, the above cycle process may include:
[0166] a(i,j)-a(i-1,j-1)>k)&&(a(i,j)-a(i,j-1)>k)&&(a(i,j)-a(i+1,j-1)>k)&&(a(i,j)-a(i-1,j)>k)& &(a(i,j)-a(i+1,j)>k)&&(a(i,j)-a(i-1,j+1)>k)&&(a(i,j)-a(i,j+1)>k)&&(a(i,j)-a(i+1,j+1)>k;
[0167] b(i,j)=a(i,j);
[0168] b(i,j)=(a(i-1,j-1)+a(i,j-1)+a(i+1,j-1)+a(i-1,j)+a(i+1,j)+a(i-1,j+1)+a(i,j+1)+a(i+1,j+1)) / 8;
[0169] Among them, a(i,j), a(i-1,j-1), a(i,j-1), a(i+1,j-1), a(i-1,j), a(i+1,j), a(i-1,j+1), a(i,j+1), a(i+1,j+1) represent the grayscale values of the two-dimensional image at (i,j), (i-1,j-1), (i,j-1), (i+1,j-1), (i-1,j), (i+1,j), (i-1,j+1), (i,j+1) and (i+1,j+1) respectively, && represents the AND operator, k represents the threshold, and b(i,j) represents the grayscale value of the denoised image at (i,j).
[0170] For example, Figure 3BAs shown, the second image may include a first denoised image, ... and an Nth denoised image, where N is 1.2.3.4..., and step S105 includes:
[0171] S501, determining a first denoised image based on the second grayscale value, wherein N=1;
[0172] S502, determining whether a preset condition is met;
[0173] S503, if the preset condition is not met, set N=N+1;
[0174] S504, obtaining an Nth threshold;
[0175] S505, respectively obtaining the Nth difference between the Nth grayscale value of each pixel in the N-1th denoised image and the grayscale values of a preset number of pixels around it;
[0176] S506, respectively comparing the Nth difference value with the Nth threshold value, and determining the N+1th grayscale value of the pixel point based on the comparison result;
[0177] S507, based on the N+1th grayscale value, determine the Nth denoised image, and return to step S502 to determine whether the preset condition is met, that is, repeatedly execute steps S502 to S507;
[0178] S508: If the preset conditions are met, output the Nth denoised image.
[0179] Specifically, the function or principle of step S505 is substantially the same as that of the above-mentioned step S103, and the function or principle of step S506 is substantially the same as that of the above-mentioned step S104, which will not be described in detail here.
[0180] In one possible implementation, the preset condition may include that N is greater than or equal to a preset value. That is, when N is greater than or equal to the preset value, step S508 is executed to output the Nth denoised image, and if N is less than the preset value, steps S503 to S507 are executed until N is greater than or equal to the preset value, and the Nth denoised image is output.
[0181] Preferably, the preset value is greater than or equal to 5. For example, when the preset value is 5, the second image includes a first denoised image, a second denoised image, a third denoised image, a fourth denoised image and a fifth denoised image, and in step S408, the fifth denoised image is output. When the preset value is 10, the second image includes a first denoised image, a second denoised image, ... and a tenth denoised image, and in step S508, the tenth denoised image is output.
[0182] It can be understood that as the preset value changes, the number of times steps S502 to S507 are repeated also changes accordingly. In this process, multiple denoised images can be obtained in sequence, and finally the last denoised image is output.
[0183] For example, when the preset value is 2, the second image includes a first denoised image and a second denoised image, and step S105 includes:
[0184] S501, determining a first denoised image based on the second grayscale value, N=1;
[0185] S502, determine whether N is less than 2;
[0186] S503, N is less than 2, so N=2;
[0187] S504, obtaining a second threshold;
[0188] S505, respectively obtaining a second difference between the second grayscale value of each pixel in the first denoised image and the grayscale values of a preset number of pixels around it;
[0189] S506, comparing the second difference with the second threshold respectively, and determining a third grayscale value of the pixel point based on the comparison result;
[0190] S507, determining a second denoised image based on the third grayscale value, and returning to the step of determining whether N is greater than or equal to 2;
[0191] S508: N is equal to 2, and a second denoised image is output.
[0192] It can be seen that the grayscale value of each pixel in the second denoised image is the third grayscale value.
[0193] In one possible implementation, the preset condition may also include: the gray value mean, standard deviation or variance of all pixels in the Nth denoised image is lower than a preset mean, preset standard deviation or preset variance, etc. If it is lower, step S508 is executed to output the Nth denoised image; if it is not lower, steps S503 to S507 are executed. It should be understood by those skilled in the art that the preset condition can be preset according to the actual application scenario and is not limited here.
[0194] More preferably, the Nth threshold is smaller than the N-1th threshold (eg, the second threshold is smaller than the first threshold), that is, the first threshold, the second threshold, the third threshold ... the Nth threshold decreases sequentially to improve image quality.
[0195] In one possible implementation, step S1 includes:
[0196] S11, obtaining the N+1th grayscale value average of all the pixels;
[0197] S12. Input the N+1th grayscale value mean into the fitting curve to obtain the N+1th threshold value.
[0198] For example, in step S11, a second grayscale value mean of each pixel in the first denoised image is obtained, and in step S12, the second grayscale value mean is input into the fitting curve to obtain a second threshold.
[0199] In one possible implementation, in step S1, the Nth threshold is equal to the N-1th threshold minus a preset value, or the Nth threshold is equal to the N-1th threshold multiplied by a preset ratio.
[0200] That is to say, assuming that the preset value is d and the first threshold is X, then the Nth threshold is equal to X-(N-1) x d. For example, if the first threshold is 10 and the preset value is 1, then the second threshold is 9, the third threshold is 8, the fourth threshold is 7, and so on.
[0201] Optionally, assuming that the preset ratio is q and the first threshold is Y, then the Nth threshold is equal to Yxd (N-1) For example, the first threshold is 10, the preset ratio is 0.5, then the second threshold is 10ⅹ0.5, the third threshold is 10ⅹ0.5ⅹ0.5,...
[0202] It can be seen that as N increases, the Nth threshold gradually decreases, that is, as the number of cycles of steps S402 to S407 increases, the threshold gradually decreases, and the noise correction of images at different grayscales is more targeted, so that the quality of the denoised image finally outputted is higher.
[0203] It is to be understood that some or all of the steps or operations in the above embodiments are merely examples, and the present application embodiments may also perform other operations or variations of various operations. In addition, the various steps may be performed in different orders presented in the above embodiments, and it is possible that not all of the operations in the above embodiments need to be performed.
[0204] like Figure 5 As shown, the present application provides an image processing device 100, comprising:
[0205] A grayscale obtaining module 10 is used to obtain a first grayscale value of each pixel in the first image and an average of the first grayscale values of all pixels;
[0206] A threshold value obtaining module 20, configured to input the first gray value mean into a preset fitting curve to obtain a first threshold value;
[0207] A difference calculation module 30, used to respectively obtain a first difference between a first grayscale value of each pixel in the first image and grayscale values of a preset number of pixels around it;
[0208] A comparison module 40, configured to compare each of the first difference values with the first threshold value, and determine a second grayscale value of each of the pixel points based on the comparison result;
[0209] The output module 50 is used to output a second image based on the second grayscale value of each pixel.
[0210] In one possible implementation, the comparison module 40 includes:
[0211] respectively determining whether the first difference is greater than the first threshold;
[0212] If any one of the first difference values is less than the first threshold, obtaining a second grayscale value of the pixel based on the first grayscale value, wherein the second grayscale value is equal to the first grayscale value;
[0213] If the first difference values are all greater than the first threshold, a second grayscale value of the pixel is obtained based on the grayscale values of a preset number of pixels around the pixel.
[0214] In one possible implementation, if any one of the first difference values is greater than the first threshold, the second grayscale value of the pixel is equal to the mean or median of the grayscale values of a preset number of pixels around it, or the second grayscale value of the second pixel is equal to the weighted sum of the grayscale values of a preset number of pixels around it.
[0215] In one possible implementation, the output module 50 includes:
[0216] Obtaining a grayscale value mean, standard deviation or variance based on the second grayscale value of each pixel;
[0217] Determine whether the gray value mean, standard deviation or variance is higher than a preset value;
[0218] If the gray value mean, standard deviation or variance is higher than the preset value;
[0219] Obtaining a second threshold, where the second threshold is determined by a difference between the first threshold and a preset value or a preset ratio;
[0220] Determine a third grayscale value of each pixel based on the second grayscale value of each pixel and the second threshold;
[0221] Based on the third grayscale value of each pixel, a second image is output.
[0222] In one possible implementation, the output module 50 includes:
[0223] Get the N+1th threshold;
[0224] Determine the N+2th grayscale value of each of the pixel points based on the N+1th grayscale value of each of the pixel points and the N+1th threshold;
[0225] Accumulate the number of cycles, and if the number of cycles is less than the preset number, execute steps S1-S3 repeatedly;
[0226] Based on the N+2th grayscale value of each pixel point, a second image is output.
[0227] In one possible implementation, the device 100 further includes:
[0228] A mean value calculation module 60 is used to obtain the mean value of the N+1th grayscale value of all the pixels;
[0229] The threshold determination module 70 is used to input the N+1th gray value mean into the fitting curve to obtain the N+1th threshold.
[0230] In one possible implementation, Figure 6 As shown, the device 100 further comprises:
[0231] An image acquisition module 81 is used to acquire a plurality of images with different grayscales;
[0232] A grayscale calculation module 82 is used to obtain the grayscale value mean and standard deviation or variance of the pixel points in the plurality of different grayscale images respectively;
[0233] The fitting module 83 is used to perform curve fitting on the mean and standard deviation or variance of the grayscale values of the pixels in the multiple different grayscale images to obtain a fitting curve.
[0234] Figure 5 The image processing device 100 provided in the embodiment shown can be used to execute the present application Figure 1 The technical solution of the method embodiment shown, its implementation principle and technical effects can be further referred to the relevant description in the method embodiment.
[0235] It should be understood that the above Figure 5-6The division of the modules of the image processing device shown is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. For example, the detection module can be a separately established processing element, or it can be integrated in a chip of an electronic device. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. In the implementation process, each step of the above method or each of the above modules can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0236] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more specific integrated circuits (ASIC), or one or more digital microprocessors (DSP), or one or more field programmable gate arrays (FPGA). For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0237] Figure 7 This is a schematic diagram of the structure of an embodiment of the electronic device of the present application. Figure 7 As shown, the electronic device may include:
[0238] one or more processors; memory; and one or more computer programs;
[0239] The electronic device may include an image processing device, such as a camera, an image sensor, a CMOS static detector, etc., or a device with an image processing function, such as a mobile phone, a computer, etc.
[0240] The one or more computer programs are stored in the memory, and the one or more computer programs include instructions. When the instructions are executed by the device, the device performs the following steps:
[0241] Obtaining a first grayscale value of each pixel in the first image and an average of the first grayscale values of all pixels;
[0242] Inputting the first gray value mean into a preset fitting curve to obtain a first threshold value;
[0243] Respectively obtaining first differences between a first grayscale value of each pixel point in the first image and grayscale values of a preset number of pixels around it;
[0244] Comparing each of the first difference values with the first threshold value respectively, and determining a second grayscale value of each of the pixel points based on the comparison result;
[0245] Based on the second grayscale value of each pixel, a second image is output.
[0246] In one possible implementation manner, when the instruction is executed by the device, the device performs the step of comparing each of the first difference values with the first threshold value respectively, and determining the second grayscale value of each of the pixel points based on the comparison result, including:
[0247] respectively determining whether each of the first differences is greater than the first threshold;
[0248] If any one of the first difference values is less than the first threshold, obtaining a second grayscale value of the pixel based on the first grayscale value, wherein the second grayscale value is equal to the first grayscale value;
[0249] If each of the first difference values is greater than the first threshold, a second grayscale value of the pixel is obtained based on the grayscale values of a preset number of pixels around the pixel.
[0250] In one possible implementation, if any one of the first difference values is greater than the first threshold, the second grayscale value of the pixel is equal to the mean or median of the grayscale values of a preset number of pixels around it, or the second grayscale value of the second pixel is equal to the weighted sum of the grayscale values of a preset number of pixels around it.
[0251] In one possible implementation manner, when the instruction is executed by the device, the device performs the step of outputting the second image based on the second grayscale value of each pixel, including:
[0252] Obtaining a grayscale value mean, standard deviation or variance based on the second grayscale value of each pixel;
[0253] Determine whether the gray value mean, standard deviation or variance is higher than a preset value;
[0254] If the gray value mean, standard deviation or variance is higher than the preset value;
[0255] Obtaining a second threshold, where the second threshold is determined by a difference between the first threshold and a preset value or a preset ratio;
[0256] Determine a third grayscale value of each pixel based on the second grayscale value of each pixel and the second threshold;
[0257] Based on the third grayscale value of each pixel, a second image is output.
[0258] In one possible implementation manner, when the instruction is executed by the device, the device performs the step of outputting the second image based on the second grayscale value of each pixel, including:
[0259] S1, obtain the N+1th threshold;
[0260] S2, determining the N+2th grayscale value of each of the pixel points based on the N+1th grayscale value of each of the pixel points and the N+1th threshold;
[0261] S3, accumulating the number of cycles, if the number of cycles is less than the preset number, then executing steps S1-S3 in a loop;
[0262] S4: output a second image based on the N+2th grayscale value of each pixel.
[0263] In one possible implementation manner, when the instruction is executed by the apparatus, the device is caused to perform the step of obtaining the N+1th threshold, including:
[0264] Obtaining the N+1th grayscale value average of all the pixels;
[0265] The N+1th gray value mean is input into the fitting curve to obtain the N+1th threshold value.
[0266] In one possible implementation manner, when the instruction is executed by the device, before the device executes the step of inputting the first gray value mean into a preset fitting curve to obtain a first threshold, the device further executes the step of:
[0267] Acquire multiple images with different grayscales;
[0268] Respectively obtain the grayscale value mean and standard deviation or variance of the pixel points in the multiple different grayscale images;
[0269] A curve fitting is performed on the mean and standard deviation of the grayscale values of the pixels in the multiple different grayscale images to obtain a fitting curve.
[0270] Figure 7 The electronic device shown can be a circuit device or a circuit device built into the above electronic device. The device can be used to execute the present application Figure 1 The illustrated embodiments provide functions / steps in the method.
[0271] like Figure 7 As shown, the electronic device 900 includes a processor 910 and a memory 920. The processor 910 and the memory 920 can communicate with each other through an internal connection path to transmit control and / or data signals. The memory 920 is used to store computer programs, and the processor 910 is used to call and run the computer program from the memory 920.
[0272] The above-mentioned memory 920 can be a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or it can be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk storage medium or other magnetic storage device, or it can also be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer.
[0273] The processor 910 and the memory 920 may be combined into a processing device, or more commonly, they are independent components, and the processor 910 is used to execute the program code stored in the memory 920 to implement the above functions. In specific implementation, the memory 920 may also be integrated into the processor 910, or may be independent of the processor 910.
[0274] It should be understood that Figure 7 The electronic device 900 shown can implement the present application Figure 1 The various processes of the method provided in the illustrated embodiment. The operations and / or functions of the various modules in the electronic device 900 are respectively to implement the corresponding processes in the above method embodiments. For details, please refer to the present application Figure 1 To avoid repetition, the detailed description of the method embodiment is appropriately omitted here.
[0275] It should be understood that Figure 7The processor 910 in the electronic device 900 shown may be a system on chip SOC, which may include a central processing unit (CPU) and may further include other types of processors, such as a graphics processing unit (GPU).
[0276] In summary, the various processors or processing units inside the processor 910 can work together to implement the previous method flow, and the corresponding software programs of the various processors or processing units can be stored in the memory 920.
[0277] The present application also provides an electronic device, the device comprising a storage medium and a central processing unit, the storage medium may be a non-volatile storage medium, the storage medium stores a computer executable program, the central processing unit is connected to the non-volatile storage medium, and executes the computer executable program to implement the present application Figure 1 The method provided by the illustrated embodiment.
[0278] In the above embodiments, the processor involved may include, for example, a CPU, a DSP, a microcontroller or a digital signal processor, and may also include a GPU, an embedded neural network processor (Neural-Network Process UNits; hereinafter referred to as: NPU) and an image signal processor (Image SigNal ProcessiNg; hereinafter referred to as: ISP). The processor may also include necessary hardware accelerators or logic processing hardware circuits, such as ASIC, or one or more integrated circuits for controlling the execution of the program of the technical solution of the present application. In addition, the processor may have the function of operating one or more software programs, and the software programs may be stored in a storage medium.
[0279] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the present application. Figure 1 The method provided by the illustrated embodiment.
[0280] The present application also provides a computer program product, which includes a computer program, which, when executed on a computer, enables the computer to execute the present application. Figure 1 The method provided by the illustrated embodiment.
[0281] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, c can be single or multiple.
[0282] Those of ordinary skill in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented in a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0283] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0284] In several embodiments provided in the present application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-ONly Memory; hereinafter referred to as: ROM), random access memory (RaNdom Access Memory; hereinafter referred to as: RAM), disk or optical disk, and other media that can store program codes.
[0285] The above is only a specific implementation of the present application. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. The protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An image processing method, characterized in that: The method comprises: Obtaining a first grayscale value of each pixel in the first image and an average of the first grayscale values of all pixels; Inputting the first gray value mean into a preset fitting curve to obtain a first threshold value; Respectively obtaining first differences between a first grayscale value of each pixel point in the first image and grayscale values of a preset number of pixels around it; Comparing each of the first difference values with the first threshold value respectively, and determining a second grayscale value of each of the pixel points based on the comparison result; Obtaining a grayscale value mean, standard deviation or variance based on the second grayscale value of each pixel; Determine whether the gray value mean, standard deviation or variance is higher than a preset value; If the gray value mean, standard deviation or variance is higher than the preset value; Obtaining a second threshold, where the second threshold is determined by a difference between the first threshold and a preset value or a preset ratio; Determine a third grayscale value of each pixel based on the second grayscale value of each pixel and the second threshold; Based on the third grayscale value of each pixel, a second image is output.
2. The method according to claim 1, characterized in that The step of comparing each of the first difference values with the first threshold value and determining the second grayscale value of each of the pixel points based on the comparison result comprises: respectively determining whether each of the first differences is greater than the first threshold; If any one of the first difference values is less than the first threshold, obtaining a second grayscale value of the pixel based on the first grayscale value, wherein the second grayscale value is equal to the first grayscale value; If each of the first difference values is greater than the first threshold, a second grayscale value of the pixel is obtained based on the grayscale values of a preset number of pixels around the pixel.
3. The method according to claim 2, characterized in that If any one of the first difference values is greater than the first threshold, the second grayscale value of the pixel is equal to the mean or median of the grayscale values of a preset number of pixels around it, or the second grayscale value of the pixel is equal to the weighted sum of the grayscale values of a preset number of pixels around it.
4. The method according to any one of claims 1 to 3, characterized in that: The step of outputting a second image based on the second grayscale value of each pixel point comprises: S1, obtain the N+1th threshold; S2, determining the N+2th grayscale value of each of the pixel points based on the N+1th grayscale value of each of the pixel points and the N+1th threshold; S3, accumulating the number of cycles, if the number of cycles is less than the preset number, then executing steps S1-S3 in a loop; S4: output a second image based on the N+2th grayscale value of each pixel.
5. The method according to claim 4, characterized in that The obtaining of the N+1th threshold value includes: Obtaining the N+1th grayscale value average of all the pixels; The N+1th gray value mean is input into the fitting curve to obtain the N+1th threshold value.
6. The method according to claim 1, characterized in that Before inputting the first gray value mean into a preset fitting curve to obtain a first threshold, the method further includes: Acquire multiple images with different grayscales; Respectively obtain the grayscale value mean and standard deviation or variance of the pixel points in the multiple different grayscale images; A curve fitting is performed on the mean and standard deviation of the grayscale values of the pixels in the multiple different grayscale images to obtain a fitting curve.
7. An image processing device, characterized in that: include: A grayscale acquisition module, used to obtain a first grayscale value of each pixel in the first image and an average of the first grayscale values of all pixels; A threshold value obtaining module, inputting the first gray value mean into a preset fitting curve to obtain a first threshold value; A difference calculation module, used to respectively obtain a first difference between a first grayscale value of each pixel point in the first image and grayscale values of a preset number of pixels around it; A comparison module, used for comparing each of the first difference values with the first threshold value, and determining a second grayscale value of each of the pixel points based on the comparison result; An output module, used for obtaining a gray value mean, a standard deviation or a variance based on the second gray value of each pixel point; Determine whether the gray value mean, standard deviation or variance is higher than a preset value; If the gray value mean, standard deviation or variance is higher than the preset value; Obtaining a second threshold, where the second threshold is determined by a difference between the first threshold and a preset value or a preset ratio; Determine a third grayscale value of each pixel based on the second grayscale value of each pixel and the second threshold; Based on the third grayscale value of each pixel, a second image is output.
8. An electronic device, characterized in that: include: one or more processors; Memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions, which, when executed, cause the electronic device to perform the method as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Image processing method and device, electronic equipment and computer readable storage medium
CN108093182A
Method and device for detecting noise point in image, computer-readable storage medium
CN109325917A