How to return the dimension of image if I had already add padding before ?

1 view (last 30 days)
W = ones(3);
padded = padarray(W,[1, 1],'symmetric','both');
ASK : dimension = 3x3
after padding = 5x5
can you help me, how to return the dimension back to 3x3

Accepted Answer

Thorsten
Thorsten on 15 Dec 2014
Edited: Thorsten on 15 Dec 2014
W = W(2:end-1, 2:end-1);
  3 Comments
Thorsten
Thorsten on 15 Dec 2014
Sorry. It should read:
W = ones(3);
padded = padarray(W,[1, 1],'symmetric','both');
X = padded(2:end-1, 2:end-1);
size(X)
ans =
3 3

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!