-
Notifications
You must be signed in to change notification settings - Fork 0
/
gengray.m
26 lines (26 loc) · 936 Bytes
/
gengray.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function gengray(width, height)
[P,offset] = graycode(width,height);
fprintf('Column offset: %d\nRow offset: %d\n',offset(1),offset(2));
k=1;
for j=1:2
for i=1:size(P{1},3);
if(j==1)
file_name1=['column_pattern_',num2str(k,'%0.02d'),'.bmp'];
imwrite(double(P{j}(:,:,i)),file_name1);
k=k+1;
file_name2=['column_pattern_',num2str(k,'%0.02d'),'.bmp'];
imwrite(double(1-P{j}(:,:,i)),file_name2);
k=k+1;
disp([file_name1,' and ',file_name2,'..written']);
else
file_name1=['row_pattern_',num2str(k,'%0.02d'),'.bmp'];
imwrite(double(P{j}(:,:,i)),file_name1);
k=k+1;
file_name2=['row_pattern_',num2str(k,'%0.02d'),'.bmp'];
imwrite(double(1-P{j}(:,:,i)),file_name2);
k=k+1;
disp([file_name1,' and ',file_name2,'..written']);
end
end
end
clear P