ARToolKit | Mailing List Archive |
![]() |
From: | pawel plaszczak <pawel@m ..........> | Received: | Aug 28, 2002 |
To | Hirokazu Kato <kato@s ........................> | ||
Subject: | error: setting palette | ||
Hirokazu, Thanks a lot. I did what you said and that's precisely what I get now: error: setting palette Does it mean "it's incompatible-full-stop" or is there anything I could still do? We bougth this Philips model because a little market review showed that they got the best maintained and documented Linux support. If this one will not work, I would have two questions: -is there a list of USB cams that ARToolkit supports? -how about Firewire. Will all cameras work, or just some? Obviously, I would much prefer to make my Philips Toucam Pro work with ARToolkit... pawel On Tue, 2002-08-27 at 20:45, Hirokazu Kato wrote: > >bash-2.05a$ simpleTest > >arVideoOpen: channel# is not valid. > > Please change include/AR/config.h or config.h.in like: > > #define DEFAULT_VIDEO_CHANNEL 1 > ---> > #define DEFAULT_VIDEO_CHANNEL 0 > > Then compile again. > But you might get another error like: > "error: setting palette" > > This is from incompatibility of ARToolKit Video Libraru and your USB camera. > > -- > ------------------------------------------------------------------ > Hirokazu Kato > Faculty of Information Sciences > Hiroshima City University Phone: 082-830-1705 > Email: kato@s ........................ Fax: 082-830-1435 > URL: http://www.sys.im.hiroshima-cu.ac.jp/people/kato/ > |
From: | Hirokazu Kato <kato@s ........................> | Received: | Aug 29, 2002 |
To | pawel plaszczak <pawel@m ..........> | ||
Subject: | Re: error: setting palette | ||
>Does it mean "it's incompatible-full-stop" or is there anything I could >still do? It's incompatible-full-stop. There are several kind of pixel formats that video4linux outputs to application programs like RGB, YUV411, YUV420 and so on. But right now, ARToolKit supports only RGB. Internal pixel format of ARToolKit is RGB 24bit or RGBA 32 bit. So if video4linux outputs other pixel formats for your camera, ARToolKit video library should convert the pixel format to RGB pixel format. I think it is not so difficult. But because I do not have such kind of USB camera, I cannot make and check the code. >-is there a list of USB cams that ARToolkit supports? If I have many USB cameras, I can list it up. But I do not have. So I can not do this. I hope many members in this ML report their own experience. >-how about Firewire. Will all cameras work, or just some? I am using iBot and dragonFly firewire camera. They work fine and can output 640x480 image 30fps. -- ---- Hirokazu Kato |
From: | pawel plaszczak <pawel@m ..........> | Received: | Aug 29, 2002 |
To | Hirokazu Kato <kato@s ........................> | ||
Subject: | Re: error: setting palette | ||
Thanks a lot Hirokazu. Now I understand the problem. The Philips driver API docs (http://www.smcc.demon.nl/webcam/api.html#palette) say that "the Philips webcam driver (as of version 7.0) only delivers the YUV420P palette, or in techno speak YUV 4:2:0 planar". I understand the problem of converting to RGB is simple but am not a specialist here and would like to avoid writing it myself. However, I am guessing that many people must have stumbled at that problem and am sure the conversion algorithms have been written many times. Perhaps there are ready to use tools / libraries that convert a YUV stream into a RBG stream, and could be easily integrated with ARToolkit? I would appreciate advice if anyone knows of such software. I could then try to look in the ARToolkit source code and see what can be done. pawel On Wed, 2002-08-28 at 16:25, Hirokazu Kato wrote: > >Does it mean "it's incompatible-full-stop" or is there anything I could > >still do? > > It's incompatible-full-stop. > There are several kind of pixel formats that video4linux outputs > to application programs like RGB, YUV411, YUV420 and so on. > But right now, ARToolKit supports only RGB. > Internal pixel format of ARToolKit is RGB 24bit or RGBA 32 bit. > So if video4linux outputs other pixel formats for your camera, > ARToolKit video library should convert the pixel format to RGB > pixel format. > I think it is not so difficult. > But because I do not have such kind of USB camera, > I cannot make and check the code. > > > >-is there a list of USB cams that ARToolkit supports? > > If I have many USB cameras, I can list it up. > But I do not have. So I can not do this. > I hope many members in this ML report their own experience. > > > >-how about Firewire. Will all cameras work, or just some? > > I am using iBot and dragonFly firewire camera. > They work fine and can output 640x480 image 30fps. > > -- > ---- > Hirokazu Kato > |
From: | Hirokazu Kato <kato@s ........................> | Received: | Aug 30, 2002 |
To | pawel plaszczak <pawel@m ..........> | ||
Subject: | Re: error: setting palette | ||
>Now I understand the problem. The Philips driver API docs >(http://www.smcc.demon.nl/webcam/api.html#palette) say that >"the Philips webcam driver (as of version 7.0) only delivers the YUV420P >palette, or in techno speak YUV 4:2:0 planar". OK. I understood supporting YUV420P is important. I will try to add it into ARToolKit. But I will not be in my office in two weeks. So it would be late... -- ------------------------------------------------------------------ Hirokazu Kato Faculty of Information Sciences Hiroshima City University Phone: +81-82-830-1705 Email: kato@s ........................ Fax: +81-82-830-1435 URL: http://www.sys.im.hiroshima-cu.ac.jp/people/kato/ |
From: | Uwe =?ISO-8859-1?Q?W=F6ssner?= <woessner@h ......> | Received: | Sep 2, 2002 |
To | Hirokazu Kato <kato@s ........................> | ||
Subject: | Re: error: setting palette | ||
Hello, Last weekend I was sitting in the garden and had nothing else to do than to fix exactly that problem ;-) Tomorrow, I can send you a patch to the sources which supports converting from YUV420P to RGB24. Hirokazu Kato wrote: >>Now I understand the problem. The Philips driver API docs >>(http://www.smcc.demon.nl/webcam/api.html#palette) say that >>"the Philips webcam driver (as of version 7.0) only delivers the YUV420P >>palette, or in techno speak YUV 4:2:0 planar". >> > > OK. I understood supporting YUV420P is important. > I will try to add it into ARToolKit. > But I will not be in my office in two weeks. > So it would be late... > > |
From: | Hirokazu Kato <kato@s ........................> | Received: | Sep 5, 2002 |
To | artoolkit@h .................. | ||
Subject: | Re: error: setting palette | ||
Hi all, I have just written codes which supports YUV420 palette in Video4Linux. But I do not have any device which is available in YUV420 palette. So I do not know this code works well or not. Please let me know any comments about this code if you can check it. ------ lib/SRC/VideoLinuxV4L/video.c ------ /* * Video capture subrutine for Linux/Video4Linux devices * author: Nakazawa,Atsushi ( nakazawa@i .......................... ) Hirokazu Kato ( kato@s ........................ ) * * Revision: 5.3 Date: 2002/08/31 */ #include <sys/ioctl.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <linux/types.h> #include <linux/videodev.h> #include <AR/config.h> #include <AR/ar.h> #include <AR/video.h> #define MAXCHANNEL 10 static AR2VideoParamT *vid = NULL; static ARUint8 *ar2VideoGetImageRGB( AR2VideoParamT *vid ); static ARUint8 *ar2VideoGetImageYUV420( AR2VideoParamT *vid ); int arVideoDispOption( void ) { return ar2VideoDispOption(); } int arVideoOpen( char *config ) { if( vid != NULL ) { printf("Device has been opened!!\n"); return -1; } vid = ar2VideoOpen( config ); if( vid == NULL ) return -1; return 0; } int arVideoClose( void ) { if( vid == NULL ) return -1; return ar2VideoClose( vid ); } int arVideoInqSize( int *x, int *y ) { if( vid == NULL ) return -1; return ar2VideoInqSize( vid, x, y ); } ARUint8 *arVideoGetImage( void ) { if( vid == NULL ) return NULL; return ar2VideoGetImage( vid ); } int arVideoCapStart( void ) { if( vid == NULL ) return -1; return ar2VideoCapStart( vid ); } int arVideoCapStop( void ) { if( vid == NULL ) return -1; return ar2VideoCapStop( vid ); } int arVideoCapNext( void ) { if( vid == NULL ) return -1; return ar2VideoCapNext( vid ); } /*-------------------------------------------*/ int ar2VideoDispOption( void ) { printf(" -width=N\n"); printf(" specifies expected width of image.\n"); printf(" -height=N\n"); printf(" specifies expected height of image.\n"); printf(" -contrast=N\n"); printf(" specifies contrast. (0.0 <-> 1.0)\n"); printf(" -brightness=N\n"); printf(" specifies brightness. (0.0 <-> 1.0)\n"); printf(" -color=N\n"); printf(" specifies color. (0.0 <-> 1.0)\n"); printf(" -channel=N\n"); printf(" specifies source channel.\n"); printf(" -dev=filepath\n"); printf(" specifies device file.\n"); printf(" -mode=[PAL|NTSC|SECAM]\n"); printf(" specifies TV signal mode.\n"); printf("\n"); return 0; } AR2VideoParamT *ar2VideoOpen( char *config ) { AR2VideoParamT *vid; struct video_capability vd; struct video_channel vc[MAXCHANNEL]; struct video_picture vp; char *a, line[256]; int i; arMalloc( vid, AR2VideoParamT, 1 ); strcpy( vid->dev, DEFAULT_VIDEO_DEVICE ); vid->width = DEFAULT_VIDEO_WIDTH; vid->height = DEFAULT_VIDEO_HEIGHT; vid->channel = DEFAULT_VIDEO_CHANNEL; vid->mode = DEFAULT_VIDEO_MODE; vid->palette = AR_VIDEO_PALETTE_RGB; vid->debug = 0; vid->contrast = 0.5; vid->brightness = 0.5; vid->color = 0.5; a = config; if( a != NULL) { for(;;) { while( *a == ' ' || *a == '\t' ) a++; if( *a == '\0' ) break; if( strncmp( a, "-width=", 7 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[7], "%d", &vid->width ) == 0 ) { ar2VideoDispOption(); free( vid ); return 0; } } else if( strncmp( a, "-height=", 8 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[8], "%d", &vid->height ) == 0 ) { ar2VideoDispOption(); free( vid ); return 0; } } else if( strncmp( a, "-contrast=", 10 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[10], "%lf", &vid->contrast ) == 0 ) { ar2VideoDispOption(); free( vid ); return 0; } } else if( strncmp( a, "-brightness=", 12 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[12], "%lf", &vid->brightness ) == 0 ) { ar2VideoDispOption(); free( vid ); return 0; } } else if( strncmp( a, "-color=", 7 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[7], "%lf", &vid->color ) == 0 ) { ar2VideoDispOption(); free( vid ); return 0; } } else if( strncmp( a, "-channel=", 9 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[9], "%d", &vid->channel ) == 0 ) { ar2VideoDispOption(); free( vid ); return 0; } } else if( strncmp( a, "-dev=", 5 ) == 0 ) { sscanf( a, "%s", line ); if( sscanf( &line[5], "%s", vid->dev ) == 0 ) { ar2VideoDispOption(); free( vid ); return 0; } } else if( strncmp( a, "-mode=", 6 ) == 0 ) { if( strncmp( &a[6], "PAL", 3 ) == 0 ) vid->mode = VIDEO_MODE_PAL; else if( strncmp( &a[6], "NTSC", 4 ) == 0 ) vid->mode = VIDEO_MODE_NTSC; else if( strncmp( &a[6], "SECAM", 5 ) == 0 ) vid->mode = VIDEO_MODE_SECAM; else { ar2VideoDispOption(); free( vid ); return 0; } } else if( strncmp( a, "-debug", 6 ) == 0 ) { vid->debug = 1; } else { ar2VideoDispOption(); free( vid ); return 0; } while( *a != ' ' && *a != '\t' && *a != '\0') a++; } } vid->fd = open(vid->dev, O_RDWR); if(vid->fd < 0){ printf("video device (%s) open failed\n",vid->dev); free( vid ); return 0; } if(ioctl(vid->fd,VIDIOCGCAP,&vd) < 0){ printf("ioctl failed\n"); free( vid ); return 0; } if( vid->debug ) { printf("=== debug info ===\n"); printf(" vd.name = %s\n",vd.name); printf(" vd.channels = %d\n",vd.channels); printf(" vd.maxwidth = %d\n",vd.maxwidth); printf(" vd.maxheight = %d\n",vd.maxheight); printf(" vd.minwidth = %d\n",vd.minwidth); printf(" vd.minheight = %d\n",vd.minheight); } /* check capture size */ if(vd.maxwidth < vid->width || vid->width < vd.minwidth || vd.maxheight < vid->height || vid->height < vd.minheight ) { printf("arVideoOpen: width or height oversize \n"); free( vid ); return 0; } /* check channel */ if(vid->channel < 0 || vid->channel >= vd.channels){ printf("arVideoOpen: channel# is not valid. \n"); free( vid ); return 0; } if( vid->debug ) { printf("==== capture device channel info ===\n"); } for(i = 0;i < vd.channels && i < MAXCHANNEL; i++){ vc[i].channel = i; if(ioctl(vid->fd,VIDIOCGCHAN,&vc[i]) < 0){ printf("error: acquireing channel(%d) info\n",i); free( vid ); return 0; } if( vid->debug ) { printf(" channel = %d\n", vc[i].channel); printf(" name = %s\n", vc[i].name); printf(" tuners = %d", vc[i].tuners); printf(" flag = 0x%08x",vc[i].flags); if(vc[i].flags & VIDEO_VC_TUNER) printf(" TUNER"); if(vc[i].flags & VIDEO_VC_AUDIO) printf(" AUDIO"); printf("\n"); printf(" vc[%d].type = 0x%08x", i, vc[i].type); if(vc[i].type & VIDEO_TYPE_TV) printf(" TV"); if(vc[i].type & VIDEO_TYPE_CAMERA) printf(" CAMERA"); printf("\n"); } } /* select channel */ vc[vid->channel].norm = vid->mode; /* 0: PAL 1: NTSC 2:SECAM 3:AUTO */ if(ioctl(vid->fd, VIDIOCSCHAN, &vc[vid->channel]) < 0){ printf("error: selecting channel %d\n", vid->channel); free( vid ); return 0; } /* set video picture */ vp.brightness = 32767 * 2.0 * vid->brightness; vp.hue = 32767; vp.colour = 32767 * 2.0 * vid->color; vp.contrast = 32767 * 2.0 * vid->contrast; vp.whiteness = 32767; vp.depth = 24; /* color depth */ #if defined(AR_PIX_FORMAT_BGRA) vp.palette = VIDEO_PALETTE_RGB32; /* palette format */ #elif defined(AR_PIX_FORMAT_BGR) vp.palette = VIDEO_PALETTE_RGB24; /* palette format */ #endif if(ioctl(vid->fd, VIDIOCSPICT, &vp)) { vid->palette = AR_VIDEO_PALETTE_YUV420; vp.palette = VIDEO_PALETTE_YUV420; if(ioctl(vid->fd, VIDIOCSPICT, &vp)) { printf("error: setting palette\n"); free( vid ); return 0; } } /* get mmap info */ if(ioctl(vid->fd,VIDIOCGMBUF,&vid->vm) < 0){ printf("error: videocgmbuf\n"); free( vid ); return 0; } if( vid->debug ) { printf("===== Image Buffer Info =====\n"); printf(" size = %d[bytes]\n", vid->vm.size); printf(" frames = %d\n", vid->vm.frames); } if(vid->vm.frames < 2){ printf("this device can not be supported by libARvideo.\n"); printf("(vm.frames < 2)\n"); free( vid ); return 0; } /* get memory mapped io */ if((vid->map = (ARUint8 *)mmap(0, vid->vm.size, PROT_READ|PROT_WRITE, MAP_SHARED, vid->fd, 0)) < 0){ printf("error: mmap\n"); free( vid ); return 0; } /*-----------------------------------------*/ #if 0 { struct video_window vw; vw.x = 0; vw.y = 0; vw.width = vid->width; vw.height = vid->height; vw.chromakey = 0; vw.flags = (30 << 16); if(ioctl(vid->fd,VIDIOCSWIN,&vw) < 0){ printf("error: videocswin\n"); free( vid ); return 0; } } #endif /* setup for vmm */ vid->vmm.frame = 0; vid->vmm.width = vid->width; vid->vmm.height = vid->height; if( vid->palette == AR_VIDEO_PALETTE_RGB ) { #if defined(AR_PIX_FORMAT_BGRA) vid->vmm.format = VIDEO_PALETTE_RGB32; #elif defined(AR_PIX_FORMAT_BGR) vid->vmm.format = VIDEO_PALETTE_RGB24; #endif } else { vid->vmm.format = VIDEO_PALETTE_YUV420; arMalloc( vid->image, ARUint8, (vid->width * vid->height * AR_PIX_SIZE) ); } vid->video_cont_num = -1; return vid; } int ar2VideoClose( AR2VideoParamT *vid ) { if(vid->video_cont_num >= 0){ ar2VideoCapStop( vid ); } close(vid->fd); free( vid ); return 0; } int ar2VideoCapStart( AR2VideoParamT *vid ) { if(vid->video_cont_num >= 0){ printf("arVideoCapStart has already been called.\n"); return -1; } vid->video_cont_num = 0; vid->vmm.frame = vid->video_cont_num; if(ioctl(vid->fd, VIDIOCMCAPTURE, &vid->vmm) < 0) { return -1; } vid->vmm.frame = 1 - vid->vmm.frame; if( ioctl(vid->fd, VIDIOCMCAPTURE, &vid->vmm) < 0) { return -1; } return 0; } int ar2VideoCapNext( AR2VideoParamT *vid ) { if(vid->video_cont_num < 0){ printf("arVideoCapStart has never been called.\n"); return -1; } vid->vmm.frame = 1 - vid->vmm.frame; ioctl(vid->fd, VIDIOCMCAPTURE, &vid->vmm); return 0; } int ar2VideoCapStop( AR2VideoParamT *vid ) { if(vid->video_cont_num < 0){ printf("arVideoCapStart has never been called.\n"); return -1; } if(ioctl(vid->fd, VIDIOCSYNC, &vid->video_cont_num) < 0){ printf("error: videosync\n"); return -1; } vid->video_cont_num = -1; return 0; } ARUint8 *ar2VideoGetImage( AR2VideoParamT *vid ) { if( vid->palette == AR_VIDEO_PALETTE_RGB ) { return ar2VideoGetImageRGB( vid ); } else if( vid->palette == AR_VIDEO_PALETTE_YUV420 ) { return ar2VideoGetImageYUV420( vid ); } else { return NULL; } } static ARUint8 *ar2VideoGetImageRGB( AR2VideoParamT *vid ) { if(vid->video_cont_num < 0){ printf("arVideoCapStart has never been called.\n"); return NULL; } if(ioctl(vid->fd, VIDIOCSYNC, &vid->video_cont_num) < 0){ printf("error: videosync\n"); return NULL; } vid->video_cont_num = 1 - vid->video_cont_num; if(vid->video_cont_num == 0) return (vid->map + vid->vm.offsets[1]); else return (vid->map + vid->vm.offsets[0]); } static ARUint8 *ar2VideoGetImageYUV420( AR2VideoParamT *vid ) { ARUint8 *p0, *p1, *p2, *p3; int i, j; int R, G, B; int U0, V0, V20, U50, UV0; int U1, V1, V21, U51, UV1; int Y0, Y1, Y2, Y3; int Y4, Y5, Y6, Y7; if(vid->video_cont_num < 0){ printf("arVideoCapStart has never been called.\n"); return NULL; } if(ioctl(vid->fd, VIDIOCSYNC, &vid->video_cont_num) < 0){ printf("error: videosync\n"); return NULL; } vid->video_cont_num = 1 - vid->video_cont_num; if(vid->video_cont_num == 0) p0 = vid->map + vid->vm.offsets[1]; else p0 = vid->map + vid->vm.offsets[0]; p1 = p0 + vid->width * 3 / 2; p2 = vid->image + vid->height * vid->width * AR_PIX_SIZE - 1; p3 = p2 - vid->width * AR_PIX_SIZE; for( j = 0; j < vid->height/2; j++ ) { for( i = 0; i < vid->width/4; i++ ) { Y0 = (ARUint8)*p0++; Y1 = (ARUint8)*p0++; Y2 = (ARUint8)*p0++; Y3 = (ARUint8)*p0++; V0 = ((ARUint8)*p0++ - 128) * 0.354; V1 = ((ARUint8)*p0++ - 128) * 0.354; Y4 = (ARUint8)*p1++; Y5 = (ARUint8)*p1++; Y6 = (ARUint8)*p1++; Y7 = (ARUint8)*p1++; U0 = ((ARUint8)*p1++ - 128) * 0.707; U1 = ((ARUint8)*p1++ - 128) * 0.707; U50 = 5*U0; V20 = 2*V0; UV0 = - U0 - V0; U51 = 5*U1; V21 = 2*V1; UV1 = - U1 - V1; // Original equations // R = Y + 1.402 V // G = Y - 0.344 U - 0.714 V // B = Y + 1.772 U R = Y0 + V20; if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; G = Y0 + UV0; if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; B = Y0 + U50; if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; *p2-- = (ARUint8)B; *p2-- = (ARUint8)G; *p2-- = (ARUint8)R; //--- R = Y1 + V20; if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; G = Y1 + UV0; if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; B = Y1 + U50; if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; *p2-- = (ARUint8)B; *p2-- = (ARUint8)G; *p2-- = (ARUint8)R; //--- R = Y2 + V21; if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; G = Y2 + UV1; if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; B = Y2 + U51; if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; *p2-- = (ARUint8)B; *p2-- = (ARUint8)G; *p2-- = (ARUint8)R; //--- R = Y3 + V21; if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; G = Y3 + UV1; if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; B = Y3 + U51; if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; *p2-- = (ARUint8)B; *p2-- = (ARUint8)G; *p2-- = (ARUint8)R; //--- R = Y4 + V20; if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; G = Y4 + UV0; if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; B = Y4 + U50; if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; *p3-- = (ARUint8)B; *p3-- = (ARUint8)G; *p3-- = (ARUint8)R; //--- R = Y5 + V20; if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; G = Y5 + UV0; if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; B = Y5 + U50; if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; *p3-- = (ARUint8)B; *p3-- = (ARUint8)G; *p3-- = (ARUint8)R; //--- R = Y6 + V21; if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; G = Y6 + UV1; if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; B = Y6 + U51; if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; *p3-- = (ARUint8)B; *p3-- = (ARUint8)G; *p3-- = (ARUint8)R; //--- R = Y7 + V21; if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; G = Y7 + UV1; if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; B = Y7 + U51; if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; *p3-- = (ARUint8)B; *p3-- = (ARUint8)G; *p3-- = (ARUint8)R; } p0 += vid->width * 3 / 2; p1 += vid->width * 3 / 2; p2 -= vid->width * AR_PIX_SIZE; p3 -= vid->width * AR_PIX_SIZE; } return vid->image; } int ar2VideoInqSize(AR2VideoParamT *vid, int *x,int *y) { *x = vid->vmm.width; *y = vid->vmm.height; return 0; } ------ include/AR/sys/videoLinuxV4L.h ------ /******************************************************* * * Author: Hirokazu Kato * * kato@s ........................ * * Revision: 4.5 * Date: 2002/08/31 * *******************************************************/ #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> #define AR_VIDEO_PALETTE_RGB 0 #define AR_VIDEO_PALETTE_YUV420 1 typedef struct { char dev[256]; int width; int height; int channel; int mode; int palette; ARUint8 *image; int debug; double contrast; double brightness; double color; int fd; int video_cont_num; ARUint8 *map; struct video_mbuf vm; struct video_mmap vmm; } AR2VideoParamT; #ifdef __cplusplus } #endif #endif -- ------------------------------------------------------------------ Hirokazu Kato Faculty of Information Sciences Hiroshima City University Phone: +81-82-830-1705 Email: kato@s ........................ Fax: +81-82-830-1435 URL: http://www.sys.im.hiroshima-cu.ac.jp/people/kato/ |
From: | pawel plaszczak <pawel@m ..........> | Received: | Sep 5, 2002 |
To | Hirokazu Kato <kato@s ........................> | ||
Subject: | Re: error: setting palette | ||
Hirokazu Great! Your YUV420 implementation works. I didn't try calibration etc yet, but I can see the picture on the screen. Two problems: 1) the picture is upside down 2) picture is reddish. For instance, yellow objects are shown orange. These two problems do not apear with other camera viewer applications like camstreams. It would be great to fix (1) and I can live with (2). pawel On Wed, 2002-09-04 at 18:10, Hirokazu Kato wrote: > Hi all, > > I have just written codes which supports YUV420 palette in Video4Linux. > But I do not have any device which is available in YUV420 palette. > So I do not know this code works well or not. > Please let me know any comments about this code if you can check it. > > ------ lib/SRC/VideoLinuxV4L/video.c ------ > /* > * Video capture subrutine for Linux/Video4Linux devices > * author: Nakazawa,Atsushi ( nakazawa@i .......................... ) > Hirokazu Kato ( kato@s ........................ ) > * > * Revision: 5.3 Date: 2002/08/31 > */ > #include <sys/ioctl.h> > #include <sys/types.h> > #include <sys/stat.h> > #include <sys/mman.h> > #include <fcntl.h> > #include <unistd.h> > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > #include <linux/types.h> > #include <linux/videodev.h> > #include <AR/config.h> > #include <AR/ar.h> > #include <AR/video.h> > > #define MAXCHANNEL 10 > > static AR2VideoParamT *vid = NULL; > > static ARUint8 *ar2VideoGetImageRGB( AR2VideoParamT *vid ); > static ARUint8 *ar2VideoGetImageYUV420( AR2VideoParamT *vid ); > > int arVideoDispOption( void ) > { > return ar2VideoDispOption(); > } > > int arVideoOpen( char *config ) > { > if( vid != NULL ) { > printf("Device has been opened!!\n"); > return -1; > } > vid = ar2VideoOpen( config ); > if( vid == NULL ) return -1; > > return 0; > } > > int arVideoClose( void ) > { > if( vid == NULL ) return -1; > > return ar2VideoClose( vid ); > } > > int arVideoInqSize( int *x, int *y ) > { > if( vid == NULL ) return -1; > > return ar2VideoInqSize( vid, x, y ); > } > > ARUint8 *arVideoGetImage( void ) > { > if( vid == NULL ) return NULL; > > return ar2VideoGetImage( vid ); > } > > int arVideoCapStart( void ) > { > if( vid == NULL ) return -1; > > return ar2VideoCapStart( vid ); > } > > int arVideoCapStop( void ) > { > if( vid == NULL ) return -1; > > return ar2VideoCapStop( vid ); > } > > int arVideoCapNext( void ) > { > if( vid == NULL ) return -1; > > return ar2VideoCapNext( vid ); > } > > /*-------------------------------------------*/ > > int ar2VideoDispOption( void ) > { > printf(" -width=N\n"); > printf(" specifies expected width of image.\n"); > printf(" -height=N\n"); > printf(" specifies expected height of image.\n"); > printf(" -contrast=N\n"); > printf(" specifies contrast. (0.0 <-> 1.0)\n"); > printf(" -brightness=N\n"); > printf(" specifies brightness. (0.0 <-> 1.0)\n"); > printf(" -color=N\n"); > printf(" specifies color. (0.0 <-> 1.0)\n"); > printf(" -channel=N\n"); > printf(" specifies source channel.\n"); > printf(" -dev=filepath\n"); > printf(" specifies device file.\n"); > printf(" -mode=[PAL|NTSC|SECAM]\n"); > printf(" specifies TV signal mode.\n"); > printf("\n"); > > return 0; > } > > AR2VideoParamT *ar2VideoOpen( char *config ) > { > AR2VideoParamT *vid; > struct video_capability vd; > struct video_channel vc[MAXCHANNEL]; > struct video_picture vp; > char *a, line[256]; > int i; > > arMalloc( vid, AR2VideoParamT, 1 ); > strcpy( vid->dev, DEFAULT_VIDEO_DEVICE ); > vid->width = DEFAULT_VIDEO_WIDTH; > vid->height = DEFAULT_VIDEO_HEIGHT; > vid->channel = DEFAULT_VIDEO_CHANNEL; > vid->mode = DEFAULT_VIDEO_MODE; > vid->palette = AR_VIDEO_PALETTE_RGB; > vid->debug = 0; > vid->contrast = 0.5; > vid->brightness = 0.5; > vid->color = 0.5; > > a = config; > if( a != NULL) { > for(;;) { > while( *a == ' ' || *a == '\t' ) a++; > if( *a == '\0' ) break; > > if( strncmp( a, "-width=", 7 ) == 0 ) { > sscanf( a, "%s", line ); > if( sscanf( &line[7], "%d", &vid->width ) == 0 ) { > ar2VideoDispOption(); > free( vid ); > return 0; > } > } > else if( strncmp( a, "-height=", 8 ) == 0 ) { > sscanf( a, "%s", line ); > if( sscanf( &line[8], "%d", &vid->height ) == 0 ) { > ar2VideoDispOption(); > free( vid ); > return 0; > } > } > else if( strncmp( a, "-contrast=", 10 ) == 0 ) { > sscanf( a, "%s", line ); > if( sscanf( &line[10], "%lf", &vid->contrast ) == 0 ) { > ar2VideoDispOption(); > free( vid ); > return 0; > } > } > else if( strncmp( a, "-brightness=", 12 ) == 0 ) { > sscanf( a, "%s", line ); > if( sscanf( &line[12], "%lf", &vid->brightness ) == 0 ) { > ar2VideoDispOption(); > free( vid ); > return 0; > } > } > else if( strncmp( a, "-color=", 7 ) == 0 ) { > sscanf( a, "%s", line ); > if( sscanf( &line[7], "%lf", &vid->color ) == 0 ) { > ar2VideoDispOption(); > free( vid ); > return 0; > } > } > else if( strncmp( a, "-channel=", 9 ) == 0 ) { > sscanf( a, "%s", line ); > if( sscanf( &line[9], "%d", &vid->channel ) == 0 ) { > ar2VideoDispOption(); > free( vid ); > return 0; > } > } > else if( strncmp( a, "-dev=", 5 ) == 0 ) { > sscanf( a, "%s", line ); > if( sscanf( &line[5], "%s", vid->dev ) == 0 ) { > ar2VideoDispOption(); > free( vid ); > return 0; > } > } > else if( strncmp( a, "-mode=", 6 ) == 0 ) { > if( strncmp( &a[6], "PAL", 3 ) == 0 ) vid->mode = VIDEO_MODE_PAL; > else if( strncmp( &a[6], "NTSC", 4 ) == 0 ) vid->mode = VIDEO_MODE_NTSC; > else if( strncmp( &a[6], "SECAM", 5 ) == 0 ) vid->mode = VIDEO_MODE_SECAM; > else { > ar2VideoDispOption(); > free( vid ); > return 0; > } > } > else if( strncmp( a, "-debug", 6 ) == 0 ) { > vid->debug = 1; > } > else { > ar2VideoDispOption(); > free( vid ); > return 0; > } > > while( *a != ' ' && *a != '\t' && *a != '\0') a++; > } > } > > vid->fd = open(vid->dev, O_RDWR); > if(vid->fd < 0){ > printf("video device (%s) open failed\n",vid->dev); > free( vid ); > return 0; > } > > if(ioctl(vid->fd,VIDIOCGCAP,&vd) < 0){ > printf("ioctl failed\n"); > free( vid ); > return 0; > } > > if( vid->debug ) { > printf("=== debug info ===\n"); > printf(" vd.name = %s\n",vd.name); > printf(" vd.channels = %d\n",vd.channels); > printf(" vd.maxwidth = %d\n",vd.maxwidth); > printf(" vd.maxheight = %d\n",vd.maxheight); > printf(" vd.minwidth = %d\n",vd.minwidth); > printf(" vd.minheight = %d\n",vd.minheight); > } > > /* check capture size */ > if(vd.maxwidth < vid->width || vid->width < vd.minwidth || > vd.maxheight < vid->height || vid->height < vd.minheight ) { > printf("arVideoOpen: width or height oversize \n"); > free( vid ); > return 0; > } > > /* check channel */ > if(vid->channel < 0 || vid->channel >= vd.channels){ > printf("arVideoOpen: channel# is not valid. \n"); > free( vid ); > return 0; > } > > if( vid->debug ) { > printf("==== capture device channel info ===\n"); > } > > for(i = 0;i < vd.channels && i < MAXCHANNEL; i++){ > vc[i].channel = i; > if(ioctl(vid->fd,VIDIOCGCHAN,&vc[i]) < 0){ > printf("error: acquireing channel(%d) info\n",i); > free( vid ); > return 0; > } > > if( vid->debug ) { > printf(" channel = %d\n", vc[i].channel); > printf(" name = %s\n", vc[i].name); > printf(" tuners = %d", vc[i].tuners); > > printf(" flag = 0x%08x",vc[i].flags); > if(vc[i].flags & VIDEO_VC_TUNER) > printf(" TUNER"); > if(vc[i].flags & VIDEO_VC_AUDIO) > printf(" AUDIO"); > printf("\n"); > > printf(" vc[%d].type = 0x%08x", i, vc[i].type); > if(vc[i].type & VIDEO_TYPE_TV) > printf(" TV"); > if(vc[i].type & VIDEO_TYPE_CAMERA) > printf(" CAMERA"); > printf("\n"); > } > } > > /* select channel */ > vc[vid->channel].norm = vid->mode; /* 0: PAL 1: NTSC 2:SECAM 3:AUTO */ > if(ioctl(vid->fd, VIDIOCSCHAN, &vc[vid->channel]) < 0){ > printf("error: selecting channel %d\n", vid->channel); > free( vid ); > return 0; > } > > /* set video picture */ > vp.brightness = 32767 * 2.0 * vid->brightness; > vp.hue = 32767; > vp.colour = 32767 * 2.0 * vid->color; > vp.contrast = 32767 * 2.0 * vid->contrast; > vp.whiteness = 32767; > vp.depth = 24; /* color depth */ > #if defined(AR_PIX_FORMAT_BGRA) > vp.palette = VIDEO_PALETTE_RGB32; /* palette format */ > #elif defined(AR_PIX_FORMAT_BGR) > vp.palette = VIDEO_PALETTE_RGB24; /* palette format */ > #endif > if(ioctl(vid->fd, VIDIOCSPICT, &vp)) { > vid->palette = AR_VIDEO_PALETTE_YUV420; > vp.palette = VIDEO_PALETTE_YUV420; > if(ioctl(vid->fd, VIDIOCSPICT, &vp)) { > printf("error: setting palette\n"); > free( vid ); > return 0; > } > } > > /* get mmap info */ > if(ioctl(vid->fd,VIDIOCGMBUF,&vid->vm) < 0){ > printf("error: videocgmbuf\n"); > free( vid ); > return 0; > } > > if( vid->debug ) { > printf("===== Image Buffer Info =====\n"); > printf(" size = %d[bytes]\n", vid->vm.size); > printf(" frames = %d\n", vid->vm.frames); > } > if(vid->vm.frames < 2){ > printf("this device can not be supported by libARvideo.\n"); > printf("(vm.frames < 2)\n"); > free( vid ); > return 0; > } > > > /* get memory mapped io */ > if((vid->map = (ARUint8 *)mmap(0, vid->vm.size, PROT_READ|PROT_WRITE, MAP_SHARED, vid->fd, 0)) < 0){ > printf("error: mmap\n"); > free( vid ); > return 0; > } > > /*-----------------------------------------*/ > #if 0 > { > struct video_window vw; > > vw.x = 0; > vw.y = 0; > vw.width = vid->width; > vw.height = vid->height; > vw.chromakey = 0; > vw.flags = (30 << 16); > > if(ioctl(vid->fd,VIDIOCSWIN,&vw) < 0){ > printf("error: videocswin\n"); > free( vid ); > return 0; > } > } > #endif > > /* setup for vmm */ > vid->vmm.frame = 0; > vid->vmm.width = vid->width; > vid->vmm.height = vid->height; > if( vid->palette == AR_VIDEO_PALETTE_RGB ) { > #if defined(AR_PIX_FORMAT_BGRA) > vid->vmm.format = VIDEO_PALETTE_RGB32; > #elif defined(AR_PIX_FORMAT_BGR) > vid->vmm.format = VIDEO_PALETTE_RGB24; > #endif > } > else { > vid->vmm.format = VIDEO_PALETTE_YUV420; > arMalloc( vid->image, ARUint8, (vid->width * vid->height * AR_PIX_SIZE) ); > } > > vid->video_cont_num = -1; > > return vid; > } > > int ar2VideoClose( AR2VideoParamT *vid ) > { > if(vid->video_cont_num >= 0){ > ar2VideoCapStop( vid ); > } > close(vid->fd); > free( vid ); > > return 0; > } > > > int ar2VideoCapStart( AR2VideoParamT *vid ) > { > if(vid->video_cont_num >= 0){ > printf("arVideoCapStart has already been called.\n"); > return -1; > } > > vid->video_cont_num = 0; > vid->vmm.frame = vid->video_cont_num; > if(ioctl(vid->fd, VIDIOCMCAPTURE, &vid->vmm) < 0) { > return -1; > } > vid->vmm.frame = 1 - vid->vmm.frame; > if( ioctl(vid->fd, VIDIOCMCAPTURE, &vid->vmm) < 0) { > return -1; > } > > return 0; > } > > int ar2VideoCapNext( AR2VideoParamT *vid ) > { > if(vid->video_cont_num < 0){ > printf("arVideoCapStart has never been called.\n"); > return -1; > } > > vid->vmm.frame = 1 - vid->vmm.frame; > ioctl(vid->fd, VIDIOCMCAPTURE, &vid->vmm); > > return 0; > } > > int ar2VideoCapStop( AR2VideoParamT *vid ) > { > if(vid->video_cont_num < 0){ > printf("arVideoCapStart has never been called.\n"); > return -1; > } > if(ioctl(vid->fd, VIDIOCSYNC, &vid->video_cont_num) < 0){ > printf("error: videosync\n"); > return -1; > } > vid->video_cont_num = -1; > > return 0; > } > > ARUint8 *ar2VideoGetImage( AR2VideoParamT *vid ) > { > if( vid->palette == AR_VIDEO_PALETTE_RGB ) { > return ar2VideoGetImageRGB( vid ); > } > else if( vid->palette == AR_VIDEO_PALETTE_YUV420 ) { > return ar2VideoGetImageYUV420( vid ); > } > else { > return NULL; > } > } > > static ARUint8 *ar2VideoGetImageRGB( AR2VideoParamT *vid ) > { > if(vid->video_cont_num < 0){ > printf("arVideoCapStart has never been called.\n"); > return NULL; > } > > if(ioctl(vid->fd, VIDIOCSYNC, &vid->video_cont_num) < 0){ > printf("error: videosync\n"); > return NULL; > } > vid->video_cont_num = 1 - vid->video_cont_num; > > if(vid->video_cont_num == 0) > return (vid->map + vid->vm.offsets[1]); > else > return (vid->map + vid->vm.offsets[0]); > } > > static ARUint8 *ar2VideoGetImageYUV420( AR2VideoParamT *vid ) > { > ARUint8 *p0, *p1, *p2, *p3; > int i, j; > int R, G, B; > int U0, V0, V20, U50, UV0; > int U1, V1, V21, U51, UV1; > int Y0, Y1, Y2, Y3; > int Y4, Y5, Y6, Y7; > > if(vid->video_cont_num < 0){ > printf("arVideoCapStart has never been called.\n"); > return NULL; > } > > if(ioctl(vid->fd, VIDIOCSYNC, &vid->video_cont_num) < 0){ > printf("error: videosync\n"); > return NULL; > } > vid->video_cont_num = 1 - vid->video_cont_num; > > if(vid->video_cont_num == 0) p0 = vid->map + vid->vm.offsets[1]; > else p0 = vid->map + vid->vm.offsets[0]; > p1 = p0 + vid->width * 3 / 2; > p2 = vid->image + vid->height * vid->width * AR_PIX_SIZE - 1; > p3 = p2 - vid->width * AR_PIX_SIZE; > > for( j = 0; j < vid->height/2; j++ ) { > for( i = 0; i < vid->width/4; i++ ) { > Y0 = (ARUint8)*p0++; > Y1 = (ARUint8)*p0++; > Y2 = (ARUint8)*p0++; > Y3 = (ARUint8)*p0++; > V0 = ((ARUint8)*p0++ - 128) * 0.354; > V1 = ((ARUint8)*p0++ - 128) * 0.354; > > Y4 = (ARUint8)*p1++; > Y5 = (ARUint8)*p1++; > Y6 = (ARUint8)*p1++; > Y7 = (ARUint8)*p1++; > U0 = ((ARUint8)*p1++ - 128) * 0.707; > U1 = ((ARUint8)*p1++ - 128) * 0.707; > > U50 = 5*U0; > V20 = 2*V0; > UV0 = - U0 - V0; > U51 = 5*U1; > V21 = 2*V1; > UV1 = - U1 - V1; > > // Original equations > // R = Y + 1.402 V > // G = Y - 0.344 U - 0.714 V > // B = Y + 1.772 U > R = Y0 + V20; > if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; > > G = Y0 + UV0; > if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; > > B = Y0 + U50; > if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; > > *p2-- = (ARUint8)B; > *p2-- = (ARUint8)G; > *p2-- = (ARUint8)R; > > //--- > R = Y1 + V20; > if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; > > G = Y1 + UV0; > if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; > > B = Y1 + U50; > if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; > > *p2-- = (ARUint8)B; > *p2-- = (ARUint8)G; > *p2-- = (ARUint8)R; > > //--- > R = Y2 + V21; > if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; > > G = Y2 + UV1; > if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; > > B = Y2 + U51; > if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; > > *p2-- = (ARUint8)B; > *p2-- = (ARUint8)G; > *p2-- = (ARUint8)R; > > //--- > R = Y3 + V21; > if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; > > G = Y3 + UV1; > if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; > > B = Y3 + U51; > if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; > > *p2-- = (ARUint8)B; > *p2-- = (ARUint8)G; > *p2-- = (ARUint8)R; > > //--- > R = Y4 + V20; > if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; > > G = Y4 + UV0; > if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; > > B = Y4 + U50; > if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; > > *p3-- = (ARUint8)B; > *p3-- = (ARUint8)G; > *p3-- = (ARUint8)R; > > //--- > R = Y5 + V20; > if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; > > G = Y5 + UV0; > if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; > > B = Y5 + U50; > if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; > > *p3-- = (ARUint8)B; > *p3-- = (ARUint8)G; > *p3-- = (ARUint8)R; > > //--- > R = Y6 + V21; > if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; > > G = Y6 + UV1; > if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; > > B = Y6 + U51; > if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; > > *p3-- = (ARUint8)B; > *p3-- = (ARUint8)G; > *p3-- = (ARUint8)R; > > //--- > R = Y7 + V21; > if ((R >> 8) > 0) R = 255; else if (R < 0) R = 0; > > G = Y7 + UV1; > if ((G >> 8) > 0) G = 255; else if (G < 0) G = 0; > > B = Y7 + U51; > if ((B >> 8) > 0) B = 255; else if (B < 0) B = 0; > > *p3-- = (ARUint8)B; > *p3-- = (ARUint8)G; > *p3-- = (ARUint8)R; > } > p0 += vid->width * 3 / 2; > p1 += vid->width * 3 / 2; > p2 -= vid->width * AR_PIX_SIZE; > p3 -= vid->width * AR_PIX_SIZE; > } > > return vid->image; > } > > int ar2VideoInqSize(AR2VideoParamT *vid, int *x,int *y) > { > *x = vid->vmm.width; > *y = vid->vmm.height; > > return 0; > } > > > ------ include/AR/sys/videoLinuxV4L.h ------ > > /******************************************************* > * > * Author: Hirokazu Kato > * > * kato@s ........................ > * > * Revision: 4.5 > * Date: 2002/08/31 > * > *******************************************************/ > #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> > > #define AR_VIDEO_PALETTE_RGB 0 > #define AR_VIDEO_PALETTE_YUV420 1 > > typedef struct { > char dev[256]; > int width; > int height; > int channel; > int mode; > int palette; > ARUint8 *image; > int debug; > double contrast; > double brightness; > double color; > > int fd; > int video_cont_num; > ARUint8 *map; > struct video_mbuf vm; > struct video_mmap vmm; > } AR2VideoParamT; > > #ifdef __cplusplus > } > #endif > #endif > > > > > -- > ------------------------------------------------------------------ > Hirokazu Kato > Faculty of Information Sciences > Hiroshima City University Phone: +81-82-830-1705 > Email: kato@s ........................ Fax: +81-82-830-1435 > URL: http://www.sys.im.hiroshima-cu.ac.jp/people/kato/ > |
From: | David Drum <david@m ............> | Received: | Sep 14, 2002 |
To | artoolkit@h .................. | ||
Subject: | Re: error: setting palette | ||
Quoth Hirokazu Kato: > > -how about Firewire. Will all cameras work, or just some? > > I am using iBot and dragonFly firewire camera. > They work fine and can output 640x480 image 30fps. Sir, We seem to have the same environment Macintosh G4/400MHz 128MB RAM ATI Rage video (built-in on Titanium PowerBook) Mac OS X 10.1.5 Firewire Orangemicro iBot IOXperts Firewire Webcam Driver (evaluation version) Software installed: ARToolKit 2.65 Behavior: all programs are run from Terminal.app and open a secondary window which is black. All terminate with a segmentation fault. Running programs from gdb provides the following additional error message: Program received signal EXC_BAD_ACCESS, Could not access memory. 0x75a3b654 in YUVU_YUVToRGB32ARGBBitColor () Regards, David K. Drum david@m ....... |
From: | David Drum <david@m ............> | Received: | Sep 16, 2002 |
To | artoolkit@h .................. | ||
Subject: | Re: error: setting palette | ||
Quoth Hirokazu Kato: > Could you tell me the version number of QuickTime. > I am still using QuickTime5.0 and I have not tried 6.0 yet. > Is it same as yours? It was QuickTime 5.0. I specifically did not upgrade to 6.0 because I have a "Pro" key for version 5.0, which expires when 6.0 is installed. I've since upgraded to 10.2 "Jaguar" and the code does not work at all. There are many graphics differences between 10.1.5 and 10.2. I have heard from another project (Flightgear) that graphics performance drops considerably in 10.2 (unless you rewrite your code to the new APIs, I guess). I am probably going to downgrade to 10.1.5, in order to continue progress on this. Mac OS X 10.2 is not a requirement for my project. Regards, David K. Drum david@m ....... |
From: | Hirokazu Kato <kato@s ........................> | Received: | Sep 17, 2002 |
To | David Drum <david@m ............> | ||
Subject: | Re: error: setting palette | ||
>Macintosh >G4/400MHz >128MB RAM >ATI Rage video (built-in on Titanium PowerBook) >Mac OS X 10.1.5 >Firewire Orangemicro iBot >IOXperts Firewire Webcam Driver (evaluation version) > >Software installed: ARToolKit 2.65 >Behavior: all programs are run from Terminal.app and open a secondary > window which is black. All terminate with a segmentation fault. > Running programs from gdb provides the following additional > error message: > > Program received signal EXC_BAD_ACCESS, Could not access memory. > 0x75a3b654 in YUVU_YUVToRGB32ARGBBitColor () Could you tell me the version number of QuickTime. I am still using QuickTime5.0 and I have not tried 6.0 yet. Is it same as yours? -- ------------------------------------------------------------------ Hirokazu Kato Faculty of Information Sciences Hiroshima City University Phone: +81-82-830-1705 Email: kato@s ........................ Fax: +81-82-830-1435 URL: http://www.sys.im.hiroshima-cu.ac.jp/people/kato/ |
From: | Marc Demlenne <m.demlenne@s ........> | Received: | Mar 5, 2003 |
To | artoolkit@h .................. | ||
Subject: | error: setting palette | ||
Hi all, I've some problems beginning using artoolkit. Maybe can you help ? Here's the result i got when i run a test with debug on: === debug info === vd.name = OV511+ USB Camera vd.channels = 1 vd.maxwidth = 640 vd.maxheight = 480 vd.minwidth = 64 vd.minheight = 48 ==== capture device channel info === channel = 0 name = Camera tuners = 0 flag = 0x00000000 vc[0].type = 0x00000002 CAMERA error: setting palette Take a look at the last line. This problem doesn't appear with all PC, and i'm using the same OS, the same version of program, and the same camera ... All the params seems OK, but it fails. Any idea to help me ? Thanks a lot ! -- __o _`\<,_ Marc Demlenne Public Key on www.keyserver.net (_)/ (_) GPG/768FA483 BFD8 E61B 180C 3E7A 3435 D393 B605 9979 768F A483 |
From: | Robert Hinn <exodus@o ........> | Received: | Mar 5, 2003 |
To | artoolkit@h .................. | ||
Subject: | Re: error: setting palette | ||
Hm, I had the same problem. It's the USB camera you are using. Most likely it doesn't send it's pictures in RGB24 or RGB32 format, which is required by the ARToolkit. My camera (Philips ToUCam 740K) sends the pictures only in YUV420P format. If you are adventurous, you can look into the Firewire driver of the ARToolkit, they do some color conversion there... It might be a good idea to modularize the ARToolkit a bit, so that one could more easily insert an image converter... If your camera also uses the YUV420P format, I could send you the code that I used to convert the images... You'd have to paste that into the ARToolkit code, though. Which version are you using, 2.50? Bye, Robert. Marc Demlenne schrieb: > Hi all, > > I've some problems beginning using artoolkit. > Maybe can you help ? > Here's the result i got when i run a test with debug on: > > === debug info === > vd.name = OV511+ USB Camera > vd.channels = 1 > vd.maxwidth = 640 > vd.maxheight = 480 > vd.minwidth = 64 > vd.minheight = 48 > ==== capture device channel info === > channel = 0 > name = Camera > tuners = 0 flag = 0x00000000 > vc[0].type = 0x00000002 CAMERA > error: setting palette > > Take a look at the last line. This problem doesn't appear with all PC, > and i'm using the same OS, the same version of program, and the same > camera ... All the params seems OK, but it fails. > > Any idea to help me ? > > Thanks a lot ! > |
From: | Robert Hinn <exodus@o ........> | Received: | Mar 5, 2003 |
To | artoolkit@h .................. | ||
Subject: | Re: error: setting palette | ||
Hm, I had the same problem. It's the USB camera you are using. Most likely it doesn't send it's pictures in RGB24 or RGB32 format, which is required by the ARToolkit. My camera (Philips ToUCam 740K) sends the pictures only in YUV420P format. If you are adventurous, you can look into the Firewire driver of the ARToolkit, they do some color conversion there... It might be a good idea to modularize the ARToolkit a bit, so that one could more easily insert an image converter... If your camera also uses the YUV420P format, I could send you the code that I used to convert the images... You'd have to paste that into the ARToolkit code, though. Which version are you using, 2.50? Bye, Robert. Marc Demlenne schrieb: > Hi all, > > I've some problems beginning using artoolkit. > Maybe can you help ? > Here's the result i got when i run a test with debug on: > > === debug info === > vd.name = OV511+ USB Camera > vd.channels = 1 > vd.maxwidth = 640 > vd.maxheight = 480 > vd.minwidth = 64 > vd.minheight = 48 > ==== capture device channel info === > channel = 0 > name = Camera > tuners = 0 flag = 0x00000000 > vc[0].type = 0x00000002 CAMERA > error: setting palette > > Take a look at the last line. This problem doesn't appear with all PC, > and i'm using the same OS, the same version of program, and the same > camera ... All the params seems OK, but it fails. > > Any idea to help me ? > > Thanks a lot ! > |
From: | Marc Demlenne <m.demlenne@s ........> | Received: | Mar 5, 2003 |
To | Robert Hinn <exodus@o ........> | ||
Subject: | Re: error: setting palette | ||
How can i make sure of format used by the cam ? It's a Creative WebCam PRO [1] I've tried different mode by passing parameters while loading the module, but nothing changed. I'm under Linux, using ARToolKit version 2.61. I'd be happy with your code. I'll take a look at it. But i've also another problem with another camera. It's a PtGrey Bumblebee stereocam[2], running over Firewire bus. When using it, ARToolKit says the format isn't recognized... I'm still looking at it but it seems IEEE1394 isn't fully supported in ARTK yet, am i wrong ? [1] http://uk.europe.creative.com/products/product.asp?prod=332&page=1 [2] http://www.ptgrey.com/products/bumblebee/index.html Thanks a lot On Wed, Mar 05, 2003 at 12:55:27PM +0100, Robert Hinn wrote: > > Hm, I had the same problem. It's the USB camera you are using. Most > likely it doesn't send it's pictures in RGB24 or RGB32 format, which is > required by the ARToolkit. My camera (Philips ToUCam 740K) sends the > pictures only in YUV420P format. If you are adventurous, you can look > into the Firewire driver of the ARToolkit, they do some color conversion > there... > > It might be a good idea to modularize the ARToolkit a bit, so that one > could more easily insert an image converter... > > If your camera also uses the YUV420P format, I could send you the code > that I used to convert the images... You'd have to paste that into the > ARToolkit code, though. Which version are you using, 2.50? > > > Bye, > Robert. -- __o _`\<,_ Marc Demlenne Public Key on www.keyserver.net (_)/ (_) GPG/768FA483 BFD8 E61B 180C 3E7A 3435 D393 B605 9979 768F A483 |
From: | christoph ganser <ganser@e ...............> | Received: | Mar 5, 2003 |
To | Marc Demlenne <m.demlenne@s ........>, artoolkit@h .................. | ||
Subject: | Re: error: setting palette | ||
hi you can use the coriander application to test the different modes of the ieee1394 camera. http://sourceforge.net/projects/coriander i am using i-bot and fire-i ieee1394 camera on linux. bye christoph Marc Demlenne wrote: > But i've also another problem with another camera. It's a PtGrey > Bumblebee stereocam[2], running over Firewire bus. When using it, ARToolKit > says the format isn't recognized... I'm still looking at it but it > seems IEEE1394 isn't fully supported in ARTK yet, am i wrong ? > > [1] http://uk.europe.creative.com/products/product.asp?prod=332&page=1 > [2] http://www.ptgrey.com/products/bumblebee/index.html > |
From: | christoph ganser <ganser@e ...............> | Received: | Mar 5, 2003 |
To | Marc Demlenne <m.demlenne@s ........>, artoolkit@h .................. | ||
Subject: | Re: error: setting palette | ||
hi you can use the coriander application to test the different modes of the ieee1394 camera. http://sourceforge.net/projects/coriander i am using i-bot and fire-i ieee1394 camera on linux. bye christoph Marc Demlenne wrote: > But i've also another problem with another camera. It's a PtGrey > Bumblebee stereocam[2], running over Firewire bus. When using it, ARToolKit > says the format isn't recognized... I'm still looking at it but it > seems IEEE1394 isn't fully supported in ARTK yet, am i wrong ? > > [1] http://uk.europe.creative.com/products/product.asp?prod=332&page=1 > [2] http://www.ptgrey.com/products/bumblebee/index.html > |
From: | "Wayne Piekarski" <wayne@c ..............> | Received: | Mar 6, 2003 |
To | "Marc Demlenne" <m.demlenne@s ........>, "Robert Hinn" <exodus@o ........> | ||
Subject: | Re: error: setting palette | ||
Hi, We have a Bumblebee stereo camera as well, and I don't think it uses either the DC (web cam) or DV (video camera) protocols. Neither Linux or Windows XP recognise it using the standard drivers. In order to make the camera work under Windows you need to install their driver. To make the camera work you would need to work out the protocol they use and then write a driver for it possibly. I haven't really looked into this but I know it doesn't work out of the box. regards, Wayne ---------------------------------------------------------------------------- Wayne Piekarski - PhD Researcher / Lecturer pho: +61-8-8302-3669 fax: +61-8-8302-3381 Tinmith Project - Wearable Computer Lab mob: 0407-395-889 Advanced Computing Research Centre ema: wayne@c .............. University of South Australia www: http://www.tinmith.net ----- Original Message ----- From: "Marc Demlenne" <m.demlenne@s ........> To: "Robert Hinn" <exodus@o ........> Cc: <artoolkit@h ..................> Sent: Wednesday, March 05, 2003 11:29 PM Subject: Re: error: setting palette > How can i make sure of format used by the cam ? It's a Creative WebCam > PRO [1] I've tried different mode by passing parameters while loading the > module, but nothing changed. > > I'm under Linux, using ARToolKit version 2.61. I'd be happy with your > code. I'll take a look at it. > > But i've also another problem with another camera. It's a PtGrey > Bumblebee stereocam[2], running over Firewire bus. When using it, ARToolKit > says the format isn't recognized... I'm still looking at it but it > seems IEEE1394 isn't fully supported in ARTK yet, am i wrong ? > > [1] http://uk.europe.creative.com/products/product.asp?prod=332&page=1 > [2] http://www.ptgrey.com/products/bumblebee/index.html > > Thanks a lot > > On Wed, Mar 05, 2003 at 12:55:27PM +0100, Robert Hinn wrote: > > > > Hm, I had the same problem. It's the USB camera you are using. Most > > likely it doesn't send it's pictures in RGB24 or RGB32 format, which is > > required by the ARToolkit. My camera (Philips ToUCam 740K) sends the > > pictures only in YUV420P format. If you are adventurous, you can look > > into the Firewire driver of the ARToolkit, they do some color conversion > > there... > > > > It might be a good idea to modularize the ARToolkit a bit, so that one > > could more easily insert an image converter... > > > > If your camera also uses the YUV420P format, I could send you the code > > that I used to convert the images... You'd have to paste that into the > > ARToolkit code, though. Which version are you using, 2.50? > > > > > > Bye, > > Robert. > > -- > __o > _`\<,_ Marc Demlenne Public Key on www.keyserver.net > (_)/ (_) GPG/768FA483 BFD8 E61B 180C 3E7A 3435 D393 B605 9979 768F A483 > |
From: | "Wayne Piekarski" <wayne@c ..............> | Received: | Mar 6, 2003 |
To | "Marc Demlenne" <m.demlenne@s ........>, "Robert Hinn" <exodus@o ........> | ||
Subject: | Re: error: setting palette | ||
Hi, We have a Bumblebee stereo camera as well, and I don't think it uses either the DC (web cam) or DV (video camera) protocols. Neither Linux or Windows XP recognise it using the standard drivers. In order to make the camera work under Windows you need to install their driver. To make the camera work you would need to work out the protocol they use and then write a driver for it possibly. I haven't really looked into this but I know it doesn't work out of the box. regards, Wayne ---------------------------------------------------------------------------- Wayne Piekarski - PhD Researcher / Lecturer pho: +61-8-8302-3669 fax: +61-8-8302-3381 Tinmith Project - Wearable Computer Lab mob: 0407-395-889 Advanced Computing Research Centre ema: wayne@c .............. University of South Australia www: http://www.tinmith.net ----- Original Message ----- From: "Marc Demlenne" <m.demlenne@s ........> To: "Robert Hinn" <exodus@o ........> Cc: <artoolkit@h ..................> Sent: Wednesday, March 05, 2003 11:29 PM Subject: Re: error: setting palette > How can i make sure of format used by the cam ? It's a Creative WebCam > PRO [1] I've tried different mode by passing parameters while loading the > module, but nothing changed. > > I'm under Linux, using ARToolKit version 2.61. I'd be happy with your > code. I'll take a look at it. > > But i've also another problem with another camera. It's a PtGrey > Bumblebee stereocam[2], running over Firewire bus. When using it, ARToolKit > says the format isn't recognized... I'm still looking at it but it > seems IEEE1394 isn't fully supported in ARTK yet, am i wrong ? > > [1] http://uk.europe.creative.com/products/product.asp?prod=332&page=1 > [2] http://www.ptgrey.com/products/bumblebee/index.html > > Thanks a lot > > On Wed, Mar 05, 2003 at 12:55:27PM +0100, Robert Hinn wrote: > > > > Hm, I had the same problem. It's the USB camera you are using. Most > > likely it doesn't send it's pictures in RGB24 or RGB32 format, which is > > required by the ARToolkit. My camera (Philips ToUCam 740K) sends the > > pictures only in YUV420P format. If you are adventurous, you can look > > into the Firewire driver of the ARToolkit, they do some color conversion > > there... > > > > It might be a good idea to modularize the ARToolkit a bit, so that one > > could more easily insert an image converter... > > > > If your camera also uses the YUV420P format, I could send you the code > > that I used to convert the images... You'd have to paste that into the > > ARToolkit code, though. Which version are you using, 2.50? > > > > > > Bye, > > Robert. > > -- > __o > _`\<,_ Marc Demlenne Public Key on www.keyserver.net > (_)/ (_) GPG/768FA483 BFD8 E61B 180C 3E7A 3435 D393 B605 9979 768F A483 > |