Added program for mark detection (Cross line, Left half line and Right half line).

Dependencies:   GR-PEACH_video mbed

Fork of TraceMark_Program_60fps by Micon Car Rally

Revision:
1:4a94c87a7d04
Parent:
0:158dbfb66e62
Child:
2:af4db183ee76
diff -r 158dbfb66e62 -r 4a94c87a7d04 main.cpp
--- a/main.cpp	Thu Sep 22 09:27:51 2016 +0000
+++ b/main.cpp	Tue Jan 10 04:59:48 2017 +0000
@@ -2,8 +2,8 @@
 //Supported MCU:   RZ/A1H
 //File Contents:   Trace Program by Image Processing
 //                                 (GR-PEACH version on the Micon Car)
-//Version number:  Ver.1.00
-//Date:            2016.09.22
+//Version number:  Ver.1.01
+//Date:            2017.01.10
 //Copyright:       Renesas Electronics Corporation
 //                 Hitachi Document Solutions Co., Ltd.
 //------------------------------------------------------------------//
@@ -592,76 +592,38 @@
     cnt1++;
  
     /* field check */
-    if( vfield_count2 == vfield_count2_buff ) {
+    if( vfield_count2 != vfield_count2_buff ) {
         vfield_count2_buff = vfield_count2;
+        counter = 0;
     }
-    /* Top field */
-    if( !vfield_count2 ) {
-        led_m_user( 1 );
-        switch( counter++ ) {
-        case 0:
-            Image_Extraction( write_buff_addr, ImageData_A, vfield_count2 );
-            break;
-        case 1:
-            Image_Extraction( write_buff_addr, ImageData_A, vfield_count2 );
-            break;
-        case 2:
-            Image_Reduction( ImageData_A, 160, ImageComp_A, 8 );
-            break;
-        case 3:
-            Image_Reduction( ImageData_A, 160, ImageComp_A, 8 );
-            break;
-        case 4:
-            Binarization_process( ImageComp_A, ImageBinary, 20*15, 128 );
-            break;
-        case 5:
-            /* Trace by image processing */
-            digital_sensor_process( ImageBinary );
-            break;
-        case 6:
-            //MarkCheck_Triangle
-            MarkDetect_process_T();
-            break;
-        case 15:
-            counter = 0;
-            break;
-        default:
-            break;
-        }
-    }
-    /* bottom field */
-    else {
-        led_m_user( 0 );
-        switch( counter++ ) {
-        case 0:
-            Image_Extraction( write_buff_addr, ImageData_A, vfield_count2 );
-            break;
-        case 1:
-            Image_Extraction( write_buff_addr, ImageData_A, vfield_count2 );
-            break;
-        case 2:
-            Image_Reduction( ImageData_A, 160, ImageComp_A, 8 );
-            break;
-        case 3:
-            Image_Reduction( ImageData_A, 160, ImageComp_A, 8 );
-            break;
-        case 4:
-            Binarization_process( ImageComp_A, ImageBinary, 20*15, 128 );
-            break;
-        case 5:
-            /* Trace by image processing */
-            digital_sensor_process( ImageBinary );
-            break;
-        case 6:
-            //MarkCheck_Triangle
-            MarkDetect_process_T();
-            break;
-        case 15:
-            counter = 0;
-            break;
-        default:
-            break;
-        }
+    /* Top field / bottom field */
+    led_m_user( vfield_count2 );
+    switch( counter++ ) {
+    case 0:
+        Image_Extraction( write_buff_addr, ImageData_A, vfield_count2 );
+        break;
+    case 1:
+        Image_Extraction( write_buff_addr, ImageData_A, vfield_count2 );
+        break;
+    case 2:
+        Image_Reduction( ImageData_A, 160, ImageComp_A, 8 );
+        break;
+    case 3:
+        Image_Reduction( ImageData_A, 160, ImageComp_A, 8 );
+        break;
+    case 4:
+        Binarization_process( ImageComp_A, ImageBinary, 20*15, 128 );
+        break;
+    case 5:
+        /* Trace by image processing */
+        digital_sensor_process( ImageBinary );
+        break;
+    case 6:
+        //MarkCheck_Triangle
+        MarkDetect_process_T();
+        break;
+    default:
+        break;
     }
 
     /* LED processing */