Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
padding of zeros

Subject: padding of zeros

From: paramveer sran

Date: 17 Jun, 2011 07:20:20

Message: 1 of 4

i have an image of 497*502. to make it 512*512 i want to create a matrix of 512*512 means i want to do padding of zeros. i am doing this like: I is my image and matrix is x=zeros(n) where n=512;
how can i append this image to 512*512

Subject: padding of zeros

From: ImageAnalyst

Date: 17 Jun, 2011 10:51:24

Message: 2 of 4

On Jun 17, 3:20 am, "paramveer sran" <params...@gmail.com> wrote:
> i have an image of 497*502. to make it 512*512 i want to create a matrix of 512*512 means i want to do padding of zeros. i am doing this like: I is my image and matrix is x=zeros(n) where n=512;
> how can i append this image to 512*512

-----------------------------
You can do it manually or use padarray() int he Image Processing
Toolbox.

Subject: padding of zeros

From: Loren Shure

Date: 17 Jun, 2011 11:31:59

Message: 3 of 4


"paramveer sran" <paramsran@gmail.com> wrote in message
news:itev7k$hdq$1@newscl01ah.mathworks.com...
> i have an image of 497*502. to make it 512*512 i want to create a matrix
> of 512*512 means i want to do padding of zeros. i am doing this like: I is
> my image and matrix is x=zeros(n) where n=512;
> how can i append this image to 512*512

if size(I) = [497 502]

I(512,512) = 0;

will pad your array with zeros.

--
Loren
http://blogs.mathworks.com/loren/
http://www.mathworks.com/matlabcentral/

Subject: padding of zeros

From: Matt J

Date: 17 Jun, 2011 11:42:04

Message: 4 of 4

"paramveer sran" wrote in message <itev7k$hdq$1@newscl01ah.mathworks.com>...
>
> how can i append this image to 512*512

Also, if this is for FFT convolution purposes, note that MATLAB's fft2 has it's own zero-padding feature

fft2(I, 512,512)

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us