资源简介
sfs shape from shading 由阴影到形状 tsai 的三篇论文以及代码,试验用图片。
代码片段和文件信息
#include
//#include
//#include
#include
#include
#include “ImageTools.h“
#include “UCFReadPic.c“
#define SSize 256
struct rusage rusage;
long btsbtmetsetm;
main()
{
char filename[80];
FILE *outfile*infile;
int ijIiterSize;
float SxSySzPsQspqpqPQsfZdfZEijWn=0.0001*0.0001YK;
float Zn[SSize][SSize]Zn1[SSize][SSize]Si1[SSize][SSize]Si[SSize][SSize];
PIC pic1;
/* for synthetic images usually 1 or 2 iterations are enough */
printf(“Input number of iterations : “);
scanf(“%d“&iter);
printf(“Input size of image : “);
scanf(“%d“&Size);
if(Size > 256)
{
printf(“Image size too large!\n“);
exit(1);
}
/* assume the initial estimate zero at time n-1 */
for(i=0;i for(j=0;j Zn1[i][j] = 0.0;
Si1[i][j] = 1.0; }
printf(“Input the image filename : “);
scanf(“%s“filename);
if((infile = fopen(filename“r“)) == NULL)
{
fprintf(stderr“Error Opening file : %s\n“filename);
exit(1);
}
pic1 = UCFReadPic(infile);
printf(“\nInput the light source direction : \n“);
printf(“\nSx = “);
scanf(“%f“&Sx);
printf(“\n“);
printf(“Sy = “);
scanf(“%f“&Sy);
printf(“\n“);
printf(“Sz = “);
scanf(“%f“&Sz);
printf(“\n“);
if(Sx == 0 && Sy == 0) Sx = Sy = 0.01;
Ps = Sx/Sz;
Qs = Sy/Sz;
/************************************************************************/
getrusage(0&rusage);
bts = rusage.ru_utime.tv_sec;
btm = rusage.ru_utime.tv_usec;
for(I=1;I<=iter;I++){
for(i=0;i for(j=0;j if(j-1 < 0 || i-1 < 0) /* take care boundary */
p = q = 0.0;
else {
p = Zn1[i][j] - Zn1[i][(j-1)];
q = Zn1[i][j] - Zn1[i-1][j]; }
pq = 1.0 + p*p + q*q;
PQs = 1.0 + Ps*Ps + Qs*Qs;
Eij = pic1.image[i*pic1.maxX+j]/255.0;
fZ = -1.0*(Eij - MAX(0.0(1+p*Ps+q*Qs)/(sqrt(pq)*sqrt(PQs))));
dfZ = -1.0*((Ps+Qs)/(sqrt(pq)*sqrt(PQs))-(p+q)*(1.0+p*Ps+q*Qs)/
(sqrt(pq*pq*pq)*sqrt(PQs))) ;
Y = fZ + dfZ*Zn1[i][j];
K = Si1[i][j]*dfZ/(Wn+dfZ*Si1[i][j]*dfZ);
Si[i][j] = (1.0 - K*dfZ)*Si1[i][j];
Zn[i][j] = Zn1[i][j] + K*(Y-dfZ*Zn1[i][j]);}
for(i=0;i for(j=0;j Zn1[i][j] = Zn[i][j];
Si1[i][j] = Si[i][j];}
}
getrusage(0&rusage);
ets = rusage.ru_utime.tv_sec;
etm = rusage.ru_utime.tv_usec;
printf(“ %ld sec. %ld usec. \n“ets-btsetm-btm);
printf(“\nOutput depth map !\n“);
sprintf(filename“final.out“);
outfile = fopen(filename“w“);
for(i=0;i for(j=0;j fprintf(outfile“%f\n“Zn[i][j]);
fclose(outfile);
} /* end of main */
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 12626 2000-01-31 20:26 Source_Codes\BPentland\bpent.c
文件 44 2000-01-31 21:21 Source_Codes\BPentland\Readme
文件 4749 2000-01-31 20:33 Source_Codes\Horn\horn.c
文件 42 2000-01-31 21:21 Source_Codes\Horn\Readme
文件 1780 2008-10-22 17:09 Source_Codes\ImageTools.h
文件 17346 2000-01-31 20:46 Source_Codes\LKuo\calc_C.c
文件 1283 2000-01-31 20:46 Source_Codes\LKuo\create_image.c
文件 289 1994-06-09 03:12 Source_Codes\LKuo\DEF.h
文件 1436 1994-06-09 03:12 Source_Codes\LKuo\GSI.c
文件 1439 1994-06-09 03:12 Source_Codes\LKuo\GSI2.c
文件 1166 1994-06-09 03:12 Source_Codes\LKuo\interp.c
文件 2328 2000-01-31 20:46 Source_Codes\LKuo\inverse.c
文件 477 1994-06-09 03:12 Source_Codes\LKuo\load_depth.c
文件 667 2000-01-31 20:41 Source_Codes\LKuo\makefile
文件 64839 2000-01-31 20:51 Source_Codes\LKuo\multigrid
文件 3104 1994-06-09 03:12 Source_Codes\LKuo\multigrid.bak
文件 5538 2000-01-31 20:39 Source_Codes\LKuo\multigrid.c
文件 349 1994-11-21 17:11 Source_Codes\LKuo\nrutil.h
文件 619520 1995-06-14 20:59 Source_Codes\LKuo\out00-00.dep
文件 65548 1995-06-14 20:58 Source_Codes\LKuo\out00-00.img
文件 619520 1995-06-14 20:59 Source_Codes\LKuo\out00.dep
文件 65548 1995-06-14 20:59 Source_Codes\LKuo\out00.img
文件 852 2000-01-31 20:43 Source_Codes\LKuo\readimg.c
文件 22 2000-01-31 21:19 Source_Codes\LKuo\Readme
文件 784 1994-06-09 03:12 Source_Codes\LKuo\residual.c
文件 646 1994-06-09 03:12 Source_Codes\LKuo\rstrct.c
文件 10212 2000-01-31 21:00 Source_Codes\LRos\lros.c
文件 42 2000-01-31 21:21 Source_Codes\LRos\Readme
文件 11467 2000-01-31 21:18 Source_Codes\Pentland\pentland.c
文件 50 2000-01-31 21:22 Source_Codes\Pentland\Readme
............此处省略62个文件信息
- 上一篇:《基于GIS的数量方法与应用》王法辉
- 下一篇:ISO11452-4 2011
评论
共有 条评论