Tony Lin
/
BX-car_s
share
Fork of BX-car_2 by
Diff: camera_api.cpp
- Revision:
- 19:eb0552a0ddae
- Parent:
- 18:88b083db7491
- Child:
- 20:4ed21397e775
--- a/camera_api.cpp Sun Jun 29 06:41:21 2014 +0000 +++ b/camera_api.cpp Sun Jun 29 14:02:37 2014 +0000 @@ -15,6 +15,66 @@ int BX_camera::black_centerR(void) { + int r_care=10; + int l_care=118; + + + // find center + // case 1 // | // + // case 2 / | / + + char find_type=0x00; + + int b_end=64; + int b_start=64; + int b_w=0; + int b_center=64; + int b2_end=64; + int b2_start=64; + int b2_center=64; + int b2_w=0; + int center=30; + int j=64,i; + int offset=64; + bool f1=false; + bool f2=false; + bool f3=false; + bool f4=false; + bool count=false; + int same_chars=0; + int w_thr_up=32; + int w_thr_dn=2; + + b_start=b_center=b_end=b2_start=b2_center=b2_end=offset; + + for(i=l_care-1; i>r_care; i--){ + if(sign_line_imageR[i]==' ' && count==false){ + b_start=i; + count=true; + if(last_sign_line_imageR[i]==' ') + same_chars++; + } + else if(sign_line_imageR[i]==' ' && count==true){ + if(last_sign_line_imageR[i]==' ') + same_chars++; + } + else if(sign_line_imageR[i]!=' ' && count==true){ + count=false; + if(same_chars>5 && same_chars<32){ + b_end=i+1; + break; + } + } + } + + center=(b_end+b_start)/2; + + for(i=l_care-1; i>r_care; i--){ + last_sign_line_imageR[i]=sign_line_imageR[i]; + } + + return center; +/* int l_care=10; int r_care=118; @@ -44,7 +104,7 @@ int w_thr_dn=2; b_start=b_center=b_end=b2_start=b2_center=b2_end=offset; - + if(sign_line_imageR[64]==' ') find_type=0x02; else @@ -107,30 +167,15 @@ center=b2_center; else center=offset; - - /* if( ( w_thr_up- (b_w))>0 &&( ( w_thr_up- (b_w)) < (w_thr_up-(b2_w)) ) ) { - center=(b_end+b_start)/2; - - - - // } else if( ( w_thr_up- (b2_w) )>0 ) { - center=(b2_end+b2_start)/2; - // } else { - - center=65; - - //???????????????? - - } - - */ break; case 0x02: center=(b_end+b_start)/2; break; } + return center; + */ }