Triangular Pyramid Image and Color it

조회 수: 1 (최근 30일)
Walter Roberta
Walter Roberta 2012년 12월 1일
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
Walter Roberta
Walter Roberta 2012년 12월 1일
Yes, two complete rectangles side-by-side. Therefore, please what is the codes.
Image Analyst
Image Analyst 2012년 12월 1일
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.

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

답변 (1개)

Image Analyst
Image Analyst 2012년 12월 1일
편집: Image Analyst 2012년 12월 1일
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
Cesar
Cesar 2013년 2월 15일
yes more help
Image Analyst
Image Analyst 2013년 2월 15일
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.

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by