Changeset 808 for trunk/MagicSoft/Cosy/videodev
- Timestamp:
- 05/25/01 16:51:24 (24 years ago)
- Location:
- trunk/MagicSoft/Cosy/videodev
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/videodev/Camera.cc
r738 r808 188 188 189 189 void Camera::Execute(const unsigned long n, 190 char*img,190 byte *img, 191 191 struct timeval *tm) 192 192 { … … 247 247 if (!StartGrab(i&1)) 248 248 break; 249 Execute(i, fImg, &fTime);249 Execute(i, (byte*)fImg, &fTime); 250 250 i++; 251 251 } … … 254 254 { 255 255 LoopStep(i); 256 Execute(i, fImg, &fTime);256 Execute(i, (byte*)fImg, &fTime); 257 257 i++; 258 258 } 259 259 260 260 LoopStep(i); 261 Execute(i, fImg, &fTime);261 Execute(i, (byte*)fImg, &fTime); 262 262 i++; 263 263 -
trunk/MagicSoft/Cosy/videodev/Camera.h
r738 r808 4 4 #include <pthread.h> 5 5 #include <sys/time.h> 6 7 typedef unsigned char byte; 6 8 7 9 class Camera … … 85 87 // 86 88 virtual void Execute(const unsigned long n, 87 char*img, struct timeval *tm);89 byte *img, struct timeval *tm); 88 90 89 91 // -
trunk/MagicSoft/Cosy/videodev/Filter.cc
r738 r808 6 6 void Filter::DrawBox(const int x1, const int y1, 7 7 const int x2, const int y2, 8 char*buffer, const int col)8 byte *buffer, const int col) 9 9 { 10 10 for (int x=x1; x<x2+1; x++) … … 13 13 } 14 14 15 void Filter::MarkPoint(const int x, const int y, char*buffer, const int col)15 void Filter::MarkPoint(const int x, const int y, byte *buffer, const int col) 16 16 { 17 17 DrawBox(x-8, y, x-5, y, buffer, col); … … 22 22 } 23 23 24 float Filter::Mean(const char*buffer, const int offset, int *min, int *max)24 float Filter::Mean(const byte *buffer, const int offset, int *min, int *max) 25 25 { 26 26 double mean = 0.0; … … 35 35 for (int y=offset; y<576-offset; y++) 36 36 { 37 unsigned char val = (unsigned char)buffer[y*768+x];37 byte val = buffer[y*768+x]; 38 38 39 39 mean += val; 40 40 41 if ( *max<val)41 if (val>*max) 42 42 *max = val; 43 43 44 if ( *min>val)44 if (val<*min) 45 45 *min = val; 46 46 } … … 51 51 } 52 52 53 float Filter::SDev(const char*buffer, const int offset, const double mean)53 float Filter::SDev(const byte *buffer, const int offset, const double mean) 54 54 { 55 55 // … … 61 61 for (int y=offset; y<576-offset; y++) 62 62 { 63 const float val = mean - (unsigned char)buffer[y*768+x];63 const float val = mean - buffer[y*768+x]; 64 64 65 65 sdev += val*val; … … 71 71 } 72 72 73 int Filter::GetMeanPosition(const char*bitmap, const int x, const int y,73 int Filter::GetMeanPosition(const byte *bitmap, const int x, const int y, 74 74 const int box) 75 75 { … … 82 82 for (int dy=y-box; dy<y+box+1; dy++) 83 83 { 84 const unsigned char m = (unsigned char)bitmap[dy*768+dx]; // desc->buffer[3*(x+y*768)]; //84 const byte m = bitmap[dy*768+dx]; // desc->buffer[3*(x+y*768)]; // 85 85 86 86 sumx += m*dx; … … 95 95 } 96 96 97 void Filter::Execute( char*img)97 void Filter::Execute(byte *img) 98 98 { 99 99 const int offset = 10; … … 115 115 if (img[y*768+x]>cut) 116 116 continue; 117 118 // 119 // FIXME: Create LOOKUP Table! 120 // 117 121 118 122 img[y*768+x] = 0; … … 169 173 int points=0; 170 174 171 charmarker[768*576];175 byte marker[768*576]; 172 176 memset(marker, 0, 768*576); 173 177 -
trunk/MagicSoft/Cosy/videodev/Filter.h
r738 r808 1 1 #ifndef FILTER_H 2 2 #define FILTER_H 3 4 typedef unsigned char byte; 3 5 4 6 class Filter … … 6 8 static void DrawBox(const int x1, const int y1, 7 9 const int x2, const int y2, 8 char*buffer, const int col);10 byte *buffer, const int col); 9 11 10 12 static void MarkPoint(const int x, const int y, 11 char*buffer, const int col);13 byte *buffer, const int col); 12 14 13 static float Mean(const char*buffer, const int offset,15 static float Mean(const byte *buffer, const int offset, 14 16 int *min, int *max); 15 17 16 static float SDev(const char*buffer, const int offset,18 static float SDev(const byte *buffer, const int offset, 17 19 const double mean); 18 20 19 static int GetMeanPosition(const char*bitmap,21 static int GetMeanPosition(const byte *bitmap, 20 22 const int x, const int y, 21 23 const int box); 22 24 23 25 public: 24 static void Execute( char*img);26 static void Execute(byte *img); 25 27 }; 26 28 -
trunk/MagicSoft/Cosy/videodev/Writer.cc
r738 r808 9 9 #include "timer.h" 10 10 11 void Writer::Png(const char *fname, const char*buf,11 void Writer::Png(const char *fname, const byte *buf, 12 12 struct timeval *date) 13 13 { … … 106 106 } 107 107 108 void Writer::Ppm(const char *fname, const char*img)108 void Writer::Ppm(const char *fname, const byte *img) 109 109 { 110 110 cout << "Writing PPM '" << fname << "'" << endl; … … 121 121 // 122 122 fout << "P6\n768 576\n255\n"; 123 for ( charconst *buf = img; buf < img+768*576; buf++)123 for (byte const *buf = img; buf < img+768*576; buf++) 124 124 fout << *buf << *buf << *buf; 125 125 } -
trunk/MagicSoft/Cosy/videodev/Writer.h
r738 r808 3 3 4 4 #include <sys/time.h> 5 6 typedef unsigned char byte; 5 7 6 8 class Writer; … … 10 12 public: 11 13 12 static void Ppm(const char *fname, const char*img);13 static void Png(const char *fname, const char*buf, struct timeval *date);14 static void Ppm(const char *fname, const byte *img); 15 static void Png(const char *fname, const byte *buf, struct timeval *date); 14 16 }; 15 17
Note:
See TracChangeset
for help on using the changeset viewer.