clear all
close all
clc
Periods = input('请输入你希望的周期大小:');
f0 = 1/Periods;
Row1 = 2730;
Row2 = 4096;
X0 = meshgrid(1:Row2,1:Row1);
%%the fringes whose phases add to 2*pi/3 from one to one
aa = ones(2730,4096,3)*255;
imwrite(uint8(aa),'white.bmp');
%%%%
%%red fringe
RCosFringe1 = 128+128*sin(2*pi*f0*X0+2*pi*1/3);
ReFr1 = zeros(Row1,Row2,3);
ReFr1(:,:,1) = RCosFringe1;clear RCosFringe1
ReFr1(1361:1368,2044:2051,:) = 0;
ww = aa - ReFr1;
ww(1361:1368,2044:2051,:) = 0;
imwrite(uint8(ReFr1),'ReFr11.bmp');
imwrite(uint8(ww),'CReFr11.bmp');
clear ww ReFr1
%%%%%
GCosFringe2 = 128+128*sin(2*pi*f0*X0+2*pi*2/3);
GrFr2 = zeros(Row1,Row2,3);
GrFr2(:,:,2) = GCosFringe2;clear GCosFringe2
GrFr2(1361:1368,2044:2051,:) = 0;
ww = aa - GrFr2;
ww(1361:1368,2044:2051,:) = 0;
imwrite(uint8(GrFr2),'GrFr22.bmp');
imwrite(uint8(ww),'CGrFr22.bmp');
clear ww GrFr2
%%%%%
BCosFringe3 = 128+128*sin(2*pi*f0*X0+2*pi*3/3);
BlFr3 = zeros(Row1,Row2,3);
BlFr3(:,:,3) = BCosFringe3;clear BCosFringe3
BlFr3(1361:1368,2044:2051,:) = 0;
ww = aa - Blfr3;
ww(1361:1368,2044:2051,:) = 0;
imwrite(uint8(BlFr3),'BlFr33.bmp');
imwrite(uint8(ww),'CBlFr33.bmp');
clear ww BlFr3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RGBColor = zeros(Row1,Row2,3);
RGBColor(:,:,1) = 128+128*sin(2*pi*f0*X0+2*pi*1/3);
RGBColor(:,:,2) = 128+128*sin(2*pi*f0*X0+2*pi*2/3);
RGBColor(:,:,3) = 128+128*sin(2*pi*f0*X0+2*pi*3/3);
RGBColor(1361:1368,2044:2051,:) = 0;
imwrite(uint8(RGBColor),'Color1,bmp');
RGBColor(678:685,1020:1027,:) = 0;
RGBColor(678:685,3068:3075,:) = 0;
RGBColor(2042:2049,1020:1027,:) = 0;
RGBColor(2042:2049,3068:3,:) = 0;
ww = aa - RGBColor;
ww(1361:1368,2044:2051,:) = 0;
imwrite(uint8(ww),'CColor1,bmp');
clear ww RGBColor