开发者

Matlab Image Processing: Bound image by a rectangle

开发者 https://www.devze.com 2023-02-19 20:02 出处:网络
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 overwritingthe boundary pixel values, using MAT开发者_运维知识库LAB.If it is

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

0

精彩评论

暂无评论...
验证码 换一张
取 消