function [Y, U, V] = pad_images(Y, U, V, padding)



col_left  = Y(:,1) ;

padding1  = repmat(col_left,1,padding) ;

col_right = Y(:,size(Y,2)) ;

padding2  = repmat(col_right,1,padding) ;

Y = [padding1 Y padding2] ;



row_upper = Y(1,:) ;

padding3  = repmat(row_upper,padding,1) ;

row_down  = Y(size(Y,1),:) ;

padding4  = repmat(row_down,padding,1) ;

Y = [padding3 ; Y ; padding4] ;



col_left  = U(:,1) ;

padding1  = repmat(col_left,1,padding/2) ;

col_right = U(:,size(U,2)) ;

padding2  = repmat(col_right,1,padding/2) ;

U = [padding1 U padding2] ;



row_upper = U(1,:) ;

padding3  = repmat(row_upper,padding/2,1) ;

row_down  = U(size(U,1),:) ;

padding4  = repmat(row_down,padding/2,1) ;

U = [padding3 ; U ; padding4] ;



col_left  = V(:,1) ;

padding1  = repmat(col_left,1,padding/2) ;

col_right = V(:,size(V,2)) ;

padding2  = repmat(col_right,1,padding/2) ;

V = [padding1 V padding2] ;



row_upper = V(1,:) ;

padding3  = repmat(row_upper,padding/2,1) ;

row_down  = V(size(V,1),:) ;

padding4  = repmat(row_down,padding/2,1) ;

V = [padding3 ; V ; padding4] ;

