CN112233051A - Median filtering method, median filtering device and computer readable storage medium - Google Patents

Median filtering method, median filtering device and computer readable storage medium Download PDF

Info

Publication number
CN112233051A
CN112233051A CN202010942921.5A CN202010942921A CN112233051A CN 112233051 A CN112233051 A CN 112233051A CN 202010942921 A CN202010942921 A CN 202010942921A CN 112233051 A CN112233051 A CN 112233051A
Authority
CN
China
Prior art keywords
value
pixel
sliding window
pixels
filtering
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010942921.5A
Other languages
Chinese (zh)
Other versions
CN112233051B (en
Inventor
王廷鸟
王松
刘晓沐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202010942921.5A priority Critical patent/CN112233051B/en
Publication of CN112233051A publication Critical patent/CN112233051A/en
Application granted granted Critical
Publication of CN112233051B publication Critical patent/CN112233051B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • G06T2207/20032Median filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20172Image enhancement details
    • G06T2207/20192Edge enhancement; Edge preservation

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The application discloses a median filtering method, a median filtering device and a computer readable storage medium, wherein the method comprises the following steps: acquiring an image to be processed, and traversing the image to be processed by using a sliding window method to acquire a pixel value in each sliding window; processing the pixel value in each sliding window to obtain the pixel characteristic value of the sliding window; calculating a distance value between the pixel characteristic value of the sliding window and the pixel value in the sliding window, and determining a weight value corresponding to each pixel value in the sliding window by using the distance value; and calculating each pixel value in the sliding window and the corresponding weight value to obtain a first filtering pixel value. By means of the method, the operation complexity can be reduced, and parallelization processing is achieved.

Description

Median filtering method, median filtering device and computer readable storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a median filtering method, a median filtering apparatus, and a computer-readable storage medium.
Background
Median filtering is a basic operator, which effectively removes impulse noise and has excellent edge-preserving characteristics, so that the median filtering is applied to many algorithms, such as: and removing salt and pepper noise or pseudo color of the image. However, as a sort statistics-based nonlinear filter operator, compared to a linear filter operator, the complexity is higher, most of the performance is consumed in sorting, and the larger the sliding window (sliding window), the larger the performance consumption. Although the conventional median filtering is improved at present, the problems of more logic judgment, front-back dependency, unsuitability for parallel Processing and the like exist, for example, the existing scheme can adopt a faster sequencing algorithm to improve the performance, but the judgment logic inherent in the sequencing algorithm causes that the parallel Processing is difficult to be performed on a DSP (Digital Signal Processing) or an FPGA (Field Programmable Gate Array).
Disclosure of Invention
The application provides a median filtering method, a median filtering device and a computer readable storage medium, which can reduce the operation complexity and realize parallelization processing.
In order to solve the above technical problem, a technical solution adopted by the present application is to provide a median filtering method, including: acquiring an image to be processed, and traversing the image to be processed by using a sliding window method to acquire a pixel value in each sliding window; processing the pixel value in each sliding window to obtain the pixel characteristic value of the sliding window; calculating a distance value between the pixel characteristic value of the sliding window and the pixel value in the sliding window, and determining a weight value corresponding to each pixel value in the sliding window by using the distance value; and calculating each pixel value in the sliding window and the corresponding weight value to obtain a first filtering pixel value.
In order to solve the above technical problem, another technical solution adopted by the present application is to provide a median filtering apparatus, which includes a memory and a processor connected to each other, wherein the memory is used for storing a computer program, and the computer program is used for implementing the median filtering method described above when being executed by the processor.
In order to solve the above technical problem, another technical solution adopted by the present application is to provide a computer-readable storage medium for storing a computer program, wherein the computer program is configured to implement the median filtering method described above when the computer program is executed by a processor.
Through the scheme, the beneficial effects of the application are that: acquiring an image to be processed containing noise, processing the image to be processed by using a sliding window method, and acquiring all pixel values in each sliding window; then, calculating a pixel characteristic value by using all pixel values, setting a weight value corresponding to each pixel value by calculating a distance value between the pixel characteristic value and each pixel value in the sliding window, and performing weighted summation processing on the weight values and the corresponding pixel values to obtain a filtering result; the scheme adopted by the application does not need to sequence the pixel values in the sliding window, has less logic judgment, can reduce the operation complexity, does not need to establish a histogram, does not need to depend on the signal bit width histogram, is suitable for instruction parallelization or hardware realization, and has a filtering effect close to that of the conventional median filtering algorithm.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts. Wherein:
FIG. 1 is a schematic flow chart diagram illustrating an embodiment of a median filtering method provided herein;
FIG. 2(a) is a diagram illustrating pixel values within a sliding window in the embodiment shown in FIG. 1;
FIG. 2(b) is a diagram illustrating the corresponding weight values of FIG. 2 (a);
FIG. 3 is a schematic flow chart diagram illustrating another embodiment of a median filtering method provided herein;
FIG. 4 is a schematic diagram of a step signal in the embodiment shown in FIG. 3;
FIG. 5 is a schematic flow chart diagram illustrating a median filtering method according to another embodiment of the present application;
FIG. 6 is a schematic flow chart diagram illustrating a median filtering method according to yet another embodiment of the present disclosure;
FIG. 7(a) is a diagram of a ramp signal and a noise signal;
FIG. 7(b) is a schematic diagram of a filtering operation performed on the noisy signal in FIG. 7(a) by using a conventional mean filtering method;
FIG. 7(c) is a schematic diagram of the filtering of the noisy signal of FIG. 7(a) using the median filtering method of the present application;
FIG. 7(d) is a schematic diagram of a filtering operation performed on the noisy signal of FIG. 7(a) by a conventional median filtering method;
FIG. 8(a) is a schematic diagram of a step signal and a noise signal;
FIG. 8(b) is a schematic diagram of a filtering operation performed on the noisy signal in FIG. 8(a) by using a conventional mean filtering method;
FIG. 8(c) is a schematic diagram of the filtering of the noisy signal of FIG. 8(a) using the median filtering method of the present application;
FIG. 8(d) is a schematic diagram of a filtering operation performed on the noisy signal of FIG. 8(a) by a conventional median filtering method;
FIG. 9(a) is a schematic diagram of a noisy image with salt and pepper noise added;
fig. 9(b) is a schematic diagram of a filtering result obtained by filtering the noisy image in fig. 9(a) by using a conventional 3 × 3 median filtering template;
fig. 9(c) is a schematic diagram of the filtering result obtained by filtering the noisy image in fig. 9(a) using the 3 × 3 median filtering template of the present application;
fig. 9(d) is a schematic diagram of the filtering result obtained by filtering the noisy image in fig. 9(a) by using the existing 11 × 11 median filtering template;
fig. 9(e) is a schematic diagram of the filtering result obtained by filtering the noisy image in fig. 9(a) using the 11 × 11 median filtering template of the present application;
fig. 10 is a schematic structural diagram of an embodiment of a median filtering apparatus provided in the present application;
FIG. 11 is a schematic structural diagram of an embodiment of a computer-readable storage medium provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating an embodiment of a median filtering method provided in the present application, the method including:
step 11: and acquiring an image to be processed, and traversing the image to be processed by using a sliding window method to acquire a pixel value in each sliding window.
The method can receive an image to be processed sent by other equipment, or read an image from a storage device as the image to be processed, wherein the image to be processed is an image containing noise, such as gaussian noise or salt and pepper noise; and then, processing the acquired image to be processed by using a sliding window method, and traversing each pixel value to obtain a current sliding window containing the pixel value.
Step 12: and processing the pixel value in each sliding window to obtain the pixel characteristic value of the sliding window.
After the pixel values in the current sliding window are obtained, the pixel values may be processed, for example, an average value, a mean square error, a standard deviation, or the like of all the pixel values in the sliding window is obtained, and a result obtained after the processing is used as a pixel characteristic value of the current sliding window, that is, the pixel characteristic value includes a pixel mean value.
Step 13: and calculating a distance value between the pixel characteristic value of the sliding window and the pixel value in the sliding window, and determining a weight value corresponding to each pixel value in the sliding window by using the distance value.
After the pixel characteristic value of the current sliding window is calculated, in order to calculate a weight value corresponding to each pixel value in the current sliding window, a distance value between each pixel value in the current sliding window and the pixel characteristic value, that is, a difference between the pixel value and the pixel characteristic value, may be calculated, and then the distance value is used to calculate the weight value, generally speaking, the larger the distance value is, the smaller the weight value is.
Step 14: and calculating each pixel value in the sliding window and the corresponding weight value to obtain a first filtering pixel value.
After calculating the weight value corresponding to each pixel value in the sliding window, the method can be usedWeighting and summing all pixel values in the sliding window and corresponding weight values to generate a first filtering pixel value, and taking the first filtering pixel value as a filtering result, or calculating based on the first filtering pixel value to obtain a filtering result; for example, as shown in fig. 2, if the sliding window area of fig. 2(a) is 3 × 3, i.e., the filtering template is 3 × 3, the corresponding pixel values are I1-I9, respectively, and the calculated weight values are denoted as h1-h9 as shown in fig. 2(b), then
Figure BDA0002674250380000041
The first filtered pixel value is the filtered pixel value corresponding to pixel value I5.
The scheme of the embodiment can be applied to the technical field of signal processing, for example, in filtering, noise reduction or smoothing of signals, pixel characteristic values corresponding to all pixel values in a sliding window can be calculated, a weight value corresponding to each pixel value is set by calculating a distance value between the pixel characteristic values and each pixel value in the sliding window, and then the weight values and the corresponding pixel values are subjected to weighted summation to obtain a filtering result; the scheme adopted by the embodiment does not need to sequence the pixel values in the sliding window, has less logic judgment, can reduce the operation complexity, does not need to establish a histogram, does not need to depend on the signal bit width histogram, is suitable for instruction parallelization or hardware realization, and has an effect close to that of the existing median filtering algorithm.
Referring to fig. 3, fig. 3 is a schematic flowchart illustrating another embodiment of a median filtering method provided in the present application, the method including:
step 31: and acquiring an image to be processed, and traversing the image to be processed by using a sliding window method to acquire a pixel value in each sliding window.
Step 31 is the same as step 11 in the above embodiment, and will not be described again.
Step 32: and averaging all pixel values in the sliding window to obtain a pixel mean value.
For each sliding window, the average value of all pixel values in the sliding window can be calculated to obtain a pixel average value, and then the pixel average value is used to calculate the weight value corresponding to each pixel value.
Step 33: and calculating the pixel absolute difference value between the pixel value in the sliding window and the pixel mean value, and taking the pixel absolute difference value as the distance value.
The pixel mean value calculated by using all pixel values in the sliding window is referred to as mv, and then the distance value between each pixel value and the pixel mean value can be calculated by using the following formula:
dis(i)=|(v(i)-mv)| (1)
where dis (i) is a distance value between the ith pixel value and the pixel mean value in the sliding window, and v (i) is the ith pixel value.
Step 34: and calculating a weight value by using the distance value corresponding to each pixel value in the sliding window, and normalizing the weight values corresponding to all the pixel values in the sliding window.
The weight value corresponding to each pixel value can be calculated by the following formula:
weight(i)=max{eps,thr-dis(i)} (2)
where weight (i) is the weight value corresponding to the ith pixel value, esp is a small value, and to prevent the situation that the weight values are all 0, thr may be a fixed parameter, or may be some statistic, such as:
Figure BDA0002674250380000051
i.e., the maximum distance value, M is the total number of pixels in the sliding window.
After the weighted values are calculated, normalization can be performed by using the following formula:
Figure BDA0002674250380000061
wherein, weight' (i) is a normalized weight value corresponding to the ith pixel value.
It will be appreciated that in other embodiments, the weight values may be calculated in other manners, such as by the following formula:
Figure BDA0002674250380000062
wherein σ is a fixed parameter.
Step 35: and carrying out weighted summation on the pixel values in the sliding window and the corresponding weight values to obtain a summation result, and taking the summation result as a first filtering pixel value.
After the weight value corresponding to each pixel value in the current sliding window is calculated, a first filtering pixel value can be calculated by using the following formula:
Figure BDA0002674250380000063
wherein v isoutIs the first filtered pixel value.
The median filtering method adopted by the embodiment is based on the idea of clustering, and normal signals account for the majority in the neighborhood range, so that the result obtained by averaging the neighborhood signals is closer to the normal signals; at this time, if the weighted average is performed by using the decay function of the distance (difference in value) from each signal to the average value as the weight value, the obtained result will be closer to the normal signal and further away from the impulse noise. For example, the neighborhood signal value of a certain signal is [1, 1, 4], the mean value thereof is 2, the distance value dis (i) from each signal value to the mean value is [1, 1, 2], i is greater than or equal to 1 and less than or equal to 3, 2-dis (i) is used as a weighted value, the weighted values of the three are [1, 1, 0], after weighted averaging, the filtering result is obtained as follows: (1 × 1+4 × 0)/(1+1+0) ═ 1, pulse noise was removed.
For a smaller neighborhood, i.e., the size of the sliding window is smaller, the method adopted in this embodiment works better, and when the sliding window becomes larger, a situation of blurred edges may occur, for example, as shown in fig. 4, for a step signal, a solid line L1 is an original signal, and a dotted line L2 is a filtering result obtained by using one cluster; because only one cluster is assumed in the neighborhood, near the value of the jump of the step signal, the mean value is close to the middle, and the distances between two sides and the mean value are not greatly different, so that the weight value is not greatly different, and the filtering effect is not good; thus, an improvement can be made, in which two clusters are set in the neighborhood, and are divided by the mean value, the scheme of the above embodiment is adopted for each cluster, and finally the two results are weighted and averaged by the function of the number of samples in the cluster to obtain the final filtering result, and the specific scheme will be described below.
Referring to fig. 5, fig. 5 is a schematic flowchart illustrating a median filtering method according to another embodiment of the present application, the method including:
step 51: and acquiring an image to be processed, and traversing the image to be processed by using a sliding window method to acquire a pixel value in each sliding window.
Step 52: and averaging all pixel values in the sliding window to obtain a pixel mean value.
Steps 51 to 52 are the same as steps 31 to 32 in the above embodiment, and are not described again.
Step 53: all pixels within the sliding window are classified into two classes using pixel mean.
After the pixel mean value is calculated, the magnitude relation between each pixel value in the sliding window and the pixel mean value is compared, pixels with the pixel values larger than or equal to the pixel mean value in the sliding window are marked as first-class pixels, and pixels with the pixel values smaller than or equal to the pixel mean value in the sliding window are marked as second-class pixels.
Step 54: and obtaining a pixel mean value corresponding to each type of pixels, and determining a weight value corresponding to each type of pixels by using the pixel mean value corresponding to each type of pixels and the pixel value of each type of pixels.
For the first type of pixels, the pixel values of all the first type of pixels are summed and averaged to obtain a first pixel average value, then the distance value between the pixel value of each first type of pixel and the first pixel average value is calculated, and the distance value can be converted into a weight value in the same manner as in the above embodiment to obtain the first weight value.
For the second type of pixels, the pixel values of all the second type of pixels are summed and averaged to obtain a second pixel average value, then the distance value between the pixel value of each second type of pixel and the second pixel average value is calculated, and the distance value can be converted into a weight value in the same manner as in the above embodiment to obtain a second weight value.
Step 55: and carrying out weighted summation on the pixel value of each type of pixel and the corresponding weight value to obtain a second filtering pixel value corresponding to each type of pixel.
Carrying out weighted average on the pixel values of the first type of pixels and corresponding first weight values to obtain second filtering pixel values corresponding to the first type of pixels; and carrying out weighted average on the pixel values of the second type of pixels and the corresponding second weight values to obtain second filtering pixel values corresponding to the second type of pixels.
Step 56: and carrying out weighted summation on the second filtering pixel values corresponding to the two types of pixels to obtain a third filtering pixel value, and taking the third filtering pixel value as a filtering result.
The number of the first type pixels and the number of the second type pixels can be counted, and then the weight values corresponding to the first type pixels and the second type pixels are calculated by utilizing the number of the first type pixels, the number of the second type pixels and the first smoothness control parameter; the third filtered pixel value is then calculated using the following equation:
vout=αmv1+(1-α)mv2 (6)
wherein v isoutFor the third filtered pixel value, α is the weight value corresponding to the first type of pixel, and (1- α) is the weight value corresponding to the second type of pixel, α ═ f (n)1,n2T1), where the function f is a smooth selection function for two cluster centers, T1 is a first smoothness control parameter, n1Is the total number of pixels of the first type, n2Is the total number of pixels of the second type.
In one embodiment, the function f may be a sigmoid function, i.e.:
Figure BDA0002674250380000081
when T is1At very high, α ≈ n1>n2) (ii) a When T is1When the temperature of the molten steel is very small,
Figure BDA0002674250380000082
this implementationThe median filtering method of the example is more excellent in the edge preserving performance.
The embodiment shown in fig. 3 may be combined with the embodiment shown in fig. 5 for better edge preservation near the step signal and better noise reduction in the smooth region, as will be described below.
Referring to fig. 6, fig. 6 is a schematic flowchart illustrating a median filtering method according to another embodiment of the present application, the method including:
step 601: and acquiring an image to be processed, and traversing the image to be processed by using a sliding window method to acquire a pixel value in each sliding window.
Step 602: and averaging all pixel values in the sliding window to obtain a pixel mean value.
Step 603: and calculating the pixel absolute difference value between the pixel value in the sliding window and the pixel mean value, and taking the pixel absolute difference value as the distance value.
Step 604: and calculating a weight value by using the distance value corresponding to each pixel value in the sliding window, and normalizing the weight values corresponding to all the pixel values in the sliding window.
Step 605: and carrying out weighted summation on the pixel values in the sliding window and the corresponding weight values to obtain a summation result, and taking the summation result as a first filtering pixel value.
Steps 601-605 are the same as steps 31-35 in the above embodiments, and are not described herein again.
Step 606: all pixels within the sliding window are classified into two classes using pixel mean.
Step 607: and obtaining a pixel mean value corresponding to each type of pixels, and determining a weight value corresponding to each type of pixels by using the pixel mean value corresponding to each type of pixels and the pixel value of each type of pixels.
Step 608: and carrying out weighted summation on the pixel value of each type of pixel and the corresponding weight value to obtain a second filtering pixel value corresponding to each type of pixel.
Step 609: and carrying out weighted summation on the second filtering pixel values corresponding to the two types of pixels to obtain a third filtering pixel value, and taking the third filtering pixel value as a filtering result.
Steps 606-609 are the same as steps 53-56 in the above embodiment, and are not described herein again.
Step 610: and performing weighted summation on the first filtering pixel value and the third filtering pixel value to obtain a fourth filtering pixel value, and taking the fourth filtering pixel value as a filtering result.
The standard deviation corresponding to all pixels in the sliding window, the standard deviation corresponding to the first type of pixels and the standard deviation corresponding to the second type of pixels can be calculated firstly; and then calculating a weight value corresponding to the first filtering pixel value and a weight value corresponding to the third filtering pixel value by using the standard deviation corresponding to all pixels in the sliding window, the standard deviation corresponding to the first type of pixels, the standard deviation corresponding to the second type of pixels and the second smoothness control parameter.
Further, the sum of the weight value corresponding to the first filtering pixel value and the weight value corresponding to the third filtering pixel value is 1, and the weight value corresponding to the first filtering pixel value is recorded as β; by weighted summation of the first filtered pixel value and the third filtered pixel value, a final filtering result may be obtained, i.e. the fourth filtered pixel value is calculated using the following formula:
vout=βmv+(1-β)[αmv1+(1-α)mv2] (8)
beta needs to be capable of better distinguishing the number of clusters, taking a step signal as an example, the total mean square error and the standard deviation are larger near the jump, and the sum of the mean square error and the standard deviation of each of the two clusters is smaller; for the ramp signal, the total standard deviation is almost the sum of the standard deviations of the two clusters, so the standard deviation is used as an input, i.e. the calculation formula of β can be as follows:
β=g(std(vec),std(vec1)+std(vec2),T2) (9)
where the function g is a smooth selection function for both cases, the function is similar to the function f, std (vec) in the above embodiment, which is the standard deviation of all pixel values in the sliding window, std (vec)1) Standard deviation for all pixels of the first type in the sliding window, std (vec)2) Is the standard deviation, T, of all pixels of the second type in the sliding window2A second smoothness control parameter.
In a specific embodiment, the function g may be a sigmoid function, i.e.:
Figure BDA0002674250380000101
it will be appreciated that the use of mean square error or the mean of the distances may also be considered in addition to the standard deviation.
By processing the ramp signal according to the scheme of this embodiment, the result shown in fig. 7 can be obtained, where fig. 7(a) is a schematic diagram of an original signal and a noisy signal generated after adding noise to the original signal, fig. 7(b) is a filtering result obtained by filtering the noisy signal by using a conventional mean filtering method, fig. 7(c) is a filtering result obtained by filtering the noisy signal by using a median filtering method of the present application, and fig. 7(d) is a filtering result obtained by filtering the noisy signal by using a conventional median filtering method. By processing the step signal according to the scheme of this embodiment, the result shown in fig. 8 can be obtained, where fig. 8(a) is a schematic diagram of an original signal and a noisy signal, fig. 8(b) is a filtering result obtained by filtering the noisy signal by using a conventional mean filtering method, fig. 8(c) is a filtering result obtained by filtering the noisy signal by using a median filtering method of the present application, and fig. 8(d) is a filtering result obtained by filtering the noisy signal by using a conventional median filtering method. By processing the noise image obtained by adding salt and pepper noise according to the scheme of this embodiment, the result shown in fig. 9 can be obtained, where fig. 9(a) is a schematic diagram of a noisy image, fig. 9(b) is a filtering result obtained by filtering the noisy image by using a conventional median filtering method, and the size of the sliding window is 3 × 3, that is, the median filtering template is 3 × 3; fig. 9(c) is a filtering result obtained by filtering a noisy image using the median filtering method of the present example, the size of the sliding window being 3 × 3; fig. 9(d) shows the filtering result obtained by filtering the noisy image by using the conventional median filtering method, where the size of the sliding window is 11 × 11, that is, the median filtering template is 11 × 11; fig. 9(e) shows the filtering result obtained by filtering the noisy image by the median filtering method of the present example, where the size of the sliding window is 11 × 11. As can be seen from the results of fig. 7-9, the filtering scheme adopted by the present embodiment has approximately the same filtering effect as the existing median filtering method.
The method is based on a clustering idea, sorting is not needed, and the performance is better; moreover, a histogram is not needed, the bit width dependence on signals is small, front and back dependence is avoided, the processing of each signal is consistent, parallel processing is convenient, and hardware implementation is easy.
Referring to fig. 10, fig. 10 is a schematic structural diagram of an embodiment of a median filtering apparatus 100 provided in the present application, where the median filtering apparatus 100 includes a memory 101 and a processor 102 connected to each other, the memory 101 is used for storing a computer program, and the computer program is used for implementing the median filtering method in the foregoing embodiment when being executed by the processor 102.
Referring to fig. 11, fig. 11 is a schematic structural diagram of an embodiment of a computer-readable storage medium provided in the present application, where the computer-readable storage medium 110 is used for storing a computer program 111, and the computer program 111, when being executed by a processor, is used for implementing the median filtering method in the foregoing embodiments.
The computer readable storage medium 110 may be a server, a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of modules or units is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings, or which are directly or indirectly applied to other related technical fields, are intended to be included within the scope of the present application.

Claims (10)

1. A method of median filtering, comprising:
acquiring an image to be processed, and traversing the image to be processed by using a sliding window method to acquire a pixel value in each sliding window;
processing the pixel value in each sliding window to obtain the pixel characteristic value of the sliding window;
calculating a distance value between the pixel characteristic value of the sliding window and the pixel value in the sliding window, and determining a weight value corresponding to each pixel value in the sliding window by using the distance value;
and calculating each pixel value in the sliding window and the corresponding weight value to obtain a first filtering pixel value.
2. The median filtering method according to claim 1, wherein the pixel characteristic values include a pixel mean value, and the step of processing the pixel values in each of the sliding windows to obtain the pixel characteristic values of the sliding windows includes:
and averaging all pixel values in the sliding window to obtain the pixel mean value.
3. The median filtering method according to claim 2, wherein the step of calculating a distance value between the pixel characteristic value of the sliding window and the pixel value in the sliding window, and determining a weight value corresponding to each pixel value in the sliding window using the distance value comprises:
calculating a pixel absolute difference value between the pixel value in the sliding window and the pixel mean value, and taking the pixel absolute difference value as the distance value;
calculating the weight value by using the distance value corresponding to each pixel value in the sliding window;
carrying out normalization processing on weight values corresponding to all pixel values in the sliding window;
the step of calculating each pixel value in the sliding window and the corresponding weight value to obtain a first filtering pixel value includes:
and carrying out weighted summation on the pixel values in the sliding window and the corresponding weight values to obtain a summation result, and taking the summation result as the first filtering pixel value.
4. The median filtering method according to claim 2, further comprising:
dividing all pixels in the sliding window into two classes by using the pixel mean value;
acquiring a pixel mean value corresponding to each type of pixels, and determining a weight value corresponding to each type of pixels by using the pixel mean value corresponding to each type of pixels and the pixel value of each type of pixels;
weighting and summing the pixel value of each type of pixels and the corresponding weight value to obtain a second filtering pixel value corresponding to each type of pixels;
and carrying out weighted summation on the second filtering pixel values corresponding to the two types of pixels to obtain a third filtering pixel value, and taking the third filtering pixel value as a filtering result.
5. The median filtering method according to claim 4, wherein said step of classifying all pixels in said sliding window into two classes using said pixel mean value comprises:
and marking the pixels with the pixel values larger than or equal to the pixel mean value in the sliding window as first-class pixels, and marking the pixels with the pixel values smaller than or equal to the pixel mean value in the sliding window as second-class pixels.
6. The median filtering method according to claim 5, wherein the step of performing weighted summation on the second filtered pixel values corresponding to the two types of pixels to obtain a third filtered pixel value comprises:
counting the number of the first type of pixels and the number of the second type of pixels;
and calculating the weight values corresponding to the first type of pixels and the second type of pixels by using the number of the first type of pixels, the number of the second type of pixels and a first smoothness control parameter.
7. The median filtering method according to claim 5, further comprising:
and performing weighted summation on the first filtering pixel value and the third filtering pixel value to obtain a fourth filtering pixel value, and taking the fourth filtering pixel value as a filtering result.
8. The median filtering method according to claim 7, wherein the step of performing a weighted summation of the first filtered pixel value and the third filtered pixel value to obtain a fourth filtered pixel value, and using the fourth filtered pixel value as a filtering result comprises:
calculating the standard deviation corresponding to all pixels in the sliding window, the standard deviation corresponding to the first type of pixels and the standard deviation corresponding to the second type of pixels;
and calculating a weight value corresponding to the first filtering pixel value and a weight value corresponding to the third filtering pixel value by using the standard deviation corresponding to all pixels in the sliding window, the standard deviation corresponding to the first type of pixels, the standard deviation corresponding to the second type of pixels and a second smoothness control parameter.
9. A median filtering apparatus comprising a memory and a processor connected to each other, wherein the memory is used for storing a computer program, which when executed by the processor is used for implementing the median filtering method according to any one of claims 1 to 8.
10. A computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, is adapted to implement the median filtering method of any one of claims 1 to 8.
CN202010942921.5A 2020-09-09 2020-09-09 Median filtering method, median filtering device and computer readable storage medium Active CN112233051B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010942921.5A CN112233051B (en) 2020-09-09 2020-09-09 Median filtering method, median filtering device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010942921.5A CN112233051B (en) 2020-09-09 2020-09-09 Median filtering method, median filtering device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN112233051A true CN112233051A (en) 2021-01-15
CN112233051B CN112233051B (en) 2024-05-10

Family

ID=74116099

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010942921.5A Active CN112233051B (en) 2020-09-09 2020-09-09 Median filtering method, median filtering device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112233051B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108846808A (en) * 2018-05-28 2018-11-20 郑州云海信息技术有限公司 A kind of method and device thereof of image procossing
CN116304584A (en) * 2023-05-17 2023-06-23 安徽智寰科技有限公司 Self-adaptive noise filtering method based on envelope spectrum peak value screening
CN117689556A (en) * 2024-02-02 2024-03-12 深圳市欧冶半导体有限公司 Histogram coding method, histogram decoding method, device, equipment and medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103247025A (en) * 2012-02-06 2013-08-14 河北师范大学 Circular self-adaptation template based image weighted mean filtering method
US20140193093A1 (en) * 2011-09-18 2014-07-10 Forus Health Pvt. Ltd. Method and system for enhancing image quality
CN105303536A (en) * 2015-11-26 2016-02-03 南京工程学院 Median filtering algorithm based on weighted mean filtering
CN107278314A (en) * 2015-03-24 2017-10-20 英特尔公司 Non-local mean image denoising with adaptive oriented space wave filter
CN107705270A (en) * 2017-10-27 2018-02-16 智车优行科技(北京)有限公司 The treating method and apparatus of medium filtering, electronic equipment, computer-readable storage medium
CN109146816A (en) * 2018-08-22 2019-01-04 浙江大华技术股份有限公司 A kind of image filtering method, device, electronic equipment and storage medium
US20190050967A1 (en) * 2017-08-14 2019-02-14 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and storage medium
CN109615599A (en) * 2018-12-13 2019-04-12 钦州学院 Excellent bilateral filtering algorithm and high spectrum image sky spectrum signature extracting method are selected based on classification
CN110246090A (en) * 2018-09-27 2019-09-17 浙江大华技术股份有限公司 A kind of method and apparatus of image procossing
CN110738621A (en) * 2019-10-17 2020-01-31 内蒙古工业大学 Linear structure filtering method, device, equipment and storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140193093A1 (en) * 2011-09-18 2014-07-10 Forus Health Pvt. Ltd. Method and system for enhancing image quality
CN103247025A (en) * 2012-02-06 2013-08-14 河北师范大学 Circular self-adaptation template based image weighted mean filtering method
CN107278314A (en) * 2015-03-24 2017-10-20 英特尔公司 Non-local mean image denoising with adaptive oriented space wave filter
CN105303536A (en) * 2015-11-26 2016-02-03 南京工程学院 Median filtering algorithm based on weighted mean filtering
US20190050967A1 (en) * 2017-08-14 2019-02-14 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and storage medium
CN107705270A (en) * 2017-10-27 2018-02-16 智车优行科技(北京)有限公司 The treating method and apparatus of medium filtering, electronic equipment, computer-readable storage medium
CN109146816A (en) * 2018-08-22 2019-01-04 浙江大华技术股份有限公司 A kind of image filtering method, device, electronic equipment and storage medium
CN110246090A (en) * 2018-09-27 2019-09-17 浙江大华技术股份有限公司 A kind of method and apparatus of image procossing
CN109615599A (en) * 2018-12-13 2019-04-12 钦州学院 Excellent bilateral filtering algorithm and high spectrum image sky spectrum signature extracting method are selected based on classification
CN110738621A (en) * 2019-10-17 2020-01-31 内蒙古工业大学 Linear structure filtering method, device, equipment and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108846808A (en) * 2018-05-28 2018-11-20 郑州云海信息技术有限公司 A kind of method and device thereof of image procossing
CN108846808B (en) * 2018-05-28 2022-06-10 郑州云海信息技术有限公司 Image processing method and device
CN116304584A (en) * 2023-05-17 2023-06-23 安徽智寰科技有限公司 Self-adaptive noise filtering method based on envelope spectrum peak value screening
CN117689556A (en) * 2024-02-02 2024-03-12 深圳市欧冶半导体有限公司 Histogram coding method, histogram decoding method, device, equipment and medium
CN117689556B (en) * 2024-02-02 2024-05-07 深圳市欧冶半导体有限公司 Histogram coding method, histogram decoding method, device, equipment and medium

Also Published As

Publication number Publication date
CN112233051B (en) 2024-05-10

Similar Documents

Publication Publication Date Title
CN112233051A (en) Median filtering method, median filtering device and computer readable storage medium
Camarena et al. Two-step fuzzy logic-based method for impulse noise detection in colour images
KR100739753B1 (en) Method and apparatus of bidirectional temporal noise reduction
CN102132554A (en) Method and system for efficient video processing
CN111681174A (en) Joint filtering method for inhibiting salt and pepper/Gaussian noise mixing target image
US6701026B1 (en) Method and apparatus for cancelling lighting variations in object recognition
Yadav Color image noise removal by modified adaptive threshold median filter for RVIN
EP3462409B1 (en) A method for filtering spurious pixels in a depth-map
Rahman et al. Gaussian noise reduction in digital images using a modified fuzzy filter
Roy et al. Fuzzy SVM based fuzzy adaptive filter for denoising impulse noise from color images
Ma et al. Difference based median filter for removal of random value impulse noise in images
Chen et al. Iterative grouping median filter for removal of fixed value impulse noise
CN110555863A (en) moving object detection method and device and computer readable storage medium
Mújica-Vargas et al. An efficient nonlinear approach for removing fixed-value impulse noise from grayscale images
CN113296095A (en) Target hyperbolic edge extraction method for pulse ground penetrating radar
Pérez-Benito et al. A model based on local graphs for colour images and its application for Gaussian noise smoothing
Chan et al. Fast non-local filtering by random sampling: it works, especially for large images
Rama Lakshmi et al. A Review on Image Denoising Algorithms for Various Applications
Kosar et al. An overview of denoising methods for different types of noises present on graphic images
Malik et al. Contrast enhancement and smoothing of CT images for diagnosis
CN115908802A (en) Camera shielding detection method and device, electronic equipment and readable storage medium
Shankar et al. Object oriented fuzzy filter for noise reduction of Pgm images
Elmogy et al. Image noise detection and removal based on enhanced gridLOF algorithm
Tu et al. Constant time bilateral filtering for color images
Chen et al. A pilot study on a new image enhancement method using spatial statistics

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant