Clark Lin
/
BX-car_s
QQQ
Fork of BX-car_s by
Diff: camera_api.cpp
- Revision:
- 21:5f7efc1ca8ad
- Parent:
- 20:4ed21397e775
- Child:
- 22:1464a3f0a290
--- a/camera_api.cpp Sun Jun 29 16:20:22 2014 +0000 +++ b/camera_api.cpp Mon Jun 30 08:19:43 2014 +0000 @@ -12,6 +12,26 @@ si=new DigitalOut(PTD7); padding = p; } +int BX_camera::black_center(void) +{ + int black_L_right = 96 , black_R_left = 32; + + for(int i = 10; i <118; i++){ + if(sign_line_imageR[i] == 'O' && sign_line_imageR[i+1] == ' ' && sign_line_imageR[i+2] == ' '){ + black_R_left = i; + break; + } + } + + for(int i = 118; i >= 10; i--){ + if(sign_line_imageR[i] == 'O' && sign_line_imageR[i-1] == ' ' && sign_line_imageR[i-2] == ' '){ + black_L_right = i; + break; + } + } + + return (black_R_left + black_L_right) / 2; +} int BX_camera::black_centerR(void) {