The present invention discloses a method and system for filtering image noise; the system includes: an image acquisition unit, a judgment unit, a first filtering unit, a second filtering unit and a selecting unit; the steps includes: selecting a pixel in one of the color channels in YUV image to detect; according to all the pixels in the N*M matrix which centers on the pixel currently detected, judging whether the pixel is in a flat region; and if the pixel is in a flat region, according to the Y-component of all the pixels inside the N*M matrix, calculating and outputting the filtering strength parameter of the pixel, and then filtering the pixel according to the filtering strength parameter; the positive effects of the mentioned technical scheme are: easy in calculation; retaining image details efficiently, restoring the original color of image and improving the quality of the filtered image after filtering.
Legal claims defining the scope of protection, as filed with the USPTO.
1. A method for filtering image noise out, comprising: acquiring a YUV image, and performing image noise filtering process to an unfiltered pixel in a color channel in the image as follows; judging the pixel currently detected in accordance with all the pixels in a preset N*M matrix centering on the pixel currently detected; if the pixel currently detected is in a flat region, performing the following steps: step S 1 , calculating and outputting a filtering strength parameter which is corresponding to the pixel currently detected in accordance with a Y-component of all the pixels in the N*M matrix; step S 2 , filtering the pixel currently detected in accordance with the filtering strength parameter; step S 3 , accomplishing the image noise filtering process performed to the pixel in the color channel; wherein, N≧3, M≧3, and both N and M are odd numbers; wherein, the N*M matrix is a filtering template used in the method for filtering image noise out; wherein, if the pixel currently detected is not in a flat region in accordance with all the pixels in the preset N*M matrix centering on the pixel currently detected, performing the step as follows: performing an average filtering to the pixel currently detected, and then accomplishing the image noise filtering process performed to the pixel in the color channel; wherein judging whether the pixel currently detected is in a flat region comprises: calculating a difference value in the maximum range of the pixel corresponding to the pixel currently detected in accordance with all the pixels in the preset N*M matrix, and judging whether the difference value in the maximum range is less than a preset first threshold, and then outputting a corresponding first judgment result; calculating a variance value of all the pixels in the preset N*M matrix, and judging whether the variance value is less than a preset second threshold, and then outputting a corresponding second judgment result; calculating and judging whether maximum distance between values of filtered pixels in first row of a preset 3*M matrix is less than a preset third threshold value, and then outputting a corresponding third judgment result; when judging whether the pixel currently detected is in a flat region, also judging the following in accordance with the first judgment result, the second judgment result and the third judgment result: if the difference value in the maximum range is less than the first threshold, and the variance value is less than the second threshold, and the maximum distance is less than the third threshold, it is determined that the pixel currently detected is in a flat region; and otherwise, it is determined that the pixel currently detected is not in a flat region.
2. The method of claim 1 , wherein after performing step S 3 , performing the steps as follows: judging whether to perform the image noise filtering process to every pixel in the color channel in the image; if not performing the image noise filtering process to every pixel in the color channel in the image, turning to detect a pixel which has not been detected; and performing steps S 1 to S 3 once it is determined that the pixel currently detected is in a flat region.
3. The method of claim 2 , wherein, if performing the image noise filtering process to every pixel in the color channel in the image, performing the steps as follows: judging whether to perform the image noise filtering process to every color channel in the image; if not performing the image noise filtering process to every color channel in the image, turning to a next color channel, and selecting a pixel of the next color channel to detect; and performing steps S 1 to S 3 once it is determined that the pixel currently detected is in a flat region.
5. The method of claim 1 , wherein calculating the variance value in accordance with the following formula: X var = ∑ i = 0 , j = 0 i = N - 1 , j = M - 1 ( X i , j - X ( N - 1 2 ) , ( M - 1 2 ) ) ; wherein, X var represents the variance value of all the pixels included in the preset N*M matrix in the color channel; X ( N - 1 2 ) , ( M - 1 2 ) is the value of the pixel currently detected in the preset N*M matrix in the color channel; X i,j represents a value of a pixel located in (i+1)th row and (j+1)th column of the preset N*M matrix in the selected color channel.
7. The method of claim 1 , wherein step S 1 comprises: step S 11 , calculating a middle filtering strength parameter in accordance with a Y-component of the pixel; step S 12 , calculating out a final filtering strength parameter in accordance with the middle filtering strength parameter, and then turning to step S 2 .
8. The method of claim 7 , wherein in step S 11 , calculating the middle filtering strength parameter in accordance with the following formulas: c y = { c 1 + ( th 4 - y cur ) * ( c 2 - c 1 ) / th 4 y cur < th 4 c 1 y cur ‡ th 4 ; wherein, c y represents the middle filtering strength parameter; c 1 and c 2 are present threshold values; c 1 ≦c y ≦c 2 ; 0<c 1 <c 2 <1; th 4 represen preset forth threshold value; y cur represents an average brightness of all the pixels, which includes the pixel currently detected in the color channel, in the preset N*M matrix: y cur = 1 N * M * ∑ i = 0 , j = 0 i < N , j < M y i , j ; y i,j represents Y-component of the pixel in the (i+1)th row and (j+1) column of the preset N*M matrix.
9. The method of claim 8 , wherein in step S 12 , calculating the filtering strength parameter in accordance with the following formula: c = { c y X max _ diff £ th 5 ( c y - c 3 ) * ( th 6 - X min _ diff ) th 6 - th 5 th 5 < X max _ diff < th 6 c 3 X max _ diff ‡ th 6 ; wherein, c represents the filtering strength parameter; c 3 is the preset threshold value; c 3 ≦c≦c y ; 0<c 3 <c y <1; X max _ diff represents the maximum distance between the pixel current detected and a value of the filtered pixel in first row of the preset N*M matrix: th 5 is a preset fifth threshold; th 6 is a preset sixth threshold; th 5 <th 6 ≦th 3 .
10. The method of claim 1 , wherein in step S 2 , performing the image noise filtering process to the pixel currently detected in the color channel with the preset N*M matrix in accordance with the following formula: X 1 , ( M - 1 2 ) ′ = 1 M * ∑ j = 0 j < M ( c 2 * X 0 , j ′ + c * ( 1 - c ) * X 1 , j + ( 1 - c ) * X 2 , j ) ; wherein, X 1 , ( M - 1 2 ) ′ represents a value of the filtered pixel in the color channel currently detected in the preset N*M matrix.
11. The method of claim 1 , wherein the average filtering comprises: step S 31 , calculating distances between the pixel currently detected and each of the pixels in the preset N*M matrix centering on the pixel currently detected; step S 32 , comparing distances between each pixel and the pixel currently detected with a preset seventh threshold value individually: if the distance is less than the seventh threshold value, setting a weight of the corresponding pixel as 1; if the distance is not less than the seventh threshold value, setting a weight of the corresponding pixel as 0; step S 33 , performing a corresponding average filtering to the pixel currently detected in accordance with the pixel whose weight is 1 in the preset N*M matrix for the current detected pixel, and then turning to step S 3 .
12. The method of claim 11 , wherein performing the average filtering to the pixel currently detected in accordance with the following formulas: X ( N - 1 2 ) , ( M - 1 2 ) ′ = 1 P * ∑ i = 0 , j = 0 i = N - 1 , j = M - 1 X i , j ; X ( N - 1 2 ) , ( M - 1 2 ) ′ represents the value obtained after the pixel currently detected in the preset N*M matrix is filtered; X ij represents a value of the pixel in (i+1)th row and (j+1)th column of the preset N*M matrix; P represents that, in the N*M matrix, there are pixels, of which the number is P, satisfying: X i , j - X ( N - 1 2 ) , ( M - 1 2 ) < th 7 ; wherein, th 7 represents the preset seventh threshold.
13. The method of claim 1 , wherein in step S 2 , performing IIR (Infinite Impulse Response) filtering to the pixel in the color channel in accordance with the filtering strength parameter.
Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.
December 30, 2015
December 5, 2017
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.