artoolkit-commits Mailing List for ARToolKit (Page 8)
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: Wayne P. <ti...@us...> - 2006-09-04 08:37:51
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinux1394Cam In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv24436 Modified Files: Makefile.in Log Message: Need to compile in conversions.c to support Bayer image decoding Index: Makefile.in =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinux1394Cam/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 4 Sep 2006 08:37:41 -0000 1.2 *************** *** 23,27 **** # compilation control # ! LIBOBJS= ${LIB}(video.o) all: ${LIBOBJS} --- 23,27 ---- # compilation control # ! LIBOBJS= ${LIB}(video.o conversions.o) all: ${LIBOBJS} |
From: Wayne P. <ti...@us...> - 2006-09-04 08:37:07
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinux1394Cam In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv23120 Added Files: conversions.c conversions.h grabdma.tgz Log Message: These files are the from grabdma demo from Point Grey's web site. They are used to decode the Bayer images that are output by high-end cameras such as Dragonfly cameras. The grabdma.tgz and conversions.* files are licensed under LGPL, which makes it easy to include in other GPL based projects. The files were downloaded from http://www.ptgrey.com/support/kb/index.asp?a=4&q=183&ST= and I have included the raw archive here as well, which includes information about the licensing. The conversions.* files are needed by the video.c file to do the decoding. --- NEW FILE: conversions.h --- /* * Copyright (C) 2000-2003 Damien Douxchamps <ddo...@us...> * Dan Dennedy <da...@de...> * * 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 __CONVERSIONS_H__ #define __CONVERSIONS_H__ #include <stdlib.h> #include <stdio.h> #include <unistd.h> typedef enum { NO_BAYER_DECODING, BAYER_DECODING_NEAREST, BAYER_DECODING_EDGE_SENSE, BAYER_DECODING_DOWNSAMPLE } bayer_decoding_t; typedef enum { NO_STEREO_DECODING, STEREO_DECODING_INTERLACED, STEREO_DECODING_FIELD } stereo_decoding_t; typedef enum { BAYER_PATTERN_BGGR, BAYER_PATTERN_GRBG, BAYER_PATTERN_RGGB, BAYER_PATTERN_GBRG } bayer_pattern_t; // UYVY <-> YUYV void uyvy2yuyv (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); void yuyv2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); // XXX -> UYVY void uyyvyy2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); void uyv2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); void y2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); void y162uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels, int bits); void y162y (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels, int bits); void rgb2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); void rgb482uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); // XXX -> RGB void rgb482rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); void uyv2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); void uyvy2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); void uyyvyy2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); void y2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); void y162rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels, int bits); // BAYER -> RGB void BayerNearestNeighbor(unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type); void BayerEdgeSense(unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type); void BayerDownsample(unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type); void StereoDecode(unsigned char *src, unsigned char *dest, unsigned long long int NumPixels); #endif --- NEW FILE: grabdma.tgz --- (This appears to be a binary file; contents omitted.) --- NEW FILE: conversions.c --- /* Comments by Wayne Piekarski (28 July 2006): The grabdma.tar.gz file downloaded from the Point Grey web site includes a LICENSE file which is the LGPL and not the GPL. So it is understood that the LGPL is the license that was intended by the original authors This file conversions.c is a copy of the conversions.cpp file from the grabdma.tar.gz archive. It had to be renamed so that it would compile as standard C code and link correctly against ARToolKit. */ /* * Copyright (C) 2000-2004 Damien Douxchamps <ddo...@us...> * Dan Dennedy <da...@de...> * * 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 "conversions.h" // The following #define is there for the users who experience green/purple // images in the display. This seems to be a videocard driver problem. #define YUYV // instead of the standard UYVY // color conversion functions from Bart Nabbe. // corrected by Damien: bad coeficients in YUV2RGB #define YUV2RGB(y, u, v, r, g, b)\ r = y + ((v*1436) >> 10);\ g = y - ((u*352 + v*731) >> 10);\ b = y + ((u*1814) >> 10);\ r = r < 0 ? 0 : r;\ g = g < 0 ? 0 : g;\ b = b < 0 ? 0 : b;\ r = r > 255 ? 255 : r;\ g = g > 255 ? 255 : g;\ b = b > 255 ? 255 : b #define RGB2YUV(r, g, b, y, u, v)\ y = (306*r + 601*g + 117*b) >> 10;\ u = ((-172*r - 340*g + 512*b) >> 10) + 128;\ v = ((512*r - 429*g - 83*b) >> 10) + 128;\ y = y < 0 ? 0 : y;\ u = u < 0 ? 0 : u;\ v = v < 0 ? 0 : v;\ y = y > 255 ? 255 : y;\ u = u > 255 ? 255 : u;\ v = v > 255 ? 255 : v #define CLIP(in, out)\ {\ in = in < 0 ? 0 : in;\ in = in > 255 ? 255 : in;\ out=in;\ } /********************************************************************** * * CONVERSION FUNCTIONS TO UYVY * **********************************************************************/ void yuyv2uyvy(unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { #ifdef YUYV swab(src, dest, NumPixels << 1); #else memcpy(dest,src, NumPixels<<1); #endif } void uyvy2yuyv(unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { #ifdef YUYV swab(src, dest, NumPixels << 1); #else memcpy(dest,src, NumPixels<<1); #endif } void uyyvyy2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i=NumPixels + (NumPixels >> 1)-1; register int j=(NumPixels << 1)-1; register int y0, y1, y2, y3, u, v; while (i > 0) { y3 = src[i--]; y2 = src[i--]; v = src[i--]; y1 = src[i--]; y0 = src[i--]; u = src[i--]; #ifdef YUYV dest[j--] = v; dest[j--] = y3; dest[j--] = u; dest[j--] = y2; dest[j--] = v; dest[j--] = y1; dest[j--] = u; dest[j--] = y0; #else // UYVY dest[j--] = y3; dest[j--] = v; dest[j--] = y2; dest[j--] = u; dest[j--] = y1; dest[j--] = v; dest[j--] = y0; dest[j--] = u; #endif } } void uyv2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i = NumPixels + (NumPixels << 1)-1; register int j = (NumPixels << 1)-1; register int y0, y1, u0, u1, v0, v1; while (i > 0) { v1 = src[i--]; y1 = src[i--]; u1 = src[i--]; v0 = src[i--]; y0 = src[i--]; u0 = src[i--]; #ifdef YUYV dest[j--] = (v0+v1) >> 1; dest[j--] = y1; dest[j--] = (u0+u1) >> 1; dest[j--] = y0; #else // UYVY dest[j--] = y1; dest[j--] = (v0+v1) >> 1; dest[j--] = y0; dest[j--] = (u0+u1) >> 1; #endif } } void y2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i= NumPixels-1; register int j = (NumPixels << 1)-1; register int y0, y1; while (i > 0) { y1 = src[i--]; y0 = src[i--]; #ifdef YUYV dest[j--] = 128; dest[j--] = y1; dest[j--] = 128; dest[j--] = y0; #else // UYVY dest[j--] = y1; dest[j--] = 128; dest[j--] = y0; dest[j--] = 128; #endif } } void y162uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels, int bits) { register int i = (NumPixels << 1)-1; register int j = (NumPixels << 1)-1; register int y0, y1; while (i > 0) { y1 = src[i--]; y1 = (y1 + (((int)src[i--])<<8))>>(bits-8); y0 = src[i--]; y0 = (y0 + (((int)src[i--])<<8))>>(bits-8); #ifdef YUYV dest[j--] = 128; dest[j--] = y1; dest[j--] = 128; dest[j--] = y0; #else // UYVY dest[j--] = y1; dest[j--] = 128; dest[j--] = y0; dest[j--] = 128; #endif } } void y162y (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels, int bits) { register int i = (NumPixels<<1)-1; register int j = NumPixels-1; register int y; while (i > 0) { y = src[i--]; dest[j--] = (y + (src[i--]<<8))>>(bits-8); } } void rgb2uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i = NumPixels + ( NumPixels << 1 )-1; register int j = (NumPixels << 1)-1; register int y0, y1, u0, u1, v0, v1 ; register int r, g, b; while (i > 0) { b = (unsigned char) src[i--]; g = (unsigned char) src[i--]; r = (unsigned char) src[i--]; RGB2YUV (r, g, b, y0, u0 , v0); b = (unsigned char) src[i--]; g = (unsigned char) src[i--]; r = (unsigned char) src[i--]; RGB2YUV (r, g, b, y1, u1 , v1); #ifdef YUYV dest[j--] = (v0+v1) >> 1; dest[j--] = y0; dest[j--] = (u0+u1) >> 1; dest[j--] = y1; #else // UYVY dest[j--] = y0; dest[j--] = (v0+v1) >> 1; dest[j--] = y1; dest[j--] = (u0+u1) >> 1; #endif } } void rgb482uyvy (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i = ( (NumPixels + ( NumPixels << 1 )) << 1 ) -1; register int j = (NumPixels << 1)-1; register int y0, y1, u0, u1, v0, v1 ; register int r, g, b; while (i > 0) { i--; b = (unsigned char) src[i--]; i--; g = (unsigned char) src[i--]; i--; r = (unsigned char) src[i--]; i--; RGB2YUV (r, g, b, y0, u0 , v0); b = (unsigned char) src[i--]; i--; g = (unsigned char) src[i--]; i--; r = (unsigned char) src[i--]; RGB2YUV (r, g, b, y1, u1 , v1); #ifdef YUYV dest[j--] = (v0+v1) >> 1; dest[j--] = y0; dest[j--] = (u0+u1) >> 1; dest[j--] = y1; #else // UYVY dest[j--] = y0; dest[j--] = (v0+v1) >> 1; dest[j--] = y1; dest[j--] = (u0+u1) >> 1; #endif } } /********************************************************************** * * CONVERSION FUNCTIONS TO RGB 24bpp * **********************************************************************/ void rgb482rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i = ((NumPixels + ( NumPixels << 1 )) << 1)-1; register int j = NumPixels + ( NumPixels << 1 ) -1; while (i > 0) { i--; dest[j--]=src[i--]; i--; dest[j--]=src[i--]; i--; dest[j--]=src[i--]; } } void uyv2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i = NumPixels + ( NumPixels << 1 ) -1; register int j = NumPixels + ( NumPixels << 1 ) -1; register int y, u, v; register int r, g, b; while (i > 0) { v = (unsigned char) src[i--] - 128; y = (unsigned char) src[i--]; u = (unsigned char) src[i--] - 128; YUV2RGB (y, u, v, r, g, b); dest[j--] = b; dest[j--] = g; dest[j--] = r; } } void uyvy2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i = (NumPixels << 1)-1; register int j = NumPixels + ( NumPixels << 1 ) -1; register int y0, y1, u, v; register int r, g, b; while (i > 0) { y1 = (unsigned char) src[i--]; v = (unsigned char) src[i--] - 128; y0 = (unsigned char) src[i--]; u = (unsigned char) src[i--] - 128; YUV2RGB (y1, u, v, r, g, b); dest[j--] = b; dest[j--] = g; dest[j--] = r; YUV2RGB (y0, u, v, r, g, b); dest[j--] = b; dest[j--] = g; dest[j--] = r; } } void uyyvyy2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i = NumPixels + ( NumPixels >> 1 )-1; register int j = NumPixels + ( NumPixels << 1 )-1; register int y0, y1, y2, y3, u, v; register int r, g, b; while (i > 0) { y3 = (unsigned char) src[i--]; y2 = (unsigned char) src[i--]; v = (unsigned char) src[i--] - 128; y1 = (unsigned char) src[i--]; y0 = (unsigned char) src[i--]; u = (unsigned char) src[i--] - 128; YUV2RGB (y3, u, v, r, g, b); dest[j--] = b; dest[j--] = g; dest[j--] = r; YUV2RGB (y2, u, v, r, g, b); dest[j--] = b; dest[j--] = g; dest[j--] = r; YUV2RGB (y1, u, v, r, g, b); dest[j--] = b; dest[j--] = g; dest[j--] = r; YUV2RGB (y0, u, v, r, g, b); dest[j--] = b; dest[j--] = g; dest[j--] = r; } } void y2rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i = NumPixels-1; register int j = NumPixels + ( NumPixels << 1 )-1; register int y; while (i > 0) { y = (unsigned char) src[i--]; dest[j--] = y; dest[j--] = y; dest[j--] = y; } } void y162rgb (unsigned char *src, unsigned char *dest, unsigned long long int NumPixels, int bits) { register int i = (NumPixels << 1)-1; register int j = NumPixels + ( NumPixels << 1 )-1; register int y; while (i > 0) { y = src[i--]; y = (y + (src[i--]<<8))>>(bits-8); dest[j--] = y; dest[j--] = y; dest[j--] = y; } } /***************************************************************** * Color conversion functions for cameras that can * * output raw-Bayer pattern images, such as some Basler and * * Point Grey camera. Most of the algos presented here come from * * http://ise0.Stanford.EDU/~tingchen/main.htm and have been * * converted from Matlab to C and extended to all elementary * * patterns. * *****************************************************************/ void BayerNearestNeighbor( unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type) { unsigned char *outR, *outG, *outB; register int i,j; // sx and sy should be even switch (type) { case BAYER_PATTERN_GRBG: case BAYER_PATTERN_BGGR: outR=&dest[0]; outG=&dest[1]; outB=&dest[2]; break; case BAYER_PATTERN_GBRG: case BAYER_PATTERN_RGGB: outR=&dest[2]; outG=&dest[1]; outB=&dest[0]; break; default: outR=NULL;outG=NULL;outB=NULL; break; } switch (type) { case BAYER_PATTERN_GRBG: //------------------------------------------- case BAYER_PATTERN_GBRG: // copy original RGB data to output images for (i=0;i<sy;i+=2) { for (j=0;j<sx;j+=2) { outG[(i*sx+j)*3]=src[i*sx+j]; outG[((i+1)*sx+(j+1))*3]=src[(i+1)*sx+(j+1)]; outR[(i*sx+j+1)*3]=src[i*sx+j+1]; outB[((i+1)*sx+j)*3]=src[(i+1)*sx+j]; } } // R channel for (i=0;i<sy;i+=2) { for (j=0;j<sx-1;j+=2) { outR[(i*sx+j)*3]=outR[(i*sx+j+1)*3]; outR[((i+1)*sx+j+1)*3]=outR[(i*sx+j+1)*3]; outR[((i+1)*sx+j)*3]=outR[(i*sx+j+1)*3]; } } // B channel for (i=0;i<sy-1;i+=2) { //every two lines for (j=0;j<sx-1;j+=2) { outB[(i*sx+j)*3]=outB[((i+1)*sx+j)*3]; outB[(i*sx+j+1)*3]=outB[((i+1)*sx+j)*3]; outB[((i+1)*sx+j+1)*3]=outB[((i+1)*sx+j)*3]; } } // using lower direction for G channel // G channel for (i=0;i<sy-1;i+=2)//every two lines for (j=1;j<sx;j+=2) outG[(i*sx+j)*3]=outG[((i+1)*sx+j)*3]; for (i=1;i<sy-2;i+=2)//every two lines for (j=0;j<sx-1;j+=2) outG[(i*sx+j)*3]=outG[((i+1)*sx+j)*3]; // copy it for the next line for (j=0;j<sx-1;j+=2) outG[((sy-1)*sx+j)*3]=outG[((sy-2)*sx+j)*3]; break; case BAYER_PATTERN_BGGR: //------------------------------------------- case BAYER_PATTERN_RGGB: // copy original data for (i=0;i<sy;i+=2) { for (j=0;j<sx;j+=2) { outB[(i*sx+j)*3]=src[i*sx+j]; outR[((i+1)*sx+(j+1))*3]=src[(i+1)*sx+(j+1)]; outG[(i*sx+j+1)*3]=src[i*sx+j+1]; outG[((i+1)*sx+j)*3]=src[(i+1)*sx+j]; } } // R channel for (i=0;i<sy;i+=2){ for (j=0;j<sx-1;j+=2) { outR[(i*sx+j)*3]=outR[((i+1)*sx+j+1)*3]; outR[(i*sx+j+1)*3]=outR[((i+1)*sx+j+1)*3]; outR[((i+1)*sx+j)*3]=outR[((i+1)*sx+j+1)*3]; } } // B channel for (i=0;i<sy-1;i+=2) { //every two lines for (j=0;j<sx-1;j+=2) { outB[((i+1)*sx+j)*3]=outB[(i*sx+j)*3]; outB[(i*sx+j+1)*3]=outB[(i*sx+j)*3]; outB[((i+1)*sx+j+1)*3]=outB[(i*sx+j)*3]; } } // using lower direction for G channel // G channel for (i=0;i<sy-1;i+=2)//every two lines for (j=0;j<sx-1;j+=2) outG[(i*sx+j)*3]=outG[((i+1)*sx+j)*3]; for (i=1;i<sy-2;i+=2)//every two lines for (j=0;j<sx-1;j+=2) outG[(i*sx+j+1)*3]=outG[((i+1)*sx+j+1)*3]; // copy it for the next line for (j=0;j<sx-1;j+=2) outG[((sy-1)*sx+j+1)*3]=outG[((sy-2)*sx+j+1)*3]; break; default: //------------------------------------------- break; } } void BayerEdgeSense( unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type) { unsigned char *outR, *outG, *outB; register int i,j; int dh, dv; int tmp; // sx and sy should be even switch (type) { case BAYER_PATTERN_GRBG: case BAYER_PATTERN_BGGR: outR=&dest[0]; outG=&dest[1]; outB=&dest[2]; break; case BAYER_PATTERN_GBRG: case BAYER_PATTERN_RGGB: outR=&dest[2]; outG=&dest[1]; outB=&dest[0]; break; default: outR=NULL;outG=NULL;outB=NULL; break; } switch (type) { case BAYER_PATTERN_GRBG://--------------------------------------------------------- case BAYER_PATTERN_GBRG: // copy original RGB data to output images for (i=0;i<sy;i+=2) { for (j=0;j<sx;j+=2) { outG[(i*sx+j)*3]=src[i*sx+j]; outG[((i+1)*sx+(j+1))*3]=src[(i+1)*sx+(j+1)]; outR[(i*sx+j+1)*3]=src[i*sx+j+1]; outB[((i+1)*sx+j)*3]=src[(i+1)*sx+j]; } } // process GREEN channel for (i=3;i<sy-2;i+=2) { for (j=2;j<sx-3;j+=2) { dh=abs((outB[(i*sx+j-2)*3]+outB[(i*sx+j+2)*3])/2-outB[(i*sx+j)*3]); dv=abs((outB[((i-2)*sx+j)*3]+outB[((i+2)*sx+j)*3])/2-outB[(i*sx+j)*3]); if (dh<dv) tmp=(outG[(i*sx+j-1)*3]+outG[(i*sx+j+1)*3])/2; else { if (dh>dv) tmp=(outG[((i-1)*sx+j)*3]+outG[((i+1)*sx+j)*3])/2; else tmp=(outG[(i*sx+j-1)*3]+outG[(i*sx+j+1)*3]+outG[((i-1)*sx+j)*3]+outG[((i+1)*sx+j)*3])/4; } CLIP(tmp,outG[(i*sx+j)*3]); } } for (i=2;i<sy-3;i+=2) { for (j=3;j<sx-2;j+=2) { dh=abs((outR[(i*sx+j-2)*3]+outR[(i*sx+j+2)*3])/2-outR[(i*sx+j)*3]); dv=abs((outR[((i-2)*sx+j)*3]+outR[((i+2)*sx+j)*3])/2-outR[(i*sx+j)*3]); if (dh<dv) tmp=(outG[(i*sx+j-1)*3]+outG[(i*sx+j+1)*3])/2; else { if (dh>dv) tmp=(outG[((i-1)*sx+j)*3]+outG[((i+1)*sx+j)*3])/2; else tmp=(outG[(i*sx+j-1)*3]+outG[(i*sx+j+1)*3]+outG[((i-1)*sx+j)*3]+outG[((i+1)*sx+j)*3])/4; } CLIP(tmp,outG[(i*sx+j)*3]); } } // process RED channel for (i=0;i<sy-1;i+=2) { for (j=2;j<sx-1;j+=2) { tmp=outG[(i*sx+j)*3]+(outR[(i*sx+j-1)*3]-outG[(i*sx+j-1)*3]+ outR[(i*sx+j+1)*3]-outG[(i*sx+j+1)*3])/2; CLIP(tmp,outR[(i*sx+j)*3]); } } for (i=1;i<sy-2;i+=2) { for (j=1;j<sx;j+=2) { tmp=outG[(i*sx+j)*3]+(outR[((i-1)*sx+j)*3]-outG[((i-1)*sx+j)*3]+ outR[((i+1)*sx+j)*3]-outG[((i+1)*sx+j)*3])/2; CLIP(tmp,outR[(i*sx+j)*3]); } for (j=2;j<sx-1;j+=2) { tmp=outG[(i*sx+j)*3]+(outR[((i-1)*sx+j-1)*3]-outG[((i-1)*sx+j-1)*3]+ outR[((i-1)*sx+j+1)*3]-outG[((i-1)*sx+j+1)*3]+ outR[((i+1)*sx+j-1)*3]-outG[((i+1)*sx+j-1)*3]+ outR[((i+1)*sx+j+1)*3]-outG[((i+1)*sx+j+1)*3])/4; CLIP(tmp,outR[(i*sx+j)*3]); } } // process BLUE channel for (i=1;i<sy;i+=2) { for (j=1;j<sx-2;j+=2) { tmp=outG[(i*sx+j)*3]+(outB[(i*sx+j-1)*3]-outG[(i*sx+j-1)*3]+ outB[(i*sx+j+1)*3]-outG[(i*sx+j+1)*3])/2; CLIP(tmp,outB[(i*sx+j)*3]); } } for (i=2;i<sy-1;i+=2) { for (j=0;j<sx-1;j+=2) { tmp=outG[(i*sx+j)*3]+(outB[((i-1)*sx+j)*3]-outG[((i-1)*sx+j)*3]+ outB[((i+1)*sx+j)*3]-outG[((i+1)*sx+j)*3])/2; CLIP(tmp,outB[(i*sx+j)*3]); } for (j=1;j<sx-2;j+=2) { tmp=outG[(i*sx+j)*3]+(outB[((i-1)*sx+j-1)*3]-outG[((i-1)*sx+j-1)*3]+ outB[((i-1)*sx+j+1)*3]-outG[((i-1)*sx+j+1)*3]+ outB[((i+1)*sx+j-1)*3]-outG[((i+1)*sx+j-1)*3]+ outB[((i+1)*sx+j+1)*3]-outG[((i+1)*sx+j+1)*3])/4; CLIP(tmp,outB[(i*sx+j)*3]); } } break; case BAYER_PATTERN_BGGR: //--------------------------------------------------------- case BAYER_PATTERN_RGGB: // copy original RGB data to output images for (i=0;i<sy;i+=2) { for (j=0;j<sx;j+=2) { outB[(i*sx+j)*3]=src[i*sx+j]; outR[((i+1)*sx+(j+1))*3]=src[(i+1)*sx+(j+1)]; outG[(i*sx+j+1)*3]=src[i*sx+j+1]; outG[((i+1)*sx+j)*3]=src[(i+1)*sx+j]; } } // process GREEN channel for (i=2;i<sy-2;i+=2) { for (j=2;j<sx-3;j+=2) { dh=abs((outB[(i*sx+j-2)*3]+outB[(i*sx+j+2)*3])/2-outB[(i*sx+j)*3]); dv=abs((outB[((i-2)*sx+j)*3]+outB[((i+2)*sx+j)*3])/2-outB[(i*sx+j)*3]); if (dh<dv) tmp=(outG[(i*sx+j-1)*3]+outG[(i*sx+j+1)*3])/2; else { if (dh>dv) tmp=(outG[((i-1)*sx+j)*3]+outG[((i+1)*sx+j)*3])/2; else tmp=(outG[(i*sx+j-1)*3]+outG[(i*sx+j+1)*3]+outG[((i-1)*sx+j)*3]+outG[((i+1)*sx+j)*3])/4; } CLIP(tmp,outG[(i*sx+j)*3]); } } for (i=3;i<sy-3;i+=2) { for (j=3;j<sx-2;j+=2) { dh=abs((outR[(i*sx+j-2)*3]+outR[(i*sx+j+2)*3])/2-outR[(i*sx+j)*3]); dv=abs((outR[((i-2)*sx+j)*3]+outR[((i+2)*sx+j)*3])/2-outR[(i*sx+j)*3]); if (dh<dv) tmp=(outG[(i*sx+j-1)*3]+outG[(i*sx+j+1)*3])/2; else { if (dh>dv) tmp=(outG[((i-1)*sx+j)*3]+outG[((i+1)*sx+j)*3])/2; else tmp=(outG[(i*sx+j-1)*3]+outG[(i*sx+j+1)*3]+outG[((i-1)*sx+j)*3]+outG[((i+1)*sx+j)*3])/4; } CLIP(tmp,outG[(i*sx+j)*3]); } } // process RED channel for (i=1;i<sy-1;i+=2) { // G-points (1/2) for (j=2;j<sx-1;j+=2) { tmp=outG[(i*sx+j)*3]+(outR[(i*sx+j-1)*3]-outG[(i*sx+j-1)*3]+ outR[(i*sx+j+1)*3]-outG[(i*sx+j+1)*3])/2; CLIP(tmp,outR[(i*sx+j)*3]); } } for (i=2;i<sy-2;i+=2) { for (j=1;j<sx;j+=2) { // G-points (2/2) tmp=outG[(i*sx+j)*3]+(outR[((i-1)*sx+j)*3]-outG[((i-1)*sx+j)*3]+ outR[((i+1)*sx+j)*3]-outG[((i+1)*sx+j)*3])/2; CLIP(tmp,outR[(i*sx+j)*3]); } for (j=2;j<sx-1;j+=2) { // B-points tmp=outG[(i*sx+j)*3]+(outR[((i-1)*sx+j-1)*3]-outG[((i-1)*sx+j-1)*3]+ outR[((i-1)*sx+j+1)*3]-outG[((i-1)*sx+j+1)*3]+ outR[((i+1)*sx+j-1)*3]-outG[((i+1)*sx+j-1)*3]+ outR[((i+1)*sx+j+1)*3]-outG[((i+1)*sx+j+1)*3])/4; CLIP(tmp,outR[(i*sx+j)*3]); } } // process BLUE channel for (i=0;i<sy;i+=2) { for (j=1;j<sx-2;j+=2) { tmp=outG[(i*sx+j)*3]+(outB[(i*sx+j-1)*3]-outG[(i*sx+j-1)*3]+ outB[(i*sx+j+1)*3]-outG[(i*sx+j+1)*3])/2; CLIP(tmp,outB[(i*sx+j)*3]); } } for (i=1;i<sy-1;i+=2) { for (j=0;j<sx-1;j+=2) { tmp=outG[(i*sx+j)*3]+(outB[((i-1)*sx+j)*3]-outG[((i-1)*sx+j)*3]+ outB[((i+1)*sx+j)*3]-outG[((i+1)*sx+j)*3])/2; CLIP(tmp,outB[(i*sx+j)*3]); } for (j=1;j<sx-2;j+=2) { tmp=outG[(i*sx+j)*3]+(outB[((i-1)*sx+j-1)*3]-outG[((i-1)*sx+j-1)*3]+ outB[((i-1)*sx+j+1)*3]-outG[((i-1)*sx+j+1)*3]+ outB[((i+1)*sx+j-1)*3]-outG[((i+1)*sx+j-1)*3]+ outB[((i+1)*sx+j+1)*3]-outG[((i+1)*sx+j+1)*3])/4; CLIP(tmp,outB[(i*sx+j)*3]); } } break; default: //--------------------------------------------------------- fprintf(stderr,"Bad bayer pattern ID\n"); break; } } void BayerDownsample(unsigned char *src, unsigned char *dest, int sx, int sy, bayer_pattern_t type) { unsigned char *outR, *outG, *outB; register int i,j; int tmp; sx*=2; sy*=2; switch (type) { case BAYER_PATTERN_GRBG: case BAYER_PATTERN_BGGR: outR=&dest[0]; outG=&dest[1]; outB=&dest[2]; break; case BAYER_PATTERN_GBRG: case BAYER_PATTERN_RGGB: outR=&dest[2]; outG=&dest[1]; outB=&dest[0]; break; default: outR=NULL;outG=NULL;outB=NULL; break; } switch (type) { case BAYER_PATTERN_GRBG://--------------------------------------------------------- case BAYER_PATTERN_GBRG: for (i=0;i<sy;i+=2) { for (j=0;j<sx;j+=2) { tmp=((src[i*sx+j]+src[(i+1)*sx+(j+1)])>>1); CLIP(tmp,outG[(((i*sx)>>2)+(j>>1))*3]); tmp=src[i*sx+j+1]; CLIP(tmp,outR[(((i*sx)>>2)+(j>>1))*3]); tmp=src[(i+1)*sx+j]; CLIP(tmp,outB[(((i*sx)>>2)+(j>>1))*3]); } } break; case BAYER_PATTERN_BGGR://--------------------------------------------------------- case BAYER_PATTERN_RGGB: for (i=0;i<sy;i+=2) { for (j=0;j<sx;j+=2) { tmp=((src[(i+1)*sx+j]+src[i*sx+(j+1)])>>1); CLIP(tmp,outG[(((i*sx)>>2)+(j>>1))*3]); tmp=src[(i+1)*sx+j+1]; CLIP(tmp,outR[(((i*sx)>>2)+(j>>1))*3]); tmp=src[i*sx+j]; CLIP(tmp,outB[(((i*sx)>>2)+(j>>1))*3]); } } break; default: //--------------------------------------------------------- fprintf(stderr,"Bad bayer pattern ID\n"); break; } } // change a 16bit stereo image (8bit/channel) into two 8bit images on top // of each other void StereoDecode(unsigned char *src, unsigned char *dest, unsigned long long int NumPixels) { register int i = NumPixels-1; register int j = (NumPixels>>1)-1; register int k = NumPixels-1; while (i > 0) { dest[k--] = src[i--]; dest[j--] = src[i--]; } } |
From: Philip L. <phi...@us...> - 2006-08-29 04:19:21
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoWin32DirectShow In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv21353/lib/SRC/VideoWin32DirectShow Modified Files: videoWin32DirectShow.cpp Log Message: Fix bug where mem buffers would be checked in before being checked out. Index: videoWin32DirectShow.cpp =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoWin32DirectShow/videoWin32DirectShow.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** videoWin32DirectShow.cpp 8 Jun 2006 21:35:58 -0000 1.7 --- videoWin32DirectShow.cpp 29 Aug 2006 04:19:16 -0000 1.8 *************** *** 51,54 **** --- 51,55 ---- DSVL_VideoSource *graphManager; MemoryBufferHandle g_Handle; + bool bufferCheckedOut; __int64 g_Timestamp; // deprecated, use (g_Handle.t) instead. //bool flip_horizontal = false; // deprecated. *************** *** 155,167 **** vid->graphManager = new DSVL_VideoSource(); if (!config) { ! if(FAILED(vid->graphManager->BuildGraphFromXMLString(config_default))) return(NULL); } else { if (strncmp(config, "<?xml", 5) == 0) { ! if(FAILED(vid->graphManager->BuildGraphFromXMLString(config))) return(NULL); } else { ! if(FAILED(vid->graphManager->BuildGraphFromXMLFile(config))) return(NULL); } } ! if(FAILED(vid->graphManager->EnableMemoryBuffer())) return(NULL); return (vid); --- 156,168 ---- vid->graphManager = new DSVL_VideoSource(); if (!config) { ! if (FAILED(vid->graphManager->BuildGraphFromXMLString(config_default))) return(NULL); } else { if (strncmp(config, "<?xml", 5) == 0) { ! if (FAILED(vid->graphManager->BuildGraphFromXMLString(config))) return(NULL); } else { ! if (FAILED(vid->graphManager->BuildGraphFromXMLFile(config))) return(NULL); } } ! if (FAILED(vid->graphManager->EnableMemoryBuffer())) return(NULL); return (vid); *************** *** 174,178 **** if (vid->graphManager == NULL) return (-1); ! vid->graphManager->CheckinMemoryBuffer(vid->g_Handle, true); vid->graphManager->Stop(); delete vid->graphManager; --- 175,179 ---- if (vid->graphManager == NULL) return (-1); ! if (vid->bufferCheckedOut) vid->graphManager->CheckinMemoryBuffer(vid->g_Handle, true); vid->graphManager->Stop(); delete vid->graphManager; *************** *** 191,199 **** if (vid->graphManager == NULL) return (NULL); wait_result = vid->graphManager->WaitForNextSample(frame_timeout_ms); ! if(wait_result == WAIT_OBJECT_0) { if (FAILED(vid->graphManager->CheckoutMemoryBuffer(&(vid->g_Handle), &pixelBuffer, NULL, NULL, NULL, &(vid->g_Timestamp)))) return(NULL); return (pixelBuffer); } return(NULL); } --- 192,206 ---- if (vid->graphManager == NULL) return (NULL); + if (vid->bufferCheckedOut) { + if (FAILED(vid->graphManager->CheckinMemoryBuffer(vid->g_Handle))) return (NULL); + vid->bufferCheckedOut = false; + } wait_result = vid->graphManager->WaitForNextSample(frame_timeout_ms); ! if (wait_result == WAIT_OBJECT_0) { if (FAILED(vid->graphManager->CheckoutMemoryBuffer(&(vid->g_Handle), &pixelBuffer, NULL, NULL, NULL, &(vid->g_Timestamp)))) return(NULL); + vid->bufferCheckedOut = true; return (pixelBuffer); } + return(NULL); } *************** *** 204,208 **** if (vid->graphManager == NULL) return (-1); ! if(FAILED(vid->graphManager->Run())) return (-1); return (0); } --- 211,215 ---- if (vid->graphManager == NULL) return (-1); ! if (FAILED(vid->graphManager->Run())) return (-1); return (0); } *************** *** 213,217 **** if (vid->graphManager == NULL) return (-1); ! vid->graphManager->CheckinMemoryBuffer(vid->g_Handle, true); // PRL 2005-09-21: Commented out due to issue where stopping the --- 220,227 ---- if (vid->graphManager == NULL) return (-1); ! if (vid->bufferCheckedOut) { ! if (FAILED(vid->graphManager->CheckinMemoryBuffer(vid->g_Handle, true))) return (-1); ! vid->bufferCheckedOut = false; ! } // PRL 2005-09-21: Commented out due to issue where stopping the *************** *** 228,232 **** if (vid->graphManager == NULL) return (-1); ! return (SUCCEEDED(vid->graphManager->CheckinMemoryBuffer(vid->g_Handle)) ? 0 : -1); } --- 238,246 ---- if (vid->graphManager == NULL) return (-1); ! if (vid->bufferCheckedOut) { ! if (FAILED(vid->graphManager->CheckinMemoryBuffer(vid->g_Handle, true))) return (-1); ! vid->bufferCheckedOut = false; ! } ! return (0); } *************** *** 285,288 **** --- 299,303 ---- if (FAILED(vid->graphManager->CheckoutMemoryBuffer(pHandle, &pixelBuffer))) return (NULL); + vid->bufferCheckedOut = true; return (pixelBuffer); *************** *** 295,299 **** if (FAILED(vid->graphManager->CheckinMemoryBuffer(Handle))) return(-1); ! return (0); } --- 310,315 ---- if (FAILED(vid->graphManager->CheckinMemoryBuffer(Handle))) return(-1); ! vid->bufferCheckedOut = false; ! return (0); } |
From: Philip L. <phi...@us...> - 2006-08-29 01:36:55
|
Update of /cvsroot/artoolkit/artoolkit/examples/simpleVRML In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22636 Modified Files: simpleVRML.vcproj simpleVRML.c Log Message: Build debug variant on Windows. Index: simpleVRML.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/simpleVRML/simpleVRML.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** simpleVRML.c 1 Jun 2006 03:40:14 -0000 1.13 --- simpleVRML.c 29 Aug 2006 01:36:52 -0000 1.14 *************** *** 455,459 **** // Test render all the VRML objects. ! printf("About to render VRML objects \n"); glEnable(GL_TEXTURE_2D); for (i = 0; i < gObjectDataCount; i++) { --- 455,460 ---- // Test render all the VRML objects. ! fprintf(stdout, "Pre-rendering the VRML objects..."); ! fflush(stdout); glEnable(GL_TEXTURE_2D); for (i = 0; i < gObjectDataCount; i++) { *************** *** 461,464 **** --- 462,466 ---- } glDisable(GL_TEXTURE_2D); + fprintf(stdout, " done\n"); // Register GLUT event-handling callbacks. Index: simpleVRML.vcproj =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/simpleVRML/simpleVRML.vcproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** simpleVRML.vcproj 21 Sep 2005 18:14:20 -0000 1.4 --- simpleVRML.vcproj 29 Aug 2006 01:36:52 -0000 1.5 *************** *** 41,44 **** --- 41,45 ---- AdditionalLibraryDirectories="$(ProjectDir)..\..\lib;$(ProjectDir)..\..\OpenVRML\lib;$(ProjectDir)..\..\OpenVRML\dependencies\lib" IgnoreDefaultLibraryNames="libc.lib;libcd.lib;libcmt.lib;libcmtd.lib;msvcrt.lib" + GenerateDebugInformation="TRUE" SubSystem="1" TargetMachine="1"/> |
From: Philip L. <phi...@us...> - 2006-08-29 01:36:08
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/Gl In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22273 Modified Files: gsub_lite.c Log Message: Fix for Windows bug where stderr is hosed: don't write to stderr. Index: gsub_lite.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/Gl/gsub_lite.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** gsub_lite.c 15 Jun 2006 04:46:37 -0000 1.18 --- gsub_lite.c 29 Aug 2006 01:36:06 -0000 1.19 *************** *** 243,423 **** } - static int arglDispImageTexRectangleCapabilitiesCheck(const ARParam *cparam, ARGL_CONTEXT_SETTINGS_REF contextSettings) - { - GLint textureRectangleSizeMax; - GLint format; - - if (!arglGLCapabilityCheck(0, (unsigned char *)"GL_NV_texture_rectangle")) { - if (!arglGLCapabilityCheck(0, (unsigned char *)"GL_EXT_texture_rectangle")) { // Alternate name. - return (FALSE); - } - } - glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE, &textureRectangleSizeMax); - if (cparam->xsize > textureRectangleSizeMax || cparam->ysize > textureRectangleSizeMax) { - return (FALSE); - } - - // Now check that the renderer can accomodate a texture of this size. - glTexImage2D(GL_PROXY_TEXTURE_RECTANGLE, 0, contextSettings->pixIntFormat, cparam->xsize, cparam->ysize, 0, contextSettings->pixFormat, contextSettings->pixType, NULL); - glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE, 0, GL_TEXTURE_INTERNAL_FORMAT, &format); - if (!format) { - return (FALSE); - } - - contextSettings->textureRectangleCapabilitiesChecked = TRUE; - - return (TRUE); - } - - static int arglCleanupTexRectangle(ARGL_CONTEXT_SETTINGS_REF contextSettings) - { - if (!contextSettings->initedRectangle) return (FALSE); - - glDeleteTextures(1, &(contextSettings->textureRectangle)); - glDeleteLists(contextSettings->listRectangle, 1); - contextSettings->textureRectangleCapabilitiesChecked = FALSE; - contextSettings->initedRectangle = FALSE; - return (TRUE); - } - - // - // Blit an image to the screen using OpenGL rectangle texturing. - // - static void arglDispImageTexRectangle(ARUint8 *image, const ARParam *cparam, const float zoom, ARGL_CONTEXT_SETTINGS_REF contextSettings, const int texmapScaleFactor) - { - float px, py, py_prev; - double x1, x2, y1, y2; - float xx1, xx2, yy1, yy2; - int i, j; - - if(!contextSettings->initedRectangle || contextSettings->initPlease) { - - contextSettings->initPlease = FALSE; - // Delete previous texture and list, unless this is our first time here. - if (contextSettings->initedRectangle) arglCleanupTexRectangle(contextSettings); - - // If we have not done so, check texturing capabilities. If they have already been - // checked, and we got to here, then obviously the capabilities were insufficient, - // so just return without doing anything. - if (!contextSettings->textureRectangleCapabilitiesChecked) { - contextSettings->textureRectangleCapabilitiesChecked = TRUE; - if (!arglDispImageTexRectangleCapabilitiesCheck(cparam, contextSettings)) { - fprintf(stderr, "argl error: Your OpenGL implementation and/or hardware's texturing capabilities are insufficient to support rectangle textures.\n"); - // Fall back to power of 2 texturing. - contextSettings->arglTexRectangle = FALSE; - return; - } - } else { - return; - } - - // Set up the rectangle texture object. - glGenTextures(1, &(contextSettings->textureRectangle)); - glBindTexture(GL_TEXTURE_RECTANGLE, contextSettings->textureRectangle); - glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - #ifdef APPLE_TEXTURE_FAST_TRANSFER - # ifdef ARGL_USE_TEXTURE_RANGE - if (arglAppleTextureRange) { - glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE, cparam->xsize * cparam->ysize * contextSettings->pixSize, image); - glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_STORAGE_HINT_APPLE, arglAppleTextureRangeStorageHint); - } else { - glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE, 0, NULL); - glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_PRIVATE_APPLE); - } - #endif // ARGL_USE_TEXTURE_RANGE - glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, arglAppleClientStorage); - #endif // APPLE_TEXTURE_FAST_TRANSFER - - // Specify the texture to OpenGL. - if (texmapScaleFactor == 2) { - // If texmapScaleFactor is 2, pretend lines in the source image are - // twice as long as they are; glTexImage2D will read only the first - // half of each line, effectively discarding every second line in the source image. - glPixelStorei(GL_UNPACK_ROW_LENGTH, cparam->xsize*texmapScaleFactor); - } - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); // Our image data is tightly packed. - glTexImage2D(GL_TEXTURE_RECTANGLE, 0, contextSettings->pixIntFormat, cparam->xsize, cparam->ysize/texmapScaleFactor, 0, contextSettings->pixFormat, contextSettings->pixType, image); - if (texmapScaleFactor == 2) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - } - - // Set up the surface which we will texture upon. - contextSettings->listRectangle = glGenLists(1); - glNewList(contextSettings->listRectangle, GL_COMPILE); - glEnable(GL_TEXTURE_RECTANGLE); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - - if (contextSettings->disableDistortionCompensation) { - glBegin(GL_QUADS); - glTexCoord2f(0.0f, (float)(cparam->ysize/texmapScaleFactor)); glVertex2f(0.0f, 0.0f); - glTexCoord2f((float)(cparam->xsize), (float)(cparam->ysize/texmapScaleFactor)); glVertex2f(cparam->xsize * zoom, 0.0f); - glTexCoord2f((float)(cparam->xsize), 0.0f); glVertex2f(cparam->xsize * zoom, cparam->ysize * zoom); - glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, cparam->ysize * zoom); - glEnd(); - } else { - py_prev = 0.0f; - for(j = 1; j <= 20; j++) { // Do 20 rows. - py = py_prev; - py_prev = cparam->ysize * j / 20.0f; - - glBegin(GL_QUAD_STRIP); - for(i = 0; i <= 20; i++) { // Draw 21 pairs of vertices per row to make 20 columns. - px = cparam->xsize * i / 20.0f; - - arParamObserv2Ideal(cparam->dist_factor, (double)px, (double)py, &x1, &y1); - arParamObserv2Ideal(cparam->dist_factor, (double)px, (double)py_prev, &x2, &y2); - - xx1 = (float)x1 * zoom; - yy1 = (cparam->ysize - (float)y1) * zoom; - xx2 = (float)x2 * zoom; - yy2 = (cparam->ysize - (float)y2) * zoom; - - glTexCoord2f(px, py/texmapScaleFactor); glVertex2f(xx1, yy1); - glTexCoord2f(px, py_prev/texmapScaleFactor); glVertex2f(xx2, yy2); - } - glEnd(); - } - } - glDisable(GL_TEXTURE_RECTANGLE); - glEndList(); - - contextSettings->asInited_ysize = cparam->ysize; - contextSettings->asInited_xsize = cparam->xsize; - contextSettings->asInited_zoom = zoom; - contextSettings->asInited_texmapScaleFactor = texmapScaleFactor; - contextSettings->initedRectangle = TRUE; - } - - glBindTexture(GL_TEXTURE_RECTANGLE, contextSettings->textureRectangle); - #ifdef APPLE_TEXTURE_FAST_TRANSFER - # ifdef ARGL_USE_TEXTURE_RANGE - if (arglAppleTextureRange) { - glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE, cparam->xsize * cparam->ysize * contextSettings->pixSize, image); - glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_STORAGE_HINT_APPLE, arglAppleTextureRangeStorageHint); - } else { - glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE, 0, NULL); - glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_PRIVATE_APPLE); - } - #endif // ARGL_USE_TEXTURE_RANGE - glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, arglAppleClientStorage); - #endif // APPLE_TEXTURE_FAST_TRANSFER - if (texmapScaleFactor == 2) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, cparam->xsize*texmapScaleFactor); - } - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexSubImage2D(GL_TEXTURE_RECTANGLE, 0, 0, 0, cparam->xsize, cparam->ysize/texmapScaleFactor, contextSettings->pixFormat, contextSettings->pixType, image); - glCallList(contextSettings->listRectangle); - if (texmapScaleFactor == 2) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - } - glBindTexture(GL_TEXTURE_RECTANGLE, 0); - } - static int arglDispImageTexPow2CapabilitiesCheck(const ARParam *cparam, ARGL_CONTEXT_SETTINGS_REF contextSettings) { --- 243,246 ---- *************** *** 467,472 **** } - contextSettings->texturePow2CapabilitiesChecked = TRUE; - return (TRUE); } --- 290,293 ---- *************** *** 506,510 **** contextSettings->texturePow2CapabilitiesChecked = TRUE; if (!arglDispImageTexPow2CapabilitiesCheck(cparam, contextSettings)) { ! fprintf(stderr, "argl error: Your OpenGL implementation and/or hardware's texturing capabilities are insufficient.\n"); return; } --- 327,331 ---- contextSettings->texturePow2CapabilitiesChecked = TRUE; if (!arglDispImageTexPow2CapabilitiesCheck(cparam, contextSettings)) { ! printf("argl error: Your OpenGL implementation and/or hardware's texturing capabilities are insufficient.\n"); // Windows bug: when running multi-threaded, can't write to stderr! return; } *************** *** 636,639 **** --- 457,636 ---- } + static int arglDispImageTexRectangleCapabilitiesCheck(const ARParam *cparam, ARGL_CONTEXT_SETTINGS_REF contextSettings) + { + GLint textureRectangleSizeMax; + GLint format; + + if (!arglGLCapabilityCheck(0, (unsigned char *)"GL_NV_texture_rectangle")) { + if (!arglGLCapabilityCheck(0, (unsigned char *)"GL_EXT_texture_rectangle")) { // Alternate name. + return (FALSE); + } + } + glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE, &textureRectangleSizeMax); + if (cparam->xsize > textureRectangleSizeMax || cparam->ysize > textureRectangleSizeMax) { + return (FALSE); + } + + // Now check that the renderer can accomodate a texture of this size. + glTexImage2D(GL_PROXY_TEXTURE_RECTANGLE, 0, contextSettings->pixIntFormat, cparam->xsize, cparam->ysize, 0, contextSettings->pixFormat, contextSettings->pixType, NULL); + glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE, 0, GL_TEXTURE_INTERNAL_FORMAT, &format); + if (!format) { + return (FALSE); + } + + return (TRUE); + } + + static int arglCleanupTexRectangle(ARGL_CONTEXT_SETTINGS_REF contextSettings) + { + if (!contextSettings->initedRectangle) return (FALSE); + + glDeleteTextures(1, &(contextSettings->textureRectangle)); + glDeleteLists(contextSettings->listRectangle, 1); + contextSettings->textureRectangleCapabilitiesChecked = FALSE; + contextSettings->initedRectangle = FALSE; + return (TRUE); + } + + // + // Blit an image to the screen using OpenGL rectangle texturing. + // + static void arglDispImageTexRectangle(ARUint8 *image, const ARParam *cparam, const float zoom, ARGL_CONTEXT_SETTINGS_REF contextSettings, const int texmapScaleFactor) + { + float px, py, py_prev; + double x1, x2, y1, y2; + float xx1, xx2, yy1, yy2; + int i, j; + + if(!contextSettings->initedRectangle || contextSettings->initPlease) { + + contextSettings->initPlease = FALSE; + // Delete previous texture and list, unless this is our first time here. + if (contextSettings->initedRectangle) arglCleanupTexRectangle(contextSettings); + + // If we have not done so, check texturing capabilities. If they have already been + // checked, and we got to here, then obviously the capabilities were insufficient, + // so just return without doing anything. + if (!contextSettings->textureRectangleCapabilitiesChecked) { + contextSettings->textureRectangleCapabilitiesChecked = TRUE; + if (!arglDispImageTexRectangleCapabilitiesCheck(cparam, contextSettings)) { + printf("argl error: Your OpenGL implementation and/or hardware's texturing capabilities are insufficient to support rectangle textures.\n"); // Windows bug: when running multi-threaded, can't write to stderr! + // Fall back to power of 2 texturing. + contextSettings->arglTexRectangle = FALSE; + arglDispImageTexPow2(image, cparam, zoom, contextSettings, texmapScaleFactor); + return; + } + } else { + return; + } + + // Set up the rectangle texture object. + glGenTextures(1, &(contextSettings->textureRectangle)); + glBindTexture(GL_TEXTURE_RECTANGLE, contextSettings->textureRectangle); + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + #ifdef APPLE_TEXTURE_FAST_TRANSFER + # ifdef ARGL_USE_TEXTURE_RANGE + if (arglAppleTextureRange) { + glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE, cparam->xsize * cparam->ysize * contextSettings->pixSize, image); + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_STORAGE_HINT_APPLE, arglAppleTextureRangeStorageHint); + } else { + glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE, 0, NULL); + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_PRIVATE_APPLE); + } + #endif // ARGL_USE_TEXTURE_RANGE + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, arglAppleClientStorage); + #endif // APPLE_TEXTURE_FAST_TRANSFER + + // Specify the texture to OpenGL. + if (texmapScaleFactor == 2) { + // If texmapScaleFactor is 2, pretend lines in the source image are + // twice as long as they are; glTexImage2D will read only the first + // half of each line, effectively discarding every second line in the source image. + glPixelStorei(GL_UNPACK_ROW_LENGTH, cparam->xsize*texmapScaleFactor); + } + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); // Our image data is tightly packed. + glTexImage2D(GL_TEXTURE_RECTANGLE, 0, contextSettings->pixIntFormat, cparam->xsize, cparam->ysize/texmapScaleFactor, 0, contextSettings->pixFormat, contextSettings->pixType, image); + if (texmapScaleFactor == 2) { + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + } + + // Set up the surface which we will texture upon. + contextSettings->listRectangle = glGenLists(1); + glNewList(contextSettings->listRectangle, GL_COMPILE); + glEnable(GL_TEXTURE_RECTANGLE); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + + if (contextSettings->disableDistortionCompensation) { + glBegin(GL_QUADS); + glTexCoord2f(0.0f, (float)(cparam->ysize/texmapScaleFactor)); glVertex2f(0.0f, 0.0f); + glTexCoord2f((float)(cparam->xsize), (float)(cparam->ysize/texmapScaleFactor)); glVertex2f(cparam->xsize * zoom, 0.0f); + glTexCoord2f((float)(cparam->xsize), 0.0f); glVertex2f(cparam->xsize * zoom, cparam->ysize * zoom); + glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, cparam->ysize * zoom); + glEnd(); + } else { + py_prev = 0.0f; + for(j = 1; j <= 20; j++) { // Do 20 rows. + py = py_prev; + py_prev = cparam->ysize * j / 20.0f; + + glBegin(GL_QUAD_STRIP); + for(i = 0; i <= 20; i++) { // Draw 21 pairs of vertices per row to make 20 columns. + px = cparam->xsize * i / 20.0f; + + arParamObserv2Ideal(cparam->dist_factor, (double)px, (double)py, &x1, &y1); + arParamObserv2Ideal(cparam->dist_factor, (double)px, (double)py_prev, &x2, &y2); + + xx1 = (float)x1 * zoom; + yy1 = (cparam->ysize - (float)y1) * zoom; + xx2 = (float)x2 * zoom; + yy2 = (cparam->ysize - (float)y2) * zoom; + + glTexCoord2f(px, py/texmapScaleFactor); glVertex2f(xx1, yy1); + glTexCoord2f(px, py_prev/texmapScaleFactor); glVertex2f(xx2, yy2); + } + glEnd(); + } + } + glDisable(GL_TEXTURE_RECTANGLE); + glEndList(); + + contextSettings->asInited_ysize = cparam->ysize; + contextSettings->asInited_xsize = cparam->xsize; + contextSettings->asInited_zoom = zoom; + contextSettings->asInited_texmapScaleFactor = texmapScaleFactor; + contextSettings->initedRectangle = TRUE; + } + + glBindTexture(GL_TEXTURE_RECTANGLE, contextSettings->textureRectangle); + #ifdef APPLE_TEXTURE_FAST_TRANSFER + # ifdef ARGL_USE_TEXTURE_RANGE + if (arglAppleTextureRange) { + glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE, cparam->xsize * cparam->ysize * contextSettings->pixSize, image); + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_STORAGE_HINT_APPLE, arglAppleTextureRangeStorageHint); + } else { + glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE, 0, NULL); + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_PRIVATE_APPLE); + } + #endif // ARGL_USE_TEXTURE_RANGE + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, arglAppleClientStorage); + #endif // APPLE_TEXTURE_FAST_TRANSFER + if (texmapScaleFactor == 2) { + glPixelStorei(GL_UNPACK_ROW_LENGTH, cparam->xsize*texmapScaleFactor); + } + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexSubImage2D(GL_TEXTURE_RECTANGLE, 0, 0, 0, cparam->xsize, cparam->ysize/texmapScaleFactor, contextSettings->pixFormat, contextSettings->pixType, image); + glCallList(contextSettings->listRectangle); + if (texmapScaleFactor == 2) { + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + } + glBindTexture(GL_TEXTURE_RECTANGLE, 0); + } + #pragma mark - // ============================================================================ *************** *** 648,652 **** // Use default pixel format handed to us by <AR/config.h>. if (!arglPixelFormatSet(contextSettings, AR_DEFAULT_PIXEL_FORMAT)) { ! fprintf(stderr, "Unknown default pixel format defined in config.h.\n"); return (NULL); } --- 645,649 ---- // Use default pixel format handed to us by <AR/config.h>. if (!arglPixelFormatSet(contextSettings, AR_DEFAULT_PIXEL_FORMAT)) { ! printf("Unknown default pixel format defined in config.h.\n"); // Windows bug: when running multi-threaded, can't write to stderr! return (NULL); } *************** *** 680,684 **** if (arParamDecompMat(cparam->mat, icpara, trans) < 0) { ! fprintf(stderr, "arglCameraFrustum(): arParamDecompMat() indicated parameter error.\n"); return; } --- 677,681 ---- if (arParamDecompMat(cparam->mat, icpara, trans) < 0) { ! printf("arglCameraFrustum(): arParamDecompMat() indicated parameter error.\n"); // Windows bug: when running multi-threaded, can't write to stderr! return; } *************** *** 725,739 **** } ! void arglCameraView(double para[3][4], GLdouble m_modelview[16], double scale) { int i, j; ! for(j = 0; j < 3; j++) { ! for(i = 0; i < 4; i++) { ! m_modelview[i*4+j] = para[j][i]; } } ! m_modelview[0*4+3] = m_modelview[1*4+3] = m_modelview[2*4+3] = 0.0; ! m_modelview[3*4+3] = 1.0; if (scale != 0.0) { m_modelview[12] *= scale; --- 722,736 ---- } ! void arglCameraView(const double para[3][4], GLdouble m_modelview[16], const double scale) { int i, j; ! for (j = 0; j < 3; j++) { // Row. ! for(i = 0; i < 4; i++) { // Column. ! m_modelview[j + i*4] = para[j][i]; } } ! m_modelview[3 + 0*4] = m_modelview[3 + 1*4] = m_modelview[3 + 2*4] = 0.0; // row + column x 4. ! m_modelview[3 + 3*4] = 1.0; if (scale != 0.0) { m_modelview[12] *= scale; |
From: Philip L. <phi...@us...> - 2006-08-29 01:35:56
|
Update of /cvsroot/artoolkit/artoolkit/include/AR In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22213 Modified Files: gsub_lite.h Log Message: Fix for Windows bug where stderr is hosed: don't write to stderr. Index: gsub_lite.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/gsub_lite.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gsub_lite.h 15 Jun 2006 04:46:30 -0000 1.12 --- gsub_lite.h 29 Aug 2006 01:35:52 -0000 1.13 *************** *** 278,282 **** @availability First appeared in ARToolKit 2.68. */ ! void arglCameraView(double para[3][4], GLdouble m_modelview[16], double scale); /*! --- 278,282 ---- @availability First appeared in ARToolKit 2.68. */ ! void arglCameraView(const double para[3][4], GLdouble m_modelview[16], const double scale); /*! |
From: Philip L. <phi...@us...> - 2006-08-20 21:48:50
|
Update of /cvsroot/artoolkit/artoolkit/include/AR/sys In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv1589 Modified Files: videoLinuxDV.h videoLinuxV4L.h videoLinux1394Cam.h videoSGI.h Log Message: Change line endings from CR to LF. Index: videoLinuxV4L.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoLinuxV4L.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** videoLinuxV4L.h 22 Nov 2004 02:10:56 -0000 1.2 --- videoLinuxV4L.h 20 Aug 2006 21:48:47 -0000 1.3 *************** *** 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 --- 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: videoLinuxDV.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoLinuxDV.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** videoLinuxDV.h 22 Nov 2004 02:10:56 -0000 1.2 --- videoLinuxDV.h 20 Aug 2006 21:48:47 -0000 1.3 *************** *** 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: videoSGI.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoSGI.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** videoSGI.h 22 Nov 2004 02:10:56 -0000 1.2 --- videoSGI.h 20 Aug 2006 21:48:47 -0000 1.3 *************** *** 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: videoLinux1394Cam.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoLinux1394Cam.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** videoLinux1394Cam.h 22 Nov 2004 02:10:56 -0000 1.2 --- videoLinux1394Cam.h 20 Aug 2006 21:48:47 -0000 1.3 *************** *** 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 --- 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 |
From: Philip L. <phi...@us...> - 2006-08-20 21:48:42
|
Update of /cvsroot/artoolkit/artoolkit/examples/paddleDemo In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv1569 Modified Files: util.h util.c paddle.h Log Message: Change line endings from CR to LF. Index: util.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/paddleDemo/util.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** util.h 22 Nov 2004 03:37:35 -0000 1.1 --- util.h 20 Aug 2006 21:48:38 -0000 1.2 *************** *** 1,12 **** ! #ifndef UTIL_H ! #define UTIL_H ! ! void get_rot( double a, double b , double c, double trans[3][4] ); ! int get_angle( double trans[3][4], double *wa, double *wb, double *wc ); ! double get_height( double x, double y, double trans[3][4], double boundary[3][2] ); ! ! /* RJS */ ! int ! wrappedDropOntoMap(char *where, float *inPt, float *outPt); ! ! #endif --- 1,12 ---- ! #ifndef UTIL_H ! #define UTIL_H ! ! void get_rot( double a, double b , double c, double trans[3][4] ); ! int get_angle( double trans[3][4], double *wa, double *wb, double *wc ); ! double get_height( double x, double y, double trans[3][4], double boundary[3][2] ); ! ! /* RJS */ ! int ! wrappedDropOntoMap(char *where, float *inPt, float *outPt); ! ! #endif Index: paddle.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/paddleDemo/paddle.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** paddle.h 22 Nov 2004 03:37:35 -0000 1.1 --- paddle.h 20 Aug 2006 21:48:38 -0000 1.2 *************** *** 1,33 **** ! #ifndef PADDLE_H ! #define PADDLE_H ! ! #include <AR/ar.h> ! ! #define PADDLE_RADIUS 41.0 ! ! typedef struct { ! char name[256]; ! int marker_id; ! double width; ! double center[2]; ! ! double trans[3][4]; ! double transL[3][4]; ! double transR[3][4]; ! int active; ! ! ARMarkerInfo prevInfo; ! ARMarkerInfo prevInfoL; ! ARMarkerInfo prevInfoR; ! ! int pcount; ! int pcountL; ! int pcountR; ! } ARPaddleInfo; ! ! ARPaddleInfo *paddleInit( char *name ); ! ! int paddleGetTrans( ARPaddleInfo *paddleInfo, ARMarkerInfo *markerInfo, ! int *flagL, int marker_num, ARParam *cparam ); ! ! #endif --- 1,33 ---- ! #ifndef PADDLE_H ! #define PADDLE_H ! ! #include <AR/ar.h> ! ! #define PADDLE_RADIUS 41.0 ! ! typedef struct { ! char name[256]; ! int marker_id; ! double width; ! double center[2]; ! ! double trans[3][4]; ! double transL[3][4]; ! double transR[3][4]; ! int active; ! ! ARMarkerInfo prevInfo; ! ARMarkerInfo prevInfoL; ! ARMarkerInfo prevInfoR; ! ! int pcount; ! int pcountL; ! int pcountR; ! } ARPaddleInfo; ! ! ARPaddleInfo *paddleInit( char *name ); ! ! int paddleGetTrans( ARPaddleInfo *paddleInfo, ARMarkerInfo *markerInfo, ! int *flagL, int marker_num, ARParam *cparam ); ! ! #endif Index: util.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/paddleDemo/util.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** util.c 22 Nov 2004 03:37:35 -0000 1.1 --- util.c 20 Aug 2006 21:48:38 -0000 1.2 *************** *** 1,171 **** ! #include <stdio.h> ! #include <math.h> ! #include "util.h" ! ! void get_rot( double a, double b , double c, double trans[3][4] ) ! { ! double sina, sinb, sinc, cosa, cosb, cosc; ! ! sina = sin(a); cosa = cos(a); ! sinb = sin(b); cosb = cos(b); ! sinc = sin(c); cosc = cos(c); ! trans[0][0] = cosa*cosa*cosb*cosc+sina*sina*cosc+sina*cosa*cosb*sinc-sina*cosa*sinc; ! trans[0][1] = -cosa*cosa*cosb*sinc-sina*sina*sinc+sina*cosa*cosb*cosc-sina*cosa*cosc; ! trans[0][2] = cosa*sinb; ! trans[1][0] = sina*cosa*cosb*cosc-sina*cosa*cosc+sina*sina*cosb*sinc+cosa*cosa*sinc; ! trans[1][1] = -sina*cosa*cosb*sinc+sina*cosa*sinc+sina*sina*cosb*cosc+cosa*cosa*cosc; ! trans[1][2] = sina*sinb; ! trans[2][0] = -cosa*sinb*cosc-sina*sinb*sinc; ! trans[2][1] = cosa*sinb*sinc-sina*sinb*cosc; ! trans[2][2] = cosb; ! ! return; ! } ! ! int get_angle( double trans[3][4], double *wa, double *wb, double *wc ) ! { ! double a, b, c; ! double sina, cosa, sinb, cosb, sinc, cosc; ! ! if( trans[2][2] > 1.0 ) { ! printf("cos(beta) = %f\n", trans[2][2]); ! trans[2][2] = -1.0; ! } ! else if( trans[2][2] < -1.0 ) { ! printf("cos(beta) = %f\n", trans[2][2]); ! trans[2][2] = -1.0; ! } ! cosb = trans[2][2]; ! b = acos( cosb ); ! sinb = sin( b ); ! if( b >= 0.000001 || b <= -0.000001) { ! cosa = trans[0][2] / sinb; ! sina = trans[1][2] / sinb; ! if( cosa > 1.0 ) { ! printf("cos(alph) = %f\n", cosa); ! cosa = 1.0; ! sina = 0.0; ! } ! if( cosa < -1.0 ) { ! printf("cos(alph) = %f\n", cosa); ! cosa = -1.0; ! sina = 0.0; ! } ! if( sina > 1.0 ) { ! printf("sin(alph) = %f\n", sina); ! sina = 1.0; ! cosa = 0.0; ! } ! if( sina < -1.0 ) { ! printf("sin(alph) = %f\n", sina); ! sina = -1.0; ! cosa = 0.0; ! } ! a = acos( cosa ); ! if( sina < 0 ) a = -a; ! ! sinc = (trans[2][1]*trans[0][2]-trans[2][0]*trans[1][2]) ! / (trans[0][2]*trans[0][2]+trans[1][2]*trans[1][2]); ! cosc = -(trans[0][2]*trans[2][0]+trans[1][2]*trans[2][1]) ! / (trans[0][2]*trans[0][2]+trans[1][2]*trans[1][2]); ! if( cosc > 1.0 ) { ! printf("cos(r) = %f\n", cosc); ! cosc = 1.0; ! sinc = 0.0; ! } ! if( cosc < -1.0 ) { ! printf("cos(r) = %f\n", cosc); ! cosc = -1.0; ! sinc = 0.0; ! } ! if( sinc > 1.0 ) { ! printf("sin(r) = %f\n", sinc); ! sinc = 1.0; ! cosc = 0.0; ! } ! if( sinc < -1.0 ) { ! printf("sin(r) = %f\n", sinc); ! sinc = -1.0; ! cosc = 0.0; ! } ! c = acos( cosc ); ! if( sinc < 0 ) c = -c; ! } ! else { ! a = b = 0.0; ! cosa = cosb = 1.0; ! sina = sinb = 0.0; ! cosc = trans[0][0]; ! sinc = trans[1][0]; ! if( cosc > 1.0 ) { ! printf("cos(r) = %f\n", cosc); ! cosc = 1.0; ! sinc = 0.0; ! } ! if( cosc < -1.0 ) { ! printf("cos(r) = %f\n", cosc); ! cosc = -1.0; ! sinc = 0.0; ! } ! if( sinc > 1.0 ) { ! printf("sin(r) = %f\n", sinc); ! sinc = 1.0; ! cosc = 0.0; ! } ! if( sinc < -1.0 ) { ! printf("sin(r) = %f\n", sinc); ! sinc = -1.0; ! cosc = 0.0; ! } ! c = acos( cosc ); ! if( sinc < 0 ) c = -c; ! } ! ! *wa = a; ! *wb = b; ! *wc = c; ! ! return(0); ! } ! ! double get_height( double px, double py, double trans[3][4], double boundary[3][2] ) ! { ! double x, x0, x1, x2; ! double y, y0, y1, y2; ! double d, m00, m01, m10, m11; ! double rx, ry; ! ! x = boundary[0][0]; ! y = boundary[1][0]; ! x0 = trans[0][0]*x + trans[0][1]*y + trans[0][3]; ! y0 = trans[1][0]*x + trans[1][1]*y + trans[1][3]; ! x = boundary[0][1]; ! y = boundary[1][0]; ! x1 = trans[0][0]*x + trans[0][1]*y + trans[0][3]; ! y1 = trans[1][0]*x + trans[1][1]*y + trans[1][3]; ! x = boundary[0][0]; ! y = boundary[1][1]; ! x2 = trans[0][0]*x + trans[0][1]*y + trans[0][3]; ! y2 = trans[1][0]*x + trans[1][1]*y + trans[1][3]; ! ! x1 -= x0; y1 -= y0; ! x2 -= x0; y2 -= y0; ! x0 = px - x0; ! y0 = py - y0; ! ! d = x1*y2 - x2*y1; ! if( d == 0.0 ) return 0.0; ! m00 = y2 / d; ! m01 = -x2 / d; ! m10 = -y1 / d; ! m11 = x1 / d; ! ! rx = m00*x0 + m01*y0; ! ry = m10*x0 + m11*y0; ! ! if( rx >= 0.0 && rx <= 1.0 && ry >= 0.0 && ry <= 1.0 ) { ! return trans[2][3] + boundary[2][1]; ! } ! ! return 0.0; ! } --- 1,171 ---- ! #include <stdio.h> ! #include <math.h> ! #include "util.h" ! ! void get_rot( double a, double b , double c, double trans[3][4] ) ! { ! double sina, sinb, sinc, cosa, cosb, cosc; ! ! sina = sin(a); cosa = cos(a); ! sinb = sin(b); cosb = cos(b); ! sinc = sin(c); cosc = cos(c); ! trans[0][0] = cosa*cosa*cosb*cosc+sina*sina*cosc+sina*cosa*cosb*sinc-sina*cosa*sinc; ! trans[0][1] = -cosa*cosa*cosb*sinc-sina*sina*sinc+sina*cosa*cosb*cosc-sina*cosa*cosc; ! trans[0][2] = cosa*sinb; ! trans[1][0] = sina*cosa*cosb*cosc-sina*cosa*cosc+sina*sina*cosb*sinc+cosa*cosa*sinc; ! trans[1][1] = -sina*cosa*cosb*sinc+sina*cosa*sinc+sina*sina*cosb*cosc+cosa*cosa*cosc; ! trans[1][2] = sina*sinb; ! trans[2][0] = -cosa*sinb*cosc-sina*sinb*sinc; ! trans[2][1] = cosa*sinb*sinc-sina*sinb*cosc; ! trans[2][2] = cosb; ! ! return; ! } ! ! int get_angle( double trans[3][4], double *wa, double *wb, double *wc ) ! { ! double a, b, c; ! double sina, cosa, sinb, cosb, sinc, cosc; ! ! if( trans[2][2] > 1.0 ) { ! printf("cos(beta) = %f\n", trans[2][2]); ! trans[2][2] = -1.0; ! } ! else if( trans[2][2] < -1.0 ) { ! printf("cos(beta) = %f\n", trans[2][2]); ! trans[2][2] = -1.0; ! } ! cosb = trans[2][2]; ! b = acos( cosb ); ! sinb = sin( b ); ! if( b >= 0.000001 || b <= -0.000001) { ! cosa = trans[0][2] / sinb; ! sina = trans[1][2] / sinb; ! if( cosa > 1.0 ) { ! printf("cos(alph) = %f\n", cosa); ! cosa = 1.0; ! sina = 0.0; ! } ! if( cosa < -1.0 ) { ! printf("cos(alph) = %f\n", cosa); ! cosa = -1.0; ! sina = 0.0; ! } ! if( sina > 1.0 ) { ! printf("sin(alph) = %f\n", sina); ! sina = 1.0; ! cosa = 0.0; ! } ! if( sina < -1.0 ) { ! printf("sin(alph) = %f\n", sina); ! sina = -1.0; ! cosa = 0.0; ! } ! a = acos( cosa ); ! if( sina < 0 ) a = -a; ! ! sinc = (trans[2][1]*trans[0][2]-trans[2][0]*trans[1][2]) ! / (trans[0][2]*trans[0][2]+trans[1][2]*trans[1][2]); ! cosc = -(trans[0][2]*trans[2][0]+trans[1][2]*trans[2][1]) ! / (trans[0][2]*trans[0][2]+trans[1][2]*trans[1][2]); ! if( cosc > 1.0 ) { ! printf("cos(r) = %f\n", cosc); ! cosc = 1.0; ! sinc = 0.0; ! } ! if( cosc < -1.0 ) { ! printf("cos(r) = %f\n", cosc); ! cosc = -1.0; ! sinc = 0.0; ! } ! if( sinc > 1.0 ) { ! printf("sin(r) = %f\n", sinc); ! sinc = 1.0; ! cosc = 0.0; ! } ! if( sinc < -1.0 ) { ! printf("sin(r) = %f\n", sinc); ! sinc = -1.0; ! cosc = 0.0; ! } ! c = acos( cosc ); ! if( sinc < 0 ) c = -c; ! } ! else { ! a = b = 0.0; ! cosa = cosb = 1.0; ! sina = sinb = 0.0; ! cosc = trans[0][0]; ! sinc = trans[1][0]; ! if( cosc > 1.0 ) { ! printf("cos(r) = %f\n", cosc); ! cosc = 1.0; ! sinc = 0.0; ! } ! if( cosc < -1.0 ) { ! printf("cos(r) = %f\n", cosc); ! cosc = -1.0; ! sinc = 0.0; ! } ! if( sinc > 1.0 ) { ! printf("sin(r) = %f\n", sinc); ! sinc = 1.0; ! cosc = 0.0; ! } ! if( sinc < -1.0 ) { ! printf("sin(r) = %f\n", sinc); ! sinc = -1.0; ! cosc = 0.0; ! } ! c = acos( cosc ); ! if( sinc < 0 ) c = -c; ! } ! ! *wa = a; ! *wb = b; ! *wc = c; ! ! return(0); ! } ! ! double get_height( double px, double py, double trans[3][4], double boundary[3][2] ) ! { ! double x, x0, x1, x2; ! double y, y0, y1, y2; ! double d, m00, m01, m10, m11; ! double rx, ry; ! ! x = boundary[0][0]; ! y = boundary[1][0]; ! x0 = trans[0][0]*x + trans[0][1]*y + trans[0][3]; ! y0 = trans[1][0]*x + trans[1][1]*y + trans[1][3]; ! x = boundary[0][1]; ! y = boundary[1][0]; ! x1 = trans[0][0]*x + trans[0][1]*y + trans[0][3]; ! y1 = trans[1][0]*x + trans[1][1]*y + trans[1][3]; ! x = boundary[0][0]; ! y = boundary[1][1]; ! x2 = trans[0][0]*x + trans[0][1]*y + trans[0][3]; ! y2 = trans[1][0]*x + trans[1][1]*y + trans[1][3]; ! ! x1 -= x0; y1 -= y0; ! x2 -= x0; y2 -= y0; ! x0 = px - x0; ! y0 = py - y0; ! ! d = x1*y2 - x2*y1; ! if( d == 0.0 ) return 0.0; ! m00 = y2 / d; ! m01 = -x2 / d; ! m10 = -y1 / d; ! m11 = x1 / d; ! ! rx = m00*x0 + m01*y0; ! ry = m10*x0 + m11*y0; ! ! if( rx >= 0.0 && rx <= 1.0 && ry >= 0.0 && ry <= 1.0 ) { ! return trans[2][3] + boundary[2][1]; ! } ! ! return 0.0; ! } |
From: Philip L. <phi...@us...> - 2006-08-20 21:48:32
|
Update of /cvsroot/artoolkit/artoolkit/examples/loadMultiple In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv1555 Modified Files: object.h Log Message: Change line endings from CR to LF. Index: object.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/loadMultiple/object.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** object.h 22 Nov 2004 03:38:05 -0000 1.1 --- object.h 20 Aug 2006 21:48:30 -0000 1.2 *************** *** 1,20 **** ! #ifndef OBJECT_H ! #define OBJECT_H ! ! ! #define OBJECT_MAX 30 ! ! typedef struct { ! char name[256]; ! int id; ! int visible; ! int collide; ! double marker_coord[4][2]; ! double trans[3][4]; ! double marker_width; ! double marker_center[2]; ! } ObjectData_T; ! ! ObjectData_T *read_ObjData( char *name, int *objectnum ); ! ! #endif --- 1,20 ---- ! #ifndef OBJECT_H ! #define OBJECT_H ! ! ! #define OBJECT_MAX 30 ! ! typedef struct { ! char name[256]; ! int id; ! int visible; ! int collide; ! double marker_coord[4][2]; ! double trans[3][4]; ! double marker_width; ! double marker_center[2]; ! } ObjectData_T; ! ! ObjectData_T *read_ObjData( char *name, int *objectnum ); ! ! #endif |
From: Philip L. <phi...@us...> - 2006-08-20 21:48:25
|
Update of /cvsroot/artoolkit/artoolkit/include/AR In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv1540 Modified Files: gsubUtil.h arMulti.h matrix.h gsub.h Log Message: Change line endings from CR to LF. Index: arMulti.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/arMulti.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** arMulti.h 23 Aug 2005 18:21:15 -0000 1.3 --- arMulti.h 20 Aug 2006 21:48:18 -0000 1.4 *************** *** 1,166 **** ! /* -------------------------------------------------------------------------- ! * Copyright (C) 2004 Hitlab NZ. ! * The distribution policy is describe on the Copyright.txt furnish ! * with this library. ! * -------------------------------------------------------------------------*/ ! /** ! * \file arMulti.h ! * \brief ARToolkit multi pattern subroutines. ! * ! * This file extend ar core routines for multi-pattern tracking. ! * You can obtain position of a local coordinate ! * system based on the estimation of multiple markers tracking (each in relative ! * position) ! * ! * \remark more efficient with uniform planar configuration ! * ! * History : ! * ! * \author Hirokazu Kato ka...@sy... ! * \version 1.0 ! * \date 01/09/05 ! **/ ! /* -------------------------------------------------------------------------- ! * History : ! * Rev Date Who Changes ! * ! *----------------------------------------------------------------------------*/ ! ! #ifndef AR_MULTI_H ! #define AR_MULTI_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! // ============================================================================ ! // Public includes. ! // ============================================================================ ! ! #include <stdio.h> ! #include <AR/config.h> ! #include <AR/param.h> ! #include <AR/ar.h> ! ! // ============================================================================ ! // Public types and defines. ! // ============================================================================ ! ! /** \struct ARMultiEachMarkerInfoT ! * \brief multi-marker structure ! * ! * Structure for multi-marker tracking ! * really similar to ARMarkerInfo ! * \param patt_id identification of the pattern ! * \param width width of the pattern (in mm) ! * \param center center of the pattern (in mm) ! * \param trans estimated position of the pattern ! * \param itrans relative position of the pattern ! * \param pos3d final position of the pattern ! * \param visible boolean flag for visibility ! * \param visibleR last state visibility ! */ ! typedef struct { ! int patt_id; ! double width; ! double center[2]; ! double trans[3][4]; ! double itrans[3][4]; ! double pos3d[4][3]; ! int visible; ! /*---*/ ! int visibleR; ! } ARMultiEachMarkerInfoT; ! ! /** \struct ARMultiMarkerInfoT ! * \brief global multi-marker structure ! * ! * Main structure for multi-marker tracking. ! * ! * \param marker list of markers of the multi-marker pattern ! * \param marker_num number of markers used ! * \param trans position of the multi-marker pattern (more precisely, the camera position in the multi-marker CS) ! * \param prevF boolean flag for visibility ! * \param transR last position ! */ ! typedef struct { ! ARMultiEachMarkerInfoT *marker; ! int marker_num; ! double trans[3][4]; ! int prevF; ! /*---*/ ! double transR[3][4]; ! } ARMultiMarkerInfoT; ! ! // ============================================================================ ! // Public globals. ! // ============================================================================ ! ! // ============================================================================ ! // Public functions. ! // ============================================================================ ! ! /** ! * \brief loading multi-markers description from a file ! * ! * Load a configuration file for multi-markers tracking. The configuration ! * file furnishs pointer to each pattern description. ! * ! * \param filename name of the pattern file ! * \return a pattern structure, NULL if error ! */ ! ARMultiMarkerInfoT *arMultiReadConfigFile( const char *filename ); ! ! /** ! * \brief compute camera position in function of the multi-marker patterns (based on detected markers) ! * ! * calculate the transformation between the multi-marker patterns and the real camera. Based on ! * confident values of detected markers in the multi-markers patterns, a global position is return. ! * ! * \param marker_info list of detected markers (from arDetectMarker) ! * \param marker_num number of detected markers ! * \param config ! * \return ! */ ! double arMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, ! ARMultiMarkerInfoT *config); ! ! /** ! * \brief activate a multi-marker pattern on the recognition procedure. ! * ! * Activate a multi-marker for be checking during the template matching ! * operation. ! * \param config pointer to the multi-marker ! * \return 0 if success, -1 if error ! */ ! int arMultiActivate( ARMultiMarkerInfoT *config ); ! ! /** ! * \brief Desactivate a multi-marker pattern on the recognition procedure. ! * ! * Desactivate a multi-marker for not be checking during the template matching ! * operation. ! * \param config pointer to the multi-marker ! * \return 0 if success, -1 if error ! */ ! int arMultiDeactivate( ARMultiMarkerInfoT *config ); ! ! /** ! * \brief remove a multi-marker pattern from memory. ! * ! * desactivate a pattern and remove it from memory. Post-condition ! * of this function is unavailability of the multi-marker pattern. ! * \param config pointer to the multi-marker ! * \return 0 if success, -1 if error ! */ ! int arMultiFreeConfig( ARMultiMarkerInfoT *config ); ! ! /*------------------------------------*/ ! double arsMultiGetTransMat(ARMarkerInfo *marker_infoL, int marker_numL, ! ARMarkerInfo *marker_infoR, int marker_numR, ! ARMultiMarkerInfoT *config); ! ! ! #ifdef __cplusplus ! } ! #endif ! #endif --- 1,166 ---- ! /* -------------------------------------------------------------------------- ! * Copyright (C) 2004 Hitlab NZ. ! * The distribution policy is describe on the Copyright.txt furnish ! * with this library. ! * -------------------------------------------------------------------------*/ ! /** ! * \file arMulti.h ! * \brief ARToolkit multi pattern subroutines. ! * ! * This file extend ar core routines for multi-pattern tracking. ! * You can obtain position of a local coordinate ! * system based on the estimation of multiple markers tracking (each in relative ! * position) ! * ! * \remark more efficient with uniform planar configuration ! * ! * History : ! * ! * \author Hirokazu Kato ka...@sy... ! * \version 1.0 ! * \date 01/09/05 ! **/ ! /* -------------------------------------------------------------------------- ! * History : ! * Rev Date Who Changes ! * ! *----------------------------------------------------------------------------*/ ! ! #ifndef AR_MULTI_H ! #define AR_MULTI_H ! #ifdef __cplusplus ! extern "C" { ! #endif ! ! // ============================================================================ ! // Public includes. ! // ============================================================================ ! ! #include <stdio.h> ! #include <AR/config.h> ! #include <AR/param.h> ! #include <AR/ar.h> ! ! // ============================================================================ ! // Public types and defines. ! // ============================================================================ ! ! /** \struct ARMultiEachMarkerInfoT ! * \brief multi-marker structure ! * ! * Structure for multi-marker tracking ! * really similar to ARMarkerInfo ! * \param patt_id identification of the pattern ! * \param width width of the pattern (in mm) ! * \param center center of the pattern (in mm) ! * \param trans estimated position of the pattern ! * \param itrans relative position of the pattern ! * \param pos3d final position of the pattern ! * \param visible boolean flag for visibility ! * \param visibleR last state visibility ! */ ! typedef struct { ! int patt_id; ! double width; ! double center[2]; ! double trans[3][4]; ! double itrans[3][4]; ! double pos3d[4][3]; ! int visible; ! /*---*/ ! int visibleR; ! } ARMultiEachMarkerInfoT; ! ! /** \struct ARMultiMarkerInfoT ! * \brief global multi-marker structure ! * ! * Main structure for multi-marker tracking. ! * ! * \param marker list of markers of the multi-marker pattern ! * \param marker_num number of markers used ! * \param trans position of the multi-marker pattern (more precisely, the camera position in the multi-marker CS) ! * \param prevF boolean flag for visibility ! * \param transR last position ! */ ! typedef struct { ! ARMultiEachMarkerInfoT *marker; ! int marker_num; ! double trans[3][4]; ! int prevF; ! /*---*/ ! double transR[3][4]; ! } ARMultiMarkerInfoT; ! ! // ============================================================================ ! // Public globals. ! // ============================================================================ ! ! // ============================================================================ ! // Public functions. ! // ============================================================================ ! ! /** ! * \brief loading multi-markers description from a file ! * ! * Load a configuration file for multi-markers tracking. The configuration ! * file furnishs pointer to each pattern description. ! * ! * \param filename name of the pattern file ! * \return a pattern structure, NULL if error ! */ ! ARMultiMarkerInfoT *arMultiReadConfigFile( const char *filename ); ! ! /** ! * \brief compute camera position in function of the multi-marker patterns (based on detected markers) ! * ! * calculate the transformation between the multi-marker patterns and the real camera. Based on ! * confident values of detected markers in the multi-markers patterns, a global position is return. ! * ! * \param marker_info list of detected markers (from arDetectMarker) ! * \param marker_num number of detected markers ! * \param config ! * \return ! */ ! double arMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, ! ARMultiMarkerInfoT *config); ! ! /** ! * \brief activate a multi-marker pattern on the recognition procedure. ! * ! * Activate a multi-marker for be checking during the template matching ! * operation. ! * \param config pointer to the multi-marker ! * \return 0 if success, -1 if error ! */ ! int arMultiActivate( ARMultiMarkerInfoT *config ); ! ! /** ! * \brief Desactivate a multi-marker pattern on the recognition procedure. ! * ! * Desactivate a multi-marker for not be checking during the template matching ! * operation. ! * \param config pointer to the multi-marker ! * \return 0 if success, -1 if error ! */ ! int arMultiDeactivate( ARMultiMarkerInfoT *config ); ! ! /** ! * \brief remove a multi-marker pattern from memory. ! * ! * desactivate a pattern and remove it from memory. Post-condition ! * of this function is unavailability of the multi-marker pattern. ! * \param config pointer to the multi-marker ! * \return 0 if success, -1 if error ! */ ! int arMultiFreeConfig( ARMultiMarkerInfoT *config ); ! ! /*------------------------------------*/ ! double arsMultiGetTransMat(ARMarkerInfo *marker_infoL, int marker_numL, ! ARMarkerInfo *marker_infoR, int marker_numR, ! ARMultiMarkerInfoT *config); ! ! ! #ifdef __cplusplus ! } ! #endif ! #endif Index: gsubUtil.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/gsubUtil.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gsubUtil.h 22 Nov 2004 02:11:05 -0000 1.2 --- gsubUtil.h 20 Aug 2006 21:48:18 -0000 1.3 *************** *** 1,37 **** ! /* -------------------------------------------------------------------------- ! * 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. --- 1,37 ---- ! /* -------------------------------------------------------------------------- ! * 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. *************** *** 61,70 **** * 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 --- 61,70 ---- * 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: matrix.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/matrix.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** matrix.h 25 Nov 2004 23:24:20 -0000 1.3 --- matrix.h 20 Aug 2006 21:48:18 -0000 1.4 *************** *** 1,28 **** ! /* -------------------------------------------------------------------------- ! * 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 ! * *----------------------------------------------------------------------------*/ --- 1,28 ---- ! /* -------------------------------------------------------------------------- ! * 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 ! * *----------------------------------------------------------------------------*/ *************** *** 363,365 **** #endif #endif ! --- 363,365 ---- #endif #endif ! Index: gsub.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/gsub.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gsub.h 22 Nov 2004 02:11:05 -0000 1.2 --- gsub.h 20 Aug 2006 21:48:18 -0000 1.3 *************** *** 1,43 **** ! /* -------------------------------------------------------------------------- ! * 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. --- 1,43 ---- ! /* -------------------------------------------------------------------------- ! * 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. *************** *** 58,64 **** * 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. --- 58,64 ---- * 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. *************** *** 70,76 **** * - AR_DRAW_TEXTURE_HALF_IMAGE: texture mapping half resolution. * by default: DEFAULT_DRAW_TEXTURE_IMAGE in config.h ! */ ! extern int argTexmapMode; ! // ============================================================================ // Public functions. --- 70,76 ---- * - AR_DRAW_TEXTURE_HALF_IMAGE: texture mapping half resolution. * by default: DEFAULT_DRAW_TEXTURE_IMAGE in config.h ! */ ! extern int argTexmapMode; ! // ============================================================================ // Public functions. *************** *** 88,94 **** * \param ywin XXXBK. 0 if indifferent. * \param hmd_flag enable stereo display mode (only interleaved configuration) ! */ ! void argInit( ARParam *cparam, double zoom, int fullFlag, int xwin, int ywin, int hmd_flag ); ! /** \fn void argLoadHMDparam( ARParam *lparam, ARParam *rparam ) * \brief initialize camera for HMD. --- 88,94 ---- * \param ywin XXXBK. 0 if indifferent. * \param hmd_flag enable stereo display mode (only interleaved configuration) ! */ ! void argInit( ARParam *cparam, double zoom, int fullFlag, int xwin, int ywin, int hmd_flag ); ! /** \fn void argLoadHMDparam( ARParam *lparam, ARParam *rparam ) * \brief initialize camera for HMD. *************** *** 99,105 **** * \param lparam parameter of left camera * \param rparam parameter of right camera ! */ ! void argLoadHMDparam( ARParam *lparam, ARParam *rparam ); ! /** \fn void argCleanup( void ) * \brief Close the gsub library. --- 99,105 ---- * \param lparam parameter of left camera * \param rparam parameter of right camera ! */ ! void argLoadHMDparam( ARParam *lparam, ARParam *rparam ); ! /** \fn void argCleanup( void ) * \brief Close the gsub library. *************** *** 109,115 **** * \remark BE CAREFUL, THIS FUNCTION DOESN'T RESET PERSPECTIVE * MATRIX AND CURRENT GL STATE TO DEFAULT ! */ ! void argCleanup( void ); ! /** \fn void argSwapBuffers( void ) * \brief swap the rendering buffer. --- 109,115 ---- * \remark BE CAREFUL, THIS FUNCTION DOESN'T RESET PERSPECTIVE * MATRIX AND CURRENT GL STATE TO DEFAULT ! */ ! void argCleanup( void ); ! /** \fn void argSwapBuffers( void ) * \brief swap the rendering buffer. *************** *** 118,124 **** * pre-condition is that all the rendering functions have been * called. ! */ ! void argSwapBuffers( void ); ! /** \fn void argMainLoop( void (*mouseFunc)(int button, int state, int x, int y), void (*keyFunc)(unsigned char key, int x, int y), --- 118,124 ---- * pre-condition is that all the rendering functions have been * called. ! */ ! void argSwapBuffers( void ); ! /** \fn void argMainLoop( void (*mouseFunc)(int button, int state, int x, int y), void (*keyFunc)(unsigned char key, int x, int y), *************** *** 132,140 **** * \param keyFunc the user keyboard function can be NULL. * \param mainFunc the user main update function can be NULL. ! */ ! void argMainLoop( void (*mouseFunc)(int button, int state, int x, int y), ! void (*keyFunc)(unsigned char key, int x, int y), ! void (*mainFunc)(void) ); ! /** \fn void argDrawMode2D( void ) * \brief switch the rendering context for 2D rendering mode. --- 132,140 ---- * \param keyFunc the user keyboard function can be NULL. * \param mainFunc the user main update function can be NULL. ! */ ! void argMainLoop( void (*mouseFunc)(int button, int state, int x, int y), ! void (*keyFunc)(unsigned char key, int x, int y), ! void (*mainFunc)(void) ); ! /** \fn void argDrawMode2D( void ) * \brief switch the rendering context for 2D rendering mode. *************** *** 196,202 **** * \param ywin width of rendering view (less than window width) */ ! void argDraw3dCamera( int xwin, int ywin ); ! ! /** \fn void argConvGlpara( double para[3][4], double gl_para[16] ) * \brief transform ARToolKit matrix format to an openGL matrix format. --- 196,202 ---- * \param ywin width of rendering view (less than window width) */ ! void argDraw3dCamera( int xwin, int ywin ); ! ! /** \fn void argConvGlpara( double para[3][4], double gl_para[16] ) * \brief transform ARToolKit matrix format to an openGL matrix format. *************** *** 314,331 **** void (**keyFunc)(unsigned char key, int x, int y), void (**mainFunc)(void) ); ! ! /*-------------------------*/ ! ! void argsInit( ARSParam *scparam, double zoom, int twinFlag, int fullFlag, int xwin, int ywin ); ! void argsDraw3dCamera( int xwin, int ywin, int LorR, int stencil_flag ); ! void argsConvGLcpara( ARSParam *sparam, double gnear, double gfar, double mL[16], double mR[16] ); ! void argsDispImage( ARUint8 *image, int LorR, int xwin, int ywin ); ! void argsDispHalfImage( ARUint8 *image, int LorR, int xwin, int ywin ); ! void argsLineSeg( double x1, double y1, double x2, double y2, int xwin, int ywin, int LorR ); ! void argsDrawSquare( double vertex[4][2], int xwin, int ywin, int LorR ); ! ! ! #ifdef __cplusplus ! } ! #endif ! #endif --- 314,331 ---- void (**keyFunc)(unsigned char key, int x, int y), void (**mainFunc)(void) ); ! ! /*-------------------------*/ ! ! void argsInit( ARSParam *scparam, double zoom, int twinFlag, int fullFlag, int xwin, int ywin ); ! void argsDraw3dCamera( int xwin, int ywin, int LorR, int stencil_flag ); ! void argsConvGLcpara( ARSParam *sparam, double gnear, double gfar, double mL[16], double mR[16] ); ! void argsDispImage( ARUint8 *image, int LorR, int xwin, int ywin ); ! void argsDispHalfImage( ARUint8 *image, int LorR, int xwin, int ywin ); ! void argsLineSeg( double x1, double y1, double x2, double y2, int xwin, int ywin, int LorR ); ! void argsDrawSquare( double vertex[4][2], int xwin, int ywin, int LorR ); ! ! ! #ifdef __cplusplus ! } ! #endif ! #endif |
From: Hartmut S. <ret...@us...> - 2006-08-08 03:33:50
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoGStreamer In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv7945/lib/SRC/VideoGStreamer Modified Files: video.c Log Message: Added prerolling of GStreamer pipeline for DV1394 cameras. Index: video.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoGStreamer/video.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** video.c 4 Aug 2006 06:40:46 -0000 1.3 --- video.c 8 Aug 2006 03:33:45 -0000 1.4 *************** *** 234,238 **** /* now preroll for V4L v2 interfaces */ ! if (strstr(config, "v4l2src") != 0) { /* set playing state of the pipeline */ --- 234,239 ---- /* now preroll for V4L v2 interfaces */ ! if ((strstr(config, "v4l2src") != 0) || ! (strstr(config, "dv1394src") != 0)) { /* set playing state of the pipeline */ |
From: Hartmut S. <ret...@us...> - 2006-08-04 06:40:52
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoGStreamer In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv18192/lib/SRC/VideoGStreamer Modified Files: video.c Log Message: added conditional preroll for the GStreamer pipeline if a V4L Version 2 source is used. This allows ARToolkit to use any V4L2 device out of the box as V4L1 is marked as deprecated in the Linux kernel. Minor update in the simpleTest example to document the usage of the gst-launch parameters with V4L2 Index: video.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoGStreamer/video.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** video.c 30 Jun 2006 13:13:13 -0000 1.2 --- video.c 4 Aug 2006 06:40:46 -0000 1.3 *************** *** 159,162 **** --- 159,163 ---- GstPad *pad; GstXML *xml; + GstStateChangeReturn _ret; /* initialise GStreamer */ *************** *** 212,217 **** gst_object_unref (pad); - - /* request ready state */ gst_element_set_state (vid->pipeline, GST_STATE_READY); --- 213,216 ---- *************** *** 234,238 **** } ! #if 0 /* write the bin to stdout */ --- 233,260 ---- } ! /* now preroll for V4L v2 interfaces */ ! if (strstr(config, "v4l2src") != 0) ! { ! /* set playing state of the pipeline */ ! gst_element_set_state (vid->pipeline, GST_STATE_PLAYING); ! ! /* wait until it's up and running or failed */ ! if (gst_element_get_state (vid->pipeline, NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE) { ! g_error ("libARvideo: failed to put GStreamer into PLAYING state!\n"); ! } else { ! g_print ("libARvideo: GStreamer pipeline is PLAYING!\n"); ! } ! ! /* set playing state of the pipeline */ ! gst_element_set_state (vid->pipeline, GST_STATE_PAUSED); ! ! /* wait until it's up and running or failed */ ! if (gst_element_get_state (vid->pipeline, NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE) { ! g_error ("libARvideo: failed to put GStreamer into PAUSED state!\n"); ! } else { ! g_print ("libARvideo: GStreamer pipeline is PAUSED!\n"); ! } ! } ! #if 0 /* write the bin to stdout */ *************** *** 282,286 **** return 0; ! } } return 1; --- 304,310 ---- return 0; ! } else { ! g_print ("libARvideo: GStreamer pipeline is PLAYING!\n"); ! } } return 1; |
From: Hartmut S. <ret...@us...> - 2006-08-04 06:40:52
|
Update of /cvsroot/artoolkit/artoolkit/examples/simple In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv18192/examples/simple Modified Files: simpleTest.c Log Message: added conditional preroll for the GStreamer pipeline if a V4L Version 2 source is used. This allows ARToolkit to use any V4L2 device out of the box as V4L1 is marked as deprecated in the Linux kernel. Minor update in the simpleTest example to document the usage of the gst-launch parameters with V4L2 Index: simpleTest.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/simple/simpleTest.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** simpleTest.c 10 Jul 2006 04:35:17 -0000 1.7 --- simpleTest.c 4 Aug 2006 06:40:46 -0000 1.8 *************** *** 26,31 **** #elif defined(__linux) # if defined(AR_INPUT_GSTREAMER) ! //"gst_arttoolkit.xml"; ! //"filesrc location=gstreamer_test_xvid.avi ! decodebin ! ffmpegcolorspace ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; " videotestsrc ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; # else --- 26,33 ---- #elif defined(__linux) # if defined(AR_INPUT_GSTREAMER) ! /* possible streams ! "filesrc location=gstreamer_test_xvid.avi ! decodebin ! ffmpegcolorspace ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! "v4l2src device=/dev/video1 use-fixed-fps=false ! ffmpegcolorspace ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! */ " videotestsrc ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; # else |
From: Philip L. <phi...@us...> - 2006-07-10 04:35:21
|
Update of /cvsroot/artoolkit/artoolkit/ARToolKit.xcodeproj In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv30663/ARToolKit.xcodeproj Modified Files: project.pbxproj Log Message: Some cleanup of gstreamer addition, plus new fliph and flipv tokens for Mac video. Index: project.pbxproj =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/ARToolKit.xcodeproj/project.pbxproj,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** project.pbxproj 23 Jun 2006 06:42:27 -0000 1.15 --- project.pbxproj 10 Jul 2006 04:35:17 -0000 1.16 *************** *** 1473,1476 **** --- 1473,1478 ---- 4A934D7C086A2BB900DF2FAC /* libSystemStubs.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libSystemStubs.a; path = /usr/lib/libSystemStubs.a; sourceTree = "<absolute>"; }; 4A934D80086A2DB700DF2FAC /* libARvrml.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libARvrml.a; sourceTree = "<group>"; }; + 4A99C6520A59DCC3001B4C35 /* Makefile.in */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Makefile.in; sourceTree = "<group>"; }; + 4A99C6530A59DCC3001B4C35 /* video.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = video.c; sourceTree = "<group>"; }; 4AAB8C740728934300708844 /* ARToolKit.dsw */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; lineEnding = 2; path = ARToolKit.dsw; sourceTree = "<group>"; }; 4AAB8C750728934300708844 /* ARToolKit.sln */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ARToolKit.sln; sourceTree = "<group>"; }; *************** *** 2318,2321 **** --- 2320,2324 ---- 4A427D530484329900B56093 /* Gl */, 4A427D630484329900B56093 /* Makefile.in */, + 4A99C6510A59DCC3001B4C35 /* VideoGStreamer */, 4A427D640484329900B56093 /* VideoLinux1394Cam */, 4A427D680484329900B56093 /* VideoLinuxDV */, *************** *** 2511,2514 **** --- 2514,2526 ---- sourceTree = "<group>"; }; + 4A99C6510A59DCC3001B4C35 /* VideoGStreamer */ = { + isa = PBXGroup; + children = ( + 4A99C6520A59DCC3001B4C35 /* Makefile.in */, + 4A99C6530A59DCC3001B4C35 /* video.c */, + ); + path = VideoGStreamer; + sourceTree = "<group>"; + }; 4AC3C076075188AB0073D2C6 /* graphicsTest */ = { isa = PBXGroup; |
From: Philip L. <phi...@us...> - 2006-07-10 04:35:21
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoGStreamer In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv30663/lib/SRC/VideoGStreamer Modified Files: Makefile.in Log Message: Some cleanup of gstreamer addition, plus new fliph and flipv tokens for Mac video. Index: Makefile.in =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoGStreamer/Makefile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.in 30 Jun 2006 04:38:40 -0000 1.1 --- Makefile.in 10 Jul 2006 04:35:17 -0000 1.2 *************** *** 22,27 **** # compilation control # ! LIBOBJS= ${LIB}(video.o) \ ! ${LIB}(video2.o) all: ${LIBOBJS} --- 22,26 ---- # compilation control # ! LIBOBJS= ${LIB}(video.o) all: ${LIBOBJS} |
From: Philip L. <phi...@us...> - 2006-07-10 04:35:21
|
Update of /cvsroot/artoolkit/artoolkit In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv30663 Modified Files: ChangeLog.txt README.txt Log Message: Some cleanup of gstreamer addition, plus new fliph and flipv tokens for Mac video. Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/ChangeLog.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ChangeLog.txt 18 Jun 2006 23:56:29 -0000 1.7 --- ChangeLog.txt 10 Jul 2006 04:35:17 -0000 1.8 *************** *** 3,8 **** ! Changes in version 2.71.3 (this release) (2006-06-19). ------------------------------------------------------ - This release supports Mac OS X on Intel, and builds Universal binaries, with the exception of the VRML projects (since OpenVRML does not yet build on Mac OS X i386). - Fixed line endings in MS Visual Studio 6 project files calib_distortion.dsp and calib_camera2.dsp. --- 3,16 ---- ! Changes in version 2.71.4 (this release) (2006-06-23). ------------------------------------------------------ + - Fix for an error in the VRML library inclusion on Mac OS X. + - Now detect if running emulated on Mac OS X on Intel, and optimise for this case. + - Linux builds: Support for gstreamer video capture added, thanks to Hartmut Seichter. + - Mac OS X: Two new video config tokens are now available; -fliph and -flipv, which will mirror the video image horizontally and vertically respectively. + + + Changes in version 2.71.3 (2006-06-19). + --------------------------------------- - This release supports Mac OS X on Intel, and builds Universal binaries, with the exception of the VRML projects (since OpenVRML does not yet build on Mac OS X i386). - Fixed line endings in MS Visual Studio 6 project files calib_distortion.dsp and calib_camera2.dsp. Index: README.txt =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/README.txt,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** README.txt 30 Jun 2006 04:38:39 -0000 1.22 --- README.txt 10 Jul 2006 04:35:17 -0000 1.23 *************** *** 125,130 **** ! Changes in version 2.71.3 (this release) (2006-06-19). ------------------------------------------------------ - This release supports Mac OS X on Intel, and builds Universal binaries, with the exception of the VRML projects (since OpenVRML does not yet build on Mac OS X i386). - Fixed line endings in MS Visual Studio 6 project files calib_distortion.dsp and calib_camera2.dsp. --- 125,138 ---- ! Changes in version 2.71.4 (this release) (2006-06-23). ------------------------------------------------------ + - Fix for an error in the VRML library inclusion on Mac OS X. + - Now detect if running emulated on Mac OS X on Intel, and optimise for this case. + - Linux builds: Support for gstreamer video capture added, thanks to Hartmut Seichter. + - Mac OS X: Two new video config tokens are now available; -fliph and -flipv, which will mirror the video image horizontally and vertically respectively. + + + Changes in version 2.71.3 (2006-06-19). + --------------------------------------- - This release supports Mac OS X on Intel, and builds Universal binaries, with the exception of the VRML projects (since OpenVRML does not yet build on Mac OS X i386). - Fixed line endings in MS Visual Studio 6 project files calib_distortion.dsp and calib_camera2.dsp. |
From: Philip L. <phi...@us...> - 2006-07-10 04:35:21
|
Update of /cvsroot/artoolkit/artoolkit/util/videoTest In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv30663/util/videoTest Modified Files: videoTest.c Log Message: Some cleanup of gstreamer addition, plus new fliph and flipv tokens for Mac video. Index: videoTest.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/util/videoTest/videoTest.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** videoTest.c 30 Jun 2006 04:38:40 -0000 1.7 --- videoTest.c 10 Jul 2006 04:35:17 -0000 1.8 *************** *** 16,35 **** #include <AR/ar.h> ! /* set up the video format globals */ ! ! #ifdef _WIN32 ! char *vconf = "Data\\WDM_camera_flipV.xml"; #else ! ! /* ! char *vconf = "gst_arttoolkit.xml"; ! */ ! /* example for GStreamer based capture */ ! char *vconf = " videotestsrc ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! ! /* ! char *vconf = "filesrc location=gstreamer_test_xvid.avi ! decodebin ! ffmpegcolorspace ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! */ ! #endif --- 16,37 ---- #include <AR/ar.h> ! // ! // Camera configuration. ! // ! char *vconf = ! #if defined(_WIN32) ! "Data\\WDM_camera_flipV.xml"; ! #elif defined(__APPLE__) ! ""; ! #elif defined(__linux) ! # if defined(AR_INPUT_GSTREAMER) ! //"gst_arttoolkit.xml"; ! //"filesrc location=gstreamer_test_xvid.avi ! decodebin ! ffmpegcolorspace ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! " videotestsrc ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! # else ! "-dev=/dev/video0 -channel=0 -palette=YUV420P -width=320 -height=240"; ! # endif #else ! ""; #endif |
From: Philip L. <phi...@us...> - 2006-07-10 04:35:21
|
Update of /cvsroot/artoolkit/artoolkit/examples/simple In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv30663/examples/simple Modified Files: simpleTest.c Log Message: Some cleanup of gstreamer addition, plus new fliph and flipv tokens for Mac video. Index: simpleTest.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/simple/simpleTest.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** simpleTest.c 30 Jun 2006 04:38:40 -0000 1.6 --- simpleTest.c 10 Jul 2006 04:35:17 -0000 1.7 *************** *** 16,33 **** #include <AR/ar.h> ! /* set up the video format globals */ ! ! #ifdef _WIN32 ! char *vconf = "Data\\WDM_camera_flipV.xml"; ! #else ! #ifdef AR_INPUT_GSTREAMER ! char *vconf = "videotestsrc ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! /* ! char *vconf = "filesrc location=/home/joe_sample/Media/gstreamer_test_xvid.avi ! decodebin ! ffmpegcolorspace ! videorate ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! */ ! #else ! char *vconf = ""; ! #endif #endif --- 16,37 ---- #include <AR/ar.h> ! // ! // Camera configuration. ! // ! char *vconf = ! #if defined(_WIN32) ! "Data\\WDM_camera_flipV.xml"; ! #elif defined(__APPLE__) ! ""; ! #elif defined(__linux) ! # if defined(AR_INPUT_GSTREAMER) ! //"gst_arttoolkit.xml"; ! //"filesrc location=gstreamer_test_xvid.avi ! decodebin ! ffmpegcolorspace ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! " videotestsrc ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! # else ! "-dev=/dev/video0 -channel=0 -palette=YUV420P -width=320 -height=240"; ! # endif #else ! ""; #endif |
From: Philip L. <phi...@us...> - 2006-07-10 04:35:20
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoMacOSX In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv30663/lib/SRC/VideoMacOSX Modified Files: video.c Log Message: Some cleanup of gstreamer addition, plus new fliph and flipv tokens for Mac video. Index: video.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoMacOSX/video.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** video.c 23 Jun 2006 06:42:39 -0000 1.20 --- video.c 10 Jul 2006 04:35:17 -0000 1.21 *************** *** 1234,1237 **** --- 1234,1241 ---- printf(" 32, BGRA, RGBA, ABGR, 24, 24BG, 2vuy, yuvs.\n"); printf(" (See http://developer.apple.com/quicktime/icefloe/dispatch020.html.)\n"); + printf(" -fliph\n"); + printf(" Flip camera image horizontally.\n"); + printf(" -flipv\n"); + printf(" Flip camera image vertically.\n"); printf("\n"); *************** *** 1250,1253 **** --- 1254,1258 ---- int showDialog = 1; int standardDialog = 0; + int flipH = 0, flipV = 0; OSErr err_s = noErr; ComponentResult err = noErr; *************** *** 1262,1266 **** CGrafPtr theSavedPort; GDHandle theSavedDevice; - Rect sourceRect = {0, 0}; long cpuType; --- 1267,1270 ---- *************** *** 1295,1298 **** --- 1299,1306 ---- } else if (strncmp(a, "-standarddialog", 15) == 0) { standardDialog = 1; + } else if (strncmp(a, "-fliph", 6) == 0) { + flipH = 1; + } else if (strncmp(a, "-flipv", 6) == 0) { + flipV = 1; } else { err_i = 1; *************** *** 1496,1517 **** (char)(((*(vid->vdImageDesc))->cType >> 0) & 0xFF), ((*vid->vdImageDesc)->width), ((*vid->vdImageDesc)->height)); ! // If a particular size was requested, set the size of the GWorld to // the request, otherwise set it to the size of the incoming video. vid->width = (width ? width : (int)((*vid->vdImageDesc)->width)); vid->height = (height ? height : (int)((*vid->vdImageDesc)->height)); ! SetRect(&(vid->theRect), 0, 0, (short)vid->width, (short)vid->height); ! // Make a scaling matrix for the sequence if size of incoming video differs from GWorld dimensions. if (vid->width != (int)((*vid->vdImageDesc)->width) || vid->height != (int)((*vid->vdImageDesc)->height)) { - sourceRect.right = (*vid->vdImageDesc)->width; - sourceRect.bottom = (*vid->vdImageDesc)->height; arMalloc(vid->scaleMatrixPtr, MatrixRecord, 1); ! RectMatrix(vid->scaleMatrixPtr, &sourceRect, &(vid->theRect)); fprintf(stdout, "Video will be scaled to size %dx%d.\n", vid->width, vid->height); } else { ! vid->scaleMatrixPtr = NULL; } // Allocate buffer for the grabber to write pixel data into, and use // QTNewGWorldFromPtr() to wrap an offscreen GWorld structure around --- 1504,1544 ---- (char)(((*(vid->vdImageDesc))->cType >> 0) & 0xFF), ((*vid->vdImageDesc)->width), ((*vid->vdImageDesc)->height)); ! // If a particular size was requested, set the size of the GWorld to // the request, otherwise set it to the size of the incoming video. vid->width = (width ? width : (int)((*vid->vdImageDesc)->width)); vid->height = (height ? height : (int)((*vid->vdImageDesc)->height)); ! SetRect(&(vid->theRect), 0, 0, (short)vid->width, (short)vid->height); ! // Make a scaling matrix for the sequence if size of incoming video differs from GWorld dimensions. + vid->scaleMatrixPtr = NULL; + int doSourceScale; if (vid->width != (int)((*vid->vdImageDesc)->width) || vid->height != (int)((*vid->vdImageDesc)->height)) { arMalloc(vid->scaleMatrixPtr, MatrixRecord, 1); ! SetIdentityMatrix(vid->scaleMatrixPtr); ! Fixed scaleX, scaleY; ! scaleX = FixRatio(vid->width, (*vid->vdImageDesc)->width); ! scaleY = FixRatio(vid->height, (*vid->vdImageDesc)->height); ! ScaleMatrix(vid->scaleMatrixPtr, scaleX, scaleY, 0, 0); fprintf(stdout, "Video will be scaled to size %dx%d.\n", vid->width, vid->height); + doSourceScale = 1; } else { ! doSourceScale = 0; } + // If a flip was requested, add a scaling matrix for it. + if (flipH || flipV) { + Fixed scaleX, scaleY; + if (flipH) scaleX = -fixed1; + else scaleX = fixed1; + if (flipV) scaleY = -fixed1; + else scaleY = fixed1; + if (!doSourceScale) { + arMalloc(vid->scaleMatrixPtr, MatrixRecord, 1); + SetIdentityMatrix(vid->scaleMatrixPtr); + } + ScaleMatrix(vid->scaleMatrixPtr, scaleX, scaleY, FloatToFixed((float)(vid->width) * 0.5f), FloatToFixed((float)(vid->height) * 0.5f)); + } + // Allocate buffer for the grabber to write pixel data into, and use // QTNewGWorldFromPtr() to wrap an offscreen GWorld structure around |
From: Philip L. <phi...@us...> - 2006-07-10 04:35:20
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv30663/lib/SRC Modified Files: Makefile.in Log Message: Some cleanup of gstreamer addition, plus new fliph and flipv tokens for Mac video. Index: Makefile.in =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/Makefile.in,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.in 19 Nov 2004 03:26:59 -0000 1.2 --- Makefile.in 10 Jul 2006 04:35:17 -0000 1.3 *************** *** 17,20 **** --- 17,21 ---- (cd VideoMacOSX; make -f Makefile clean) (cd ARvrml; make -f Makefile clean) + (cd VideoGStreamer; make -f Makefile clean) allclean: *************** *** 28,30 **** --- 29,32 ---- (cd VideoMacOSX; make -f Makefile allclean) (cd ARvrml; make -f Makefile allclean) + (cd VideoGStreamer; make -f Makefile allclean) rm -f Makefile |
From: Philip L. <phi...@us...> - 2006-07-10 04:35:20
|
Update of /cvsroot/artoolkit/artoolkit/examples/simpleLite In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv30663/examples/simpleLite Modified Files: simpleLite.c Log Message: Some cleanup of gstreamer addition, plus new fliph and flipv tokens for Mac video. Index: simpleLite.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/examples/simpleLite/simpleLite.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** simpleLite.c 28 May 2006 23:38:40 -0000 1.15 --- simpleLite.c 10 Jul 2006 04:35:17 -0000 1.16 *************** *** 413,423 **** const char *cparam_name = "Data/camera_para.dat"; ! char *vconf = // Camera configuration. #if defined(_WIN32) "Data\\WDM_camera_flipV.xml"; #elif defined(__APPLE__) ""; ! #else "-dev=/dev/video0 -channel=0 -palette=YUV420P -width=320 -height=240"; #endif const char *patt_name = "Data/patt.hiro"; --- 413,434 ---- const char *cparam_name = "Data/camera_para.dat"; ! // ! // Camera configuration. ! // ! char *vconf = #if defined(_WIN32) "Data\\WDM_camera_flipV.xml"; #elif defined(__APPLE__) ""; ! #elif defined(__linux) ! # if defined(AR_INPUT_GSTREAMER) ! //"gst_arttoolkit.xml"; ! //"filesrc location=gstreamer_test_xvid.avi ! decodebin ! ffmpegcolorspace ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! " videotestsrc ! capsfilter caps=video/x-raw-rgb,bpp=24 ! identity name=artoolkit ! fakesink"; ! # else "-dev=/dev/video0 -channel=0 -palette=YUV420P -width=320 -height=240"; + # endif + #else + ""; #endif const char *patt_name = "Data/patt.hiro"; |
From: Hartmut S. <ret...@us...> - 2006-06-30 13:14:30
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoGStreamer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25342/lib/SRC/VideoGStreamer Modified Files: video.c Log Message: Fixed header for hidden implementation Index: video.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoGStreamer/video.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** video.c 30 Jun 2006 04:38:40 -0000 1.1 --- video.c 30 Jun 2006 13:13:13 -0000 1.2 *************** *** 23,26 **** --- 23,43 ---- + struct _AR2VideoParamT { + + /* GStreamer pipeline */ + GstElement *pipeline; + + /* GStreamer identity needed for probing */ + GstElement *probe; + + /* size of the image */ + int width, height; + + /* the actual video buffer */ + ARUint8 *videoBuffer; + + }; + + static AR2VideoParamT *gVid = 0; |
From: Hartmut S. <ret...@us...> - 2006-06-30 13:14:24
|
Update of /cvsroot/artoolkit/artoolkit/include/AR/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25342/include/AR/sys Modified Files: videoGStreamer.h Log Message: Fixed header for hidden implementation Index: videoGStreamer.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoGStreamer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** videoGStreamer.h 30 Jun 2006 05:14:27 -0000 1.2 --- videoGStreamer.h 30 Jun 2006 13:13:13 -0000 1.3 *************** *** 10,15 **** #define AR_VIDEO_GSTREAMER_H - - #ifdef __cplusplus extern "C" { --- 10,13 ---- *************** *** 18,39 **** #include <AR/config.h> #include <AR/ar.h> - #include <gst/gst.h> - - - typedef struct { - - /* GStreamer pipeline */ - GstElement *pipeline; - - /* GStreamer identity needed for probing */ - GstElement *probe; - - /* size of the image */ - int width, height; ! /* the actual video buffer */ ! ARUint8 *videoBuffer; ! ! } AR2VideoParamT; #ifdef __cplusplus --- 16,21 ---- #include <AR/config.h> #include <AR/ar.h> ! typedef struct _AR2VideoParamT AR2VideoParamT; #ifdef __cplusplus |
From: Hartmut S. <ret...@us...> - 2006-06-30 13:14:22
|
Update of /cvsroot/artoolkit/artoolkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25342 Modified Files: Configure Log Message: Fixed header for hidden implementation Index: Configure =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/Configure,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Configure 30 Jun 2006 04:38:39 -0000 1.6 --- Configure 30 Jun 2006 13:13:13 -0000 1.7 *************** *** 99,103 **** ARFLAG="rs" RANLIB="" ! LIBS="-lpthread -lglut -lGLU -lGL -lXi -lXmu -lX11 -lm" CONFIG="AR_INPUT_GSTREAMER" else --- 99,103 ---- ARFLAG="rs" RANLIB="" ! LIBS="-lpthread -lglut -lGLU -lGL -lXi -lX11 -lm" CONFIG="AR_INPUT_GSTREAMER" else |
From: Hartmut S. <ret...@us...> - 2006-06-30 05:14:31
|
Update of /cvsroot/artoolkit/artoolkit/include/AR/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25875/include/AR/sys Modified Files: videoGStreamer.h Log Message: minor fix for GStreamer header Index: videoGStreamer.h =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/include/AR/sys/videoGStreamer.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** videoGStreamer.h 30 Jun 2006 04:38:40 -0000 1.1 --- videoGStreamer.h 30 Jun 2006 05:14:27 -0000 1.2 *************** *** 9,20 **** #ifndef AR_VIDEO_GSTREAMER_H #define AR_VIDEO_GSTREAMER_H ! #ifdef __cplusplus ! extern "C" { #endif ! #include <AR/config.h> #include <AR/ar.h> #include <gst/gst.h> typedef struct { --- 9,24 ---- #ifndef AR_VIDEO_GSTREAMER_H #define AR_VIDEO_GSTREAMER_H ! ! ! ! #ifdef __cplusplus ! extern "C" { #endif ! #include <AR/config.h> #include <AR/ar.h> #include <gst/gst.h> + typedef struct { *************** *** 36,38 **** --- 40,43 ---- } #endif + #endif |