資源簡介
生成不同朝向,不同空間頻率,不同時間頻率,不同顏色的光柵程序
代碼片段和文件信息
function?IMA?=?grating(mnvarargin)
%???繪制光柵圖
%???grating(mn)?繪制光柵圖(灰度圖),m為灰度值矩陣的行數,n為列數
%???grating(mn‘PARAM1‘val1?‘PARAM2‘val2?...)?用成對出現的參數名/參數值
%???????指定光柵圖的顯示屬性,可用的參數名/參數值如下:
%???????‘Direction‘??--??設定光柵條紋的方向,其參數值為:
%???????????‘horizontal‘?--?水平條紋
%???????????‘Vertical‘???--?豎直條紋
%???????????‘circle‘?????--?同心圓條紋
%???????????‘radiated‘???--?輻射狀條紋
%
%???????‘Velocity‘??--??設定角速度,其參數值為標量
%
%???????‘Angle‘??--??設定初始相位角,其參數值為標量
%
%???????‘Color‘??--??設定光柵條紋的顏色,其參數值為:
%???????????‘Gray‘?--?黑白條紋
%???????????‘Rgb‘??--?彩色條紋
%
%???IMA?=?grating(?...?)?返回光柵圖對應的灰度值矩陣
%
%???CopyRight:xiezhh(謝中華)
%???2011.11.26
%???Example:
%???????grating(512512‘direction‘‘rad‘‘Velocity‘5000‘color‘‘rgb‘);
%???????grating(512512‘Velocity‘20‘maxgrayval‘200)
%???????grating(512512‘direction‘‘ver‘‘Velocity‘40)
%???????grating(512512‘Velocity‘20‘maxgrayval‘200‘direction‘‘cir‘)
if?nargin?2
????error(‘輸入參數過少‘);
end
[DirectionVelAngColMaxGrayVal]?=?parseInputs(varargin{:});
if?strncmpi(Direction‘hor‘3)
????x?=?(1:m)‘;
????Theta?=?x*pi/Vel;
????Theta?=?repmat(Theta[1n]);
elseif?strncmpi(Direction‘ver‘3)
????x?=?1:n;
????Theta?=?x*pi/Vel;
????Theta?=?repmat(Theta[m1]);
elseif?strncmpi(Direction‘cir‘3)
????x?=?repmat((1:n)[m1])-n/2;
????y?=?repmat((1:m)‘[1n])-m/2;
????D?=?sqrt(x.^2?+?y.^2);
????Theta?=?D*pi/Vel;
elseif?strncmpi(Direction‘rad‘3)
????x?=?repmat((1:n)[m1])-n/2;
??
- 上一篇:MSR MATLAB
- 下一篇:最小費用最大流
評論
共有 條評論