00001 00002 00003 00004 00005 00006 00007
00008
00009 #ifndef _svs_h_
00010 #define _svs_h_
00011
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045
00046 #include <stdio.h>
00047
00048 #ifdef UNIX
00049 #include <sys/ipc.h>
00050 #include <sys/shm.h>
00051 #define ALIGN8 __attribute__ ((aligned (8)))
00052 #define ALIGN16 __attribute__ ((aligned (16)))
00053 #define FALSE 0
00054 #define TRUE 1
00055 #endif
00056
00057 #ifdef WIN32
00058 #include <windows.h>
00059 #define ALIGN8
00060 #define REALLYIMPORT __declspec(dllimport)
00061 #ifndef LIBCODE
00062 #define IMPORT __declspec(dllimport)
00063 #else
00064 #define IMPORT __declspec(dllexport)
00065 #endif
00066 #else
00067 #define IMPORT
00068 #endif
00069
00070 00071 00072 00073 00074 00075 00076 00077
00078 typedef struct {
00079
00080 int pwidth;
00081 int pheight;
00082 double dpx;
00083 double dpy;
00084 double sx;
00085 double Cx;
00086 double Cy;
00087 double f;
00088 double kappa1;
00089 double kappa2;
00090 float proj[3][4];
00091 float rect[3][3];
00092 } svsIP;
00093
00094
00095
00096
00097
00098
00099 typedef struct {
00100 int id;
00101
00102
00103 int convx, convy;
00104 int corrxsize, corrysize;
00105 int thresh;
00106 int lr;
00107 int ndisp;
00108 int dpp;
00109 int offx, offy;
00110
00111
00112 int max_linelen;
00113 int max_lines;
00114 int max_decimation;
00115 int max_binning;
00116 double gamma;
00117 int color;
00118
00119
00120 int autogain;
00121 int manualgain;
00122 int autowhite;
00123 int manualwhite;
00124
00125 int gain;
00126 int exposure;
00127 int contrast;
00128 int brightness;
00129 int saturation;
00130 int red;
00131 int blue;
00132 int green;
00133
00134
00135 int ix;
00136 int iy;
00137 int width;
00138 int height;
00139 int vergence;
00140
00141
00142 int subwarp;
00143 int left_ix, left_iy;
00144 int left_width, left_height;
00145 int right_ix, right_iy;
00146 int right_width, right_height;
00147
00148
00149 int decimation;
00150 int binning;
00151 int subwindow;
00152
00153 int linelen;
00154 int lines;
00155
00156
00157 svsIP left;
00158 svsIP right;
00159
00160
00161 00162 00163
00164 double Tx;
00165 double Ty;
00166 double Tz;
00167 double Rx;
00168 double Ry;
00169 double Rz;
00170
00171 unsigned long reserved;
00172 } svsSP;
00173
00174 IMPORT extern svsSP svsParams;
00175
00176 #define VIDEO_ERROR_FRAME_SIZE -6
00177 #define VIDEO_ERROR_FRAME_SAMPLE -2
00178 #define VIDEO_ERROR_DEC_MODE -3
00179 #define VIDEO_ERROR_BIN_MODE -4
00180 #define VIDEO_ERROR_SUBWINDOW -5
00181
00182
00183
00184
00185
00186 00187 00188
00189 #define MAXX 1280
00190 #define MAXY 1032
00191 #define MAXD 16
00192 #define MAXDS 128
00193 #define MAXW 13
00194 #define MAXRVAL 2048
00195 #define SUBPIXELS 16
00196
00197
00198 IMPORT extern int svsConvX, svsConvY, svsCorrX, svsCorrY, svsNumDisp;
00199
00200 #define VID_ROWS 240
00201 #define VID_COLS 320
00202 #define XKERNEL 9
00203 #define YKERNEL 5
00204 #define XCORR 11
00205 #define YCORR 1
00206 #define NUM_DISP 16
00207
00208 00209 00210 00211
00212 #define RESWIDTH(p) ((p)->width - (p)->convx - (p)->corrxsize - 2*(p)->ndisp - \
00213 abs((p)->offx) + 4)
00214 #define RESLEN(p) ((p)->height - (p)->convy - (p)->corrysize - abs((p)->offy) + 2)
00215 #define RESLEFT(p) (((p)->convx +(p)->corrxsize + (p)->ndisp + (p)->ndisp - 4) /2 \
00216 + ((p)->offx < 0 ? -(p)->offx : 0))
00217 #define RESTOP(p) (((p)->convy + (p)->corrysize - 2) / 2 + \
00218 ((p)->offy < 0 ? -(p)->offy : 0))
00219
00220 00221 00222
00223 #define EDGEWIDTH(p) (((p)->linelen) - (p)->convx + 1)
00224 #define EDGELEN(p) (((p)->height) - (p)->convy + 1)
00225 #define EDGELEFT(p) ((p)->convx/2)
00226 #define EDGETOP(p) ((p)->convy/2)
00227
00228
00229 #define IN_STORAGE 4
00230 #define IN_LIVE 5
00231
00232
00233 #define DISP_NONE 0
00234 #define DISP_LEFT 1
00235 #define DISP_RIGHT 2
00236 #define DISP_BOTH 3
00237 #define DISP_MOSAIC 4
00238 #define DISP_HIST 5
00239 #define DISP_IMAGE 6
00240 #define DISP_X1 7
00241 #define DISP_X2 8
00242
00243
00244 #define AQ_SINGLE 1
00245 #define AQ_CONTIN 2
00246 #define AQ_FREEZE 11
00247 #define AQ_CALIBRATE 10
00248
00249
00250 #define AQT_SVM 3
00251 #define AQT_BUFFER 4
00252 #define AQT_FRAMEGRAB 5
00253 #define AQT_NONE 6
00254
00255
00256 #define STO_ON 1
00257 #define STO_OFF 2
00258 #define STO_CLEAR 3
00259
00260
00261 #define CAP_INTERLACE 0
00262 #define CAP_RGCOMPONENT 1
00263 #define CAP_DUAL 2
00264 #define CAP_TRIPLE 3
00265 #define CAP_CHANNELS 4
00266
00267 #define BI_YVU9 0x39555659 // YVU9, planar
00268 #define BI_YV12 0x32315659 // YVU12 (4:1:1), planar
00269 #define BI_I420 0x30323449 // YUV12 (4:2:0), planar
00270 #define BI_I422 0x32323449 // YUV12 (4:1:1), planar
00271 #define BI_MRG2 0x3247524d // YUV16 (4:2:2) ??
00272
00273 00274 00275
00276
00277 IMPORT extern char *svsVideoIdent;
00278
00279 IMPORT extern int svsDevice1;
00280 IMPORT extern int svsDevice2;
00281
00282 IMPORT extern int svsDevice1;
00283 IMPORT extern int svsDevice2;
00284 IMPORT extern char *svsDevName;
00285 IMPORT extern char *svsDevName2;
00286 IMPORT extern int svsIsPXC_PC104;
00287
00288 IMPORT extern int svsMeteorMotion;
00289 IMPORT extern int svsDualCaptureFormat;
00290 IMPORT extern int svsSwapInterlace;
00291 IMPORT extern int svsVideoFormat;
00292 IMPORT extern int svsVideoBPP;
00293
00294 IMPORT int svsVideoOpen(svsSP *sp);
00295 IMPORT void svsVideoClose(void);
00296
00297 IMPORT int svsVideoWaitImage(int ms);
00298 IMPORT int svsVideoCheckImage(void);
00299 IMPORT void svsVideoGetImage(unsigned char **buf, unsigned char **buf2,
00300 unsigned char **color);
00301 IMPORT void svsVideoGetRectImage(unsigned char **left, unsigned char **right,
00302 unsigned char **color, svsSP *sp);
00303 IMPORT int svsVideoCheckParameters(svsSP *sp);
00304 IMPORT int svsVideoStartContinuous(svsSP *sp);
00305 IMPORT void svsVideoHaltContinuous(void);
00306 IMPORT int svsVideoGrabSingle(svsSP *sp, int ms);
00307
00308
00309 IMPORT int svsVideoSetDigParams(svsSP *sp);
00310 IMPORT int svsVideoSetOffsets(svsSP *sp);
00311
00312
00313 IMPORT int svsVideoGetName(char *name);
00314 IMPORT int svsVideoSetName(char *name);
00315
00316
00317 IMPORT extern void (*capDebug)(char *str);
00318 IMPORT extern void (*svsDebug)(char *str);
00319 IMPORT void svsDebugMessage(char *str, ...);
00320
00321
00322 00323 00324
00325
00326 #define svsLEFT 1
00327 #define svsRIGHT 2
00328 #define svsBOTH 3
00329 #define svsLEFTCOLOR 100
00330 #define svsLEFTBAYER 102
00331 #define svsRIGHTBAYER 103
00332
00333
00334
00335 #define svsLEFT1 4
00336 #define svsLEFT2 5
00337 #define svsLEFT3 6
00338 #define svsRIGHT1 7
00339 #define svsRIGHT2 8
00340 #define svsRIGHT3 9
00341
00342 00343 00344
00345 #define svsNONE 0
00346 #define svsSTEREO 1
00347 #define svsCONFIDENCE 2
00348 #define svsEDGES 3
00349 #define svsMOTION 4
00350 #define svsCOLOR 5
00351
00352 00353 00354
00355
00356
00357 #ifdef IMPORT_HASMMX
00358 REALLYIMPORT
00359 #else
00360 IMPORT
00361 #endif
00362 extern int svsHasMMX; 00363
00364 IMPORT int svsCheckMMX(void);
00365
00366 00367 00368 00369
00370 IMPORT void svsWarpImage(unsigned char *dest, unsigned char *src, int which, svsSP *sp);
00371 IMPORT void svsWarpImageBayer(unsigned char *dest, unsigned char *dest2, unsigned char *src,
00372 int which, svsSP *sp);
00373 IMPORT void svsWarpImageMono (unsigned char *dest, unsigned char *src,
00374 int which, svsSP *sp);
00375 IMPORT void svsCalcStereo(short *dest, unsigned char *il,
00376 unsigned char *ir, svsSP *sp);
00377 IMPORT void svsCalcEdges(signed char *ld, signed char *rd, unsigned char *il,
00378 unsigned char *ir, svsSP *sp);
00379 IMPORT void svsCalcConfidence(char *dest, unsigned char *il, svsSP *sp);
00380 IMPORT void svsCalcMotion(unsigned char *dest, unsigned char *il,
00381 unsigned char *ir, int xs, int ys, svsSP *sp);
00382
00383
00384
00385
00386 IMPORT void svsReconstruct3D (float *X, float *Y, float *Z, float x, float y, float disp, svsSP *sp);
00387 IMPORT void svsReconstruct3DFast (float *X, float *Y, float *Z, float x, float y, float disp, svsSP *sp);
00388
00389 #define LRVAL 0xfe
00390 #define THRESHVAL 0xff
00391
00392 00393 00394
00395
00396 IMPORT extern int svsStereoOffsetX, svsStereoOffsetY;
00397 IMPORT extern float svsRangeImageValue(short *im, svsSP *sp);
00398 IMPORT extern void svsSleep(int ms);
00399 IMPORT extern int svsSharedMemory;
00400
00401 #ifdef UNIX
00402 #endif
00403
00404 #ifdef WIN32
00405 IMPORT extern HWND svsMainWin;
00406 #endif
00407
00408 00409 00410
00411
00412 #define HEADER_STRING "srisunim"
00413
00414 #define HEADER_TYPE 0
00415 #define DATA_INT 0
00416 #define DATA_FLOAT 1
00417 #define HEADER_SIZE 256
00418
00419
00420 struct srisunim_header
00421 {
00422 char srisunim[8];
00423 char header_type;
00424 char data_type;
00425 char bits_per_pixel;
00426 char n_dimensions;
00427 unsigned char x_dimension_h;
00428 unsigned char x_dimension_l;
00429 unsigned char y_dimension_h;
00430 unsigned char y_dimension_l;
00431 unsigned char z_dimension_h;
00432 unsigned char z_dimension_l;
00433 unsigned char n_images;
00434 char padding[237];
00435 };
00436
00437 00438
00439 IMPORT unsigned char *svsReadFile(char *name, unsigned char *buffer,
00440 int *height, int *width, int *num);
00441 IMPORT int svsWriteImage(char *name, unsigned char *buf, int width,
00442 int height, char *type, int numframes);
00443 IMPORT int svsReadFileBMP(char *name, unsigned char *buffer,
00444 int *width, int *height, int interlace);
00445 IMPORT unsigned char *svsReadFile2BMP(char *name, unsigned char *buffer,
00446 int *width, int *height);
00447 IMPORT int svsWriteImageBMP(char *name, unsigned char *im, int width, int height,
00448 int isDisparity);
00449 IMPORT int svsWriteImageColorBMP(char *name, unsigned char *im, int width, int height,
00450 int isDisparity);
00451 IMPORT extern char *svsError;
00452 IMPORT int svsWriteParamFile(char *fname, svsSP *sp);
00453 IMPORT int svsReadParamFile(char *fname, svsSP *sp);
00454
00455
00456
00457
00458 #define engine_version 21
00459 IMPORT extern int svsEngineVersion;
00460
00461 IMPORT extern int svsPreFilterTime, svsPostFilterTime, svsCorrTime, svsMaxTime;
00462
00463
00464
00465
00466
00467 IMPORT void svsDrawImage(void *w, unsigned char *im, svsSP *p, int type);
00468 IMPORT void *svsGetWindow(int w, int h);
00469 IMPORT int fltk_check(void);
00470
00471 #ifdef __cplusplus
00472 }
00473 #endif
00474
00475 #endif