Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Adafruit-16-Ch-PWM-Servo-Driver HCSR04 PID PololuQik2 QEI Sharp mbed-rtos
Revision 15:78f5e937f6ab, committed 2014-04-02
- Comitter:
- tashworth
- Date:
- Wed Apr 02 04:04:28 2014 +0000
- Parent:
- 14:784acd735b8c
- Child:
- 16:8bb212df81b7
- Commit message:
- 4-1-14 11pm
Changed in this revision
| ShapeDetect.cpp | Show annotated file Show diff for this revision Revisions of this file |
| ShapeDetect.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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
+ }
+
+ }
--- a/ShapeDetect.h Wed Apr 02 03:36:49 2014 +0000 +++ b/ShapeDetect.h Wed Apr 02 04:04:28 2014 +0000 @@ -14,6 +14,8 @@ #define GREYSCALE 2 #define DECIMAL 3 +#define RIG_IP_THRESHOLD 1000 +#define RIG_1_IP_THRESHOLD 3000 void lrf_baudCalibration(void); @@ -24,6 +26,7 @@ void clearBounds(void); int shapeDetection(void); int getDistance(void); +int rigDetectionImgProc(void); int get_com_x(void); int get_com_y(void);