Changeset 560 for trunk/projects/hsv-ppm-grab/main.c
- Timestamp:
- 02/23/09 18:40:45 (17 months ago)
- Files:
-
- 1 modified
-
trunk/projects/hsv-ppm-grab/main.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/hsv-ppm-grab/main.c
r504 r560 3 3 #include <stdbool.h> 4 4 #include <cc3_hsv.h> 5 #include "cc3.h"5 #include <cc3.h> 6 6 7 7 … … 36 36 // Check if files exist, if they do then skip over them 37 37 do { 38 snprintf(filename, 16, "c:/img%.5d.ppm", i); 39 //snprintf(filename, 16, "img%.5d.ppm", i); 38 #ifndef VIRTUAL_CAM 39 snprintf(filename, 16, "c:/img%.5d.ppm", i); 40 #else 41 snprintf(filename, 16, "img%.5d.ppm", i); 42 #endif 40 43 f = fopen(filename, "r"); 41 44 if (f != NULL) { … … 102 105 103 106 cc3_pixbuf_load (); 104 uint8_t *row =cc3_malloc_rows(1);107 cc3_pixel_t *row = (cc3_pixel_t*) cc3_malloc_rows(1); 105 108 106 109 size_x = cc3_g_pixbuf_frame.width; 107 110 size_y = cc3_g_pixbuf_frame.height; 108 111 109 fprintf(f,"P6\n% d %d\n255\n",size_x,size_y );112 fprintf(f,"P6\n%lu %lu\n255\n",size_x,size_y ); 110 113 111 114 time = cc3_timer_get_current_ms(); … … 113 116 cc3_pixbuf_read_rows(row, 1); 114 117 cc3_rgb2hsv_row(row,size_x); // This line will convert the row to HSV 115 for (x = 0; x < size_x * 3U; x++) { 116 uint8_t p = row[x]; 117 if (fputc(p, f) == EOF) { 118 perror("fputc failed"); 119 } 118 for (x = 0; x < size_x; x++) { 119 uint8_t h,s,v; 120 h = row[x].channel[CC3_CHANNEL_HUE]; 121 s = row[x].channel[CC3_CHANNEL_SAT]; 122 v = row[x].channel[CC3_CHANNEL_VAL]; 123 if (fputc(h, f) == EOF) { perror("fputc failed\n"); } 124 if (fputc(s, f) == EOF) { perror("fputc failed\n"); } 125 if (fputc(v, f) == EOF) { perror("fputc failed\n"); } 120 126 } 121 127 fprintf(stderr, ".");
