Learning Matlab at uni, need some help

1 回表示 (過去 30 日間)
Andrew
Andrew 2014 年 9 月 15 日
コメント済み: Andrew 2014 年 9 月 15 日
a. Create horizontal lines across the image by making every 8th row of the image a row of white pixels (value = 254). View result.
b. Do the same in the vertical direction to create a grid over the image. View result.
c. Extract only the woman’s face and view this section only (Turn the axis on to help you identify which parts of the matrix to index. Use: axis on to do this).
My Code:
load woman;
for i=1:8:length(X)
X(i,:)=254;
X(:,i)=254;
end
axis on
imshow(uint8(X));
Have i done this correct, with the axis on?

採用された回答

Adam
Adam 2014 年 9 月 15 日
編集済み: Adam 2014 年 9 月 15 日
X(1:8:end,:) = 254;
X(:,1:8:end) = 254;
would do the job rather than using a for loop.
  1 件のコメント
Andrew
Andrew 2014 年 9 月 15 日
thanks man, really simplifies it.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2014 年 9 月 15 日
Since it says "over" the image rather than "in" the image, I'd put lines into the overlay using "hold on" and then the line() function. Try that.
Then to "extract" I can't tell because you didn't include the image. Perhaps you can threshold or do color segmentation, or perhaps you can simply crop with imcrop() at specified coordinates. "Extract" is ambiguous so it could mean either of those. It's probably the latter since it hinted to turn on the axis tick marks.
  1 件のコメント
Andrew
Andrew 2014 年 9 月 15 日
yeah, sounds good. ill work on it

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

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by