使用[Matlab]创建圣诞树

时间:2015-12-25 13:47:47

标签: xcode matlab image-processing

我正在寻找一个Matlab代码来创建一棵圣诞树 也许是一些上面的三角形和一个带有圆圈作为装饰的矩形。

1 个答案:

答案 0 :(得分:3)

没有比这简单,只需使用fillannotation

figure;
hold on;
axis off;

% Strunk
fill([3,3,4,4],[0,1,1,0],[139,69,19]./255,'LineStyle','none')

% Tree
x = [1,6,5,5.5,4.5,5,3.5,2,2.5,1.5,2,1]
y = [1,1,3,3,5,5,8,5,5,3,3,1]
fill(x,y,'g','LineStyle','none')

% Decoration
annotation('ellipse',[0.3,0.5,0.05,0.05],'Color','red','FaceColor','red')
annotation('ellipse',[0.6,0.3,0.05,0.05],'Color','red','FaceColor','red')
annotation('ellipse',[0.55,0.6,0.05,0.05],'Color','red','FaceColor','red')

result