青年梦想家 发表于 2015-11-19 21:27

matlab绘制视觉错觉图!

本帖最后由 青年梦想家 于 2015-11-19 21:29 编辑







http://attach.matlabsky.com/data/attachment/forum/201112/25/010845tttpzb5cppfe4rfr.gif
点击看图



%
% 视觉错觉图-
%
% copyright© 2007-2011 $author: baby_wolf $
%                  
% $25-Dec-2011 00:25:14$
%%
clear all
close all
hfig=figure('menu','none','pos',,'color','k') ;
hold on
axis();
axis off
%%  标注
text(0.01,1.1,'@蜀山掌门V','color',,'fontsize',8);
%%  点图
t=0:1/480:479/480;
y=sin(30*2*pi*t).*sin(2*pi*t);
hplot=plot(t,y,'g.','markersize',3);
%% 设置 gif 图片帧数等
numFrames=30;
frames = struct('cdata', [], 'colormap', []);
frames(numFrames) = frames;
%% 循环绘制各帧
k=0;
while k<=30%ishandle(hfig)
    y=y();
   set(hplot,'xdata',t,'ydata',y);         %点图 移动
pause(0.1);
k=k+1;
frames(k)=getframe(gcf);   %获取当前帧
end
%% 写gif文件
animated(1,1,1,numFrames) = 0;
for k=1:numFrames
   if k == 1
       = rgb2ind(frames(k).cdata, 256, 'nodither');
   else
      animated(:,:,1,k) = ...
         rgb2ind(frames(k).cdata, cmap, 'nodither');
   end     
end
%%  
filename = 'illusorygif2.gif';
if ~exist(filename,'file');
imwrite(animated, cmap, filename, 'DelayTime', 0.1, ...
   'LoopCount', inf);
end
web(filename)




1345389794 发表于 2015-11-19 22:31

赞!!!!!!!!!!!!!!!!!!!

数学中国YY主管 发表于 2015-11-19 23:52

这个图我给满分

青年梦想家 发表于 2015-11-20 14:36

数学中国YY主管 发表于 2015-11-19 23:52 static/image/common/back.gif
这个图我给满分

:)

青年梦想家 发表于 2015-11-20 14:37

1345389794 发表于 2015-11-19 22:31 static/image/common/back.gif
赞!!!!!!!!!!!!!!!!!!!

:P:P:P

森之张卫东 发表于 2015-11-20 22:50

好厉害的图啊!!!
页: [1]
查看完整版本: matlab绘制视觉错觉图!