Effacer les filtres
Effacer les filtres

why color fringes are not deformed by peak function?

2 vues (au cours des 30 derniers jours)
ajeet verma
ajeet verma le 27 Mar 2017
Commenté : KSSV le 27 Mar 2017
i have a code in which fringe pattern is projected on the 3D object(peaks) and fringes are deformed according to peaks. code is--
m=1000;
n=1000;
%object
[x,y,z]=peaks;
z=imresize(z,[m,n]);
Q=exp(1i*z*1);
subplot(2,3,1),imshow(z,[])
%sinusoidal fringes
f1=30;
f2=0;
for i = 1:m
for j=1:n
a(i,j)=exp(1i*2*pi*(f1*j/n+f2*i/m));
end
end
V=128*(real(a)+1);
subplot(2,3,2),imshow(V,[])
%modulation
U=128*(real(a.*Q)+1);
subplot(2,3,3),imshow(U,[])
but when color fringe patterns are projected, these are not deformed but i need . code is given
%color fringe projection
m=1000;
n=1000;
% object
[x,y,z]=peaks;
z=imresize(z,[m,n]);
Q=exp(1i*z*2);
subplot(331),imshow(z,[]),impixelinfo;
% color fringes
f1=20; % No. of vertical fringes
f2=0; % No. of horizontal fringes
a1 = zeros(m,n) ;
a2 = zeros(m,n) ;
a3 = zeros(m,n) ;
for i=1:m
for j=1:n
a1(i,j)=exp(1i*(2*pi*(f1*j/n+f2*i/m)-2*pi/3));
a2(i,j)=exp(1i*(2*pi*(f1*j/n+f2*i/m)));
a3(i,j)=exp(1i*(2*pi*(f1*j/n+f2*i/m)+2*pi/3));
end
end
Color=zeros(m,n,3);
Color(:,:,1)=a1;
Color(:,:,2)=a2;
Color(:,:,3)=a3;
%imshow(Color,[]),impixelinfo;
imwrite(Color,'myimage1.jpg');
% seperation into r,g,b component
i = imread('myimage1.jpg'); % Read image
red = double(i(:,:,1)); % Red channel
green = double(i(:,:,2)); % Green channel
blue = double(i(:,:,3)); % Blue channel
%a = zeros(size(i, 1), size(i, 2));
%R = cat(3, red, a, a);
%G = cat(3, a, green, a);
%B = cat(3, a, a, blue);
subplot(332),imshow(red,[]);
subplot(333),imshow(green,[]);
subplot(334),imshow(blue,[]);
% projection
R=real(red.*Q);
G=real(green.*Q);
B=real(blue.*Q);
subplot(335),imshow(R,[]);
subplot(336),imshow(G,[]);
subplot(337),imshow(B,[]);
so help me please and tell me what is wrong ?
  1 commentaire
KSSV
KSSV le 27 Mar 2017
You check your folder.....a .jpg file is created on the name myimage1.jpg this is the colored image.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by