Problem 1186. 2D - Mean Filter
Assume you are given an "image" matrix of size NxM. Reduce the image noise by implementing a mean filter window of size 9 (a 3x3 averaging window). The image matrix will have integer elements from 0 to 255 (to reflect 8 bits of resolution).
The averaging window is a square matrix of odd size where the center element (pixel) is the one that is being operated on. Replace the center pixel with the average of the pixels the matrix window encompasses. This is accomplished for every pixel. The output should be the filtered image matrix. Each average should be rounded to the nearest integer
Note: If the window filter overlaps the edge of an image use zero (0) for missing values
Example:
Operating on the first element of matrix
[1 2 3 4 5; 6 7 8 9 10; 11 12 13 14 15]
would have the window:
[0 0 0; 0 1 2; 0 6 7]
this will result in:
B(1,1) = 2
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers60
Suggested Problems
-
22256 Solvers
-
Maximum running product for a string of numbers
2161 Solvers
-
5602 Solvers
-
Find the peak 3n+1 sequence value
2498 Solvers
-
How to find the position of an element in a vector without using the find function
2728 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!