Generate gray scale image which contains non overlapping triangle.

조회 수: 2 (최근 30일)
Amrita Singh
Amrita Singh 2020년 9월 27일
댓글: Rena Berman 2020년 10월 8일
Generate gray scale image of M×N having a border around it which contains n-non overlapping right angle triangle.As shown in below figure.Afterwards Image size become M+2*border×N+2*border.
  댓글 수: 8
Rik
Rik 2020년 9월 28일
Start by learning C or assembler. That way you can avoid all built-in functions, including plus and subsref.
Do you have a clear description of the functions you want to avoid? And why? To challenge yourself?
Rena Berman
Rena Berman 2020년 10월 8일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2020년 9월 27일
Try poly2mask():
binaryImage = false(M, N);
for k = 1 : numTriangles
x = rand(3, 1);
y = rand(3, 1);
thisMask = poly2mask(x, y, M, N);
binaryImage = binaryImage | thisMask;
end
imshow(binaryImage);
It should be really trivial for you to adapt it to make sure the triangles are right triangles. Just make sure 2 of the x's are the same and 2 of the y's are the same.
  댓글 수: 12
Amrita Singh
Amrita Singh 2020년 9월 28일
No, without using Inbulit function(like poly2mask).and i dont need any code...I just want to know the steps how to do this?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image 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