Changeset 518
- Timestamp:
- 06/05/09 13:57:34 (3 years ago)
- Location:
- trunk/software/rb/vision
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/software/rb/vision/_vision.c
r514 r518 36 36 void free_pixbuf_data(guchar *pixels, gpointer _ipl_image) 37 37 { 38 printf("freeing ipl image data\n");38 debug("freeing ipl image data\n"); 39 39 IplImage *ipl_image = _ipl_image; 40 40 cvReleaseImage(&ipl_image); … … 74 74 /* Init ccam */ 75 75 if (!fake_ccam) { 76 printf("Initializing capture\n");76 debug("Initializing capture\n"); 77 77 cam = cvCreateCameraCapture(0); 78 78 if (cam == NULL) … … 81 81 82 82 /* Init classifier */ 83 printf("Initialzing classifier\n");83 debug("Initialzing classifier\n"); 84 84 classifier = classifier_new(classifier_num); 85 85 classifier_add_data_from_files(classifier, … … 104 104 105 105 // TODO: start with a larger list 106 printf("generating new pixbuf\n");106 debug("generating new pixbuf\n"); 107 107 PyObject *py_points = PyList_New(0); 108 108 -
trunk/software/rb/vision/classify.c
r514 r518 16 16 return type; 17 17 } 18 printf("Warning, unknown type: (%f,%f,%f)\n", in[0], in[1], in[2]);18 debug("Warning, unknown type: (%f,%f,%f)\n", in[0], in[1], in[2]); 19 19 return 0; 20 20 } … … 43 43 /* Create matrix from image */ 44 44 int out_rows = size.height * size.width; 45 fprintf(stderr,"Creating %dx%d = %d input\n", size.width, size.height, out_rows);45 debug("Creating %dx%d = %d input\n", size.width, size.height, out_rows); 46 46 CvMat *input = cvCreateMat(out_rows, 3*1, CV_32F); 47 47 int row, col; … … 85 85 switch (type) { 86 86 case RB_DTREE: 87 printf("Using decision tree classifier\n");87 debug("Using decision tree classifier\n"); 88 88 classifier->classifier = dtree_create(); 89 89 break; 90 90 case RB_HARD: 91 printf("Using hard coded classifier\n");91 debug("Using hard coded classifier\n"); 92 92 break; 93 93 default: 94 fprintf(stderr,"Warning: unknown classifier id %d\n", type);94 debug("Warning: unknown classifier id %d\n", type); 95 95 break; 96 96 } -
trunk/software/rb/vision/main.c
r490 r518 30 30 /* Load image */ 31 31 if (argc < 2) { 32 printf("usage: %s <image>\n", argv[0]);32 debug("usage: %s <image>\n", argv[0]); 33 33 return EINVAL; 34 34 } … … 36 36 IplImage *input = cvLoadImage(test_file, 1); 37 37 if (!input) { 38 printf("Could not load image file: %s\n", test_file);38 debug("Could not load image file: %s\n", test_file); 39 39 return EINVAL; 40 40 } -
trunk/software/rb/vision/vision.c
r516 r518 18 18 19 19 #include <stdio.h> 20 #include <stdarg.h> 20 21 #include <unistd.h> 21 22 #include <errno.h> … … 29 30 #include "classify.h" 30 31 32 /* Debugging */ 33 int debug_level = 0; 34 void debug(const char *fmt, ...) 35 { 36 if (debug_level) { 37 va_list ap; 38 va_start(ap, fmt); 39 fprintf(stderr, "DEBUG: "); 40 vfprintf(stderr, fmt, ap); 41 va_end(ap); 42 } 43 } 44 45 void print_time(const char *label) 46 { 47 struct timeb tp; 48 ftime(&tp); 49 debug("%30s time = %d.%hu\n", label, (int)tp.time, tp.millitm); 50 } 31 51 32 52 IplImage *get_image(CvCapture *cam) … … 39 59 IplImage *image = cvLoadImage(file, 1); 40 60 if (!image) { 41 printf("Could not load image file: %s\n", file);61 debug("Could not load image file: %s\n", file); 42 62 return NULL; 43 63 } … … 143 163 } 144 164 } 145 // printf("found %d/%d white points\n", n, box.width * box.height);165 //debug("found %d/%d white points\n", n, box.width * box.height); 146 166 if ((double)n / (box.width * box.height) < 0.05) return -1; 147 167 … … 191 211 int rval = find_slope_in_box(out, box, &linebox, &yint, &slope); 192 212 if (rval == -1) continue; 193 // printf("checking box (%4d,%4d)â(%4d-%4d): y = %8.3f*x + %8.3f\n",213 //debug("checking box (%4d,%4d)â(%4d-%4d): y = %8.3f*x + %8.3f\n", 194 214 // box.x, box.y, box.width, box.height, slope, yint); 195 215 if (abs(slope) < 0.5) { … … 219 239 } 220 240 } 221 222 void print_time(const char *label)223 {224 struct timeb tp;225 ftime(&tp);226 //fprintf(stderr, "%30s time = %d.%hu\n", label, (int)tp.time, tp.millitm);227 } -
trunk/software/rb/vision/vision.h
r488 r518 104 104 105 105 /** 106 * Print deubgging message 107 */ 108 void debug(const char *fmt, ...); 109 110 /** 106 111 * Prints out the given label as well as a timestamps for the current time. 107 112 * This is used for profiling the software

