Go to the documentation of this file.00001 #ifndef FCAM_BASE_H
00002 #define FCAM_BASE_H
00003
00004 #include <stdlib.h>
00005
00012 namespace FCam {
00013
00015 typedef enum {
00017 RGB24 = 0,
00018
00021 RGB16,
00022
00030 UYVY,
00031
00033 YUV24,
00034
00041 RAW,
00042
00045 UNKNOWN
00046 } ImageFormat;
00047
00051 enum BayerPattern {RGGB = 0,
00052 BGGR,
00053 GRBG,
00054 GBRG,
00055 NotBayer
00056 };
00057
00059 int bytesPerPixel(ImageFormat);
00060
00063 struct Size {
00065 Size() : width(0), height(0) {}
00066
00068 Size(int w, int h) : width(w), height(h) {}
00069
00071 bool operator==(const Size &other) const {return width == other.width && height == other.height;}
00072
00074 bool operator!=(const Size &other) const {return width != other.width || height != other.height;}
00075
00076 int width;
00077 int height;
00078 };
00079
00081 struct Rect {
00083 Rect() : x(0), y(0), width(0), height(0) {}
00084
00087 Rect(int x_, int y_, int w_, int h_) : x(x_), y(y_), width(w_), height(h_) {}
00088
00090 bool operator==(const Rect &other) const {
00091 return (width == other.width &&
00092 height == other.height &&
00093 x == other.x &&
00094 y == other.y);
00095 }
00096
00098 bool operator!=(const Rect &other) const {
00099 return (width != other.width ||
00100 height != other.height ||
00101 x != other.x ||
00102 y != other.y);
00103 }
00104
00105 int x;
00106 int y;
00107 int width;
00108 int height;
00109 };
00110
00113 #define fcamPanic(fmt, ...) panic(__FILE__, __LINE__, fmt, __VA_ARGS__)
00114 void panic(const char *fileName, int line, const char *fmt, ...);
00115
00116 }
00117
00118 #endif