artoolkit-commits Mailing List for ARToolKit (Page 28)
Optical marker tracking and overlay for augmented reality.
Brought to you by:
philip_lamb
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(65) |
Dec
(32) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
(5) |
Mar
(15) |
Apr
(22) |
May
|
Jun
(9) |
Jul
(108) |
Aug
(42) |
Sep
(62) |
Oct
(5) |
Nov
|
Dec
(4) |
2006 |
Jan
|
Feb
|
Mar
|
Apr
(38) |
May
(27) |
Jun
(58) |
Jul
(8) |
Aug
(11) |
Sep
(51) |
Oct
(15) |
Nov
(12) |
Dec
(3) |
2007 |
Jan
(25) |
Feb
(6) |
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
|
2008 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(20) |
Sep
(5) |
Oct
|
Nov
|
Dec
(2) |
2009 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Philip L. <phi...@us...> - 2004-11-22 02:39:57
|
Update of /cvsroot/artoolkit/artoolkit/util/videoTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15286/videoTest Log Message: Directory /cvsroot/artoolkit/artoolkit/util/videoTest added to the repository |
From: Philip L. <phi...@us...> - 2004-11-22 02:33:08
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinux1394Cam In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13718 Modified Files: video.c Log Message: Linux video driver updates and patches. Index: video.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinux1394Cam/video.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** video.c 4 Nov 2004 08:51:47 -0000 1.1.1.1 --- video.c 22 Nov 2004 02:32:48 -0000 1.2 *************** *** 1,9 **** /* * Video capture subrutine for Linux/libdc1394 devices * author: Kiyoshi Kiyokawa ( ki...@cr... ) ! Hirokazu Kato ( ka...@sy... ) * - * Revision: 1.0 Date: 2002/01/01 */ #include <sys/ioctl.h> #include <sys/types.h> --- 1,18 ---- /* + * Revision: 1.0 Date: 2002/01/01 * Video capture subrutine for Linux/libdc1394 devices * author: Kiyoshi Kiyokawa ( ki...@cr... ) ! * Hirokazu Kato ( ka...@sy... ) ! * ! * ! * Revision: 1.1 Date: 2004/09/30 ! * Modifications by Wayne Piekarski ( wa...@cs... ) ! * - #ifdef macros added to support the many different versions of libdc1394 ! * - Initialisation code rewritten to support multiple 1394 busses ! * - Either autodetect of cameras or specifying the exact camera is now possible ! * - Support for changing of various 1394 camera properties * */ + #include <sys/ioctl.h> #include <sys/types.h> *************** *** 23,26 **** --- 32,82 ---- + + + /* Do not touch the following macros! */ + #undef LIBDC_8 + #undef LIBDC_9 + #undef LIBDC_10 + #undef LIBDC_DEF + + + /* ----------------------- MAKE ANY #define CHANGES HERE ONLY -------------------------------- */ + /* This define controls if we use the new or old libDC1394 API functions. The new code is much + more stable for multiple cameras and so is recommended */ + // #define LIBDC_8 + // #define LIBDC_9 + #define LIBDC_10 + /* ----------------------- MAKE ANY #define CHANGES HERE ONLY -------------------------------- */ + + + /* These are some extra constants I defined for my modifications */ + #define DEFAULT_VIDEO_CARD -1 + #define MAX_PORTS 4 /* This is the maximum number of Firewire cards we can have installed in the system, it is an arbitrary number */ + + + /* Error checking to ensure we have a proper configuration, and put some debugging out */ + #ifdef LIBDC_8 + #warning Compiling using original 0.8.3 libDC library (single camera only) - debian: libdc1394-8-dev + #warning The 0.8.3 libDC code is dangerous and has a number of bugs which will cause trouble - upgrade to 0.9.1 or later! + #define LIBDC_DEF + #endif + + #ifdef LIBDC_9 + #warning Compiling using the newer and safer 0.9.1 libDC library (multiple camera support) - debian: libdc1394-9-dev + #define LIBDC_DEF + #endif + + #ifdef LIBDC_10 + #warning Compiling using the newer and safer 0.9.5 libDC library (multiple camera support) - debian: libdc1394-10-dev + #define LIBDC_DEF + #endif + + #ifndef LIBDC_DEF + #error One of the LIBDC_[8,9,10] macros must be defined to compile this code properly! + #endif + + + + static AR2VideoParamT *gVid = NULL; *************** *** 94,101 **** { raw1394handle_t handle; - int numNodes; - int numCameras; - nodeid_t *camera_nodes; - int *activeFlag; } ARVideo1394; --- 150,153 ---- *************** *** 103,107 **** static int initFlag = 0; ! static int ar2Video1394Init( int debug ); --- 155,159 ---- static int initFlag = 0; ! static int ar2Video1394Init( int debug, int *card, int *node ); *************** *** 112,122 **** printf(" -node=N\n"); printf(" specifies detected node ID of a FireWire camera (-1: Any).\n"); ! printf(" -mode=[320x240_YUV422|640x480_RGB|640x480_YUV411|\n"); ! printf(" 640x480_YUV411_HALF|640x480_MONO|640x480_MONO_COLOR\n"); ! printf(" 640x480_MONO_COLOR_HALF]\n"); printf(" specifies input image format.\n"); printf(" -rate=N\n"); printf(" specifies desired framerate of a FireWire camera. \n"); printf(" (1.875, 3.75, 7.5, 15, 30, 60)\n"); printf("\n"); --- 164,176 ---- printf(" -node=N\n"); printf(" specifies detected node ID of a FireWire camera (-1: Any).\n"); ! printf(" -card=N\n"); ! printf(" specifies the FireWire adaptor id number (-1: Any).\n"); ! printf(" -mode=[320x240_YUV422|640x480_RGB|640x480_YUV411]\n"); printf(" specifies input image format.\n"); printf(" -rate=N\n"); printf(" specifies desired framerate of a FireWire camera. \n"); printf(" (1.875, 3.75, 7.5, 15, 30, 60)\n"); + printf(" -[name]=N where name is brightness, iris, shutter, gain, saturation, gamma, sharpness\n"); + printf(" (value must be a legal value for this parameter - use coriander to find what they are\n"); printf("\n"); *************** *** 126,129 **** --- 180,184 ---- AR2VideoParamT *ar2VideoOpen( char *config ) { + char video1394devname [128]; AR2VideoParamT *vid; ARUint32 p1,p2; *************** *** 132,140 **** int i; arMalloc( vid, AR2VideoParamT, 1 ); vid->node = DEFAULT_VIDEO_NODE; vid->mode = DEFAULT_VIDEO_MODE; vid->rate = DEFAULT_VIDEO_FRAME_RATE; ! //vid->channel = 0; vid->speed = SPEED_400; vid->format = FORMAT_VGA_NONCOMPRESSED; --- 187,204 ---- int i; + int brightness = -1; + int iris = -1; + int shutter = -1; + int gain = -1; + int saturation = -1; + int gamma = -1; + int sharpness = -1; + arMalloc( vid, AR2VideoParamT, 1 ); vid->node = DEFAULT_VIDEO_NODE; + vid->card = DEFAULT_VIDEO_CARD; vid->mode = DEFAULT_VIDEO_MODE; vid->rate = DEFAULT_VIDEO_FRAME_RATE; ! vid->channel = 0; vid->speed = SPEED_400; vid->format = FORMAT_VGA_NONCOMPRESSED; *************** *** 153,159 **** vid->mode = VIDEO_MODE_320x240_YUV422; } - else if ( strncmp( &a[6], "640x480_YUV411_HALF", 19 ) == 0 ) { - vid->mode = VIDEO_MODE_640x480_YUV411_HALF; - } else if ( strncmp( &a[6], "640x480_YUV411", 14 ) == 0 ) { vid->mode = VIDEO_MODE_640x480_YUV411; --- 217,220 ---- *************** *** 162,175 **** vid->mode = VIDEO_MODE_640x480_RGB; } ! else if ( strncmp( &a[6], "640x480_MONO_COLOR_HALF", 23 ) == 0 ) { ! vid->mode = VIDEO_MODE_640x480_MONO_COLOR_HALF; ! } ! else if ( strncmp( &a[6], "640x480_MONO_COLOR", 18 ) == 0 ) { ! vid->mode = VIDEO_MODE_640x480_MONO_COLOR; } ! else if ( strncmp( &a[6], "640x480_MONO", 12 ) == 0 ) { ! vid->mode = VIDEO_MODE_640x480_MONO; } ! else { ar2VideoDispOption(); free( vid ); --- 223,244 ---- vid->mode = VIDEO_MODE_640x480_RGB; } ! else { ! ar2VideoDispOption(); ! free( vid ); ! return 0; } ! } ! ! else if( strncmp( a, "-iris=", 6 ) == 0 ) { ! sscanf( a, "%s", line ); ! if( sscanf( &line[6], "%d", &iris ) == 0 ) { ! ar2VideoDispOption(); ! free( vid ); ! return 0; } ! } ! else if( strncmp( a, "-gain=", 6 ) == 0 ) { ! sscanf( a, "%s", line ); ! if( sscanf( &line[6], "%d", &gain ) == 0 ) { ar2VideoDispOption(); free( vid ); *************** *** 177,180 **** --- 246,250 ---- } } + else if( strncmp( a, "-node=", 6 ) == 0 ) { sscanf( a, "%s", line ); *************** *** 185,188 **** --- 255,266 ---- } } + else if( strncmp( a, "-card=", 6 ) == 0 ) { + sscanf( a, "%s", line ); + if( sscanf( &line[6], "%d", &vid->card ) == 0 ) { + ar2VideoDispOption(); + free( vid ); + return 0; + } + } else if( strncmp( a, "-rate=", 6 ) == 0 ) { if ( strncmp( &a[6], "1.875", 5 ) == 0 ) { *************** *** 223,247 **** } ! if( initFlag == 0 ) { ! if( ar2Video1394Init(vid->debug) < 0 ) exit(0); initFlag = 1; } - - for( i=0; i<arV1394.numCameras; i++ ) { - if( (vid->node == VIDEO_NODE_ANY && arV1394.activeFlag[i] == 0) || (arV1394.camera_nodes[i] == vid->node) ) { - if( vid->debug ) printf("Using a camera #%d (Node ID = %d)\n", i, arV1394.camera_nodes[i]); - vid->internal_id = i; - if( vid->node == VIDEO_NODE_ANY ) vid->node = arV1394.camera_nodes[i]; - break; - } - } - if( i == arV1394.numCameras ) { - printf("cound not find the specified camera.\n"); - exit(0); - } - - vid->channel = vid->node; - switch( vid->mode ) { case VIDEO_MODE_320x240_YUV422: --- 301,312 ---- } ! ! if( initFlag == 0 ) ! { ! if( ar2Video1394Init(vid->debug, &vid->card, &vid->node) < 0 ) ! exit(0); initFlag = 1; } switch( vid->mode ) { case VIDEO_MODE_320x240_YUV422: *************** *** 249,253 **** break; case VIDEO_MODE_640x480_YUV411: - case VIDEO_MODE_640x480_YUV411_HALF: vid->int_mode = MODE_640x480_YUV411; break; --- 314,317 ---- *************** *** 255,263 **** vid->int_mode = MODE_640x480_RGB; break; - case VIDEO_MODE_640x480_MONO: - case VIDEO_MODE_640x480_MONO_COLOR: - case VIDEO_MODE_640x480_MONO_COLOR_HALF: - vid->int_mode = MODE_640x480_MONO; - break; default: printf("Sorry, Unsupported Video Format for IEEE1394 Camera.\n"); --- 319,322 ---- *************** *** 300,303 **** --- 359,381 ---- } + + /* Change the camera settings if we need to */ + if (iris != -1) + { + fprintf (stderr, "Adjusting IRIS setting to %d\n", iris); + dc1394_set_iris (arV1394.handle, vid->node, (unsigned int)iris); + } + if (gain != -1) + { + fprintf (stderr, "Adjusting GAIN setting to %d\n", gain); + dc1394_set_gain (arV1394.handle, vid->node, (unsigned int)gain); + } + + + /* Dump out the new parameters now */ + if (vid->debug) + dc1394_print_feature_set( &(vid->features) ); + + /*-----------------------------------------------------------------------*/ /* check parameters */ *************** *** 335,341 **** /* setup capture */ /*-----------------------------------------------------------------------*/ if( dc1394_dma_setup_capture(arV1394.handle, vid->node, ! vid->channel, vid->format, vid->int_mode, --- 413,424 ---- /* setup capture */ /*-----------------------------------------------------------------------*/ + sprintf (video1394devname, "/dev/video1394/%d", vid->card); if( dc1394_dma_setup_capture(arV1394.handle, vid->node, ! #ifndef LIBDC_8 ! vid->node, ! #else ! vid->channel, ! #endif vid->format, vid->int_mode, *************** *** 343,346 **** --- 426,435 ---- vid->int_rate, vid->dma_buf_num, + #ifdef LIBDC_10 + 0, /* do_extra_buffering */ + #endif + #ifndef LIBDC_8 + 1, video1394devname, /* drop_frames, dma_device_file */ + #endif &(vid->camera)) != DC1394_SUCCESS ) { fprintf( stderr,"unable to setup camera-\n" *************** *** 360,365 **** arMalloc( vid->image, ARUint8, (vid->camera.frame_width * vid->camera.frame_height * AR_PIX_SIZE) ); - arV1394.activeFlag[vid->internal_id] = 1; - return vid; } --- 449,452 ---- *************** *** 374,389 **** dc1394_dma_release_camera(arV1394.handle, &(vid->camera)); #endif - arV1394.activeFlag[vid->internal_id] = 0; free( vid->image ); free( vid ); ! ! for( i=0; i<arV1394.numCameras; i++ ) { ! if( arV1394.activeFlag[i] ) break; ! } ! if( i == arV1394.numCameras ) { ! raw1394_destroy_handle(arV1394.handle); ! free (arV1394.activeFlag); initFlag = 0; - } return 0; --- 461,469 ---- dc1394_dma_release_camera(arV1394.handle, &(vid->camera)); #endif free( vid->image ); free( vid ); ! ! raw1394_destroy_handle(arV1394.handle); initFlag = 0; return 0; *************** *** 392,395 **** --- 472,478 ---- int ar2VideoCapStart( AR2VideoParamT *vid ) { + char video1394devname [128]; + + if(vid->status != 0 && vid->status != 3){ printf("arVideoCapStart has already been called.\n"); *************** *** 400,407 **** /* setup capture */ /*-----------------------------------------------------------------------*/ if( vid->status == 3 ) { if( dc1394_dma_setup_capture(arV1394.handle, vid->node, ! vid->channel, vid->format, vid->int_mode, --- 483,495 ---- /* setup capture */ /*-----------------------------------------------------------------------*/ + sprintf (video1394devname, "/dev/video1394/%d", vid->card); if( vid->status == 3 ) { if( dc1394_dma_setup_capture(arV1394.handle, vid->node, ! #ifndef LIBDC_8 ! vid->node, ! #else ! vid->channel, ! #endif vid->format, vid->int_mode, *************** *** 409,412 **** --- 497,506 ---- vid->int_rate, vid->dma_buf_num, + #ifdef LIBDC_10 + 0, /* do_extra_buffering */ + #endif + #ifndef LIBDC_8 + 1, video1394devname, /* drop_frames, dma_device_file */ + #endif &(vid->camera)) != DC1394_SUCCESS ) { fprintf( stderr,"unable to setup camera-\n" *************** *** 477,481 **** { register ARUint8 *buf, *buf2; - register ARUint8 *p1, *p2, *p3; register int i, j; register int U, V, R, G, B, V2, U5, UV; --- 571,574 ---- *************** *** 499,507 **** ! switch( vid->mode ) { ! case VIDEO_MODE_640x480_RGB: return (ARUint8 *)vid->camera.capture_buffer; ! case VIDEO_MODE_640x480_YUV411: buf = vid->image; buf2 = (ARUint8 *)vid->camera.capture_buffer; --- 592,600 ---- ! switch( vid->int_mode ) { ! case MODE_640x480_RGB: return (ARUint8 *)vid->camera.capture_buffer; ! case MODE_640x480_YUV411: buf = vid->image; buf2 = (ARUint8 *)vid->camera.capture_buffer; *************** *** 578,661 **** return vid->image; ! case VIDEO_MODE_640x480_YUV411_HALF: ! buf = vid->image; ! buf2 = (ARUint8 *)vid->camera.capture_buffer; ! for( j = 0; j < vid->camera.frame_height / 2; j++ ) { ! for( i = 0; i < vid->camera.frame_width / 4; i++ ) { ! U = ((ARUint8)*buf2++ - 128) * 0.354; ! U5 = 5*U; ! Y0 = (ARUint8)*buf2++; ! Y1 = (ARUint8)*buf2++; ! V = ((ARUint8)*buf2++ - 128) * 0.707; ! V2 = 2*V; ! Y2 = (ARUint8)*buf2++; ! Y3 = (ARUint8)*buf2++; ! UV = - U - V; ! ! // Original equations ! // R = Y + 1.402 V ! // G = Y - 0.344 U - 0.714 V ! // B = Y + 1.772 U ! R = Y0 + V2; ! if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; ! ! G = Y0 + UV; ! if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; ! ! B = Y0 + U5; ! if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; ! ! *buf++ = (ARUint8)R; ! *buf++ = (ARUint8)G; ! *buf++ = (ARUint8)B; ! ! //--- ! R = Y1 + V2; ! if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; ! ! G = Y1 + UV; ! if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; ! ! B = Y1 + U5; ! if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; ! ! *buf++ = (ARUint8)R; ! *buf++ = (ARUint8)G; ! *buf++ = (ARUint8)B; ! ! //--- ! R = Y2 + V2; ! if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; ! ! G = Y2 + UV; ! if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; ! ! B = Y2 + U5; ! if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; ! ! *buf++ = (ARUint8)R; ! *buf++ = (ARUint8)G; ! *buf++ = (ARUint8)B; ! ! //--- ! R = Y3 + V2; ! if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; ! ! G = Y3 + UV; ! if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; ! ! B = Y3 + U5; ! if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; ! ! *buf++ = (ARUint8)R; ! *buf++ = (ARUint8)G; ! *buf++ = (ARUint8)B; ! } ! buf2 += (vid->camera.frame_width / 4) * 6; ! buf += vid->camera.frame_width * 3; ! } ! return vid->image; ! ! case VIDEO_MODE_320x240_YUV422: buf = vid->image; buf2 = (ARUint8 *)vid->camera.capture_buffer; --- 671,675 ---- return vid->image; ! case MODE_320x240_YUV422: buf = vid->image; buf2 = (ARUint8 *)vid->camera.capture_buffer; *************** *** 698,884 **** } return vid->image; - - case VIDEO_MODE_640x480_MONO: - buf = vid->image; - buf2 = (ARUint8 *)vid->camera.capture_buffer; - for( i = vid->camera.frame_height * vid->camera.frame_width; i; i--) { - *buf++ = *buf2; - *buf++ = *buf2; - *buf++ = *buf2++; - } - return vid->image; - - case VIDEO_MODE_640x480_MONO_COLOR: - buf = vid->image; - p2 = (ARUint8 *)vid->camera.capture_buffer; - p3 = p2 + vid->camera.frame_width; - - *buf++ = *p2; - *buf++ = *(p2+1); - *buf++ = *(p3+1); - p2++; - p3++; - for( i = vid->camera.frame_width/2-1; i; i-- ) { - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - *buf++ = *p2; - *buf++ = *p3; - p2++; - p3++; - *buf++ = *p2; - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - *buf++ = ((int)*(p3-1) + (int)*(p3+1))/2; - p2++; - p3++; - } - *buf++ = *(p2-1); - *buf++ = *p2; - *buf++ = *p3; - p2++; - p3++; - p1 = (ARUint8 *)vid->camera.capture_buffer; - - for( j = vid->camera.frame_height/2-1; j; j-- ) { - *buf++ = ((int)*p1 + (int)*p3)/2; - *buf++ = *p2; - *buf++ = *(p2+1); - p1++; - p2++; - p3++; - for( i = vid->camera.frame_width/2-1; i; i-- ) { - *buf++ = ((int)*(p1-1) + (int)*(p1+1) + (int)*(p3-1) + (int)*(p3+1))/4; - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - *buf++ = *p2; - p1++; - p2++; - p3++; - *buf++ = ((int)*p1 + (int)*p3)/2; - *buf++ = *p2; - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - p1++; - p2++; - p3++; - } - *buf++ = ((int)*(p1-1) + (int)*(p3-1))/2; - *buf++ = ((int)*p1 + (int)*p3)/2; - *buf++ = *p2; - p1++; - p2++; - p3++; - - *buf++ = *p2; - *buf++ = ((int)*p1 + (int)*p3)/2; - *buf++ = ((int)*(p1+1) + (int)*(p3+1))/2; - p1++; - p2++; - p3++; - for( i = vid->camera.frame_width/2-1; i; i-- ) { - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - *buf++ = *p2; - *buf++ = ((int)*p1 + (int)*p3)/2; - p1++; - p2++; - p3++; - *buf++ = *p2; - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - *buf++ = ((int)*(p1-1) + (int)*(p1+1) + (int)*(p3-1) + (int)*(p3+1))/4; - p1++; - p2++; - p3++; - } - *buf++ = *(p2-1); - *buf++ = *p2; - *buf++ = ((int)*p1 + (int)*p3)/2; - p1++; - p2++; - p3++; - } - - *buf++ = *p1; - *buf++ = *p2; - *buf++ = *(p2+1); - p1++; - p2++; - for( i = vid->camera.frame_width/2; i; i-- ) { - *buf++ = ((int)*(p1-1) + (int)*(p1+1))/2; - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - *buf++ = *p2; - p1++; - p2++; - *buf++ = *p1; - *buf++ = *p2; - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - p1++; - p2++; - } - *buf++ = *(p1-1); - *buf++ = *(p2-1); - *buf++ = *p2; - - return vid->image; - - case VIDEO_MODE_640x480_MONO_COLOR_HALF: - buf = vid->image; - p2 = (ARUint8 *)vid->camera.capture_buffer; - p3 = p2 + vid->camera.frame_width; - - *buf++ = *p2; - *buf++ = *(p2+1); - *buf++ = *(p3+1); - p2++; - p3++; - for( i = vid->camera.frame_width/2-1; i; i-- ) { - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - *buf++ = *p2; - *buf++ = *p3; - p2++; - p3++; - *buf++ = *p2; - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - *buf++ = ((int)*(p3-1) + (int)*(p3+1))/2; - p2++; - p3++; - } - *buf++ = *(p2-1); - *buf++ = *p2; - *buf++ = *p3; - p2++; - p3++; - p1 = (ARUint8 *)vid->camera.capture_buffer; - - for( j = vid->camera.frame_height/2-1; j; j-- ) { - p1 += vid->camera.frame_width; - p2 += vid->camera.frame_width; - p3 += vid->camera.frame_width; - buf += vid->camera.frame_width * 3; - - *buf++ = *p2; - *buf++ = ((int)*p1 + (int)*p3)/2; - *buf++ = ((int)*(p1+1) + (int)*(p3+1))/2; - p1++; - p2++; - p3++; - for( i = vid->camera.frame_width/2-1; i; i-- ) { - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - *buf++ = *p2; - *buf++ = ((int)*p1 + (int)*p3)/2; - p1++; - p2++; - p3++; - *buf++ = *p2; - *buf++ = ((int)*(p2-1) + (int)*(p2+1))/2; - *buf++ = ((int)*(p1-1) + (int)*(p1+1) + (int)*(p3-1) + (int)*(p3+1))/4; - p1++; - p2++; - p3++; - } - *buf++ = *(p2-1); - *buf++ = *p2; - *buf++ = ((int)*p1 + (int)*p3)/2; - p1++; - p2++; - p3++; - } - - return vid->image; } --- 712,715 ---- *************** *** 889,943 **** ! static int ar2Video1394Init( int debug ) { int i; ! ! /*-----------------------------------------------------------------------*/ ! /* Open ohci and asign handle to it */ ! /*-----------------------------------------------------------------------*/ ! arV1394.handle = dc1394_create_handle(0); ! if (arV1394.handle==NULL) { ! fprintf( stderr, "Unable to aquire a raw1394 handle\n" ! "did you insmod the drivers?\n"); ! exit(0); ! } ! ! /*-----------------------------------------------------------------------*/ ! /* get the camera nodes and describe them as we find them */ ! /*-----------------------------------------------------------------------*/ ! arV1394.numNodes = raw1394_get_nodecount(arV1394.handle); ! arV1394.camera_nodes = dc1394_get_camera_nodes(arV1394.handle,&arV1394.numCameras,((debug)? 1: 0)); ! fflush(stdout); ! if (arV1394.numCameras<1) { ! fprintf( stderr, "no cameras found :(\n"); ! raw1394_destroy_handle(arV1394.handle); ! exit(0); ! } ! if( debug ) { ! printf("%d camera(s) found on the bus\n", arV1394.numCameras); ! printf("Node IDs are: "); ! for (i=0; i<arV1394.numCameras; i++) { ! printf("%d, ", arV1394.camera_nodes[i]); ! } ! printf("\n"); ! } ! ! arMalloc( arV1394.activeFlag, int, arV1394.numCameras ); ! for( i=0; i<arV1394.numCameras; i++ ) { ! if( arV1394.camera_nodes[i] == arV1394.numNodes-1) { ! fprintf( stderr, "\n" ! "If ohci1394 is not working as root, please do:\n" ! "\n" ! " rmmod ohci1394\n" ! " insmod ohci1394 attempt_root=1\n" ! "\n" ! "Otherwise, try to change FireWire connections so that\n" ! "the highest number is not given to any camera.\n"); ! exit(0); ! } ! ! arV1394.activeFlag[i] = 0; ! } ! return 0; } --- 720,814 ---- ! static int ar2Video1394Init( int debug, int *card, int *node ) { int i; ! ! /* The user must either specify both card and node, or neither of them */ ! if (((*card == -1) && (*node != -1)) || ! ((*card != -1) && (*node == -1))) ! { ! fprintf (stderr, "Card value is %d and node value is %d, you must either auto-detect both or specify both\n"); ! exit (1); ! } ! ! /* If the user has specified so, we will autodetect for the camera and grab the first one we can find */ ! if ((*card == -1) && (*node == -1)) ! { ! /* Find the total number of firewire cards in the system */ ! int numPorts = MAX_PORTS; ! int p; ! struct raw1394_portinfo ports[MAX_PORTS]; ! raw1394handle_t raw_handle = raw1394_new_handle (); ! if (raw_handle == NULL) ! { ! fprintf (stderr, "Could not acquire a raw1394 handle - driver not installed?\n"); ! exit (1); ! } ! numPorts = raw1394_get_port_info (raw_handle, ports, numPorts); ! raw1394_destroy_handle (raw_handle); ! ! /* Perform autodetection */ ! printf ("Auto-detecting firewire camera because card and node is not specified\n"); ! ! /* We need to traverse all available cards and process each one */ ! for (p = 0; p < numPorts; p++) ! { ! /* Open up OHCI and assign a handle */ ! int numnodes, c; ! raw1394handle_t handle; ! handle = dc1394_create_handle (p); ! if (handle == NULL) ! continue; ! ! /* Get the camera nodes */ ! numnodes = raw1394_get_nodecount (handle); ! if (numnodes <= 1) ! continue; ! ! /* Get info for each camera node */ ! for (c = 0; c < numnodes; c++) ! { ! dc1394_camerainfo info; ! if (dc1394_get_camera_info (handle, c, &info) < 0) ! { ! printf ("1394 card %d node %d is not a camera [INVALID]\n", p, c); ! } ! else ! { ! printf ("1394 card %d node %d is a [%s - %s] --> ", p, c, info.vendor, info.model); ! ! /* Store the node numbers */ ! if (*card == -1) ! { ! printf ("auto detected\n"); ! *card = p; ! *node = c; ! } ! else ! printf ("not used\n"); ! } ! } ! } ! ! /* If we still haven't found a camera then we are in trouble */ ! if ((*card == -1) && (*node == -1)) ! { ! fprintf (stderr, "Could not auto detect any cameras on the %d firewire cards available\n", numPorts); ! exit (1); ! } ! printf ("Using the firewire camera on card %d and node %d\n", *card, *node); ! } ! ! ! /* Lets create a handle so it can be used later on */ ! arV1394.handle = dc1394_create_handle(*card); ! if (arV1394.handle==NULL) ! { ! fprintf (stderr, "Could not acquire a raw1394 handle, did you insmod the drivers?\n"); ! exit(1); ! } ! ! ! /* Success */ return 0; } |
From: Philip L. <phi...@us...> - 2004-11-22 02:32:54
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinuxV4L In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13693 Modified Files: video.c Makefile.in Added Files: jpegtorgb.h ccvt_i386.S ccvt_c.c ccvt.h Log Message: Linux video driver updates and patches. --- NEW FILE: ccvt.h --- /* (C) 2000 Nemosoft Unv. nem...@sm... This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef CCVT_H #define CCVT_H #ifdef __cplusplus extern "C" { #endif /* Colour ConVerT: going from one colour space to another Format descriptions: 420i = "4:2:0 interlaced" YYYY UU YYYY UU even lines YYYY VV YYYY VV odd lines U/V data is subsampled by 2 both in horizontal and vertical directions, and intermixed with the Y values. 420p = "4:2:0 planar" YYYYYYYY N lines UUUU N/2 lines VVVV N/2 lines U/V is again subsampled, but all the Ys, Us and Vs are placed together in separate buffers. The buffers may be placed in one piece of contiguous memory though, with Y buffer first, followed by U, followed by V. yuyv = "4:2:2 interlaced" YUYV YUYV YUYV ... N lines The U/V data is subsampled by 2 in horizontal direction only. bgr24 = 3 bytes per pixel, in the order Blue Green Red (whoever came up with that idea...) rgb24 = 3 bytes per pixel, in the order Red Green Blue (which is sensible) rgb32 = 4 bytes per pixel, in the order Red Green Blue Alpha, with Alpha really being a filler byte (0) bgr32 = last but not least, 4 bytes per pixel, in the order Blue Green Red Alpha, Alpha again a filler byte (0) */ /* Functions in ccvt_i386.S/ccvt_c.c */ /* 4:2:0 YUV interlaced to RGB/BGR */ void ccvt_420i_bgr24(int width, int height, void *src, void *dst); void ccvt_420i_rgb24(int width, int height, void *src, void *dst); void ccvt_420i_bgr32(int width, int height, void *src, void *dst); void ccvt_420i_rgb32(int width, int height, void *src, void *dst); /* 4:2:2 YUYV interlaced to RGB/BGR */ void ccvt_yuyv_rgb32(int width, int height, void *src, void *dst); void ccvt_yuyv_bgr32(int width, int height, void *src, void *dst); /* 4:2:0 YUV planar to RGB/BGR */ void ccvt_420p_rgb32(int width, int height, void *srcy, void *srcu, void *srcv, void *dst); void ccvt_420p_bgr32(int width, int height, void *srcy, void *srcu, void *srcv, void *dst); void ccvt_420p_rgb24(int width, int height, void *srcy, void *srcu, void *srcv, void *dst); void ccvt_420p_bgr24(int width, int height, void *srcy, void *srcu, void *srcv, void *dst); /* RGB/BGR to 4:2:0 YUV interlaced */ /* RGB/BGR to 4:2:0 YUV planar */ void ccvt_rgb24_420p(int width, int height, void *src, void *dsty, void *dstu, void *dstv); void ccvt_bgr24_420p(int width, int height, void *src, void *dsty, void *dstu, void *dstv); /* Go from 420i to other yuv formats */ void ccvt_420i_420p(int width, int height, void *src, void *dsty, void *dstu, void *dstv); void ccvt_420i_yuyv(int width, int height, void *src, void *dst); #ifdef __cplusplus } #endif #endif --- NEW FILE: ccvt_c.c --- /* Colour conversion routines (RGB <-> YUV) in plain C (C) 2000 Nemosoft Unv. nem...@sm... This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ccvt.h" #define PUSH_RGB24 1 #define PUSH_BGR24 2 #define PUSH_RGB32 3 #define PUSH_BGR32 4 /* This is a really simplistic approach. Speedups are welcomed. */ static void ccvt_420i(int width, int height, unsigned char *src, unsigned char *dst, int push) { int line, col, linewidth; int y, u, v, yy, vr, ug, vg, ub; int r, g, b; unsigned char *py, *pu, *pv; linewidth = width + (width >> 1); py = src; pu = py + 4; pv = pu + linewidth; y = *py++; yy = y << 8; u = *pu - 128; ug = 88 * u; ub = 454 * u; v = *pv - 128; vg = 183 * v; vr = 359 * v; /* The biggest problem is the interlaced data, and the fact that odd add even lines have V and U data, resp. */ for (line = 0; line < height; line++) { for (col = 0; col < width; col++) { r = (yy + vr) >> 8; g = (yy - ug - vg) >> 8; b = (yy + ub ) >> 8; switch(push) { case PUSH_RGB24: *dst++ = r; *dst++ = g; *dst++ = b; break; case PUSH_BGR24: *dst++ = b; *dst++ = g; *dst++ = r; break; case PUSH_RGB32: *dst++ = r; *dst++ = g; *dst++ = b; *dst++ = 0; break; case PUSH_BGR32: *dst++ = b; *dst++ = g; *dst++ = r; *dst++ = 0; break; } y = *py++; yy = y << 8; if ((col & 3) == 3) py += 2; // skip u/v if (col & 1) { if ((col & 3) == 3) { pu += 4; // skip y pv += 4; } else { pu++; pv++; } u = *pu - 128; ug = 88 * u; ub = 454 * u; v = *pv - 128; vg = 183 * v; vr = 359 * v; } } /* ..for col */ if (line & 1) { // odd line: go to next band pu += linewidth; pv += linewidth; } else { // rewind u/v pointers pu -= linewidth; pv -= linewidth; } } /* ..for line */ } void ccvt_420i_rgb24(int width, int height, void *src, void *dst) { ccvt_420i(width, height, (unsigned char *)src, (unsigned char *)dst, PUSH_RGB24); } void ccvt_420i_bgr24(int width, int height, void *src, void *dst) { ccvt_420i(width, height, (unsigned char *)src, (unsigned char *)dst, PUSH_BGR24); } void ccvt_420i_rgb32(int width, int height, void *src, void *dst) { ccvt_420i(width, height, (unsigned char *)src, (unsigned char *)dst, PUSH_RGB32); } void ccvt_420i_bgr32(int width, int height, void *src, void *dst) { ccvt_420i(width, height, (unsigned char *)src, (unsigned char *)dst, PUSH_BGR32); } void ccvt_420i_420p(int width, int height, void *src, void *dsty, void *dstu, void *dstv) { short *s, *dy, *du, *dv; int line, col; s = (short *)src; dy = (short *)dsty; du = (short *)dstu; dv = (short *)dstv; for (line = 0; line < height; line++) { for (col = 0; col < width; col += 4) { *dy++ = *s++; *dy++ = *s++; if (line & 1) *dv++ = *s++; else *du++ = *s++; } /* ..for col */ } /* ..for line */ } void ccvt_420i_yuyv(int width, int height, void *src, void *dst) { int line, col, linewidth; unsigned char *py, *pu, *pv, *d; linewidth = width + (width >> 1); py = (unsigned char *)src; pu = src + 4; pv = pu + linewidth; d = (unsigned char *)dst; for (line = 0; line < height; line++) { for (col = 0; col < width; col += 4) { /* four pixels in one go */ *d++ = *py++; *d++ = *pu++; *d++ = *py++; *d++ = *pv++; *d++ = *py++; *d++ = *pu++; *d++ = *py++; *d++ = *pv++; py += 2; pu += 4; pv += 4; } /* ..for col */ if (line & 1) { // odd line: go to next band pu += linewidth; pv += linewidth; } else { // rewind u/v pointers pu -= linewidth; pv -= linewidth; } } /* ..for line */ } Index: video.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinuxV4L/video.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** video.c 4 Nov 2004 08:51:50 -0000 1.1.1.1 --- video.c 22 Nov 2004 02:32:40 -0000 1.2 *************** *** 4,8 **** Hirokazu Kato ( ka...@sy... ) * ! * Revision: 5.2 Date: 2000/08/25 */ #include <sys/ioctl.h> --- 4,16 ---- Hirokazu Kato ( ka...@sy... ) * ! * Revision: 5.3 Date: 2004/11/18 ! * Rev Date Who Changes ! * 5.3 2004-11-18 RG -adding patch done by Uwe Woessner for YUV support on V4L. ! * (Thanks a lot for this contribution !!) ! * -modify default video options ! * (no overhead if define externally) ! * -adding full V4L options support ! * -adding eyetoy support ! * */ #include <sys/ioctl.h> *************** *** 20,23 **** --- 28,35 ---- #include <AR/ar.h> #include <AR/video.h> + #include "ccvt.h" + #ifdef USE_EYETOY + #include "jpegtorgb.h" + #endif #define MAXCHANNEL 10 *************** *** 94,113 **** printf("ARVideo may be configured using one or more of the following options,\n"); printf("separated by a space:\n\n"); printf(" -width=N\n"); printf(" specifies expected width of image.\n"); printf(" -height=N\n"); printf(" specifies expected height of image.\n"); ! printf(" -contrast=N\n"); ! printf(" specifies contrast. (0.0 <-> 1.0)\n"); printf(" -brightness=N\n"); printf(" specifies brightness. (0.0 <-> 1.0)\n"); printf(" -color=N\n"); ! printf(" specifies color. (0.0 <-> 1.0)\n"); ! printf(" -channel=N\n"); ! printf(" specifies source channel.\n"); ! printf(" -dev=filepath\n"); ! printf(" specifies device file.\n"); printf(" -mode=[PAL|NTSC|SECAM]\n"); ! printf(" specifies TV signal mode.\n"); printf("\n"); --- 106,136 ---- printf("ARVideo may be configured using one or more of the following options,\n"); printf("separated by a space:\n\n"); + printf("DEVICE CONTROLS:\n"); + printf(" -dev=filepath\n"); + printf(" specifies device file.\n"); + printf(" -channel=N\n"); + printf(" specifies source channel.\n"); printf(" -width=N\n"); printf(" specifies expected width of image.\n"); printf(" -height=N\n"); printf(" specifies expected height of image.\n"); ! printf(" -palette=[RGB|YUV420P]\n"); ! printf(" specifies the camera palette (WARNING:all are not supported on each camera !!).\n"); ! printf("IMAGE CONTROLS (WARNING: every options are not supported by all camera !!):\n"); printf(" -brightness=N\n"); printf(" specifies brightness. (0.0 <-> 1.0)\n"); + printf(" -contrast=N\n"); + printf(" specifies contrast. (0.0 <-> 1.0)\n"); + printf(" -saturation=N\n"); + printf(" specifies saturation (color). (0.0 <-> 1.0) (for color camera only)\n"); + printf(" -hue=N\n"); + printf(" specifies hue. (0.0 <-> 1.0) (for color camera only)\n"); + printf(" -whiteness=N\n"); + printf(" specifies whiteness. (0.0 <-> 1.0) (REMARK: gamma for some drivers, otherwise for greyscale camera only)\n"); printf(" -color=N\n"); ! printf(" specifies saturation (color). (0.0 <-> 1.0) (REMARK: obsolete !! use saturation control)\n\n"); ! printf("OPTION CONTROLS:\n"); printf(" -mode=[PAL|NTSC|SECAM]\n"); ! printf(" specifies TV signal mode (for tv/capture card).\n"); printf("\n"); *************** *** 126,137 **** arMalloc( vid, AR2VideoParamT, 1 ); strcpy( vid->dev, DEFAULT_VIDEO_DEVICE ); vid->width = DEFAULT_VIDEO_WIDTH; vid->height = DEFAULT_VIDEO_HEIGHT; ! vid->channel = DEFAULT_VIDEO_CHANNEL; vid->mode = DEFAULT_VIDEO_MODE; vid->debug = 0; ! vid->contrast = 0.5; ! vid->brightness = 0.5; ! vid->color = 0.5; a = config; --- 149,168 ---- arMalloc( vid, AR2VideoParamT, 1 ); strcpy( vid->dev, DEFAULT_VIDEO_DEVICE ); + vid->channel = DEFAULT_VIDEO_CHANNEL; vid->width = DEFAULT_VIDEO_WIDTH; vid->height = DEFAULT_VIDEO_HEIGHT; ! #if defined(AR_PIX_FORMAT_BGRA) ! vid->palette = VIDEO_PALETTE_RGB32; /* palette format */ ! #elif defined(AR_PIX_FORMAT_BGR) || defined(AR_PIX_FORMAT_RGB) ! vid->palette = VIDEO_PALETTE_RGB24; /* palette format */ ! #endif ! vid->contrast = -1.; ! vid->brightness = -1.; ! vid->saturation = -1.; ! vid->hue = -1.; ! vid->whiteness = -1.; vid->mode = DEFAULT_VIDEO_MODE; vid->debug = 0; ! vid->videoBuffer=NULL; a = config; *************** *** 140,145 **** while( *a == ' ' || *a == '\t' ) a++; if( *a == '\0' ) break; ! ! if( strncmp( a, "-width=", 7 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[7], "%d", &vid->width ) == 0 ) { --- 171,191 ---- while( *a == ' ' || *a == '\t' ) a++; if( *a == '\0' ) break; ! if( strncmp( a, "-dev=", 5 ) == 0 ) { ! sscanf( a, "%s", line ); ! if( sscanf( &line[5], "%s", vid->dev ) == 0 ) { ! ar2VideoDispOption(); ! free( vid ); ! return 0; ! } ! } ! else if( strncmp( a, "-channel=", 9 ) == 0 ) { ! sscanf( a, "%s", line ); ! if( sscanf( &line[9], "%d", &vid->channel ) == 0 ) { ! ar2VideoDispOption(); ! free( vid ); ! return 0; ! } ! } ! else if( strncmp( a, "-width=", 7 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[7], "%d", &vid->width ) == 0 ) { *************** *** 157,160 **** --- 203,218 ---- } } + else if( strncmp( a, "-palette=", 9 ) == 0 ) { + if( strncmp( &a[9], "RGB", 3) == 0 ) { + #if defined(AR_PIX_FORMAT_BGRA) + vid->palette = VIDEO_PALETTE_RGB32; /* palette format */ + #elif defined(AR_PIX_FORMAT_BGR)|| defined(AR_PIX_FORMAT_RGB) + vid->palette = VIDEO_PALETTE_RGB24; /* palette format */ + #endif + } + else if( strncmp( &a[9], "YUV420P", 7 ) == 0 ) { + vid->palette = VIDEO_PALETTE_YUV420P; + } + } else if( strncmp( a, "-contrast=", 10 ) == 0 ) { sscanf( a, "%s", line ); *************** *** 173,187 **** } } ! else if( strncmp( a, "-color=", 7 ) == 0 ) { sscanf( a, "%s", line ); ! if( sscanf( &line[7], "%lf", &vid->color ) == 0 ) { ar2VideoDispOption(); free( vid ); return 0; } ! } ! else if( strncmp( a, "-channel=", 9 ) == 0 ) { sscanf( a, "%s", line ); ! if( sscanf( &line[9], "%d", &vid->channel ) == 0 ) { ar2VideoDispOption(); free( vid ); --- 231,253 ---- } } ! else if( strncmp( a, "-saturation=", 12 ) == 0 ) { sscanf( a, "%s", line ); ! if( sscanf( &line[12], "%lf", &vid->saturation ) == 0 ) { ar2VideoDispOption(); free( vid ); return 0; } ! } ! else if( strncmp( a, "-hue=", 5 ) == 0 ) { sscanf( a, "%s", line ); ! if( sscanf( &line[5], "%lf", &vid->hue ) == 0 ) { ! ar2VideoDispOption(); ! free( vid ); ! return 0; ! } ! } ! else if( strncmp( a, "-whiteness=", 11 ) == 0 ) { ! sscanf( a, "%s", line ); ! if( sscanf( &line[11], "%lf", &vid->whiteness ) == 0 ) { ar2VideoDispOption(); free( vid ); *************** *** 189,195 **** } } ! else if( strncmp( a, "-dev=", 5 ) == 0 ) { sscanf( a, "%s", line ); ! if( sscanf( &line[5], "%s", vid->dev ) == 0 ) { ar2VideoDispOption(); free( vid ); --- 255,261 ---- } } ! else if( strncmp( a, "-color=", 7 ) == 0 ) { sscanf( a, "%s", line ); ! if( sscanf( &line[7], "%lf", &vid->saturation ) == 0 ) { ar2VideoDispOption(); free( vid ); *************** *** 220,224 **** } ! vid->fd = open(vid->dev, O_RDWR); if(vid->fd < 0){ printf("video device (%s) open failed\n",vid->dev); --- 286,290 ---- } ! vid->fd = open(vid->dev, O_RDWR);// O_RDONLY ? if(vid->fd < 0){ printf("video device (%s) open failed\n",vid->dev); *************** *** 299,319 **** } /* set video picture */ ! vp.brightness = 32767 * 2.0 * vid->brightness; ! vp.hue = 32767; ! vp.colour = 32767 * 2.0 * vid->color; ! vp.contrast = 32767 * 2.0 * vid->contrast; ! vp.whiteness = 32767; ! vp.depth = 24; /* color depth */ ! #if defined(AR_PIX_FORMAT_BGRA) ! vp.palette = VIDEO_PALETTE_RGB32; /* palette format */ ! #elif defined(AR_PIX_FORMAT_BGR) ! vp.palette = VIDEO_PALETTE_RGB24; /* palette format */ ! #endif if(ioctl(vid->fd, VIDIOCSPICT, &vp)) { ! printf("error: setting palette\n"); free( vid ); return 0; } /* get mmap info */ --- 365,422 ---- } + if(ioctl(vid->fd, VIDIOCGPICT, &vp)) { + printf("error: getting palette\n"); + free( vid ); + return 0; + } + + if( vid->debug ) { + printf("=== debug info ===\n"); + printf(" vp.brightness= %d\n",vp.brightness); + printf(" vp.hue = %d\n",vp.hue); + printf(" vp.colour = %d\n",vp.colour); + printf(" vp.contrast = %d\n",vp.contrast); + printf(" vp.whiteness = %d\n",vp.whiteness); + printf(" vp.depth = %d\n",vp.depth); + printf(" vp.palette = %d\n",vp.palette); + } + /* set video picture */ ! if ((vid->brightness+1.)>0.001) ! vp.brightness = 32767 * 2.0 *vid->brightness; ! if ((vid->contrast+1.)>0.001) ! vp.contrast = 32767 * 2.0 *vid->contrast; ! if ((vid->hue+1.)>0.001) ! vp.hue = 32767 * 2.0 *vid->hue; ! if ((vid->whiteness+1.)>0.001) ! vp.whiteness = 32767 * 2.0 *vid->whiteness; ! if ((vid->saturation+1.)>0.001) ! vp.colour = 32767 * 2.0 *vid->saturation; ! vp.depth = 24; ! vp.palette = vid->palette; ! if(ioctl(vid->fd, VIDIOCSPICT, &vp)) { ! printf("error: setting configuration !! bad palette mode..\n TIPS:try other palette mode (or with new failure contact ARToolKit Developer)\n"); free( vid ); return 0; } + if (vid->palette==VIDEO_PALETTE_YUV420P) + arMalloc( vid->videoBuffer, ARUint8, vid->width*vid->height*3 ); + + if( vid->debug ) { + if(ioctl(vid->fd, VIDIOCGPICT, &vp)) { + printf("error: getting palette\n"); + free( vid ); + return 0; + } + printf("=== debug info ===\n"); + printf(" vp.brightness= %d\n",vp.brightness); + printf(" vp.hue = %d\n",vp.hue); + printf(" vp.colour = %d\n",vp.colour); + printf(" vp.contrast = %d\n",vp.contrast); + printf(" vp.whiteness = %d\n",vp.whiteness); + printf(" vp.depth = %d\n",vp.depth); + printf(" vp.palette = %d\n",vp.palette); + } /* get mmap info */ *************** *** 348,359 **** vid->vmm.width = vid->width; vid->vmm.height = vid->height; ! #if defined(AR_PIX_FORMAT_BGRA) ! vid->vmm.format = VIDEO_PALETTE_RGB32; ! #elif defined(AR_PIX_FORMAT_BGR) ! vid->vmm.format = VIDEO_PALETTE_RGB24; ! #endif vid->video_cont_num = -1; return vid; } --- 451,461 ---- vid->vmm.width = vid->width; vid->vmm.height = vid->height; ! vid->vmm.format= vid->palette; vid->video_cont_num = -1; + #ifdef USE_EYETOY + JPEGToRGBInit(vid->width,vid->height); + #endif return vid; } *************** *** 365,368 **** --- 467,472 ---- } close(vid->fd); + if(vid->videoBuffer!=NULL) + free(vid->videoBuffer); free( vid ); *************** *** 422,425 **** --- 526,531 ---- ARUint8 *ar2VideoGetImage( AR2VideoParamT *vid ) { + ARUint8 *buf; + if(vid->video_cont_num < 0){ printf("arVideoCapStart has never been called.\n"); *************** *** 434,440 **** if(vid->video_cont_num == 0) ! return (vid->map + vid->vm.offsets[1]); else ! return (vid->map + vid->vm.offsets[0]); } --- 540,561 ---- if(vid->video_cont_num == 0) ! buf=(vid->map + vid->vm.offsets[1]); else ! buf=(vid->map + vid->vm.offsets[0]); ! ! if(vid->palette == VIDEO_PALETTE_YUV420P) ! { ! ! ccvt_420p_bgr24(vid->width, vid->height, buf, buf+(vid->width*vid->height), ! buf+(vid->width*vid->height)+(vid->width*vid->height)/4, ! vid->videoBuffer); ! return vid->videoBuffer; ! } ! #ifdef USE_EYETOY ! buf=JPEGToRGB(buf,vid->width, vid->height); ! #endif ! ! return buf; ! } Index: Makefile.in =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinuxV4L/Makefile.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile.in 4 Nov 2004 08:51:49 -0000 1.1.1.1 --- Makefile.in 22 Nov 2004 02:32:40 -0000 1.2 *************** *** 22,26 **** # compilation control # ! LIBOBJS= ${LIB}(video.o) all: ${LIBOBJS} --- 22,26 ---- # compilation control # ! LIBOBJS= ${LIB}(video.o) ${LIB}(ccvt_i386.o) all: ${LIBOBJS} *************** *** 33,36 **** --- 33,42 ---- rm -f $*.o + .S.a: + ${CC} -c ${CFLAG} $< + ${AR} ${ARFLAGS} $@ $*.o + rm -f $*.o + + clean: rm -f *.o --- NEW FILE: ccvt_i386.S --- /* Colour conversion routines (RGB <-> YUV) in x86 assembly (C) 2000 Nemosoft Unv. nem...@sm... This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. [...1194 lines suppressed...] pop %eax # y3y2y1y0 # Second half shr $8, %eax # __y3y2y1 shr $8, %ax # __y3__y2 and $0xff00ff00, %edx # v1__u1__ or %edx, %eax # v1y3u1y2 stosl loop 1b decl Height # height-- jnz 0b # Done 9: pop %edi pop %esi pop %ebx leave ret --- NEW FILE: jpegtorgb.h --- /* JPEG To RGB interface --Raphael Grasset - 04/07/16 - 2004 Hitlab NZ. All Rights reserved-- This file define simple routine functions for converting a JPEG image to RGB format. It use is ONLY for EyeToy Camera. WARNING : It use a static image area : at each call of conversion, the new image is copying on the same memory area (limited dynamic allocation mamagement). So be careful when you manipulating the pointer on the image !! USAGE : Based on libjpeg (providing hardware decompression), you need just add few things on your code: #include "jpegtorgb.h" //this file int xsiwe=640;//video image format int ysize=480;//video image format .... JPEGToRGBInit(xsize,ysize); //init function with image size in parameters .... ARUint8* decompressed_image=JPEGToRGB(video_image,xsize,ysize); //converting function (converted image return) don't be care with ARUint8, equivalent to an unsigned char format. */ #include "jpeglib.h" #include "jerror.h" #include <setjmp.h> /*---------------- Direct Input Functions for libjpeg --------------*/ /* we overload the interface for open a jpeg file : the libjpeg file is limited for only FILE* input. Since we have a JPEG image in memory we need a new interface for libjpeg. For these we overload differents functions. I have modified the code for jpeg_stdio_src, and providing new functions name EyeToy_XXX (XXX template Need to be optimized, cleaned. */ #define JFREAD(file,buf,sizeofbuf) \ ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) /* Expanded data source object for stdio input */ typedef struct { struct jpeg_source_mgr pub; /* public fields */ unsigned char* image; int image_size; JOCTET * buffer; /* start of buffer */ boolean start_of_file; /* have we gotten any data yet? */ } my_source_mgr; typedef my_source_mgr * my_src_ptr; #define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ /* * Initialize source --- called by jpeg_read_header * before any data is actually read. */ METHODDEF(void) EyeToy_init_source (j_decompress_ptr cinfo) { my_src_ptr src = (my_src_ptr) cinfo->src; /* We reset the empty-input-file flag for each image, * but we don't clear the input buffer. * This is correct behavior for reading a series of images from one source. */ src->start_of_file = TRUE; } /* * Fill the input buffer --- called whenever buffer is emptied. * * In typical applications, this should read fresh data into the buffer * (ignoring the current state of next_input_byte & bytes_in_buffer), * reset the pointer & count to the start of the buffer, and return TRUE * indicating that the buffer has been reloaded. It is not necessary to * fill the buffer entirely, only to obtain at least one more byte. * * There is no such thing as an EOF return. If the end of the file has been * reached, the routine has a choice of ERREXIT() or inserting fake data into * the buffer. In most cases, generating a warning message and inserting a * fake EOI marker is the best course of action --- this will allow the * decompressor to output however much of the image is there. However, * the resulting error message is misleading if the real problem is an empty * input file, so we handle that case specially. * * In applications that need to be able to suspend compression due to input * not being available yet, a FALSE return indicates that no more data can be * obtained right now, but more may be forthcoming later. In this situation, * the decompressor will return to its caller (with an indication of the * number of scanlines it has read, if any). The application should resume * decompression after it has loaded more data into the input buffer. Note * that there are substantial restrictions on the use of suspension --- see * the documentation. * * When suspending, the decompressor will back up to a convenient restart point * (typically the start of the current MCU). next_input_byte & bytes_in_buffer * indicate where the restart point will be if the current call returns FALSE. * Data beyond this point must be rescanned after resumption, so move it to * the front of the buffer rather than discarding it. */ METHODDEF(boolean) EyeToy_fill_input_buffer (j_decompress_ptr cinfo) { my_src_ptr src = (my_src_ptr) cinfo->src; src->pub.next_input_byte = src->image; src->pub.bytes_in_buffer = src->image_size; src->start_of_file = FALSE; return TRUE; } /* * Skip data --- used to skip over a potentially large amount of * uninteresting data (such as an APPn marker). * * Writers of suspendable-input applications must note that skip_input_data * is not granted the right to give a suspension return. If the skip extends * beyond the data currently in the buffer, the buffer can be marked empty so * that the next read will cause a fill_input_buffer call that can suspend. * Arranging for additional bytes to be discarded before reloading the input * buffer is the application writer's problem. */ METHODDEF(void) EyeToy_skip_input_data (j_decompress_ptr cinfo, long num_bytes) { my_src_ptr src = (my_src_ptr) cinfo->src; /* Just a dumb implementation for now. Could use fseek() except * it doesn't work on pipes. Not clear that being smart is worth * any trouble anyway --- large skips are infrequent. */ if (num_bytes > 0) { while (num_bytes > (long) src->pub.bytes_in_buffer) { num_bytes -= (long) src->pub.bytes_in_buffer; (void) EyeToy_fill_input_buffer(cinfo); /* note we assume that fill_input_buffer will never return FALSE, * so suspension need not be handled. */ } src->pub.next_input_byte += (size_t) num_bytes; src->pub.bytes_in_buffer -= (size_t) num_bytes; } } /* * An additional method that can be provided by data source modules is the * resync_to_restart method for error recovery in the presence of RST markers. * For the moment, this source module just uses the default resync method * provided by the JPEG library. That method assumes that no backtracking * is possible. */ /* * Terminate source --- called by jpeg_finish_decompress * after all data has been read. Often a no-op. * * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding * application must deal with any cleanup that should happen even * for error exit. */ METHODDEF(void) EyeToy_term_source (j_decompress_ptr cinfo) { /* no work necessary here */ } /* The new jpeg access function : directly read the memory buffer instead of a FILE* input. Since all the image is in memory we put all the buffer in one pass. */ GLOBAL(void) EyeToy_jpeg_stdio_src(j_decompress_ptr cinfo,unsigned char *image,int count) { my_src_ptr src; /* The source object and input buffer are made permanent so that a series * of JPEG images can be read from the same file by calling jpeg_stdio_src * only before the first one. (If we discarded the buffer at the end of * one image, we'd likely lose the start of the next one.) * This makes it unsafe to use this manager and a different source * manager serially with the same JPEG object. Caveat programmer. */ if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *)(*cinfo->mem->alloc_small)((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(my_source_mgr)); src = (my_src_ptr) cinfo->src; src->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof(JOCTET)); } src = (my_src_ptr) cinfo->src; src->pub.init_source = EyeToy_init_source; src->pub.fill_input_buffer = EyeToy_fill_input_buffer; src->pub.skip_input_data = EyeToy_skip_input_data; src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ src->pub.term_source = EyeToy_term_source; src->image=image; src->image_size=count; src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */ src->pub.next_input_byte = NULL; /* until buffer loaded */ } static ARUint8* TransfertBufferImage; /*---------------- Main Functions --------------*/ void JPEGToRGBInit(int xsize,int ysize) { TransfertBufferImage = malloc(xsize*ysize*3); } ARUint8* JPEGToRGB(ARUint8* image, int xsize,int ysize) { int image_height=xsize; /* Number of rows in image */ int image_width=ysize; /* Number of columns in image */ struct jpeg_error_mgr jerr; struct jpeg_decompress_struct cinfo; JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */ int row_stride; /* physical row width in output buffer */ int crows=0; cinfo.err = jpeg_std_error(&jerr); jpeg_create_decompress(&cinfo); ssize_t count; count=(image[0]+image[1]*65536)/8; EyeToy_jpeg_stdio_src(&cinfo,image+2,count); (void) jpeg_read_header(&cinfo, TRUE); (void) jpeg_start_decompress(&cinfo); row_stride = cinfo.output_width * cinfo.output_components; /* Make a one-row-high sample array that will go away when done with image */ while (cinfo.output_scanline < cinfo.output_height) { row_pointer[0] = & TransfertBufferImage[crows * row_stride]; (void) jpeg_read_scanlines(&cinfo, row_pointer, 1); crows++; } (void) jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); return TransfertBufferImage; } |
From: Philip L. <phi...@us...> - 2004-11-22 02:11:20
|
Update of /cvsroot/artoolkit/artoolkit/include/AR In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9605 Modified Files: gsub.h param.h arMulti.h gsubUtil.h matrix.h config.h.in ar.h video.h Log Message: Add doxygen docs. Linux video driver updates and patches. Index: param.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/param.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** param.h 4 Nov 2004 08:51:15 -0000 1.1.1.1 --- param.h 22 Nov 2004 02:11:05 -0000 1.2 *************** *** 1,14 **** ! /******************************************************* ! * ! * Author: Takeshi Mita, Shinsaku Hiura, Hirokazu Kato ! * ! * tm...@in... ! * shi...@sy... ! * ka...@sy... ! * ! * Revision: 4.1 ! * Date: 01/12/07 ! * ! *******************************************************/ #ifndef AR_PARAM_H #define AR_PARAM_H --- 1,32 ---- ! /* -------------------------------------------------------------------------- ! * Copyright (C) 2004 Hitlab NZ. ! * The distribution policy is describe on the Copyright.txt furnish ! * with this library. ! * -------------------------------------------------------------------------*/ ! /** ! * \file param.h ! * \brief ARToolkit global structure (parameters) subroutines. ! * ! * This file contains principal routines for loading, saving, and modify ! * camera parameters for of ARToolkit library. Different structures are used ! * for modify in run-time this parameters in the library. A file structure ! * is use for input/output. ! * \remark ! * ! * History : ! * ! * \author Takeshi Mita tm...@in... ! * \author Shinsaku Hiura shi...@sy... ! * \author Hirokazu Kato ka...@sy... ! ! * \version 4.1 ! * \date 01/12/07 ! **/ ! /* -------------------------------------------------------------------------- ! * History : ! * Rev Date Who Changes ! * ! *----------------------------------------------------------------------------*/ ! #ifndef AR_PARAM_H #define AR_PARAM_H *************** *** 17,22 **** --- 35,67 ---- #endif + // ============================================================================ + // Public includes. + // ============================================================================ + #include <AR/config.h> + // ============================================================================ + // Public types and defines. + // ============================================================================ + + /** \struct ARParam + * \brief camera intrinsic parameters. + * + * this structure contains the main parameters for + * the intrinsic parameters of the camera + * representation. The camera used is a pinhole + * camera with standard parameters. User can + * report on Computer Vision Book for more informations. + * (like Three-Dimensional Computer Vision + * (Artificial Intelligence) by Olivier Faugeras). + * \param xsize length of the image (in pixels). + * \param ysize height of the image (in pixels). + * \param mat perspective matrix (K). + * \param dist_factor radial distorsions factor + * dist_factor[0]=x center of distorsion + * dist_factor[1]=y center of distorsion + * dist_factor[2]=distorsion factor + * dist_factor[3]=scale factor + */ typedef struct { int xsize, ysize; *************** *** 34,57 **** } ARSParam; int arParamGet( double global[][3], double screen[][2], int data_num, double mat[3][4] ); int arParamDecomp( ARParam *source, ARParam *icpara, double trans[3][4] ); int arParamDecompMat( double source[3][4], double cpara[3][4], double trans[3][4] ); ! ! int arParamIdeal2Observ( const double dist_factor[4], const double ix, const double iy, double *ox, double *oy ); ! int arParamObserv2Ideal( const double dist_factor[4], const double ox, const double oy, double *ix, double *iy ); int arParamChangeSize( ARParam *source, int xsize, int ysize, ARParam *newparam ); int arParamSave( char *filename, int num, ARParam *param, ...); ! int arParamLoad( const char *filename, int num, ARParam *param, ...); int arParamDisp( ARParam *param ); --- 79,198 ---- } ARSParam; + // ============================================================================ + // Public globals. + // ============================================================================ + // ============================================================================ + // Public functions. + // ============================================================================ + /** \fn int arParamGet( double global[][3], double screen[][2], int data_num, + double mat[3][4] ) + * \brief XXXBK + * + * XXXBK + * \param global XXXBK + * \param screen XXXBK + * \param data_num XXXBK + * \param mat XXXBK + * \return XXXBK + */ int arParamGet( double global[][3], double screen[][2], int data_num, double mat[3][4] ); + /** \fn int arParamDecomp( ARParam *source, ARParam *icpara, double trans[3][4] ) + * \brief XXXBK + * + * XXXBK + * \param source XXXBK + * \param icpara XXXBK + * \param trans XXXBK + * \return XXXBK + */ int arParamDecomp( ARParam *source, ARParam *icpara, double trans[3][4] ); + /** \fn int arParamDecompMat( double source[3][4], double cpara[3][4], double trans[3][4] ) + * \brief XXXBK + * + * XXXBK + * \param source XXXBK + * \param cpara XXXBK + * \param trans XXXBK + * \return XXXBK + */ int arParamDecompMat( double source[3][4], double cpara[3][4], double trans[3][4] ); ! /** \fn int arParamIdeal2Observ( double dist_factor[4], double ix, double iy, ! double *ox, double *oy ) ! * \brief XXXBK ! * ! * XXXBK ! * \param dist_factor XXXBK ! * \param ix XXXBK ! * \param iy XXXBK ! * \param ox XXXBK ! * \param oy XXXBK ! * \return XXXBK ! */ ! int arParamIdeal2Observ( double dist_factor[4], double ix, double iy, double *ox, double *oy ); ! /** \fn int arParamObserv2Ideal( double dist_factor[4], double ox, double oy, ! double *ix, double *iy ) ! * \brief XXXBK ! * ! * XXXBK ! * \param dist_factor XXXBK ! * \param ox XXXBK ! * \param oy XXXBK ! * \param ix XXXBK ! * \param iy XXXBK ! * \return XXXBK ! */ ! int arParamObserv2Ideal( double dist_factor[4], double ox, double oy, double *ix, double *iy ); + /** \fn int arParamChangeSize( ARParam *source, int xsize, int ysize, ARParam *newparam ) + * \brief change the camera size parameters. + * + * Change the size variable in camera intrinsic parameters. + * \param source name of the source parameters structure + * \param xsize new length size + * \param ysize new height size + * \param newparam name of the destination parameters structure. + * \return 0 + */ int arParamChangeSize( ARParam *source, int xsize, int ysize, ARParam *newparam ); + /** \fn int arParamSave( char *filename, int num, ARParam *param, ...) + * \brief save a camera intrinsic parameters. + * + * Save manipulated camera intrinsic parameters in a file. + * \param filename name of the parameters file. + * \param num XXXBK + * \param param parameters to save + * \return 0 if success, -1 if Error (file not found, file structure problem) + */ int arParamSave( char *filename, int num, ARParam *param, ...); ! ! /** \fn int arParamLoad( char *filename, int num, ARParam *param, ...) ! * \brief load the camera intrinsic parameters. ! * ! * Load camera intrinsic parameters in the ARToolkit Library from ! * a file (itselft, a resulted output of calibration step). ! * \param filename name of the parameters file. ! * \param num XXXBK ! * \param param result of the loaded parameters ! * \return 0 if success, -1 if Error (file not found, file structure problem) ! */ ! int arParamLoad( char *filename, int num, ARParam *param, ...); ! ! /** \fn int arParamDisp( ARParam *param ) ! * \brief display parameters. ! * ! * Display the structure of the camera instrinsic parameters argument. ! * \param param structure to display ! * \return 0 ! */ int arParamDisp( ARParam *param ); *************** *** 59,65 **** --- 200,210 ---- int arsParamChangeSize( ARSParam *source, int xsize, int ysize, ARSParam *newparam ); + int arsParamSave( char *filename, ARSParam *sparam ); + int arsParamLoad( char *filename, ARSParam *sparam ); + int arsParamDisp( ARSParam *sparam ); + int arsParamGetMat( double matL[3][4], double matR[3][4], double cparaL[3][4], double cparaR[3][4], double matL2R[3][4] ); *************** *** 68,70 **** } #endif ! #endif --- 213,215 ---- } #endif ! #endif Index: config.h.in =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/config.h.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** config.h.in 4 Nov 2004 08:51:11 -0000 1.1.1.1 --- config.h.in 22 Nov 2004 02:11:05 -0000 1.2 *************** *** 1,201 **** ! #ifndef AR_CONFIG_H ! #define AR_CONFIG_H ! ! /*------------------------------------------------------------*/ ! /* */ ! /* For Linux, you should define one of below 3 input method */ ! /* AR_INPUT_V4L: use of standard Video4Linux Library */ ! /* AR_INPUT_DV: use of DV Camera */ ! /* AR_INPUT_1394CAM: use of 1394 Digital Camara */ ! /* */ ! /*------------------------------------------------------------*/ ! #ifdef __linux ! #undef AR_INPUT_V4L ! #undef AR_INPUT_DV ! #undef AR_INPUT_1394CAM ! ! # ifdef AR_INPUT_V4L ! # define AR_PIX_FORMAT_BGR ! # undef AR_PIX_FORMAT_BGRA ! # endif ! ! # ifdef AR_INPUT_DV ! # define AR_PIX_FORMAT_RGB ! # undef AR_PIX_FORMAT_BGRA ! # endif ! ! # ifdef AR_INPUT_1394CAM ! # define AR_PIX_FORMAT_RGB ! # endif ! ! # undef AR_BIG_ENDIAN ! # define AR_LITTLE_ENDIAN ! #endif ! ! ! /*------------------------------------------------------------*/ ! /* For SGI */ ! /*------------------------------------------------------------*/ ! #ifdef __sgi ! # define AR_BIG_ENDIAN ! # undef AR_LITTLE_ENDIAN ! # define AR_PIX_FORMAT_ABGR ! #endif ! ! /*------------------------------------------------------------*/ ! /* For Windows */ ! /*------------------------------------------------------------*/ ! #ifdef _WIN32 ! # undef AR_BIG_ENDIAN ! # define AR_LITTLE_ENDIAN ! # define AR_PIX_FORMAT_BGRA ! #endif ! ! /*------------------------------------------------------------*/ ! /* For Mac OS X */ ! /*------------------------------------------------------------*/ ! #ifdef __APPLE__ ! # define AR_BIG_ENDIAN ! # undef AR_LITTLE_ENDIAN ! # define AR_PIX_FORMAT_2vuy ! #endif ! ! ! /*------------------------------------------------------------*/ ! ! #define AR_DRAW_BY_GL_DRAW_PIXELS 0 ! #define AR_DRAW_BY_TEXTURE_MAPPING 1 ! #define AR_DRAW_TEXTURE_FULL_IMAGE 0 ! #define AR_DRAW_TEXTURE_HALF_IMAGE 1 ! #define AR_IMAGE_PROC_IN_FULL 0 ! #define AR_IMAGE_PROC_IN_HALF 1 ! #define AR_FITTING_TO_IDEAL 0 ! #define AR_FITTING_TO_INPUT 1 ! ! #define AR_TEMPLATE_MATCHING_COLOR 0 ! #define AR_TEMPLATE_MATCHING_BW 1 ! #define AR_MATCHING_WITHOUT_PCA 0 ! #define AR_MATCHING_WITH_PCA 1 ! #define DEFAULT_TEMPLATE_MATCHING_MODE AR_TEMPLATE_MATCHING_COLOR ! #define DEFAULT_MATCHING_PCA_MODE AR_MATCHING_WITHOUT_PCA ! ! ! #ifdef __linux ! # ifdef AR_INPUT_V4L ! # define VIDEO_MODE_PAL 0 ! # define VIDEO_MODE_NTSC 1 ! # define VIDEO_MODE_SECAM 2 ! # define DEFAULT_VIDEO_DEVICE "/dev/video0" ! # define DEFAULT_VIDEO_WIDTH 640 ! # define DEFAULT_VIDEO_HEIGHT 480 ! # define DEFAULT_VIDEO_CHANNEL 1 ! # define DEFAULT_VIDEO_MODE VIDEO_MODE_NTSC ! # endif ! ! # ifdef AR_INPUT_DV ! # define VIDEO_MODE_PAL 0 ! # define VIDEO_MODE_NTSC 1 ! # define DEFAULT_VIDEO_MODE VIDEO_MODE_NTSC ! # endif ! ! # ifdef AR_INPUT_1394CAM ! #undef DRAGONFLY ! # define VIDEO_NODE_ANY -1 ! # define VIDEO_MODE_320x240_YUV422 32 ! # define VIDEO_MODE_640x480_YUV411 33 ! # define VIDEO_MODE_640x480_RGB 34 ! # define VIDEO_MODE_640x480_YUV411_HALF 35 ! # define VIDEO_MODE_640x480_MONO 36 ! # define VIDEO_MODE_640x480_MONO_COLOR 37 ! # define VIDEO_MODE_640x480_MONO_COLOR_HALF 38 ! # define VIDEO_FRAME_RATE_1_875 1 ! # define VIDEO_FRAME_RATE_3_75 2 ! # define VIDEO_FRAME_RATE_7_5 3 ! # define VIDEO_FRAME_RATE_15 4 ! # define VIDEO_FRAME_RATE_30 5 ! # define VIDEO_FRAME_RATE_60 6 ! # define DEFAULT_VIDEO_NODE VIDEO_NODE_ANY ! # ifndef DRAGONFLY ! # define DEFAULT_VIDEO_MODE VIDEO_MODE_640x480_YUV411_HALF ! # else ! # define DEFAULT_VIDEO_MODE VIDEO_MODE_640x480_MONO_COLOR_HALF ! # endif ! # define DEFAULT_VIDEO_FRAME_RATE VIDEO_FRAME_RATE_30 ! # endif ! ! # define DEFAULT_IMAGE_PROC_MODE AR_IMAGE_PROC_IN_HALF ! # define DEFAULT_FITTING_MODE AR_FITTING_TO_IDEAL ! # define DEFAULT_DRAW_MODE AR_DRAW_BY_TEXTURE_MAPPING ! # define DEFAULT_DRAW_TEXTURE_IMAGE AR_DRAW_TEXTURE_HALF_IMAGE ! #endif ! ! #ifdef __sgi ! # define VIDEO_FULL 0 ! # define VIDEO_HALF 1 ! # define DEFAULT_VIDEO_SIZE VIDEO_FULL ! # define DEFAULT_IMAGE_PROC_MODE AR_IMAGE_PROC_IN_HALF ! # define DEFAULT_FITTING_MODE AR_FITTING_TO_INPUT ! # define DEFAULT_DRAW_MODE AR_DRAW_BY_GL_DRAW_PIXELS ! # define DEFAULT_DRAW_TEXTURE_IMAGE AR_DRAW_TEXTURE_HALF_IMAGE ! #endif ! ! #ifdef _WIN32 ! # define DEFAULT_IMAGE_PROC_MODE AR_IMAGE_PROC_IN_FULL ! # define DEFAULT_FITTING_MODE AR_FITTING_TO_INPUT ! # define DEFAULT_DRAW_MODE AR_DRAW_BY_GL_DRAW_PIXELS ! # define DEFAULT_DRAW_TEXTURE_IMAGE AR_DRAW_TEXTURE_FULL_IMAGE ! #endif ! ! #ifdef __APPLE__ ! # define DEFAULT_VIDEO_WIDTH 640 ! # define DEFAULT_VIDEO_HEIGHT 480 ! # define DEFAULT_IMAGE_PROC_MODE AR_IMAGE_PROC_IN_HALF ! # define DEFAULT_FITTING_MODE AR_FITTING_TO_IDEAL ! # define DEFAULT_DRAW_MODE AR_DRAW_BY_TEXTURE_MAPPING ! # define DEFAULT_DRAW_TEXTURE_IMAGE AR_DRAW_TEXTURE_FULL_IMAGE ! #undef APPLE_TEXTURE_FAST_TRANSFER ! #endif ! ! ! /* For NVIDIA OpenGL Driver */ ! #undef AR_OPENGL_TEXTURE_RECTANGLE ! ! ! ! #if defined(AR_PIX_FORMAT_ABGR) || defined(AR_PIX_FORMAT_BGRA) || defined(AR_PIX_FORMAT_RGBA) || defined(AR_PIX_FORMAT_ARGB) ! # define AR_PIX_SIZE 4 ! #elif defined(AR_PIX_FORMAT_BGR) || defined(AR_PIX_FORMAT_RGB) ! # define AR_PIX_SIZE 3 ! #elif defined(AR_PIX_FORMAT_2vuy) || defined(AR_PIX_FORMAT_yuvs) ! # define AR_PIX_SIZE 2 ! #else ! # error Unknown pixel format defined in config.h. ! #endif ! ! ! #define AR_GET_TRANS_MAT_MAX_LOOP_COUNT 5 ! #define AR_GET_TRANS_MAT_MAX_FIT_ERROR 1.0 ! #define AR_GET_TRANS_CONT_MAT_MAX_FIT_ERROR 1.0 ! ! #define AR_AREA_MAX 100000 ! #define AR_AREA_MIN 70 ! ! ! #define AR_SQUARE_MAX 30 ! #define AR_CHAIN_MAX 10000 ! #define AR_PATT_NUM_MAX 50 ! #define AR_PATT_SIZE_X 16 ! #define AR_PATT_SIZE_Y 16 ! #define AR_PATT_SAMPLE_NUM 64 ! ! #define AR_GL_CLIP_NEAR 50.0 ! #define AR_GL_CLIP_FAR 5000.0 ! ! #define AR_HMD_XSIZE 640 ! #define AR_HMD_YSIZE 480 ! ! #define AR_PARAM_NMIN 6 ! #define AR_PARAM_NMAX 1000 ! #define AR_PARAM_C34 100.0 ! ! #endif --- 1,205 ---- ! #ifndef AR_CONFIG_H ! #define AR_CONFIG_H ! ! /*------------------------------------------------------------*/ ! /* */ ! /* For Linux, you should define one of below 3 input method */ ! /* AR_INPUT_V4L: use of standard Video4Linux Library */ ! /* AR_INPUT_DV: use of DV Camera */ ! /* AR_INPUT_1394CAM: use of 1394 Digital Camara */ ! /* */ ! /*------------------------------------------------------------*/ ! #ifdef __linux ! #undef AR_INPUT_V4L ! #undef AR_INPUT_DV ! #undef AR_INPUT_1394CAM ! ! # ifdef AR_INPUT_V4L ! # ifdef USE_EYETOY ! # define AR_PIX_FORMAT_RGB ! # else ! # define AR_PIX_FORMAT_BGR ! # endif ! # undef AR_PIX_FORMAT_BGRA ! # endif ! ! # ifdef AR_INPUT_DV ! # define AR_PIX_FORMAT_RGB ! # undef AR_PIX_FORMAT_BGRA ! # endif ! ! # ifdef AR_INPUT_1394CAM ! # define AR_PIX_FORMAT_RGB ! # endif ! ! # undef AR_BIG_ENDIAN ! # define AR_LITTLE_ENDIAN ! #endif ! ! ! /*------------------------------------------------------------*/ ! /* For SGI */ ! /*------------------------------------------------------------*/ ! #ifdef __sgi ! # define AR_BIG_ENDIAN ! # undef AR_LITTLE_ENDIAN ! # define AR_PIX_FORMAT_ABGR ! #endif ! ! /*------------------------------------------------------------*/ ! /* For Windows */ ! /*------------------------------------------------------------*/ ! #ifdef _WIN32 ! # undef AR_BIG_ENDIAN ! # define AR_LITTLE_ENDIAN ! # define AR_PIX_FORMAT_BGRA ! #endif ! ! /*------------------------------------------------------------*/ ! /* For Mac OS X */ ! /*------------------------------------------------------------*/ ! #ifdef __APPLE__ ! # define AR_BIG_ENDIAN ! # undef AR_LITTLE_ENDIAN ! # define AR_PIX_FORMAT_2vuy ! #endif ! ! ! /*------------------------------------------------------------*/ ! ! #define AR_DRAW_BY_GL_DRAW_PIXELS 0 ! #define AR_DRAW_BY_TEXTURE_MAPPING 1 ! #define AR_DRAW_TEXTURE_FULL_IMAGE 0 ! #define AR_DRAW_TEXTURE_HALF_IMAGE 1 ! #define AR_IMAGE_PROC_IN_FULL 0 ! #define AR_IMAGE_PROC_IN_HALF 1 ! #define AR_FITTING_TO_IDEAL 0 ! #define AR_FITTING_TO_INPUT 1 ! ! #define AR_TEMPLATE_MATCHING_COLOR 0 ! #define AR_TEMPLATE_MATCHING_BW 1 ! #define AR_MATCHING_WITHOUT_PCA 0 ! #define AR_MATCHING_WITH_PCA 1 ! #define DEFAULT_TEMPLATE_MATCHING_MODE AR_TEMPLATE_MATCHING_COLOR ! #define DEFAULT_MATCHING_PCA_MODE AR_MATCHING_WITHOUT_PCA ! ! ! #ifdef __linux ! # ifdef AR_INPUT_V4L ! # define VIDEO_MODE_PAL 0 ! # define VIDEO_MODE_NTSC 1 ! # define VIDEO_MODE_SECAM 2 ! # define DEFAULT_VIDEO_DEVICE "/dev/video0" ! # define DEFAULT_VIDEO_WIDTH 640 ! # define DEFAULT_VIDEO_HEIGHT 480 ! # define DEFAULT_VIDEO_CHANNEL 1 ! # define DEFAULT_VIDEO_MODE VIDEO_MODE_NTSC ! # endif ! ! # ifdef AR_INPUT_DV ! # define VIDEO_MODE_PAL 0 ! # define VIDEO_MODE_NTSC 1 ! # define DEFAULT_VIDEO_MODE VIDEO_MODE_NTSC ! # endif ! ! # ifdef AR_INPUT_1394CAM ! #undef DRAGONFLY ! # define VIDEO_NODE_ANY -1 ! # define VIDEO_MODE_320x240_YUV422 32 ! # define VIDEO_MODE_640x480_YUV411 33 ! # define VIDEO_MODE_640x480_RGB 34 ! # define VIDEO_MODE_640x480_YUV411_HALF 35 ! # define VIDEO_MODE_640x480_MONO 36 ! # define VIDEO_MODE_640x480_MONO_COLOR 37 ! # define VIDEO_MODE_640x480_MONO_COLOR_HALF 38 ! # define VIDEO_FRAME_RATE_1_875 1 ! # define VIDEO_FRAME_RATE_3_75 2 ! # define VIDEO_FRAME_RATE_7_5 3 ! # define VIDEO_FRAME_RATE_15 4 ! # define VIDEO_FRAME_RATE_30 5 ! # define VIDEO_FRAME_RATE_60 6 ! # define DEFAULT_VIDEO_NODE VIDEO_NODE_ANY ! # ifndef DRAGONFLY ! # define DEFAULT_VIDEO_MODE VIDEO_MODE_640x480_YUV411_HALF ! # else ! # define DEFAULT_VIDEO_MODE VIDEO_MODE_640x480_MONO_COLOR_HALF ! # endif ! # define DEFAULT_VIDEO_FRAME_RATE VIDEO_FRAME_RATE_30 ! # endif ! ! # define DEFAULT_IMAGE_PROC_MODE AR_IMAGE_PROC_IN_HALF ! # define DEFAULT_FITTING_MODE AR_FITTING_TO_IDEAL ! # define DEFAULT_DRAW_MODE AR_DRAW_BY_TEXTURE_MAPPING ! # define DEFAULT_DRAW_TEXTURE_IMAGE AR_DRAW_TEXTURE_HALF_IMAGE ! #endif ! ! #ifdef __sgi ! # define VIDEO_FULL 0 ! # define VIDEO_HALF 1 ! # define DEFAULT_VIDEO_SIZE VIDEO_FULL ! # define DEFAULT_IMAGE_PROC_MODE AR_IMAGE_PROC_IN_HALF ! # define DEFAULT_FITTING_MODE AR_FITTING_TO_INPUT ! # define DEFAULT_DRAW_MODE AR_DRAW_BY_GL_DRAW_PIXELS ! # define DEFAULT_DRAW_TEXTURE_IMAGE AR_DRAW_TEXTURE_HALF_IMAGE ! #endif ! ! #ifdef _WIN32 ! # define DEFAULT_IMAGE_PROC_MODE AR_IMAGE_PROC_IN_FULL ! # define DEFAULT_FITTING_MODE AR_FITTING_TO_INPUT ! # define DEFAULT_DRAW_MODE AR_DRAW_BY_GL_DRAW_PIXELS ! # define DEFAULT_DRAW_TEXTURE_IMAGE AR_DRAW_TEXTURE_FULL_IMAGE ! #endif ! ! #ifdef __APPLE__ ! # define DEFAULT_VIDEO_WIDTH 640 ! # define DEFAULT_VIDEO_HEIGHT 480 ! # define DEFAULT_IMAGE_PROC_MODE AR_IMAGE_PROC_IN_HALF ! # define DEFAULT_FITTING_MODE AR_FITTING_TO_IDEAL ! # define DEFAULT_DRAW_MODE AR_DRAW_BY_TEXTURE_MAPPING ! # define DEFAULT_DRAW_TEXTURE_IMAGE AR_DRAW_TEXTURE_FULL_IMAGE ! #undef APPLE_TEXTURE_FAST_TRANSFER ! #endif ! ! ! /* For NVIDIA OpenGL Driver */ ! #undef AR_OPENGL_TEXTURE_RECTANGLE ! ! ! ! #if defined(AR_PIX_FORMAT_ABGR) || defined(AR_PIX_FORMAT_BGRA) || defined(AR_PIX_FORMAT_RGBA) || defined(AR_PIX_FORMAT_ARGB) ! # define AR_PIX_SIZE 4 ! #elif defined(AR_PIX_FORMAT_BGR) || defined(AR_PIX_FORMAT_RGB) ! # define AR_PIX_SIZE 3 ! #elif defined(AR_PIX_FORMAT_2vuy) || defined(AR_PIX_FORMAT_yuvs) ! # define AR_PIX_SIZE 2 ! #else ! # error Unknown pixel format defined in config.h. ! #endif ! ! ! #define AR_GET_TRANS_MAT_MAX_LOOP_COUNT 5 ! #define AR_GET_TRANS_MAT_MAX_FIT_ERROR 1.0 ! #define AR_GET_TRANS_CONT_MAT_MAX_FIT_ERROR 1.0 ! ! #define AR_AREA_MAX 100000 ! #define AR_AREA_MIN 70 ! ! ! #define AR_SQUARE_MAX 30 ! #define AR_CHAIN_MAX 10000 ! #define AR_PATT_NUM_MAX 50 ! #define AR_PATT_SIZE_X 16 ! #define AR_PATT_SIZE_Y 16 ! #define AR_PATT_SAMPLE_NUM 64 ! ! #define AR_GL_CLIP_NEAR 50.0 ! #define AR_GL_CLIP_FAR 5000.0 ! ! #define AR_HMD_XSIZE 640 ! #define AR_HMD_YSIZE 480 ! ! #define AR_PARAM_NMIN 6 ! #define AR_PARAM_NMAX 1000 ! #define AR_PARAM_C34 100.0 ! ! #endif Index: matrix.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/matrix.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** matrix.h 4 Nov 2004 08:51:15 -0000 1.1.1.1 --- matrix.h 22 Nov 2004 02:11:05 -0000 1.2 *************** *** 1,7 **** ! /******************************************************* ! * matrix.h matrix handring library header ! * ! * ! *******************************************************/ #ifndef AR_MATRIX_H #define AR_MATRIX_H --- 1,30 ---- ! /* -------------------------------------------------------------------------- ! * Copyright (C) 2004 Hitlab NZ. ! * The distribution policy is describe on the Copyright.txt furnish ! * with this library. ! * -------------------------------------------------------------------------*/ ! /** ! * \file matrix.h ! * \brief ARToolkit algebric mathematics subroutines. ! * ! * This package include matrix, vector manipulation routine. In complement ! * to must classical routines (inversion, innerproduct), it includes a PCA (Principal) ! * Component Analysis) routine. ! * For the structure of the matrix see ARMat. ! * \remark ! * ! * History : ! * ! * \author Hirokazu Kato ka...@sy... ! * \version ! * \date ! * ! **/ ! /* -------------------------------------------------------------------------- ! * History : ! * Rev Date Who Changes ! * ! *----------------------------------------------------------------------------*/ ! #ifndef AR_MATRIX_H #define AR_MATRIX_H *************** *** 10,17 **** --- 33,47 ---- #endif + // ============================================================================ + // Public includes. + // ============================================================================ #include <math.h> #include <AR/config.h> + // ============================================================================ + // Public types and defines. + // ============================================================================ + /* === matrix definition === *************** *** 25,28 **** --- 55,74 ---- =========================== */ + /** \struct ARMat + * \brief matrix structure. + * + * Defined the structure of the matrix type based on a dynamic allocation. + * The matrix format is :<br> + * <---- clm ---><br> + * [ 10 20 30 ] ^<br> + * [ 20 10 15 ] |<br> + * [ 12 23 13 ] row<br> + * [ 20 10 15 ] |<br> + * [ 13 14 15 ] v<br> + * + * \param m content of matrix + * \param row number of lines in matrix + * \param clm number of column in matrix + */ typedef struct { double *m; *************** *** 31,34 **** --- 77,90 ---- } ARMat; + /** \struct ARVec + * \brief vector structure. + * + * The vector format is :<br> + * <---- clm ---><br> + * [ 10 20 30 ]<br> + * Defined the structure of the vector type based on a dynamic allocation. + * \param m content of vector + * \param clm number of column in matrix + */ typedef struct { double *v; *************** *** 36,79 **** } ARVec; ! /* 0 origin */ #define ARELEM0(mat,r,c) ((mat)->m[(r)*((mat)->clm)+(c)]) /* 1 origin */ #define ARELEM1(mat,row,clm) ARELEM0(mat,row-1,clm-1) ARMat *arMatrixAlloc(int row, int clm); int arMatrixFree(ARMat *m); int arMatrixDup(ARMat *dest, ARMat *source); ARMat *arMatrixAllocDup(ARMat *source); int arMatrixUnit(ARMat *unit); ARMat *arMatrixAllocUnit(int dim); int arMatrixMul(ARMat *dest, ARMat *a, ARMat *b); ARMat *arMatrixAllocMul(ARMat *a, ARMat *b); int arMatrixTrans(ARMat *dest, ARMat *source); ARMat *arMatrixAllocTrans(ARMat *source); int arMatrixInv(ARMat *dest, ARMat *source); int arMatrixSelfInv(ARMat *m); ARMat *arMatrixAllocInv(ARMat *source); double arMatrixDet(ARMat *m); int arMatrixPCA( ARMat *input, ARMat *evec, ARVec *ev, ARVec *mean ); int arMatrixPCA2( ARMat *input, ARMat *evec, ARVec *ev ); int arMatrixDisp(ARMat *m); ! ARVec *arVecAlloc( int clm ); int arVecFree( ARVec *v ); int arVecDisp( ARVec *v ); double arVecHousehold( ARVec *x ); double arVecInnerproduct( ARVec *x, ARVec *y ); int arVecTridiagonalize( ARMat *a, ARVec *d, ARVec *e ); --- 92,359 ---- } ARVec; ! /** \def ARELEM0(mat,r,c) ! * \brief macro function that give direct access to an element (0 origin) ! * ! * ! */ /* 0 origin */ #define ARELEM0(mat,r,c) ((mat)->m[(r)*((mat)->clm)+(c)]) + + /** \def ARELEM1(mat,row,clm) + * \brief macro function that give direct access to an element (1 origin) + * + * + */ /* 1 origin */ #define ARELEM1(mat,row,clm) ARELEM0(mat,row-1,clm-1) + // ============================================================================ + // Public globals. + // ============================================================================ + // ============================================================================ + // Public functions. + // ============================================================================ + /** \fn ARMat *arMatrixAlloc(int row, int clm) + * \brief creates a new matrix. + * + * Allocate and initialize a new matrix structure. + * XXXBK initializing ?? to 0 m ?? + * \param row number of line + * \param clm number of column + * \return the matrix structure, NULL if allocation is impossible + */ ARMat *arMatrixAlloc(int row, int clm); + + /** \fn int arMatrixFree(ARMat *m) + * \brief deletes a matrix. + * + * Delete a matrix structure (deallocate used memory). + * \param m matrix to delete + * \return 0 + */ int arMatrixFree(ARMat *m); + /** \fn int arMatrixDup(ARMat *dest, ARMat *source) + * \brief copy a matrix + * + * copy one matrix to another. The two ARMat must + * be allocate + * \param dest the destination matrix of the copy + * \param source the original matrix source + * \return 0 if success, -1 if error (matrix with different size) + */ int arMatrixDup(ARMat *dest, ARMat *source); + + /** \fn ARMat *arMatrixAllocDup(ARMat *source) + * \brief dumps a new matrix + * + * Allocates and recopy the original source matrix. + * \param source the source matrix to copy + * \return the matrix if success, NULL if error + */ ARMat *arMatrixAllocDup(ARMat *source); + /** \fn int arMatrixUnit(ARMat *unit) + * \brief Creates a unit matrix. + * + * Transforms the source parameter matrix to + * a unit matrix (all values are modified). + * the unit matrix needs to be allocated. + * \param unit the matrix to transform + * \return 0 if success, -1 if error + */ int arMatrixUnit(ARMat *unit); + + /** \fn int arMatrixAllocUnit(int dim) + * \brief Creates a unit matrix. + * + * Allocates and initializes a matrix to a + * a unit matrix. + * \param dim dimensions of the unit matrix (square) + * \return the matrix allocated if success, NULL if error + */ ARMat *arMatrixAllocUnit(int dim); + /** \fn int arMatrixMul(ARMat *dest, ARMat *a, ARMat *b) + * \brief Multiply two matrix + * + * Multiply two matrix and copy the result in another + * the product is this one : dest = a * b. The destination + * matrix must be allocated. Matrix a and b need to have + * the same size (the source matrix is unmodified). + * \param dest final matrix product + * \param a first matrix + * \param b second matrix + * \return 0 if success, -1 if error + */ int arMatrixMul(ARMat *dest, ARMat *a, ARMat *b); + + /** \fn ARMat *arMatrixAllocMul(ARMat *a, ARMat *b) + * \brief Multiply two matrix with memory allocation. + * + * multiply two matrix and copy the result in a new + * allocate matrix (the source matrix is unmodified). + * the product is this one : dest = a * b + * + * \param a first matrix + * \param b second matrix + * \return the allocated matrix if success, NULL if error + */ ARMat *arMatrixAllocMul(ARMat *a, ARMat *b); + /** \fn int arMatrixTrans(ARMat *dest, ARMat *source) + * \brief transposes a matrix. + * + * Transposes a matrix. The destination matrix + * must be allocated (the source matrix is unmodified). + * \param dest the destination matrix of the copy + * \param source the source matrix + * \return 0 if success, -1 if error + */ int arMatrixTrans(ARMat *dest, ARMat *source); + + /** \fn ARMat *arMatrixAllocTrans(ARMat *source) + * \brief transposes a matrix with allocation. + * + * transposes a matrix and copy the result in a new + * allocate matrix (the source matrix is unmodified). + * \param source the matrix to transpose + * \return the allocated matrix if success, NULL if error + */ ARMat *arMatrixAllocTrans(ARMat *source); + /** \fn int arMatrixInv(ARMat *dest, ARMat *source) + * \brief inverse a matrix. + * + * inverse a matrix and copy the result in a new + * one (the source matrix is unmodified). the destination + * matrix must be allocated. the source matrix need to be a + * square matrix. + * \param dest result matrix of the inverse operation + * \param source source matrix + * \return 0 if success, -1 if error + */ int arMatrixInv(ARMat *dest, ARMat *source); + + /** \fn int arMatrixSelfInv(ARMat *m) + * \brief inverses a matrix. + * + * Inverses a matrix and copy the result in + * the same structure. + * \param m the matrix to inverse + * \return 0 if success, -1 if error + */ int arMatrixSelfInv(ARMat *m); + + /** \fn int arMatrixAllocInv(ARMat *source) + * \brief inverses a matrix. + * + * Inverses a matrix and copy the result in + * in a new allocated structure. + * \param source the matrix to inverse + * \return the inversed matrix if success, NULL if error + */ ARMat *arMatrixAllocInv(ARMat *source); + /** \fn int arMatrixDet(ARMat *m) + * \brief compute determinant of a matrix. + * + * Compute the determinant of a matrix. + * \param m matrix source + * \return the computed determinant + */ double arMatrixDet(ARMat *m); + /** \fn int arMatrixPCA( ARMat *input, ARMat *evec, ARVec *ev, ARVec *mean ) + * \brief compute the PCA of a matrix. + * + * XXXBK + * \param input XXXBK + * \param evec XXXBK + * \param ev XXXBK + * \param mean XXXBK + * \return XXXBK + */ int arMatrixPCA( ARMat *input, ARMat *evec, ARVec *ev, ARVec *mean ); + + /** \fn int arMatrixPCA2( ARMat *input, ARMat *evec, ARVec *ev ) + * \brief compute the PCA of a matrix. + * + * XXXBK + * \param input XXXBK + * \param evec XXXBK + * \param ev XXXBK + * \return XXXBK + */ int arMatrixPCA2( ARMat *input, ARMat *evec, ARVec *ev ); + /** \fn int arMatrixDisp(ARMat *m) + * \brief display content of a matrix. + * + * Display in current console, the content of + * the matrix. The display is done line by line. + * \param m + * \return 0 + */ int arMatrixDisp(ARMat *m); ! /** \fn ARVec *arVecAlloc( int clm ) ! * \brief creates a new vector. ! * ! * Allocates and initializes new vector structure. ! * \param clm dimension of vector ! * \return the allocated vector, NULL if error ! */ ARVec *arVecAlloc( int clm ); + + /** \fn int arVecFree( ARVec *v ) + * \brief delete a vector. + * + * Delete a vector structure (deallocate used memory). + * \param v vector to delete + * \return 0 + */ int arVecFree( ARVec *v ); + + /** \fn int arVecDisp( ARVec *v ) + * \brief display a vector. + * + * Display element of a vector. + * \param v the vector to display + * \return 0 + */ int arVecDisp( ARVec *v ); + + /** \fn double arVecHousehold( ARVec *x ) + * \brief XXXBK + * + * XXXBK: for QR decomposition ?? (can't success to find french translation of this term) + * \param x XXXBK + * \return XXXBK + */ double arVecHousehold( ARVec *x ); + + /** \fn double arVecInnerproduct( ARVec *x, ARVec *y ) + * \brief Computes the inner product of 2 vectors. + * + * computes the inner product of the two argument vectors. + * the operation done is a=x.y (and a is return) + * \param x first vector source + * \param y second vector source + * \return the computed innerproduct + */ double arVecInnerproduct( ARVec *x, ARVec *y ); + + /** \fn int arVecTridiagonalize( ARMat *a, ARVec *d, ARVec *e ) + * \brief XXXBK + * + * XXXBK + * \param a XXXBK + * \param d XXXBK + * \param e XXXBK + * \return XXXBK + */ int arVecTridiagonalize( ARMat *a, ARVec *d, ARVec *e ); *************** *** 83,84 **** --- 363,365 ---- #endif #endif + Index: gsubUtil.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/gsubUtil.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gsubUtil.h 4 Nov 2004 08:51:14 -0000 1.1.1.1 --- gsubUtil.h 22 Nov 2004 02:11:05 -0000 1.2 *************** *** 1,15 **** ! #ifndef AR_GSUB_UTIL_H ! #define AR_GSUB_UTIL_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! #include <AR/param.h> ! void argUtilCalibHMD( int targetId, int thresh2, ! void (*postFunc)(ARParam *lpara, ARParam *rpara) ); ! #ifdef __cplusplus ! } ! #endif ! #endif --- 1,70 ---- ! /* -------------------------------------------------------------------------- ! * Copyright (C) 2004 Hitlab NZ. ! * The distribution policy is describe on the Copyright.txt furnish ! * with this library. ! * -------------------------------------------------------------------------*/ ! /** ! * \file gsubUtil.h ! * \brief ARToolkit OpenGL utilities subroutines. ! * ! * Complement routines of gsub module. ! * \remark ! * ! * History : ! * ! * \author Hirokazu Kato ka...@sy... ! * \version ! * \date ! **/ ! /* -------------------------------------------------------------------------- ! * History : ! * Rev Date Who Changes ! * ! *----------------------------------------------------------------------------*/ ! #ifndef AR_GSUB_UTIL_H ! #define AR_GSUB_UTIL_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! // ============================================================================ ! // Public includes. ! // ============================================================================ ! ! #include <AR/param.h> ! ! // ============================================================================ ! // Public types and defines. ! // ============================================================================ ! // ============================================================================ ! // Public globals. ! // ============================================================================ ! // ============================================================================ ! // Public functions. ! // ============================================================================ ! /** \fn void argUtilCalibHMD( int targetId, int thresh2, ! void (*postFunc)(ARParam *lpara, ARParam *rpara) ) ! * \brief utility function for calibrate an HMD. ! * ! * This function offers a full calibration run-time routines for an optical HMD (mono ! * or stereo). ! * It is useful for estimate transformation between user eye position and ! * camera position. You will find more informations on the calibration routine ! * on opticalcalibration.html .This function modify gsub state of left and right camera ! * intrinsic parameters. ! * \param targetId the target used for the calibration step. ! * \param thresh2 lighting threshold value to use ! * \param postFunc a callback function used to analysis computed internal camera ! * parameters. if your application is mono display, only lpara contains a value. ! * lpara and rpara are NULL if the calibration failed. ! */ ! void argUtilCalibHMD( int targetId, int thresh2, ! void (*postFunc)(ARParam *lpara, ARParam *rpara) ); ! ! #ifdef __cplusplus ! } ! #endif ! #endif Index: video.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/video.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** video.h 4 Nov 2004 08:51:15 -0000 1.1.1.1 --- video.h 22 Nov 2004 02:11:05 -0000 1.2 *************** *** 1,126 **** ! /* ! * ! * Author: Hirokazu Kato, Atsishi Nakazawa. ! * Modified by Thomas Pintaric. ! * ! * ! * ka...@sy... ! * nak...@in... ! * pin...@im... ! * ! * Revision: 4.3b ! * Date: 2003/02/02 ! * ! */ ! /* ! * Copyright (c) 2004-2004 Philip Lamb (PRL) ph...@ed.... All rights reserved. ! * ! * Rev Date Who Changes ! * 2.6.8 2004-07-20 PRL Rewrite for ARToolKit 2.68.2 ! * ! */ ! /* ! * ! * This file is part of ARToolKit. ! * ! * ARToolKit is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * ARToolKit is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with ARToolKit; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! */ ! ! #ifndef AR_VIDEO_H ! #define AR_VIDEO_H ! ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! #ifdef _WIN32 ! # include <AR/sys/videoWin32DirectShow.h> ! # ifdef LIBARVIDEO_EXPORTS ! # define AR_DLL_API __declspec(dllexport) ! # else ! # ifdef _DLL ! # define AR_DLL_API __declspec(dllimport) ! # else ! # define AR_DLL_API extern ! # endif ! # endif ! #else ! # define AR_DLL_API ! #endif ! ! #ifdef __linux ! # ifdef AR_INPUT_V4L ! # include <AR/sys/videoLinuxV4L.h> ! # endif ! # ifdef AR_INPUT_DV ! # include <AR/sys/videoLinuxDV.h> ! # endif ! # ifdef AR_INPUT_1394CAM ! # include <AR/sys/videoLinux1394Cam.h> ! # endif ! #endif ! ! #ifdef __sgi ! # include <AR/sys/videoSGI.h> ! #endif ! ! #ifdef __APPLE__ ! # include <AR/sys/videoMacOSX.h> ! #endif ! ! AR_DLL_API int arVideoDispOption(void); ! AR_DLL_API int arVideoOpen(char *config); ! AR_DLL_API int arVideoClose(void); ! AR_DLL_API int arVideoCapStart(void); ! AR_DLL_API int arVideoCapStop(void); ! AR_DLL_API int arVideoCapNext(void); ! AR_DLL_API ARUint8* arVideoGetImage(void); ! AR_DLL_API int arVideoInqSize(int *x, int *y); ! ! AR_DLL_API int ar2VideoDispOption(void); ! AR_DLL_API AR2VideoParamT *ar2VideoOpen(char *config); ! AR_DLL_API int ar2VideoClose(AR2VideoParamT *vid); ! AR_DLL_API int ar2VideoCapStart(AR2VideoParamT *vid); ! AR_DLL_API int ar2VideoCapNext(AR2VideoParamT *vid); ! AR_DLL_API int ar2VideoCapStop(AR2VideoParamT *vid); ! AR_DLL_API ARUint8 *ar2VideoGetImage(AR2VideoParamT *vid); ! AR_DLL_API int ar2VideoInqSize(AR2VideoParamT *vid, int *x, int *y); ! ! // Functions added for Studierstube/OpenTracker. ! #ifdef _WIN32 ! # ifndef __MEMORY_BUFFER_HANDLE__ ! # define __MEMORY_BUFFER_HANDLE__ ! # define DEFAULT_NUMBER_OF_ALLOCATOR_BUFFERS 3 ! typedef struct _MemoryBufferHandle ! { ! unsigned long n; // sample number ! __int64 t; // timestamp ! } MemoryBufferHandle; ! # endif // __MEMORY_BUFFER_HANDLE__ ! AR_DLL_API int ar2VideoInqFreq(AR2VideoParamT *vid, float *fps); ! AR_DLL_API int ar2VideoInqFlipping(AR2VideoParamT *vid, int *flipH, int *flipV); ! AR_DLL_API unsigned char *ar2VideoLockBuffer(AR2VideoParamT *vid, MemoryBufferHandle *pHandle); ! AR_DLL_API int ar2VideoUnlockBuffer(AR2VideoParamT *vid, MemoryBufferHandle Handle); ! #endif // _WIN32 ! ! #ifdef __cplusplus ! } ! #endif ! #endif // AR_VIDEO_H --- 1,327 ---- ! /* -------------------------------------------------------------------------- ! * Copyright (c) 2004-2004 Philip Lamb (PRL) ph...@ed.... All rights reserved. ! * This file is part of ARToolKit. ! * ! * ARToolKit is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * ARToolKit is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with ARToolKit; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * -------------------------------------------------------------------------*/ ! /** ! * \file video.h ! * \brief ARToolkit video subroutines. ! * ! * This component furnishs a multi-platform video support for ARToolkit. ! * It provides access to hardware video input available on different machines, OS. ! * For each platform a specific sub-component have been implemented, unified in the ! * same interface (with the prefix function name arVideoXXX). ! * ! * The actual supported platforms (and the driver/library used) are: ! * - Windows: with DirectShow (VFW obsolete). ! * - Linux: with V4L, IEEE1394 Library. ! * - Macintosh: with QuickTime 6. ! * - SGI: with VL. ! * ! * This component have two separated interfaces according to your videos input ! * number: ! * - one single alone camera: used the <b>arXXX</b> functions (XXX template name). ! * - multiple camera: used the <b>ar2XXX</b> functions (XXX template name). ! * ! * More information are available on <a href="video.html">the video page</a>. ! * ! * \remark ! * the arXXX uses a global variable and wrap all calls to ar2XXX functions ! * - WINDOWS: only one camera is supported. ! * ! * History : ! * modified by Thomas Pintaric (pin...@im...) for adding ! * a fully transparent DirectShow Driver. ! * ! * \author Hirokazu Kato ka...@sy... ! * \author Atsishi Nakazawa nak...@in... ! * \author Thomas Pintaric pin...@im... ! * \version 4.3b ! * \date 03/02/02 ! * ! * ! **/ ! /* -------------------------------------------------------------------------- ! * History : ! * Rev Date Who Changes ! * 2.6.8 2004-07-20 PRL Rewrite for ARToolKit 2.68.2 ! * ! *----------------------------------------------------------------------------*/ ! ! #ifndef AR_VIDEO_H ! #define AR_VIDEO_H ! ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! // ============================================================================ ! // Public includes. ! // ============================================================================ ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! // ============================================================================ ! // Public types and defines. ! // ============================================================================ ! ! #ifdef _WIN32 ! # include <AR/sys/videoWin32DirectShow.h> ! # ifdef LIBARVIDEO_EXPORTS ! # define AR_DLL_API __declspec(dllexport) ! # else ! # ifdef _DLL ! # define AR_DLL_API __declspec(dllimport) ! # else ! # define AR_DLL_API extern ! # endif ! # endif ! #else ! # define AR_DLL_API ! #endif ! ! #ifdef __linux ! # ifdef AR_INPUT_V4L ! # include <AR/sys/videoLinuxV4L.h> ! # endif ! # ifdef AR_INPUT_DV ! # include <AR/sys/videoLinuxDV.h> ! # endif ! # ifdef AR_INPUT_1394CAM ! # include <AR/sys/videoLinux1394Cam.h> ! # endif ! #endif ! ! #ifdef __sgi ! # include <AR/sys/videoSGI.h> ! #endif ! ! #ifdef __APPLE__ ! # include <AR/sys/videoMacOSX.h> ! #endif ! ! // ============================================================================ ! // Public globals. ! // ============================================================================ ! // ============================================================================ ! // Public functions. ! // ============================================================================ ! ! /* ! mono-camera ! */ ! ! /** \fn int arVideoDispOption( void ) ! * \brief display the video option. ! * ! * According to your platform, output in the ! * standard console the video option available. ! * \return 0 ! */ ! AR_DLL_API int arVideoDispOption(void); ! ! /** \fn int arVideoOpen( char *config ) ! * \brief open a video source. ! * ! * this function open a video input path with the ! * driver (and device) present on your platform. ! * According to your operating system and the ! * hardware the initialization will be different : a ! * generic string structure is used for this issue. ! * You can find all details in this <a href="videoconfig.html"> ! * webpage</a> ! * \param config string of the selected video configuration. ! * \return 0 if successful, -1 if a video path couldnt be opened ! */ ! AR_DLL_API int arVideoOpen(char *config); ! ! /** \fn int arVideoClose( void ) ! * \brief close the video source. ! * a function that needs to be called in order to shut down the video capture ! * \return 0 if shut down successfully, otherwise 1. ! */ ! AR_DLL_API int arVideoClose(void); ! ! /** \fn int arVideoCapStart( void ) ! * \brief start the capture of video. ! * ! * This function start the video capture routine. According ! * to the architecture can start a video thread, call a specific ! * run-time function in the driver. ! * \remark this function coupled with arVideoCapStop, can ! * be call many times in your program (reduce the CPU load ! * when they stop for long and critical operations) ! * \return 0 if successful, -1 if the capture can't be start ! */ ! AR_DLL_API int arVideoCapStart(void); ! ! /** \fn int arVideoCapStop( void ) ! * \brief stop the capture of video. ! * ! * This function stop the video capture routine. According ! * to the architecture can stop a video thread, call a specific ! * run-time function in the driver. ! * \remark this function coupled with arVideoCapStart, can ! * be call many times in your program (reduce the CPU load ! * when they stop for long and critical operations) ! * \return 0 if successful, -1 if the capture can't be stop ! */ ! AR_DLL_API int arVideoCapStop(void); ! ! /** \fn int arVideoCapNext( void ) ! * \brief call for the next grabbed video frame. ! * ! * According to your platform, this function can ! * be have different effects. A call to the function ! * indicates that a new frame can be grabbed. The outcome ! * is you can't use more the last video frame. You need to ! * call this function after analysis the video image and ! * display it. ! * ! * \remark if your video grabber is multithread, this ! * function do nothing since a buffer is still available. ! * \return 0 if successful, -1 if the next grabbed frame can't be start ! */ ! AR_DLL_API int arVideoCapNext(void); ! ! /** \fn ARUint8 *arVideoGetImage( void ) ! * \brief get the video image. ! * ! * This function return a buffer with a captured video image. ! * XXXBK : do we need to delete the pointed area ? ! * is the area still available in the next call ? ! * \return a pointer to the captured video frame, or NULL if a frame isnt captured. ! */ ! AR_DLL_API ARUint8* arVideoGetImage(void); ! ! /** \fn int arVideoInqSize( int *x, int *y ) ! * \brief get the video image size. ! * ! * a function that returns the size of the captured video frame. ! * \param x a pointer to the length of the captured image ! * \param y a pointer to the width of the captured image ! * \return 0 if the dimensions are found successfully, otherwise 1 ! */ ! AR_DLL_API int arVideoInqSize(int *x, int *y); ! ! /* ! multiple cameras ! */ ! ! /** \fn int ar2VideoDispOption ( void ) ! * \brief display the video option (multiple video inputs) ! * ! * idem of arVideoDispOption for multiple video sources. ! * \return 0 ! */ ! AR_DLL_API int ar2VideoDispOption(void); ! ! /** \fn AR2VideoParamT *ar2VideoOpen ( char *config ) ! * \brief open a video source (multiple video inputs) ! * ! * idem of arVideoOpen for multiple video sources (the selected ! * source in argument). ! * \param config string of the selected video configuration. ! * \return 0 if successful, -1 if a video path couldnt be opened ! */ ! AR_DLL_API AR2VideoParamT *ar2VideoOpen(char *config); ! ! /** \fn int ar2VideoClose ( AR2VideoParamT *vid ) ! * \brief close a video source (multiple video inputs) ! * ! * idem of arVideoClose for multiple video sources (the selected ! * source in argument). ! * \param vid a video handle structure for multi-camera grabbing ! * \return 0 if shut down successfully, otherwise 1. ! */ ! AR_DLL_API int ar2VideoClose(AR2VideoParamT *vid); ! ! /** \fn int ar2VideoCapStart (AR2VideoParamT *vid ) ! * \brief start the capture of a video source (multiple video inputs) ! * ! * idem of arVideoCapStart for multiple video sources (the selected ! * source in argument). ! * \param vid a video handle structure for multi-camera grabbing ! * \return 0 if successful, -1 if the capture can't be start ! */ ! AR_DLL_API int ar2VideoCapStart(AR2VideoParamT *vid); ! ! /** \fn int ar2VideoCapNext ( AR2VideoParamT *vid ) ! * \brief call for the next grabbed video frame of a video source (multiple video inputs) ! * ! * idem of arVideoCapNext for multiple video sources (the selected ! * source in argument). ! * \param vid a video handle structure for multi-camera grabbing ! * \return 0 if successful, -1 if the next grabbed frame can't be start ! */ ! AR_DLL_API int ar2VideoCapNext(AR2VideoParamT *vid); ! ! /** \fn int ar2VideoCapStop ( AR2VideoParamT *vid ) ! * \brief stop the capture of a video source (multiple video inputs) ! * ! * idem of arVideoCapStop for multiple video sources (the selected ! * source in argument). ! * \param vid a video handle structure for multi-camera grabbing ! * \return 0 if successful, -1 if the next grabbed frame can't be stop ! */ ! AR_DLL_API int ar2VideoCapStop(AR2VideoParamT *vid); ! ! /** \fn int ar2VideoGetImage ( AR2VideoParamT *vid ) ! * \brief get a video image from a video source (multiple video inputs) ! * ! * idem of arVideoGetImage for multiple video sources (the selected ! * source in argument). ! * \param vid a video handle structure for multi-camera grabbing ! * \return a pointer to the captured video frame, or NULL if a frame isnt captured. ! */ ! AR_DLL_API ARUint8 *ar2VideoGetImage(AR2VideoParamT *vid); ! ! /** \fn int ar2VideoInqSize ( AR2VideoParamT *vid, int *x,int *y ) ! * \brief get the video image size of a video source (multiple video inputs) ! * ! * idem of arVideoInqSize for multiple video sources (the selected ! * source in argument). ! * \param vid a video handle structure for multi-camera grabbing ! * \param x a pointer to the length of the captured image ! * \param y a pointer to the width of the captured image ! * \return 0 if the dimensions are found successfully, otherwise 1 ! */ ! AR_DLL_API int ar2VideoInqSize(AR2VideoParamT *vid, int *x, int *y); ! ! // Functions added for Studierstube/OpenTracker. ! #ifdef _WIN32 ! # ifndef __MEMORY_BUFFER_HANDLE__ ! # define __MEMORY_BUFFER_HANDLE__ ! # define DEFAULT_NUMBER_OF_ALLOCATOR_BUFFERS 3 ! typedef struct _MemoryBufferHandle ! { ! unsigned long n; // sample number ! __int64 t; // timestamp ! } MemoryBufferHandle; ! # endif // __MEMORY_BUFFER_HANDLE__ ! AR_DLL_API int ar2VideoInqFreq(AR2VideoParamT *vid, float *fps); ! AR_DLL_API int ar2VideoInqFlipping(AR2VideoParamT *vid, int *flipH, int *flipV); ! AR_DLL_API unsigned char *ar2VideoLockBuffer(AR2VideoParamT *vid, MemoryBufferHandle *pHandle); ! AR_DLL_API int ar2VideoUnlockBuffer(AR2VideoParamT *vid, MemoryBufferHandle Handle); ! #endif // _WIN32 ! ! #ifdef __cplusplus ! } ! #endif ! ! #endif // AR_VIDEO_H Index: gsub.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/gsub.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gsub.h 4 Nov 2004 08:51:11 -0000 1.1.1.1 --- gsub.h 22 Nov 2004 02:11:05 -0000 1.2 *************** *** 1,45 **** ! #ifndef AR_GSUB_H ! #define AR_GSUB_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! ! #include <AR/config.h> ! #include <AR/param.h> ! #include <AR/ar.h> ! extern int argDrawMode; ! extern int argTexmapMode; ! void argInit( ARParam *cparam, double zoom, int fullFlag, int xwin, int ywin, int hmd_flag ); ! void argLoadHMDparam( ARParam *lparam, ARParam *rparam ); ! void argCleanup( void ); ! void argSwapBuffers( void ); ! void argMainLoop( void (*mouseFunc)(int button, int state, int x, int y), void (*keyFunc)(unsigned char key, int x, int y), ! void (*mainFunc)(void) ); ! ! void argDrawMode2D( void ); void argDraw2dLeft( void ); void argDraw2dRight( void ); void argDrawMode3D( void ); void argDraw3dLeft( void ); - void argDraw3dRight( void ); - void argDraw3dCamera( int xwin, int ywin ); void argConvGlpara( double para[3][4], double gl_para[16] ); void argConvGLcpara( ARParam *param, double gnear, double gfar, double m[16] ); void argDispImage( ARUint8 *image, int xwin, int ywin ); void argDispHalfImage( ARUint8 *image, int xwin, int ywin ); void argDrawSquare( double vertex[4][2], int xwin, int ywin ); void argLineSeg( double x1, double y1, double x2, double y2, int xwin, int ywin ); void argLineSegHMD( double x1, double y1, double x2, double y2 ); void argInqSetting( int *hmdMode, int *gMiniXnum2, int *gMiniYnum2, --- 1,312 ---- ! /* -------------------------------------------------------------------------- ! * Copyright (C) 2004 Hitlab NZ. ! * The distribution policy is describe on the Copyright.txt furnish ! * with this library. ! * -------------------------------------------------------------------------*/ ! /** ! * \file gsub.h ! * \brief ARToolkit OpenGL subroutines. ! * ! * This file contains the main display functions used in ARToolkit Library. ! * It contains wrapped functions of GLUT and openGL for doing real-time ! * rendering. This choice give us a large multi-platform support for the display ! * module of ARToolkit. ! * \remark The supported stereo mode is interleaved stereo mode (only for i-glasses display). ! * ! * History : ! * ! * \author Hirokazu Kato ka...@sy... ! * \version ! * \date ! **/ ! /* -------------------------------------------------------------------------- ! * History : ! * Rev Date Who Changes ! * ! *----------------------------------------------------------------------------*/ ! ! #ifndef AR_GSUB_H ! #define AR_GSUB_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! // ============================================================================ ! // Public includes. ! // ============================================================================ ! ! #include <AR/config.h> ! #include <AR/param.h> ! #include <AR/ar.h> ! ! // ============================================================================ ! // Public types and defines. ! // ============================================================================ ! // ============================================================================ ! // Public globals. ! // ============================================================================ ! /** \var int argDrawMode ! * \brief define the draw configuration mode. ! * ! * Define the draw mode for display of the video background. ! * The possible values are : ! * - AR_DRAW_BY_GL_DRAW_PIXELS: use the GL_DRAW_PIXELS function ! * - AR_DRAW_BY_TEXTURE_MAPPING: use a quad mesh with a texture mapping ! * of the video. ! * by default: DEFAULT_DRAW_MODE in config.h ! * \rem choice and performance depends on your hardware and your openGL driver. ! */ ! extern int argDrawMode; ! ! /** \var int argTexmapMode ! * \brief define the texture map configuration mode. ! * ! * If the draw mode is AR_DRAW_BY_TEXTURE_MAPPING, you can ! * configure the copy mode of the texture mapping. ! * The possible values are : ! * - AR_DRAW_TEXTURE_FULL_IMAGE: texture mapping full resolution. ! * - AR_DRAW_TEXTURE_HALF_IMAGE: texture mapping half resolution. ! * by default: DEFAULT_DRAW_TEXTURE_IMAGE in config.h ! */ ! extern int argTexmapMode; ! ! // ============================================================================ ! // Public functions. ! // ========================... [truncated message content] |
From: Philip L. <phi...@us...> - 2004-11-22 02:11:20
|
Update of /cvsroot/artoolkit/artoolkit/include/AR/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9541 Modified Files: videoMacOSX.h videoLinux1394Cam.h videoSGI.h videoLinuxDV.h videoLinuxV4L.h Log Message: Add doxygen docs. Linux video driver updates and patches. Index: videoSGI.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoSGI.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** videoSGI.h 4 Nov 2004 08:51:15 -0000 1.1.1.1 --- videoSGI.h 22 Nov 2004 02:10:56 -0000 1.2 *************** *** 1,92 **** ! /******************************************************* ! * ! * Author: Hirokazu Kato, Atsishi Nakazawa ! * ! * ka...@sy... ! * nak...@in... ! * ! * Revision: 4.2 ! * Date: 2002/01/01 ! * ! *******************************************************/ ! #ifndef AR_VIDEO_SGI_H ! #define AR_VIDEO_SGI_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! ! typedef enum{ ! AR_VIDEO_INTERLEAVED, ! AR_VIDEO_NONINTERLEAVED, ! AR_VIDEO_ODD, ! AR_VIDEO_EVEN ! } ARVideoFormat; ! ! typedef enum { ! AR_VIDEO_RGB_8, ! AR_VIDEO_RGB_332, ! AR_VIDEO_MONO, ! AR_VIDEO_YVYU ! } ARVideoPacking; ! ! typedef enum { ! AR_VIDEO_1_P_1, ! AR_VIDEO_1_P_2, ! AR_VIDEO_1_P_4, ! AR_VIDEO_1_P_8 ! } ARVideoZoom; ! ! typedef enum { ! AR_VIDEO_INDY, ! AR_VIDEO_O2, ! AR_VIDEO_GALILEO, ! AR_VIDEO_OCTANE, ! AR_VIDEO_IMPACT ! } ARVideoDeviceType; ! ! #define ARVideoDeviceMax 4 ! ! typedef struct { ! ARVideoDeviceType type[ARVideoDeviceMax]; ! int num; ! } ARVideoDeviceTypeList; ! ! ! typedef struct { ! int did; ! int width; ! int height; ! ARVideoFormat format; ! ARVideoPacking packing; ! ARVideoZoom zoom; ! int buf_size; ! } AR2VideoParamT; ! ! int arVideoOpen2( void ); ! int arVideoClose2( void ); ! ! int arVideoInqDevice2( ARVideoDeviceTypeList *dev_list ); ! int arVideoInqSize2( int dev_id, int *x, int *y ); ! ! int arVideoSetupDevice2( int dev_id, ! ARVideoFormat format, ! ARVideoPacking packing, ! ARVideoZoom zoom ); ! int arVideoCleanupDevice2( int dev_id ); ! ! ! int arVideoStart2( int dev_id ); ! int arVideoStop2( int dev_id ); ! ! unsigned char *arVideoGetImage2( int dev_id ); ! ! int arVideoSetBufferSize2( int dev_id, int size ); ! ! #ifdef __cplusplus ! } ! #endif ! #endif --- 1,92 ---- ! /******************************************************* ! * ! * Author: Hirokazu Kato, Atsishi Nakazawa ! * ! * ka...@sy... ! * nak...@in... ! * ! * Revision: 4.2 ! * Date: 2002/01/01 ! * ! *******************************************************/ ! #ifndef AR_VIDEO_SGI_H ! #define AR_VIDEO_SGI_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! ! typedef enum{ ! AR_VIDEO_INTERLEAVED, ! AR_VIDEO_NONINTERLEAVED, ! AR_VIDEO_ODD, ! AR_VIDEO_EVEN ! } ARVideoFormat; ! ! typedef enum { ! AR_VIDEO_RGB_8, ! AR_VIDEO_RGB_332, ! AR_VIDEO_MONO, ! AR_VIDEO_YVYU ! } ARVideoPacking; ! ! typedef enum { ! AR_VIDEO_1_P_1, ! AR_VIDEO_1_P_2, ! AR_VIDEO_1_P_4, ! AR_VIDEO_1_P_8 ! } ARVideoZoom; ! ! typedef enum { ! AR_VIDEO_INDY, ! AR_VIDEO_O2, ! AR_VIDEO_GALILEO, ! AR_VIDEO_OCTANE, ! AR_VIDEO_IMPACT ! } ARVideoDeviceType; ! ! #define ARVideoDeviceMax 4 ! ! typedef struct { ! ARVideoDeviceType type[ARVideoDeviceMax]; ! int num; ! } ARVideoDeviceTypeList; ! ! ! typedef struct { ! int did; ! int width; ! int height; ! ARVideoFormat format; ! ARVideoPacking packing; ! ARVideoZoom zoom; ! int buf_size; ! } AR2VideoParamT; ! ! int arVideoOpen2( void ); ! int arVideoClose2( void ); ! ! int arVideoInqDevice2( ARVideoDeviceTypeList *dev_list ); ! int arVideoInqSize2( int dev_id, int *x, int *y ); ! ! int arVideoSetupDevice2( int dev_id, ! ARVideoFormat format, ! ARVideoPacking packing, ! ARVideoZoom zoom ); ! int arVideoCleanupDevice2( int dev_id ); ! ! ! int arVideoStart2( int dev_id ); ! int arVideoStop2( int dev_id ); ! ! unsigned char *arVideoGetImage2( int dev_id ); ! ! int arVideoSetBufferSize2( int dev_id, int size ); ! ! #ifdef __cplusplus ! } ! #endif ! #endif Index: videoLinuxDV.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoLinuxDV.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** videoLinuxDV.h 4 Nov 2004 08:51:15 -0000 1.1.1.1 --- videoLinuxDV.h 22 Nov 2004 02:10:56 -0000 1.2 *************** *** 1,54 **** ! /******************************************************* ! * ! * Author: Hirokazu Kato ! * ! * ka...@sy... ! * ! * Revision: 1.1 ! * Date: 2002/01/01 ! * ! *******************************************************/ ! #ifndef AR_VIDEO_LINUX_DV_H ! #define AR_VIDEO_LINUX_DV_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! #include <stdio.h> ! #include <string.h> ! #include <unistd.h> ! #include <libraw1394/raw1394.h> ! #include <libdv/dv.h> ! ! typedef struct { ! int size; ! ARUint8 *buff_in; ! ARUint8 *buff_wait; ! ARUint8 *buff_out; ! int fill_size_in; ! int fill_size_wait; ! int fill_size_out; ! int read_size; ! pthread_mutex_t mutex; ! int init; ! } AR2VideoBufferT; ! ! typedef struct { ! int mode; ! int debug; ! int status; ! raw1394handle_t handle; ! pthread_t capture; ! AR2VideoBufferT *buffer; ! int packet_num; ! dv_decoder_t *dv_decoder; ! ARUint8 *image; ! } AR2VideoParamT; ! ! #ifdef __cplusplus ! } ! #endif ! #endif --- 1,54 ---- ! /******************************************************* ! * ! * Author: Hirokazu Kato ! * ! * ka...@sy... ! * ! * Revision: 1.1 ! * Date: 2002/01/01 ! * ! *******************************************************/ ! #ifndef AR_VIDEO_LINUX_DV_H ! #define AR_VIDEO_LINUX_DV_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! #include <stdio.h> ! #include <string.h> ! #include <unistd.h> ! #include <libraw1394/raw1394.h> ! #include <libdv/dv.h> ! ! typedef struct { ! int size; ! ARUint8 *buff_in; ! ARUint8 *buff_wait; ! ARUint8 *buff_out; ! int fill_size_in; ! int fill_size_wait; ! int fill_size_out; ! int read_size; ! pthread_mutex_t mutex; ! int init; ! } AR2VideoBufferT; ! ! typedef struct { ! int mode; ! int debug; ! int status; ! raw1394handle_t handle; ! pthread_t capture; ! AR2VideoBufferT *buffer; ! int packet_num; ! dv_decoder_t *dv_decoder; ! ARUint8 *image; ! } AR2VideoParamT; ! ! #ifdef __cplusplus ! } ! #endif ! #endif Index: videoLinuxV4L.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoLinuxV4L.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** videoLinuxV4L.h 4 Nov 2004 08:51:15 -0000 1.1.1.1 --- videoLinuxV4L.h 22 Nov 2004 02:10:56 -0000 1.2 *************** *** 1,45 **** ! /******************************************************* ! * ! * Author: Hirokazu Kato ! * ! * ka...@sy... ! * ! * Revision: 4.4 ! * Date: 2002/01/01 ! * ! *******************************************************/ ! #ifndef AR_VIDEO_LINUX_V4L_H ! #define AR_VIDEO_LINUX_V4L_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <stdlib.h> ! #include <linux/types.h> ! #include <linux/videodev.h> ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! typedef struct { ! char dev[256]; ! int width; ! int height; ! int channel; ! int mode; ! int debug; ! double contrast; ! double brightness; ! double color; ! ! int fd; ! int video_cont_num; ! ARUint8 *map; ! struct video_mbuf vm; ! struct video_mmap vmm; ! } AR2VideoParamT; ! ! #ifdef __cplusplus ! } ! #endif ! #endif --- 1,59 ---- ! /******************************************************* ! * ! * Author: Hirokazu Kato ! * ! * ka...@sy... ! * ! * Revision: 4.5 ! * Date: 2002/01/01 ! * ! * 2004/11/17 Grasset adding new parameters for better controls of ! * V4L driver ! * 2004/11/17 Grasset adding patch done by XXX for supporting YUV 4:2:0 ! * (adding #define and videoBuffer encoding parameters) ! ! *******************************************************/ ! #ifndef AR_VIDEO_LINUX_V4L_H ! #define AR_VIDEO_LINUX_V4L_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <stdlib.h> ! #include <linux/types.h> ! #include <linux/videodev.h> ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! typedef struct { ! //device controls ! char dev[256]; ! int channel; ! int width; ! int height; ! int palette; ! //image controls ! double brightness; ! double contrast; ! double saturation; ! double hue; ! double whiteness; ! ! //options controls ! int mode; ! ! int debug; ! ! int fd; ! int video_cont_num; ! ARUint8 *map; ! ARUint8 *videoBuffer; ! struct video_mbuf vm; ! struct video_mmap vmm; ! } AR2VideoParamT; ! ! #ifdef __cplusplus ! } ! #endif ! #endif Index: videoLinux1394Cam.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoLinux1394Cam.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** videoLinux1394Cam.h 4 Nov 2004 08:51:15 -0000 1.1.1.1 --- videoLinux1394Cam.h 22 Nov 2004 02:10:56 -0000 1.2 *************** *** 1,50 **** ! /******************************************************* ! * ! * Author: Hirokazu Kato ! * ! * ka...@sy... ! * ! * Revision: 1.0 ! * Date: 2002/01/01 ! * ! *******************************************************/ ! #ifndef AR_VIDEO_LINUX_1394CAM_H ! #define AR_VIDEO_LINUX_1394CAM_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! #include <stdlib.h> ! #include <linux/types.h> ! #include <linux/videodev.h> ! #include <libraw1394/raw1394.h> ! #include <libdc1394/dc1394_control.h> ! ! ! typedef struct { ! int node; ! int mode; ! int rate; ! int debug; ! ! int channel; ! int speed; ! int format; ! int dma_buf_num; ! int int_mode; ! int int_rate; ! int status; ! ! int internal_id; ! dc1394_feature_set features; ! dc1394_cameracapture camera; ! ARUint8 *image; ! } AR2VideoParamT; ! ! #ifdef __cplusplus ! } ! #endif ! #endif --- 1,50 ---- ! /******************************************************* ! * ! * Author: Hirokazu Kato ! * ! * ka...@sy... ! * ! * Revision: 1.0 ! * Date: 2002/01/01 ! * ! *******************************************************/ ! #ifndef AR_VIDEO_LINUX_1394CAM_H ! #define AR_VIDEO_LINUX_1394CAM_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! #include <stdlib.h> ! #include <linux/types.h> ! #include <linux/videodev.h> ! #include <libraw1394/raw1394.h> ! #include <libdc1394/dc1394_control.h> ! ! ! typedef struct { ! int node; ! int mode; ! int rate; ! int debug; ! int card; ! int channel; ! int speed; ! int format; ! int dma_buf_num; ! int int_mode; ! int int_rate; ! int status; ! ! int internal_id; ! dc1394_feature_set features; ! dc1394_cameracapture camera; ! ARUint8 *image; ! } AR2VideoParamT; ! ! #ifdef __cplusplus ! } ! #endif ! #endif Index: videoMacOSX.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoMacOSX.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** videoMacOSX.h 4 Nov 2004 08:51:15 -0000 1.1.1.1 --- videoMacOSX.h 22 Nov 2004 02:10:56 -0000 1.2 *************** *** 1,62 **** ! /* ! * Video capture subrutine for Linux/libdc1394 devices ! * author: Kiyoshi Kiyokawa ( ki...@cr... ) ! * Hirokazu Kato ( ka...@sy... ) ! * ! * Revision: 1.0 Date: 2002/01/01 ! * ! */ ! /* ! * Copyright (c) 2003-2004 Philip Lamb (PRL) ph...@ed.... All rights reserved. ! * ! * Rev Date Who Changes ! * 1.1.0 2003-09-09 PRL Based on Apple "Son of MungGrab" sample code for QuickTime 6. ! * Added config option "-fps" to superimpose frame counter on video. ! * Returns aligned data in ARGB pixel format. ! * 1.2.0 2004-04-28 PRL Now one thread per video source. Versions of QuickTime ! * prior to 6.4 are NOT thread safe, and if using a non-thread ! * safe version, you should comment out AR_VIDEO_HAVE_THREADSAFE_QUICKTIME ! * so serialise access when there is more than one thread. ! * 1.2.1 2004-06-28 PRL Support for 2vuy and yuvs pixel formats. ! * 1.3.0 2004-07-13 PRL Code from Daniel Heckenberg to directly access vDig. ! * ! */ ! /* ! * ! * This file is part of ARToolKit. ! * ! * ARToolKit is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * ARToolKit is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with ARToolKit; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! */ ! ! #ifndef AR_VIDEO_MACOSX_H ! #define AR_VIDEO_MACOSX_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <Carbon/Carbon.h> ! #include <QuickTime/QuickTime.h> ! #include <pthread.h> ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! typedef struct _AR2VideoParamT AR2VideoParamT; ! ! #ifdef __cplusplus ! } ! #endif ! #endif // AR_VIDEO_MACOSX_H --- 1,62 ---- ! /* ! * Video capture subrutine for Linux/libdc1394 devices ! * author: Kiyoshi Kiyokawa ( ki...@cr... ) ! * Hirokazu Kato ( ka...@sy... ) ! * ! * Revision: 1.0 Date: 2002/01/01 ! * ! */ ! /* ! * Copyright (c) 2003-2004 Philip Lamb (PRL) ph...@ed.... All rights reserved. ! * ! * Rev Date Who Changes ! * 1.1.0 2003-09-09 PRL Based on Apple "Son of MungGrab" sample code for QuickTime 6. ! * Added config option "-fps" to superimpose frame counter on video. ! * Returns aligned data in ARGB pixel format. ! * 1.2.0 2004-04-28 PRL Now one thread per video source. Versions of QuickTime ! * prior to 6.4 are NOT thread safe, and if using a non-thread ! * safe version, you should comment out AR_VIDEO_HAVE_THREADSAFE_QUICKTIME ! * so serialise access when there is more than one thread. ! * 1.2.1 2004-06-28 PRL Support for 2vuy and yuvs pixel formats. ! * 1.3.0 2004-07-13 PRL Code from Daniel Heckenberg to directly access vDig. ! * ! */ ! /* ! * ! * This file is part of ARToolKit. ! * ! * ARToolKit is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * ARToolKit is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with ARToolKit; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! */ ! ! #ifndef AR_VIDEO_MACOSX_H ! #define AR_VIDEO_MACOSX_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! #include <Carbon/Carbon.h> ! #include <QuickTime/QuickTime.h> ! #include <pthread.h> ! ! #include <AR/config.h> ! #include <AR/ar.h> ! ! typedef struct _AR2VideoParamT AR2VideoParamT; ! ! #ifdef __cplusplus ! } ! #endif ! #endif // AR_VIDEO_MACOSX_H |
From: Philip L. <phi...@us...> - 2004-11-19 03:37:44
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/Gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3822 Modified Files: Makefile.in Log Message: gsub_lite was not being cleaned; fix. Index: Makefile.in =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/Gl/Makefile.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile.in 4 Nov 2004 08:51:43 -0000 1.1.1.1 --- Makefile.in 19 Nov 2004 03:37:34 -0000 1.2 *************** *** 54,61 **** clean: rm -f *.o ! rm -f ${LIB} ${LIB2} allclean: rm -f *.o ! rm -f ${LIB} ${LIB2} rm -f Makefile --- 54,61 ---- clean: rm -f *.o ! rm -f ${LIB} ${LIB2} ${LIB3} allclean: rm -f *.o ! rm -f ${LIB} ${LIB2} ${LIB3} rm -f Makefile |
From: Philip L. <phi...@us...> - 2004-11-19 03:37:06
|
Update of /cvsroot/artoolkit/artoolkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3677 Modified Files: Configure Log Message: Added libARvrml. Index: Configure =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/Configure,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Configure 4 Nov 2004 08:50:27 -0000 1.1.1.1 --- Configure 19 Nov 2004 03:36:54 -0000 1.2 *************** *** 10,13 **** --- 10,14 ---- lib/SRC/VideoLinuxV4L lib/SRC/VideoSGI \ lib/SRC/VideoMacOSX \ + lib/SRC/ARvrml \ util \ util/calib_camera2 util/calib_cparam util/calib_distortion \ |
From: Philip L. <phi...@us...> - 2004-11-19 03:32:21
|
Update of /cvsroot/artoolkit/artoolkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3059 Modified Files: README.txt Log Message: Added libARvrml. Index: README.txt =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/README.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** README.txt 4 Nov 2004 08:50:30 -0000 1.1.1.1 --- README.txt 19 Nov 2004 03:32:11 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- Building on Linux / SGI Irix. Building on Mac OS X. + Latest changes. Changes in version 2.69. Changes in version 2.68.2. *************** *** 83,90 **** Mac OS X 10.3 and later include an inbuilt IIDC FireWire camera driver. USB camera drivers and Firewire camera drivers for pre-10.3 systems can be obtained from ioXperts at http://www.ioxperts.com. ! Changes in version 2.69. ! -------------------------- - Windows builds still depend on DSVideoLib, but DSVideoLib is no longer included in source-only ARToolKit releases and must be downloaded separately. - Fixed bugs identified by Raphael Grasset: typo 'DEFALUT' in config.h.in and arUtil.c, return values in arMultiActivate.c, implementation of arUtilSleep for Win32. --- 84,97 ---- Mac OS X 10.3 and later include an inbuilt IIDC FireWire camera driver. USB camera drivers and Firewire camera drivers for pre-10.3 systems can be obtained from ioXperts at http://www.ioxperts.com. ! ! ! Latest changes. ! --------------- ! - Added libARvrml. ! - Turn off texturing in gsub/gsub_lite when argDrawMode/arglDrawmode is AR_DRAW_BY_GL_DRAW_PIXELS. ! Changes in version 2.69. ! ------------------------ - Windows builds still depend on DSVideoLib, but DSVideoLib is no longer included in source-only ARToolKit releases and must be downloaded separately. - Fixed bugs identified by Raphael Grasset: typo 'DEFALUT' in config.h.in and arUtil.c, return values in arMultiActivate.c, implementation of arUtilSleep for Win32. *************** *** 117,121 **** Changes in version 2.68. ! -------------------------- Version 2.65 of ARToolKit incorporated the enhanced Windows video capture library created by Thomas Pintaric (http://www.ims.tuwien.ac.at/~thomas/artoolkit.php). Version 2.68 is based on 2.65f with the following changes: - New gsub_lite library designed to allow easier use of ARToolKit in existing applications, plus complete documentation in HTML format in doc/gsub_lite. --- 124,128 ---- Changes in version 2.68. ! ------------------------ Version 2.65 of ARToolKit incorporated the enhanced Windows video capture library created by Thomas Pintaric (http://www.ims.tuwien.ac.at/~thomas/artoolkit.php). Version 2.68 is based on 2.65f with the following changes: - New gsub_lite library designed to allow easier use of ARToolKit in existing applications, plus complete documentation in HTML format in doc/gsub_lite. |
From: Philip L. <phi...@us...> - 2004-11-19 03:32:04
|
Update of /cvsroot/artoolkit/artoolkit/ARToolKit.xcode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2997 Modified Files: project.pbxproj Log Message: Added libARvrml. Index: project.pbxproj =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/ARToolKit.xcode/project.pbxproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** project.pbxproj 7 Nov 2004 23:42:26 -0000 1.2 --- project.pbxproj 19 Nov 2004 03:31:55 -0000 1.3 *************** *** 72,75 **** --- 72,77 ---- 4AB9FEFD0651CD1F003B9097, 4AB9FF440651CD8D003B9097, + 4A835647074D914100F58781, + 4A835659074D936800F58781, ); }; *************** *** 1880,1883 **** --- 1882,1886 ---- 4A427D080484329800B56093, 4A427D0F0484329800B56093, + 4A83565E074D945A00F58781, ); isa = PBXGroup; *************** *** 2075,2078 **** --- 2078,2082 ---- 4A427D7A0484329900B56093, 4A427D7C0484329900B56093, + 4A83563C074D90E300F58781, ); isa = PBXGroup; *************** *** 4027,4030 **** --- 4031,4232 ---- }; }; + 4A83563C074D90E300F58781 = { + children = ( + 4A83563D074D90E300F58781, + 4A83563E074D90E300F58781, + 4A83563F074D90E300F58781, + 4A835640074D90E300F58781, + 4A835641074D90E300F58781, + 4A835642074D90E300F58781, + ); + isa = PBXGroup; + path = ARvrml; + refType = 4; + sourceTree = "<group>"; + }; + 4A83563D074D90E300F58781 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = arViewer.cpp; + refType = 4; + sourceTree = "<group>"; + }; + 4A83563E074D90E300F58781 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = arViewer.h; + refType = 4; + sourceTree = "<group>"; + }; + 4A83563F074D90E300F58781 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = arViewerCapi.cpp; + refType = 4; + sourceTree = "<group>"; + }; + 4A835640074D90E300F58781 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = text; + path = libarvrml.sln; + refType = 4; + sourceTree = "<group>"; + }; + 4A835641074D90E300F58781 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = text.xml; + path = libarvrml.vcproj; + refType = 4; + sourceTree = "<group>"; + }; + 4A835642074D90E300F58781 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = text; + path = Makefile.in; + refType = 4; + sourceTree = "<group>"; + }; + 4A835647074D914100F58781 = { + buildPhases = ( + ); + buildSettings = { + OPTIMIZATION_CFLAGS = ""; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "ARToolKit extensions"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + }; + dependencies = ( + 4A83565D074D93A900F58781, + ); + isa = PBXAggregateTarget; + name = "ARToolKit extensions"; + productName = "ARToolKit extensions"; + }; + 4A835656074D936800F58781 = { + buildActionMask = 2147483647; + files = ( + 4A83565F074D945A00F58781, + 4A835662074D950F00F58781, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 4A835657074D936800F58781 = { + buildActionMask = 2147483647; + files = ( + 4A835660074D950600F58781, + 4A835661074D950E00F58781, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 4A835658074D936800F58781 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 4A835659074D936800F58781 = { + buildPhases = ( + 4A835656074D936800F58781, + 4A835657074D936800F58781, + 4A835658074D936800F58781, + ); + buildRules = ( + ); + buildSettings = { + DEPLOYMENT_LOCATION = YES; + DSTROOT = /; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; + GCC_WARN_UNKNOWN_PRAGMAS = NO; + HEADER_SEARCH_PATHS = "include /sw/include/openvrml /usr/X11R6/include"; + INSTALL_PATH = "$(SRCROOT)/lib"; + LIBRARY_STYLE = STATIC; + PRODUCT_NAME = ARvrml; + WARNING_CFLAGS = "-Wmost"; + }; + dependencies = ( + 4A83567C074D96E600F58781, + ); + isa = PBXNativeTarget; + name = ARvrml; + productName = ARvrml; + productReference = 4A83565A074D936800F58781; + productType = "com.apple.product-type.library.static"; + }; + 4A83565A074D936800F58781 = { + explicitFileType = archive.ar; + includeInIndex = 0; + isa = PBXFileReference; + path = libARvrml.a; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4A83565C074D93A900F58781 = { + containerPortal = 08FB7793FE84155DC02AAC07; + isa = PBXContainerItemProxy; + proxyType = 1; + remoteGlobalIDString = 4A835659074D936800F58781; + remoteInfo = ARvrml; + }; + 4A83565D074D93A900F58781 = { + isa = PBXTargetDependency; + target = 4A835659074D936800F58781; + targetProxy = 4A83565C074D93A900F58781; + }; + 4A83565E074D945A00F58781 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = arvrml.h; + refType = 4; + sourceTree = "<group>"; + }; + 4A83565F074D945A00F58781 = { + fileRef = 4A83565E074D945A00F58781; + isa = PBXBuildFile; + settings = { + }; + }; + 4A835660074D950600F58781 = { + fileRef = 4A83563D074D90E300F58781; + isa = PBXBuildFile; + settings = { + }; + }; + 4A835661074D950E00F58781 = { + fileRef = 4A83563F074D90E300F58781; + isa = PBXBuildFile; + settings = { + }; + }; + 4A835662074D950F00F58781 = { + fileRef = 4A83563E074D90E300F58781; + isa = PBXBuildFile; + settings = { + }; + }; + 4A83567B074D96E600F58781 = { + containerPortal = 08FB7793FE84155DC02AAC07; + isa = PBXContainerItemProxy; + proxyType = 1; + remoteGlobalIDString = 4A8486680728DD530063B1B3; + remoteInfo = Configure; + }; + 4A83567C074D96E600F58781 = { + isa = PBXTargetDependency; + target = 4A8486680728DD530063B1B3; + targetProxy = 4A83567B074D96E600F58781; + }; 4A8486680728DD530063B1B3 = { buildPhases = ( *************** *** 5477,5480 **** --- 5679,5683 ---- 4AE230320659B7A80047D402, 4AE230340659B7A80047D402, + 4A83565A074D936800F58781, ); isa = PBXGroup; |
From: Philip L. <phi...@us...> - 2004-11-19 03:27:10
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2102 Modified Files: Makefile.in Log Message: Added libARvrml. Index: Makefile.in =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/Makefile.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile.in 4 Nov 2004 08:51:16 -0000 1.1.1.1 --- Makefile.in 19 Nov 2004 03:26:59 -0000 1.2 *************** *** 16,19 **** --- 16,20 ---- (cd VideoLinux1394Cam; make -f Makefile clean) (cd VideoMacOSX; make -f Makefile clean) + (cd ARvrml; make -f Makefile clean) allclean: *************** *** 26,28 **** --- 27,30 ---- (cd VideoLinux1394Cam; make -f Makefile allclean) (cd VideoMacOSX; make -f Makefile allclean) + (cd ARvrml; make -f Makefile allclean) rm -f Makefile |
From: Philip L. <phi...@us...> - 2004-11-19 03:27:02
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/ARvrml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2066 Added Files: arViewerCapi.cpp Makefile.in arViewer.cpp arViewer.h Log Message: Added libARvrml. --- NEW FILE: Makefile.in --- UNAME = $(shell uname) AR_HOME = ../../.. AR_CPPFLAGS = -I$(AR_HOME)/include VRML_HOME = /usr ifeq "$(UNAME)" "Darwin" VRML_HOME = /sw endif VRML_CPPFLAGS = -I$(VRML_HOME)/include/openvrml -I/usr/X11R6/include CPPFLAGS = $(AR_CPPFLAGS) $(VRML_CPPFLAGS) CFLAGS = @CFLAG@ CXXFLAGS = @CFLAG@ AR = ar ARFLAGS = @ARFLAG@ RANLIB = @RANLIB@ TARGET = $(AR_HOME)/lib/libARvrml.a HEADERS = \ $(AR_HOME)/include/AR/arvrml.h \ arViewer.h OBJS = \ arViewer.o \ arViewerCapi.o # Implicit rule, to compile C++ files with the .cpp suffix (rule already exists for .cc). %.o : %.cpp $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ default build all: $(TARGET) $(OBJS): $(HEADERS) $(TARGET): $(OBJS) $(AR) $(ARFLAGS) $@ $^ $(RANLIB) $@ clean: -rm -f *.o *~ *.bak -rm $(TARGET) allclean: -rm -f *.o *~ *.bak -rm $(TARGET) -rm -f Makefile --- NEW FILE: arViewer.cpp --- /* modif: version 0.14.3 remove vrmlScene since we use reference now. remove culling pb */ /* * * This file is part of ARToolKit. * * ARToolKit is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * ARToolKit is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ARToolKit; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ //#ifdef _WIN32 //# include <windows.h> //#endif //#include <stdio.h> //#include <string.h> #include <iostream> #include <math.h> #ifdef __APPLE__ # include <GLUT/glut.h> #else # include <GL/glut.h> #endif #include "arViewer.h" using namespace openvrml; arVrmlViewer::arVrmlViewer(openvrml::browser& browser) : gl::viewer(browser) { internal_light = true; translation[0] = 0.0; translation[1] = 0.0; translation[2] = 0.0; rotation[0] = 0.0; rotation[1] = 0.0; rotation[2] = 0.0; rotation[3] = 0.0; scale[0] = 1.0; scale[1] = 1.0; scale[2] = 1.0; } arVrmlViewer::~arVrmlViewer() { } void arVrmlViewer::timerUpdate() { this->update(0.0); } void arVrmlViewer::setInternalLight(bool flag) { internal_light = flag; } void arVrmlViewer::redraw() { double start = browser::current_time(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glTranslated( translation[0], translation[1], translation[2] ); if( rotation[0] != 0.0 ) { glRotated( rotation[0], rotation[1], rotation[2], rotation[3] ); } glScaled( scale[0], scale[1], scale[2] ); #if USE_STENCIL_SHAPE glEnable(GL_STENCIL_TEST); glStencilFunc(GL_ALWAYS, 1, 1); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); #endif glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable( GL_FOG ); // this is a global attribute glDisable( GL_TEXTURE_2D ); glEnable( GL_CULL_FACE ); glFrontFace( GL_CCW ); glCullFace( GL_BACK ); if( internal_light ) { if (lit) glEnable( GL_LIGHTING ); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); glEnable(GL_NORMALIZE); glDisable( GL_COLOR_MATERIAL ); glDisable(GL_BLEND); glShadeModel( GL_SMOOTH ); for(int i=0; i<max_lights; ++i) { light_info_[i].type = light_unused; GLenum light = (GLenum) (GL_LIGHT0 + i); glDisable( light ); } } objects = 0; nested_objects = 0; sensitive = 0; this->browser.render(*this); if( internal_light ) { if (lit) glDisable( GL_LIGHTING ); } glDisable(GL_BLEND); glDisable( GL_CULL_FACE ); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } void arVrmlViewer::post_redraw() { } void arVrmlViewer::set_cursor(cursor_style c) { } void arVrmlViewer::swap_buffers() { } void arVrmlViewer::set_timer(double t) { } void arVrmlViewer::set_viewpoint(const openvrml::vec3f & position, const openvrml::rotation & orientation, float fieldOfView, float avatarSize, float visibilityLimit) { } viewer::object_t arVrmlViewer::insert_background(const std::vector<float> & groundAngle, const std::vector<openvrml::color> & groundColor, const std::vector<float> & skyAngle, const std::vector<openvrml::color> & skyColor, size_t * whc, unsigned char ** pixels) { return 0; } viewer::object_t arVrmlViewer::insert_dir_light(float ambientIntensity, float intensity, const openvrml::color & color, const openvrml::vec3f & direction) { if( internal_light ) return gl::viewer::insert_dir_light(ambientIntensity,intensity,color,direction); return 0; } viewer::object_t arVrmlViewer::insert_point_light(float ambientIntensity, const openvrml::vec3f & attenuation, const openvrml::color & color, float intensity, const openvrml::vec3f & location, float radius) { if( internal_light ) return gl::viewer::insert_point_light(ambientIntensity,attenuation,color,intensity,location,radius); return 0; } viewer::object_t arVrmlViewer::insert_spot_light(float ambientIntensity, const openvrml::vec3f & attenuation, float beamWidth, const openvrml::color & color, float cutOffAngle, const openvrml::vec3f & direction, float intensity, const openvrml::vec3f & location, float radius) { if( internal_light ) return gl::viewer::insert_spot_light(ambientIntensity,attenuation,beamWidth,color,cutOffAngle, direction, intensity, location, radius); return 0; } bounding_volume::intersection arVrmlViewer::intersect_view_volume(const bounding_volume & bvolume) const { // if( d_cull ) { //return openvrml::viewer::intersect_view_volume(bvolume); // } // else { return bounding_volume::inside; //} } --- NEW FILE: arViewerCapi.cpp --- /* * * This file is part of ARToolKit. * * ARToolKit is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * ARToolKit is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ARToolKit; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include <AR/arvrml.h> #include "arViewer.h" #include <iostream> #include <vector> #include <string> #ifdef __APPLE__ # include <GLUT/glut.h> #else # include <GL/glut.h> #endif #include <stdio.h> #include <string.h> //extern "C" { //} #define AR_VRML_MAX 100 static arVrmlViewer *viewer[AR_VRML_MAX]; static int init = 1; static int vrID = -1; static char *get_buff( char *buf, int n, FILE *fp ); int arVrmlLoadFile( char *file ) { FILE *fp; openvrml::browser * myBrowser = 0; char buf[256], buf1[256]; char buf2[256]; int id; int i; if( init ) { for( i = 0; i < AR_VRML_MAX; i++ ) viewer[i] = NULL; init = 0; } for( i = 0; i < AR_VRML_MAX; i++ ) { if( viewer[i] == NULL ) break; } if( i == AR_VRML_MAX ) return -1; id = i; if( (fp=fopen(file, "r")) == NULL ) return -1; get_buff(buf, 256, fp); if( sscanf(buf, "%s", buf1) != 1 ) {fclose(fp); return -1;} for( i = 0; file[i] != '\0'; i++ ) buf2[i] = file[i]; for( ; i >= 0; i-- ) { if( buf2[i] == '/' ) break; } buf2[i+1] = '\0'; sprintf(buf, "%s%s", buf2, buf1); myBrowser = new openvrml::browser(std::cout, std::cerr); if( !myBrowser) {fclose(fp); return -1;} std::vector<std::string> uri(1, buf); std::vector<std::string> parameter; myBrowser->load_url(uri, parameter); viewer[id] = new arVrmlViewer(*myBrowser); if(!viewer[id]) { delete myBrowser; fclose(fp); return -1; } strcpy( viewer[id]->filename, buf ); get_buff(buf, 256, fp); if( sscanf(buf, "%lf %lf %lf", &viewer[id]->translation[0], &viewer[id]->translation[1], &viewer[id]->translation[2]) != 3 ) { delete viewer[id]; viewer[id] = NULL; fclose(fp); return -1; } get_buff(buf, 256, fp); if( sscanf(buf, "%lf %lf %lf %lf", &viewer[id]->rotation[0], &viewer[id]->rotation[1], &viewer[id]->rotation[2], &viewer[id]->rotation[3]) != 4 ) { delete viewer[id]; viewer[id] = NULL; fclose(fp); return -1; } get_buff(buf, 256, fp); if( sscanf(buf, "%lf %lf %lf", &viewer[id]->scale[0], &viewer[id]->scale[1], &viewer[id]->scale[2]) != 3 ) { delete viewer[id]; viewer[id] = NULL; fclose(fp); return -1; } fclose(fp); return id; } int arVrmlFree( int id ) { if( viewer[id] == NULL ) return -1; delete viewer[id]; viewer[id] = NULL; if( vrID == id ) { vrID = -1; } return 0; } int arVrmlTimerUpdate() { int i; for( i = 0; i < AR_VRML_MAX; i++ ) { if( viewer[i] == NULL ) continue; viewer[i]->timerUpdate(); } return 0; } int arVrmlDraw( int id ) { if( viewer[id] == NULL ) return -1; viewer[id]->redraw(); return 0; } int arVrmlSetInternalLight( int flag ) { int i; if( flag ) { for( i = 0; i < AR_VRML_MAX; i++ ) { if( viewer[i] == NULL ) continue; viewer[i]->setInternalLight(true); } } else { for( i = 0; i < AR_VRML_MAX; i++ ) { if( viewer[i] == NULL ) continue; viewer[i]->setInternalLight(false); } } return 0; } static char *get_buff( char *buf, int n, FILE *fp ) { char *ret, buf1[256]; for(;;) { ret = fgets( buf, n, fp ); if( ret == NULL ) return(NULL); if( sscanf(buf, "%s", buf1) != 1 ) continue; if( buf1[0] != '#' ) return(ret); } } --- NEW FILE: arViewer.h --- // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; -*- /* * * This file is part of ARToolKit. * * ARToolKit is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * ARToolKit is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ARToolKit; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef AR_VRMLINT_H #define AR_VRMLINT_H #include <openvrml/browser.h> #include <openvrml/gl/viewer.h> #include <openvrml/bounding_volume.h> class arVrmlViewer : public openvrml::gl::viewer { public: arVrmlViewer(openvrml::browser& browser); ~arVrmlViewer(); char filename[512]; double translation[3]; double rotation[4]; double scale[3]; bool internal_light; void timerUpdate(); void redraw(); void setInternalLight( bool f ); protected: virtual void post_redraw(); virtual void set_cursor(openvrml::gl::viewer::cursor_style c); virtual void swap_buffers(); virtual void set_timer(double); virtual void set_viewpoint(const openvrml::vec3f & position, const openvrml::rotation & orientation, float fieldOfView, float avatarSize, float visibilityLimit); virtual viewer::object_t insert_background(const std::vector<float> & groundAngle, const std::vector<openvrml::color> & groundColor, const std::vector<float> & skyAngle, const std::vector<openvrml::color> & skyColor, size_t * whc = 0, unsigned char ** pixels = 0); virtual viewer::object_t insert_dir_light(float ambientIntensity, float intensity, const openvrml::color & color, const openvrml::vec3f & direction); virtual viewer::object_t insert_point_light(float ambientIntensity, const openvrml::vec3f & attenuation, const openvrml::color & color, float intensity, const openvrml::vec3f & location, float radius); virtual viewer::object_t insert_spot_light(float ambientIntensity, const openvrml::vec3f & attenuation, float beamWidth, const openvrml::color & color, float cutOffAngle, const openvrml::vec3f & direction, float intensity, const openvrml::vec3f & location, float radius); virtual openvrml::bounding_volume::intersection intersect_view_volume(const openvrml::bounding_volume & bvolume) const; }; #endif |
From: Philip L. <phi...@us...> - 2004-11-19 03:26:44
|
Update of /cvsroot/artoolkit/artoolkit/include/AR In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2029 Added Files: arvrml.h Log Message: Added libARvrml. --- NEW FILE: arvrml.h --- /* * * This file is part of ARToolKit. * * ARToolKit is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * ARToolKit is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ARToolKit; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef AR_VRML_H #define AR_VRML_H #ifdef __cplusplus extern "C" { #endif int arVrmlLoadFile( char *file ); int arVrmlFree( int id ); int arVrmlDraw( int id ); int arVrmlTimerUpdate( void ); int arVrmlSetInternalLight( int flag ); #ifdef __cplusplus } #endif #endif |
From: Philip L. <phi...@us...> - 2004-11-19 02:47:05
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/ARvrml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26546/ARvrml Log Message: Directory /cvsroot/artoolkit/artoolkit/lib/SRC/ARvrml added to the repository |