本帖最后由 jiuri1989 于 2012-3-7 10:36 编辑
请求加精。。
图形一
扫视图片,黄线交叉点会出现颜色。这是一种至今无法解释的视觉现象。
- [hide]%
- %
- %
- %
- close all
- clear all
- %% 设置
- N=520; %设置图像宽度
- Lwidth=12; %设置方块间隔宽度
- Swidth=60; %设置方块宽度
- Pwidth=Lwidth+Swidth;
- I=ones(N,N)*0.5;
- % I(:,:,1)=0;
- % I(:,:,2)=0.8;
- % I(:,:,3)=1;
- for i=Lwidth:Pwidth:N-Pwidth
- for j=Lwidth:Pwidth:N-Pwidth
- I(i:i+Swidth-1,j:j+Swidth-1)=0;
- % I(i:i+29,j:j+29,2)=0;
- % I(i:i+29,j:j+29,3)=0;
- end
- end
- imshow(I);
- hold on
- for i=(Pwidth+Lwidth/2):Pwidth:N-Pwidth
- for j=(Pwidth+Lwidth/2):Pwidth:N-Pwidth
- % plot(i,j,'o','markersize',0.8*Lwidth,'markerfacecolor','w','markeredgecolor','none');
- end
- end
- colormap hot[/hide]
复制代码
图形二
这些点的运动据说能看出6种不同的运动方式。。。。
- %
- % 视觉错觉图-
- %
- % copyright© 2007-2011 $author: baby_wolf $
- % $25-Dec-2011 00:25:14$
- %%
- clear all
- close all
- hfig=figure('menu','none','pos',[200 200 800 300],'color','k') ;
- hold on
- axis([0 1 -2 2]);
- axis off
- %% 标注
- text(0.01,1.1,'@蜀山掌门V','color',[0.5 0.06 0.9],'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([17:end,1:16]);
- 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
- [animated, cmap] = 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)
复制代码
- [hide]
- % 视觉错觉图-
- %
- % copyright© 2007-2011 $author: baby_wolf $
- % $25-Dec-2011 00:25:14$
- %%
- clear all
- close all
- hfig=figure('menu','none','pos',[200 200 800 300],'color','k') ;
- hold on
- axis([0 1 -2 2]);
- axis off
- %% 标注
- text(0.01,1.1,'@蜀山掌门V','color',[0.5 0.06 0.9],'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([17:end,1:16]);
- 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
- [animated, cmap] = rgb2ind(frames(k).cdata, 256, 'nodither');
- else
- animated(:,:,1,k) = ...
- rgb2ind(frames(k).cdata, cmap, 'nodither');
- end
- end
- %%
- filename = 'illusorygif1.gif';
- if ~exist(filename,'file');
- imwrite(animated, cmap, filename, 'DelayTime', 0.1, ...
- 'LoopCount', inf);
- end
- web(filename)
复制代码
- [hide]%
- % 视觉错觉图-
- %
- % copyright© 2007-2011 $author: baby_wolf $
- % $25-Dec-2011 00:25:14$
- %%
- clear all
- close all
- hfig=figure('menu','none','pos',[200 200 800 300],'color','k') ;
- hold on
- axis([0 1 -2 2]);
- axis off
- %% 标注
- text(0.01,1.1,'@蜀山掌门V','color',[0.5 0.06 0.9],'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);
- %% 红色包络线
- tmax=1/120:1/30:1;
- ymax=sin(30*2*pi*tmax).*sin(2*pi*tmax);
- hplotmax=plot(tmax,ymax,'r');
- %% 绿色包络线
- tmin=3/120:1/30:1;
- ymin=sin(30*2*pi*tmin).*sin(2*pi*tmin);
- hplotmin=plot(tmin,ymin,'g');
- %% 30条斜线
- t2=[tmax',tmin']; %n by 2 matrix
- y2=[ymax',ymin'];
- n=size(t2,1);
- h=zeros(1,n);
- for i=1:n
- h(i)=plot(t2(i,:),y2(i,:),'color',rand(1,3));
- end
- %% 设置 gif 图片帧数等
- numFrames=30;
- frames = struct('cdata', [], 'colormap', []);
- frames(numFrames) = frames;
- %% 循环绘制各帧
- k=0;
- while k<=30%ishandle(hfig)
- ymin=ymin([2:end,1]);
- ymax=ymax([2:end,1]);
- y=y([17:end,1:16]);
- set(hplotmin,'xdata',tmin,'ydata',ymin);%绿色包络线 移动
- set(hplotmax,'xdata',tmax,'ydata',ymax);%红色包络线 移动
- set(hplot,'xdata',t,'ydata',y); %点图 移动
- y2=y2([2:end,1],:);
- for i=1:n
- set(h(i),'xdata',t2(i,:),'ydata',y2(i,:)); %30条线移动
- end
- 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
- [animated, cmap] = rgb2ind(frames(k).cdata, 256, 'nodither');
- else
- animated(:,:,1,k) = ...
- rgb2ind(frames(k).cdata, cmap, 'nodither');
- end
- end
- %%
- filename = 'illusorygif3.gif';
- if ~exist(filename,'file');
- imwrite(animated, cmap, filename, 'DelayTime', 0.1, ...
- 'LoopCount', inf);
- end
- web(filename)[/hide]
复制代码
1
|
|
|
|