How to assign zero value to plotted lines

Hi,
I have the following codes to plot lines on an image. I want to assign zero value to the lines plotted by the following codes. How can I do this ?
plot([xleft xleft],[ytop ybottom],'b','LineWidth',2);
plot([xright xright],[ytop ybottom],'b','LineWidth',2);
plot([xleft xright],[ymiddle ymiddle],'r','LineWidth',2);
plot([xmiddle xright],[ytop ymiddle],'y','LineWidth',2);
plot([xmiddle xright],[ybottom ymiddle],'y','LineWidth',2);
plot([floor(xmiddle/2) xright],[ytop ymiddle],'g','LineWidth',2);
plot([floor(xmiddle/2) xright],[ybottom ymiddle],'g','LineWidth',2);

4 件のコメント

Stephen23
Stephen23 2016 年 1 月 6 日
編集済み: Stephen23 2016 年 1 月 6 日
S C. Carl's "Answer" moved here:
I want to make more clear my question ;
I want to assign zero value to pixels that show lines plotted by the above codes How to do this ?
Stephen23
Stephen23 2016 年 1 月 6 日
Can you explain what you mean by "assign zero value to pixels"? A line is simply some colored pixels, what would they be like if zero was "assigned" to them? How could this be checked or used?
Jan
Jan 2016 年 1 月 6 日
It does not makes sense to assign a number to a pixel or to a line. What do you expect as result of such an "assignment"?
Geoff Hayes
Geoff Hayes 2016 年 1 月 6 日
@S.C. - are you trying to draw a box (square or rectangle) on an image (perhaps shown with imshow) with its lines coloured black (zero for each of the red, green, and blue pixel along these lines)?

サインインしてコメントする。

回答 (1 件)

harjeet singh
harjeet singh 2016 年 1 月 6 日

0 投票

hello dear use this code
clear all
close all
clc
x_left=10;
y_left=10;
x_right=100;
y_right=100;
img(1:200,1:200,1:3)=255;
img=uint8(img);
img(x_left:x_right,y_left,:)=0;
img(x_left:x_right,y_right,:)=0;
img(x_left,y_left:y_right,:)=0;
img(x_right,y_left:y_right,:)=0;
figure(1)
imshow(img)

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

タグ

質問済み:

2016 年 1 月 6 日

回答済み:

2016 年 1 月 6 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by