Matlab Image Processing: Bound image by a rectangle
I have an image and I plotted the boundary of the image. Can anyone please tell me how to draw a rectangle on the image by overwriting the boundary pixel values, using MAT开发者_运维知识库LAB.
If it is a straight rectangle, just set the values in the matrix:
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
Probably you can use this File Exchange submission:
Draw a border around an image
精彩评论