here is my code again
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
a = imread('anw2.jpg');% original image b = im2bw(a); p = zeros(); b = zeros(); f = gcd(f1,f2); T = 1/f; N1 = f1/f; N2 = f2/f; N = N1+N2; for t = 0.0001:0.00005:T;%picking random samples to test the code tpif1 = 2*pi*f1*t; tpif2 = 2*pi*f2*t;
sig = 1.5; % refractive index of the prisms
x = sig/2*(cos(tpif1) + cos(tpif2));
y = sig/2*(sin(tpif1) - sin(tpif2));
%imagesc([min(x) max(x)],[min(y) max(y)],b);
if size(b,1)>size(b,2)
L = 0.5*size(b,2);
else
L = 0.5*size(b,1);
end
X = L + L*x/sig; % mapping the image to a rosette pattern
Y = L + L*y/sig;
if((round(Y)>0)&&(round(X)>0))
d(round(Y),round(X)) = b(round(Y),round(X));
end
% d is a sampled image
A = pi*(f1-f2)*t;
if (A>=0)
i = (A*N/pi)+1;
else
i = (A*N/pi)+(2*pi)+1;%rows or no of half petals
end
Np = 1/(2*f*N*t);%the number of samples in each half of a petal
NT = 2*N*Np;%total number of samples in all petals of the rosette pattern for Nj= 1:NT;%desired no of samples D = Nj/Np; if(mod(D,2)==1) j = Nj -(Np*D);%doesnot make sense else j = (1+D)*Np - Nj+1;% or Np + 1 but makes sense end end
j1 = round(j); % coordinates of the rosette in 2D space (rows and columns) i1 = round(i);
disp('j1'); disp(j1); disp('i1') disp(i1); %plot(j1,i1); if((round(Y)>0)&&(round(X)>0)) p(i1,j1) = d(round(Y),round(X)); % appearance of the image in 2D space imshow(p); end end
1 件のコメント
Please, Hernry, do us the favor and format your code. It is always a good idea to make a question as easy to read as possible, especially when you want help from volunteers.
You forgot to ask a question concerning your code.
@Editors and admins: Do you have the impression that the frequence of unformatted code decreased since the new layout has been implemented?
回答 (0 件)
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!