nav fixed
Dependencies: Adafruit-16-Ch-PWM-Servo-Driver HCSR04 PID PololuQik2 QEI Sharp mbed-rtos
Fork of theRobot by
Diff: ShapeDetect.cpp
- Revision:
- 15:78f5e937f6ab
- Parent:
- 14:784acd735b8c
- Child:
- 16:8bb212df81b7
--- a/ShapeDetect.cpp Wed Apr 02 03:36:49 2014 +0000 +++ b/ShapeDetect.cpp Wed Apr 02 04:04:28 2014 +0000 @@ -329,3 +329,36 @@ return s_area_val; } + +int rigDetectionImgProc(void){ + + ImageToArray(GREYSCALE); + int count1 = 0; + int count2 = 1; + + //first rig + for(int i=40; i<80; i++){ + for(int j=0; j<60; j++){ + if (image[i][j] < 128); + count1++; + }// j + }// i + + //second rig + for(int i=0; i<120; i++){ + for(int j=139; j<160; j++){ + if (image[i][j] < 128); + count2++; + }// j + }// i + + if( (count1 < RIG_IP_THRESHOLD) && (count2 < RIG_IP_THRESHOLD) ){ + //no fire detected on forst two rigs + return 3; // CIRCLE RIG + } else if( count1 > RIG_1_IP_THRESHOLD ){ + return 1; //SQUARE RIG + } else { + return 2; //TRIANGLE RIG + } + + }