Triangular Pyramid Image and Color it

1 visualización (últimos 30 días)
Walter Roberta
Walter Roberta el 1 de Dic. de 2012
Please Can Somebody tell me how to generate a triangular Pyramid image of 2 by 2 with height of 200 pixels and the base of 200 pixels; and Color the image in any two colors "http://www.google.com/imgres?q=triangular+Pyramid+image+of+2+by+2&hl=en&tbo=d&biw=1366&bih=541&tbm=isch&tbnid=hhxBKdNeShxfdM:&imgrefurl=http://www.analyzemath.com/calculus/Integrals/volume_square_pyramid.html&docid=Ts_z5lT0xhYuyM&imgurl=http://www.analyzemath.com/calculus/Integrals/volume_square_pyramid_2.gif&w=322&h=312&ei=j0O6UKCyKPCB0QHk_YH4CA&zoom=1&iact=hc&vpx=935&vpy=179&dur=12880&hovh=221&hovw=228&tx=102&ty=244&sig=116099075241339748532&page=1&tbnh=141&tbnw=150&start=0&ndsp=22&ved=1t:429,r:20,s:0,i:147" THIS IS AN EXAMPLE OF 2 BY 2 TRIANGULAR PYRAMID THAT I'M TALKING ABOUT. I would like to have codes that imshow a triangular Pyramid Image and color each with two diferent color such as Blue and Red. Can somebody do that.
  7 comentarios
Walter Roberta
Walter Roberta el 1 de Dic. de 2012
Yes, two complete rectangles side-by-side. Therefore, please what is the codes.
Image Analyst
Image Analyst el 1 de Dic. de 2012
Like I said: I gave you code for one triangle below. All you have to do is repeat it with different vertices. Simple. Just change x and y. Surely you can do that. It's so trivial that I'm not going to do it for you.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 1 de Dic. de 2012
Editada: Image Analyst el 1 de Dic. de 2012
I showed you the concepts in this solution so it should not be too hard for you to adapt that. If you want to do it a different way than I did it for you there, you might look into poly2mask(), if you have the Image Processing Toolbox. In fact that's a much easier way since you have triangles.
Alright - haven't heard back from you so I guess you need more help.
x = [100 150 50];
y = [50 150 150];
redChannel = 255 * poly2mask(x, y, 200, 200);
greenChannel = 255 * ones(200);
blueChannel = zeros(200);
rgbImage = cat(3, redChannel, greenChannel, blueChannel);
imshow(rgbImage);
axis on;
axis square;
axis image;
  2 comentarios
Cesar
Cesar el 15 de Feb. de 2013
yes more help
Image Analyst
Image Analyst el 15 de Feb. de 2013
Do you have the same assignment at Walter Roberta? Cesar, I gave you the entire solution to your assignment in http://www.mathworks.com/matlabcentral/answers/63312#comment_129804. Unfortunately you can't now turn it in as your homework because I did it all for you.

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by