2011-03-27 69 views

回答

1

如果是直的長方形,只是設置的值在矩陣:

function Stack1() 
im = imread('peppers.png'); 
x = 10; 
y = 20; 
w = 40; 
h = 50; 
im(y:y+h,x,:) = 255; 
im(y:y+h,x+w,:) = 255; 

im(y,x:x+w,:) = 255; 
im(y+h,x:x+w,:) = 255; 

figure();imshow(im); 


end