function Y=exteB(X,left,right,up,down)
%extension of the image X
[v,h]=size(X);
V=v+up+down;
H=h+left+right;
Y=zeros(V,H);
Y(up+(1:v),left+(1:h))=X;
Y(up:-1:1,:)=Y(up+(1:up),:);
Y(up+v+(1:down),:)=Y(up+v-(0:(down-1)),:);
Y(:,left:-1:1)=Y(:,left+(1:left));
Y(:,left+h+(1:right))=Y(:,left+h-(0:(right-1)));