資源簡介
shape from shaping 3D重構
代碼片段和文件信息
clear?all;
%?Import?the?images?here
%?Thinking?about?flipping?the?images?up_side_down
%?into?the?ordinary?x_y?plane?coordinate
%%
%picstr=dir(‘*.bmp‘);
%[rowcol]=size(picstr);
%shadow_image=cell(row1);
%for?i=1:row
%??shadow_image{i}=imread(picstr(i).name);
%end
%%
shadow_image=cell(17);
for?i=1:7
????temp=num2str(i);
????shadow_image{i}=imread(strcat(‘B‘temp‘.bmp‘));
end
[Height?Width]?=?size(shadow_image{1});
%?Build?your?own?V?here
%?V?=?255*[??1??????0??????0;
%????????????0??????1??????0;
%????????????1??????0??????0;
%????????????0??????1??????0;
%????????????1??????0??????0;
%????????????0??????1??????0;
%????????????1??????0??????0;????????????];
V=?255*[0.1?0?0.995;
?0.8?0?0.6;
0.707?0?0.707;
-0.707?0?0.707;
?0?0.707?0.707;
??0.56568?0.56568?0.6;
0.56568?0.56568?0.6;];
%%
shape_r?=?1;?%?Grid?of?reconstruction?to?save?time?set?it?2~4?during?debuging?
%?Normal?calculation
for?x?=??1?:?Width/shape_r
????for?y?=??1?:?Height/shape_r
????????for?k?=?1?:7
????????????i(k1)?=?shadow_image{k}(shape_r*yshape_r*x);
????????end
????????I?=?diag(i);
????????Ii?=?I*i;
????????IV?=?I*V;
????????if(det(IV‘*IV)~=0)??????????
????????????temp?=?inv(IV‘*IV)*IV‘*Ii;
????????????g(yx:)?=?temp;
????????????if(abs(norm(?temp))<10)
????????????????albedo(yx)?=?norm(?temp);?????????????????????
????????????????n(yx:)?=?g(yx:)./albedo(yx);
????????????????p(yx)?=?-n(yx1)/n(yx3);
????????????????q(yx)?=?-n(yx2)/n(yx3);???
????????????else
????????????????temp?=?[0;0;0];
????????????????g(yx:)?=?temp;
????????????????albedo(yx)?=?0;?????
????????????????n(yx:)?=?temp;
????????????????p(yx)?=?0;???q(yx)?=?0;??????
????????????end
????????else
????????????temp?=?[0;0;0];
????????????g(yx:)?=?temp;
????????????albedo(yx)?=?0;?????
????????????n(yx:)?=?temp;
????????????p(yx)?=?0;???q(yx)?=?0;????????
????????end
????end
end
for?x?=??2?:?Width/shape_r
????for?y?=??2?:?Height/shape_r
????????if(abs((p(yx)-p(y-1x))-(q(yx)-q(yx-1)))>5)
????????????p(yx)=0;
????????????q(yx)=0;
????????end
????end
end
%%
imshow(albedo);
plot(norm);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2173??2012-10-22?21:55??SFScode.m
?????文件?????123478??2005-02-23?14:53??B1.bmp
?????文件?????123478??2005-02-23?14:53??B2.bmp
?????文件?????123478??2005-02-23?14:53??B3.bmp
?????文件?????123478??2005-02-23?14:53??B4.bmp
?????文件?????123478??2005-02-23?14:53??B5.bmp
?????文件?????123478??2005-02-23?14:53??B6.bmp
?????文件?????123478??2005-02-23?14:53??B7.bmp
-----------?---------??----------?-----??----
???????????????866519????????????????????8
- 上一篇:一維信號壓縮還原信號
- 下一篇:車牌識別小程序
評論
共有 條評論