Simple Matlab Code for Generatig Isodipole Textures
introduction to isodipole textures
examples of the textures
references on isodipole textures
Matlab code for Isodipole Textures
Two methods are shown: a simple but slow way, and a fast vectorized method
% evenodd_demo.m
% demonstrates construction of even and odd textures, as well as decorrelated versions
%
rows=input('number of rows (e.g., 20):');
cols=input('number of columns (e.g., 30):');
fprop=input('propagated decorrelation fraction (0=even, 1=odd, 0.5=random):');
fspor=input('sporadic decorrelation fraction (0=even, 0.5=random):');
%
% the straightforward but really slow way
%
tic;
tex1=zeros(rows,cols);
tex1(1,:)=(rand(1,cols)>0.5); %random first row
tex1(:,1)=(rand(rows,1)>0.5); %random first column
%
%do the iteration, with propagated decorrelation
%
for ir=2:rows
for ic=2:cols
if (rand(1,1)0.5),rows,1)+repmat(rand(rows,1)>0.5,1,cols); %even texture
tex2=mod(tex2+cumsum(cumsum((rand(rows,cols)