1. Original image
S = imread('pic12.jpg');
S = im2bw(S);
S2 = S;
imshow(S2);

2. Define transparent object properties
transparency = 0.5;
facecolor = [0 1 0];
edgecolor = [0 1 0];
3. Creating and drawing transparent object
x = [0 20 20 0];
y = [0 0 20 20];
z = [1 1 1 1];
tcolor(1,1,1:3) = facecolor;
h = patch(x,y,z,tcolor,'FaceAlpha',transparency,'edgecolor',edgecolor);

4. To move the object, simply set the "Xdata" and "Ydata" of the object without deleting current object and redrawing a new onject
set(h,'Xdata',x+20);
set(h,'Ydata',y+20);
