简体   繁体   English

在图像中绘制矩形-Matlab

[英]Drawing rectangle in an image - Matlab

I need to draw a rectangle inside an image, then i want to set all the area that is out of the rectangle (that filled by the orange airBrush) to black and save the editing! 我需要在图像内绘制一个矩形,然后将所有不在矩形(由橙色airBrush填充)中的区域都设置为黑色并保存编辑!

Here is my code: 这是我的代码:

%Draw rectangle
shapeInserter = vision.ShapeInserter;
rectangle = int32([100 100 800 800]);
J = step(shapeInserter, imageA , rectangle);
imshow(J);

在此处输入图片说明

I was just drawn the rectangle, without any idea to complete my work, any help ? 我只是被画成矩形,不知道要完成我的工作,有什么帮助吗?

Image dimension is 1000x1000. 图片尺寸为1000x1000。

RickRoll = rgb2gray(imread('Rick-Roll3.png'));  % 800x800 image
I = zeros ([1000, 1000]);
I(101:100+800, 101:100+800) = RickRoll;

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM