Andhika
Andhika

Reputation: 21

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

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 ?

Upvotes: 2

Views: 38

Answers (1)

nkjt
nkjt

Reputation: 7817

If you padded symmetrically with n zeros you can just index back using end:

I_orig = I_padded(n+1:end-n,n+1:end-n);

Upvotes: 2

Related Questions