image thumbnail

Padding of zeros

by

 

To pad zeros to the matrix in rows as well as column.

pad.m
clc;
clear all;


a=uigetfile('*.*');
a=imread(a);

[row column cc]= size(a);

b= input('enter the value for row zero padding::');
c=input('enter the value for column zero padding::');

x = zeros(row+b,column+c);


for i= 1 : row
    for j =1 : column
        x(i+b/2,j+c/2)=a(i,j);
    end
end

imshow(x);

Contact us