Index: trunk/code/projects/colonet/vision/build_fitellipse.sh
===================================================================
--- trunk/code/projects/colonet/vision/build_fitellipse.sh	(revision 429)
+++ trunk/code/projects/colonet/vision/build_fitellipse.sh	(nonexistent)
@@ -1,2 +0,0 @@
-#!/bin/sh
-gcc -ggdb `pkg-config opencv --cflags --libs` fitellipse.c -o fitellipse

Property changes on: trunk/code/projects/colonet/vision/build_fitellipse.sh
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: trunk/code/projects/colonet/vision/build_vision.sh
===================================================================
--- trunk/code/projects/colonet/vision/build_vision.sh	(revision 429)
+++ trunk/code/projects/colonet/vision/build_vision.sh	(nonexistent)
@@ -1,2 +0,0 @@
-#!/bin/sh
-gcc -ggdb `pkg-config opencv --cflags --libs` vision.c -o vision

Property changes on: trunk/code/projects/colonet/vision/build_vision.sh
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: trunk/code/projects/colonet/vision/fitellipse
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/code/projects/colonet/vision/fitellipse
===================================================================
--- trunk/code/projects/colonet/vision/fitellipse	(revision 429)
+++ trunk/code/projects/colonet/vision/fitellipse	(nonexistent)

Property changes on: trunk/code/projects/colonet/vision/fitellipse
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: trunk/code/projects/colonet/vision/vision
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/code/projects/colonet/vision/vision
===================================================================
--- trunk/code/projects/colonet/vision/vision	(revision 429)
+++ trunk/code/projects/colonet/vision/vision	(nonexistent)

Property changes on: trunk/code/projects/colonet/vision/vision
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: trunk/code/projects/colonet/vision/vision.sh
===================================================================
--- trunk/code/projects/colonet/vision/vision.sh	(revision 429)
+++ trunk/code/projects/colonet/vision/vision.sh	(revision 430)
@@ -4,5 +4,5 @@
 # only use wget when not on roboclub9
 # wget -q http://roboclub9.frc.ri.cmu.edu/colonet.jpg -O colonet.jpg
 sudo ./vision /var/www/colonet.jpg > /var/www/colonet/locations.txt
-sleep 1s
+sleep .1s
 done
Index: trunk/code/projects/colonet/vision/vision.c
===================================================================
--- trunk/code/projects/colonet/vision/vision.c	(revision 429)
+++ trunk/code/projects/colonet/vision/vision.c	(revision 430)
@@ -23,138 +23,144 @@
 // Load the source image. HighGUI use.
 IplImage *image02 = 0, *image03 = 0, *image04 = 0;
 
-void loop_image();
+void loop_image(void);
 
 struct CenterP {
-	CvPoint center;
-	int count;
+  CvPoint center;
+  int count;
 };
 
 int main( int argc, char** argv ) {
-	const char* filename = argc == 2 ? argv[1] : (char*)"colonet.jpg";
+  const char* filename = argc == 2 ? argv[1] : (char*)"colonet.jpg";
 
-	// load image and force it to be grayscale
-	if( (image03 = cvLoadImage(filename, 0)) == 0 ) return -1;
+  // load image and force it to be grayscale
+  if ((image03 = cvLoadImage(filename, 0)) == 0) {
+    fprintf(stderr, "Failed to load image.\n");
+    return -1;
+  }
 
-	// Create the destination images
-	image02 = cvCloneImage( image03 );
-	image04 = cvCloneImage( image03 );
+  // Create the destination images
+  image02 = cvCloneImage( image03 );
+  image04 = cvCloneImage( image03 );
 
-	if (DEBUG) cvNamedWindow("Result", 1);
-	
-	loop_image();
+  if (DEBUG) cvNamedWindow("Result", 1);
 
-	if (DEBUG) cvWaitKey(0);
+  loop_image();
 
-	cvReleaseImage(&image02);
-	cvReleaseImage(&image03);
+  if (DEBUG) cvWaitKey(0);
 
-	if (DEBUG){
-		cvDestroyWindow("Result");
-	}
-	return 0;
+  cvReleaseImage(&image02);
+  cvReleaseImage(&image03);
+
+  if (DEBUG) {
+    cvDestroyWindow("Result");
+  }
+
+  return 0;
 }
 
-void loop_image(){
-	CvMemStorage* stor;
-	CvSeq* cont;
-	CvBox2D32f* box;
-	CvPoint* PointArray;
-	CvPoint2D32f* PointArray2D32f;
-    
-	// Create dynamic structure and sequence.
-	stor = cvCreateMemStorage(0);
-	cont = cvCreateSeq(CV_SEQ_ELTYPE_POINT, sizeof(CvSeq), sizeof(CvPoint) , stor);
-    
-	struct CenterP bestc[100];
-	int index=0;
+void loop_image() {
+  CvMemStorage* stor;
+  CvSeq* cont;
+  CvBox2D32f* box;
+  CvPoint* PointArray;
+  CvPoint2D32f* PointArray2D32f;
 
-	int h;
-	for (h=MINH;h<MAXH;h++){
-		// Threshold the source image. This needful for cvFindContours().
-		cvThreshold( image03, image02, h, 255, CV_THRESH_BINARY );
-    
-		// Find all contours.
-		cvFindContours( image02, stor, &cont, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_NONE, cvPoint(0,0));
-    
-		// Clear images. IPL use.
-		cvZero(image02);
-		cvZero(image04);
-    
-		// This cycle draw all contours and approximate it by ellipses.
-		for(;cont;cont = cont->h_next) {   
-			int i; // Indicator of cycle.
-			int count = cont->total; // This is number point in contour
-			CvPoint center;
-			CvSize size;
-        
-			// Number point must be more than or equal to 6 (for cvFitEllipse_32f).
-			if( count < 6 ) continue;
-        
-			// Alloc memory for contour point set.    
-			PointArray = (CvPoint*)malloc( count*sizeof(CvPoint) );
-			PointArray2D32f= (CvPoint2D32f*)malloc( count*sizeof(CvPoint2D32f) );
-        
-			// Alloc memory for ellipse data.
-			box = (CvBox2D32f*)malloc(sizeof(CvBox2D32f));
-        
-			// Get contour point set.
-			cvCvtSeqToArray(cont, PointArray, CV_WHOLE_SEQ);
-        
-			// Convert CvPoint set to CvBox2D32f set.
-			for(i=0; i<count; i++) {
-				PointArray2D32f[i].x = (float)PointArray[i].x;
-				PointArray2D32f[i].y = (float)PointArray[i].y;
-			}
-        
-			// Fits ellipse to current contour.
-			cvFitEllipse(PointArray2D32f, count, box);
-        
-			// Convert ellipse data from float to integer representation.
-			center.x = cvRound(box->center.x);
-			center.y = cvRound(box->center.y);
-			size.width = cvRound(box->size.width*0.5);
-			size.height = cvRound(box->size.height*0.5);
-			box->angle = -box->angle;
+  // Create dynamic structure and sequence.
+  stor = cvCreateMemStorage(0);
+  cont = cvCreateSeq(CV_SEQ_ELTYPE_POINT, sizeof(CvSeq), sizeof(CvPoint) , stor);
 
-			if (size.width>10&&size.height>10&&size.width<20&&size.height<20){
-				//printf("%d %d %d %d\n",center.x,center.y,size.width,size.height);
-        
-				int found=0;
-				int j;
-				for (j=0;j<index;j++)
-					if (abs(bestc[j].center.x-center.x)<9&&abs(bestc[j].center.y-center.y)<9){
-						bestc[j].count++;
-						found=1;
-						break;
-					}
-				if (!found){
-					struct CenterP c;
-					c.center=center;
-					c.count=1;
-					bestc[index]=c;
-					index++;
-				}
-			}
-			// Free memory.          
-			free(PointArray);
-			free(PointArray2D32f);
-			free(box);
-		}
-	}
-	image04 = cvCloneImage( image03 );
-	int i;
-	for (i=0;i<index;i++){
-		if (bestc[i].count>7){
-			printf("%d,%d\n",bestc[i].center.x,bestc[i].center.y);
-			if (DEBUG) cvCircle(image04,bestc[i].center, 20, CV_RGB(0,0,0),5,8,0);
-		}
-	}
-	// Show image. HighGUI use.
-	if (DEBUG) cvShowImage( "Result", image04 );
+  struct CenterP bestc[100];
+  int index=0;
+
+  int h;
+  for (h = MINH; h < MAXH; h++) {
+    // Threshold the source image. This needful for cvFindContours().
+    cvThreshold(image03, image02, h, 255, CV_THRESH_BINARY);
+
+    // Find all contours.
+    cvFindContours( image02, stor, &cont, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_NONE, cvPoint(0,0));
+
+    // Clear images. IPL use.
+    cvZero(image02);
+    cvZero(image04);
+
+    // This cycle draw all contours and approximate it by ellipses.
+    for(; cont; cont = cont->h_next) {
+      int i; // Indicator of cycle.
+      int count = cont->total; // This is number point in contour
+      CvPoint center;
+      CvSize size;
+
+      // Number point must be more than or equal to 6 (for cvFitEllipse_32f).
+      if (count < 6) continue;
+
+      // Alloc memory for contour point set.
+      PointArray = (CvPoint*) malloc(count * sizeof(CvPoint));
+      PointArray2D32f= (CvPoint2D32f*) malloc(count * sizeof(CvPoint2D32f));
+
+      // Alloc memory for ellipse data.
+      box = (CvBox2D32f*)malloc(sizeof(CvBox2D32f));
+
+      // Get contour point set.
+      cvCvtSeqToArray(cont, PointArray, CV_WHOLE_SEQ);
+
+      // Convert CvPoint set to CvBox2D32f set.
+      for(i=0; i<count; i++) {
+        PointArray2D32f[i].x = (float)PointArray[i].x;
+        PointArray2D32f[i].y = (float)PointArray[i].y;
+      }
+
+      // Fits ellipse to current contour.
+      cvFitEllipse(PointArray2D32f, count, box);
+
+      // Convert ellipse data from float to integer representation.
+      center.x = cvRound(box->center.x);
+      center.y = cvRound(box->center.y);
+      size.width = cvRound(box->size.width*0.5);
+      size.height = cvRound(box->size.height*0.5);
+      box->angle = -box->angle;
+
+      if (size.width>10&&size.height>10&&size.width<20&&size.height<20){
+        //printf("%d %d %d %d\n",center.x,center.y,size.width,size.height);
+
+        int found=0;
+        int j;
+        for (j=0;j<index;j++)
+          if (abs(bestc[j].center.x-center.x)<9&&abs(bestc[j].center.y-center.y)<9){
+            bestc[j].count++;
+            found=1;
+            break;
+          }
+        if (!found){
+          struct CenterP c;
+          c.center=center;
+          c.count=1;
+          bestc[index]=c;
+          index++;
+        }
+      }
+      // Free memory.
+      free(PointArray);
+      free(PointArray2D32f);
+      free(box);
+    }
+  }
+
+  image04 = cvCloneImage( image03 );
+  int i;
+  for (i=0; i < index; i++) {
+    if (bestc[i].count>7){
+      printf("%d,%d\n",bestc[i].center.x,bestc[i].center.y);
+      if (DEBUG) cvCircle(image04,bestc[i].center, 20, CV_RGB(0,0,0),5,8,0);
+    }
+  }
+
+  // Show image. HighGUI use.
+  if (DEBUG) cvShowImage( "Result", image04 );
 }
-
+/*
 #ifdef _EiC
 main(1,"vision.c");
 #endif
-
+*/
Index: trunk/code/projects/colonet/vision/README
===================================================================
--- trunk/code/projects/colonet/vision/README	(revision 429)
+++ trunk/code/projects/colonet/vision/README	(revision 430)
@@ -2,5 +2,5 @@
 
 You need to have OpenCV installed and correct path configuration.
 
-build_vision.sh to compile
-vision.sh to run
+Run "make" to compile.
+Run "./vision.sh" to get robot positions.
Index: trunk/code/projects/colonet/vision/Makefile
===================================================================
--- trunk/code/projects/colonet/vision/Makefile	(nonexistent)
+++ trunk/code/projects/colonet/vision/Makefile	(revision 430)
@@ -0,0 +1,14 @@
+# Makefile for vision.
+
+default: vision fitellipse
+
+vision: vision.c
+	mkdir -p bin
+	gcc -ggdb `pkg-config opencv --cflags --libs` vision.c -o bin/vision
+
+fitellipse: fitellipse.c
+	mkdir -p bin
+	gcc -ggdb `pkg-config opencv --cflags --libs` fitellipse.c -o bin/fitellipse
+
+clean:
+	rm -rf bin *~
