From c171c057984f6aaae6ef8a2606f9b31d933a9a39 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sat, 31 Jul 2010 10:38:43 +0800 Subject: [PATCH] The Last Update. This Repo Will Be Suspended Forever... --- sources/app/image/image_prc.c | 102 +++++++++--------------------------------- 1 file changed, 21 insertions(+), 81 deletions(-) diff --git a/sources/app/image/image_prc.c b/sources/app/image/image_prc.c index 0b1a491..5ef1e54 100644 --- a/sources/app/image/image_prc.c +++ b/sources/app/image/image_prc.c @@ -32,7 +32,6 @@ int image_prc(unsigned char data[VER][HOR], int v, int h,unsigned char *pdata){ t=0; t=image_head(data, v, h,itrack); - //printf("t: %d \n",t); if(t<2){ if(t==-1){ @@ -42,55 +41,35 @@ int image_prc(unsigned char data[VER][HOR], int v, int h,unsigned char *pdata){ itrack[t].x = -1; itrack[t].y = -1; } - /* - itrack[1].x=-1; - itrack[1].y=-1; - //itrack[0].vector = 0; - */ return 0; }else{ t=image_trail(data,v,h,t,itrack); - //printf("t:%d\n",t); itrack[t].x=-1; itrack[t].y=-1; - - tt=image_Fline(data,v,h,t,itrack); - if(tt==1){ - itrack[t].x=0; - }else{ - - tt=image_crossline(data,v,h,t,itrack); - - if(tt==1){ + + tt=image_Fline(data,v,h,t,itrack); + if(tt==1){ + itrack[t].x=0; + }else{ + + tt=image_crossline(data,v,h,t,itrack); + + if(tt==1){ itrack[t].x=1; - } } - - + } } #ifdef DEBUG - //printf("This one\n"); for(i=1; i0 && ix0 && iy1; po--){ flag=0; - //temp = h*(po-1); pf=0; left=h; right =0; nf=0; a=0; - //printf("po:%d\n",po); if(po==40) { offset=60; - //crital=0; scale=15; } - // if(po==35) offset=60; - // if(po==25) offset=50; - // if(po== 15) offset=40; - + if(po==35) offset=80; //60 if(po==25) offset=60; //40 if(po== 15) offset=40; if(po<=40 && it==0) return 0; - //printf("local:%d, scale:%d\n",local,scale); for(i=local-scale; i< local+scale; i++){ if(i0){ j=(unsigned char)data[po][i] ; k=(unsigned char)data[po][i+4] ; - //printf("j-k:%d flag:%d\n",j-k,flag); - //printf("i:%d\n",i); if(j-k>offset && flag==0){ left=i; i=i; flag=1; } - // printf("k-j:%d flag:%d\n",k-j,flag); if(k-j>offset && flag==1){ right=i; - //data[po][i]=255; // Debugging .... if(a<5) apot[a]=(i+left+6)/2; // apot[] size is 5 a++; flag=0; - // printf("a:%d\n",a); } } } if(a==0 || a==4) { crital++; - //printf("in a=0: %d\n",crital); } else{ // Store nearest val in apot[4] temp=255; @@ -238,26 +201,19 @@ body: it++; itrack[it].x=itrack[it-1].x; itrack[it].y=po; - //local=2*itrack[it].x-itrack[it-1].x; crital++; - //printf("in temp=255: %d\n",crital); }else{ it++; itrack[it].x=apot[4]; - //printf("temp:%d\n",temp); itrack[it].y=po; - //data[po][apot[4]]=255; local=2*itrack[it].x-itrack[it-1].x; crital=0; } } if(crital>6) { - //printf("body return:%d \n",crital); return it; } - - //po--; } return it; @@ -307,7 +263,6 @@ body: itrack[offset].y=yo+i-2; yo=itrack[offset].y; flag=1; - //printf("xo:%d\n",xo); break; } @@ -319,12 +274,9 @@ body: if(flag==0) { crital++; if(crital>2){ - //printf("1offset:%d\n",offset); return offset; } } - //if(crital>15) return offset; - xo--; xo--; @@ -353,7 +305,6 @@ body: if(flag==0){ crital++; if(crital>2){ - //printf("2offset:%d\n",offset); return offset; } } @@ -361,10 +312,8 @@ body: xo++; xo++; - //if(crital>15) return offset; } } - //printf("3offset:%d\n",offset); return offset; } @@ -382,14 +331,11 @@ body: xo=(char)itrack[offset-1].x; p=(char)itrack[offset-1].y; - - //printf("xo:%d\n",xo); + flag=xo-(char)itrack[2].x; - // if(p>40 || flag>20 || flag<-20 || itrack[2].x>50 || itrack[2].x<10){ // Limitation if(p>80 || itrack[2].x>77 || itrack[2].x<2){ // Limitation - //printf("flag:%d, itrack[2].x:%d\n",flag,itrack[2].x); return 0; } @@ -405,10 +351,8 @@ body: if(i+xo+2step){ - - //data[yo][i+xo+2]=255; + for(n=2; n<15; n++){ if(i+xo+2+n 0){ j=(unsigned char)data[yo][xo-i]; k=(unsigned char)data[yo][xo-i-2]; - //printf("2/%d\n",j-k); - + if(j-k>step){ - - //data[yo][xo-i-2]=255; + for(n=0; n<25; n++){ if(xo-i-2-n >0){ j=(unsigned char) data[yo][xo-i-2-n]; @@ -451,14 +393,13 @@ body: f++; yo=(char)itrack[f].y; xo=(char)itrack[f].x; - //printf("f:%d, yo:%d\n",f,yo); } return 0; } -int image_crossline(unsigned char data[VER][HOR],int v, int h, int offset, struct track *itrack){ + int image_crossline(unsigned char data[VER][HOR],int v, int h, int offset, struct track *itrack){ int step=0; int i=0; @@ -475,7 +416,6 @@ int image_crossline(unsigned char data[VER][HOR],int v, int h, int offset, struc flag=xo-(char)itrack[2].x; - // if(p>40 || flag>20 || flag<-20 || itrack[2].x>50 || itrack[2].x<10){ // Limitation if(p>60 || itrack[2].x>70 || itrack[2].x<10){ // Limitation return 0; } @@ -483,13 +423,13 @@ int image_crossline(unsigned char data[VER][HOR],int v, int h, int offset, struc f=2; yo=(char)itrack[f].y; xo=(char)itrack[f].x; - + for(i=3; i4) break; } - + if(i==offset-1) return 0; - + if(itrack[i].y>40) return 1; else return 0; - } \ No newline at end of file + } -- 2.11.4.GIT