params.n=400; % size of image (pixels) img=zeros (params.n); % start with a blank image % pick random parameters for each Gabor for i=1:5 params.center = 2*pi*(rand(1,2)-0.5); params.orientation = pi*rand(1); % radians (pi/4 = 45 degrees) params.width =rand (1); % 1/e half params.width of Gaussian params.sf =12*rand(1) ; % sf of sinewave carrier cycles/image params.phase = 2*pi*rand(1); % spatial params.phase of sinewave carrier (radians) params.contrast =rand(1); % contrast from 0 to 1 img = insertGabor(params, img); end % show the image using the usual conmmands figure(1) clf % scale Gabor between 0 and 255 img = scaleMat(img, [0, 255]); image (img); axis equal axis off colormap(gray(256));