Generate gray scale image which contains non overlapping triangle.

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Rik
Rik il 28 Set 2020
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?

Accedi per commentare.

Risposte (1)

Image Analyst
Image Analyst il 27 Set 2020
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 Commenti
Amrita Singh
Amrita Singh il 28 Set 2020
No, without using Inbulit function(like poly2mask).and i dont need any code...I just want to know the steps how to do this?

Accedi per commentare.

Categorie

Scopri di più su Image Processing and Computer Vision in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by