Cody

# Problem 1186. 2D - Mean Filter

Solution 187482

Submitted on 7 Jan 2013
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% A = 127*ones(5,4) B_correct = [56 85 85 56; 85 127 127 85; 85 127 127 85; 85 127 127 85; 56 85 85 56] assert(isequal(med_filt(A),B_correct)) clear all

``` A = 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 B_correct = 56 85 85 56 85 127 127 85 85 127 127 85 85 127 127 85 56 85 85 56 Test_Matrix = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 0 0 0 0 127 127 127 127 0 0 0 0 127 127 127 127 0 0 0 0 127 127 127 127 0 0 0 0 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 B = 56 85 85 56 85 127 127 85 85 127 127 85 85 127 127 85 56 85 85 56 ```

2   Fail
%% A(1,:) = [0:7:63]; A(2,:) = [63:7:127]; A(3,:) = [128:7:191]; A(4,:) = [192:7:256]; A B_correct = [16 26 30 35 40 44 49 54 58 40; 45 71 78 85 92 99 106 113 120 82; 87 135 142 149 156 163 170 177 184 125; 73 111 116 121 125 130 135 139 144 98] assert(isequal(med_filt(A),B_correct))

```Error: Assertion failed. ```

3   Fail
%% clear all A = [71 128 192 246 215; 174 246 65 140 65; 168 87 130 35 208; 42 150 179 38 62; 30 57 228 66 238] B_correct = [69 97 113 103 74; 97 140 141 144 101; 96 138 119 102 61; 59 119 108 132 72; 31 76 80 90 45] assert(isequal(med_filt(A),B_correct))

```Error: Assertion failed. ```