Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A = [1 2 3 4 5
- 6 7 8 9 10
- -1 3 4 8 13
- 4 2 0 9 1]
- A = [1 2 3 4 5
- 6 8 9 10 10
- -1 8 9 13 13
- 4 2 0 9 1]
- %%// Dilate to get the max of a 9x9 neighborhood (including the element itself)
- A1 = imdilate(A, true(3));
- %%// Since you are looking to keep the boundary elements
- m1 = ones(size(A));
- m1(2:end-1,2:end-1)=0;
- A1 = m1.*A+~m1.*A1
- %%// Dilate to get the max of a 8x8 neighborhood (excluding the element itself)
- h = true(3);
- h(2,2)=false;
- A1 = imdilate(A,h);
- %%// Since you are looking to keep the boundary elements
- m1 = ones(size(A));
- m1(2:end-1,2:end-1)=0;
- A1 = m1.*A+~m1.*A1
- fun = @(x) max(x(:)),
- B = nlfilter(YourImage,[3 3],fun);
- fun=@(x) max([x(1:3, 1)' x(1,2) x(3,2) x(1:3,3)'])
- B = ordfilt2(A, 9, ones(3,3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement