wu

Dependencies:   mbed-rtos mbed

Fork of CCC by kao yi

Revision:
16:b78dce5c0e98
Parent:
15:585df3979be8
Child:
17:3dac99cf2b89
diff -r 585df3979be8 -r b78dce5c0e98 camera_api.cpp
--- a/camera_api.cpp	Sun Jun 29 14:02:25 2014 +0000
+++ b/camera_api.cpp	Sun Jun 29 14:32:30 2014 +0000
@@ -70,6 +70,61 @@
 }   
 
 
+int BX_camera::black_centerL(void)
+{
+
+    int l_care=10;
+    int r_care=118;
+    int b_start=0;
+    int b_end=0;
+    bool l_f1=false;
+    bool l_f2=false;
+    bool find=false;
+    int b_thr_up=32;
+    int b_thr_dn=5;
+    int b_w=0;
+    
+     for(int i=r_care;i>l_care;i--){
+         
+         
+          if(l_f1==false&&sign_line_imageL[i]==' '){
+               
+              b_start=i;
+              l_f1=true;
+          }
+          if(l_f1==true && sign_line_imageL[i]=='O'){
+              b_end=i-1;
+              l_f2=true;   
+           }
+         
+           if(l_f1==true && l_f2== true){
+               b_w=b_start-b_end;
+               if( b_thr_up>b_w&&b_w> b_thr_dn){
+                   
+                   find=true;     
+                   break;
+                }
+                else{
+                   l_f1=false;
+                   l_f2=false;
+                   
+                } 
+                
+                   
+            }
+               
+               
+    }
+         
+         
+         
+     
+
+  if(find)
+     return (b_start+b_end)/2;
+  else
+     return -1;  
+}