AlfroJang80
AlfroJang80

Reputation: 125

MATLAB - padarray()

I have the FFT of an image that is a 55x36 complex double, I'm trying to make it 760x1064 by zero-padding. I'm using the padarray() function but for some reason it's not padding by the amount I want.

IMAGE1 in the following is 55x36

padarray(IMAGE1, [760-55 1064-36])

This gives me a 1465x2902 not a 760x1064. Why?

Upvotes: 0

Views: 705

Answers (1)

Matt
Matt

Reputation: 1362

padarray, by default, pads both before and after your array. So your resulting matrix will have a size of 705+55+705 = 1465 in the first dimension. If you want to pad only after your array in each dimension, you can use the 'post' option, if you wanted to pad before your array you can use the 'pre' option.

A = padarray(IMAGE1, [760-55 1064-36], 'post');
size(A)

ans =

         760        1064

Upvotes: 3

Related Questions