ARToolKit | Mailing List Archive |
![]() |
From: | Peter Oost <h.b.oost@s .................> | Received: | Oct 29, 2004 |
To | ARToolKit <artoolkit@h ..................> | ||
Subject: | YUV420P to RGB | ||
Hello, I'm trying to get the linux version of the ARToolKit to work with my Philips PCVC730K webcamera (pwc/pwcx driver). This camera seems to work in YUV420P mode instead of RGB24 or RGB32 which the toolkit apparently wants to use. An earlier discussion on this mailinglist [1] led to the site of Thomas Pintaric [2]. He apparently solved this, but it appears to be windows only. Also, I'm unable to find what he added to the toolkit. Philip Lambs version [3] is an adaptation of Pintaric's and should work under linux. That version however doesn't 'automatically' convert my camera's image to RGB. Am I missing a configuration option or is it not there? Regards, -Peter Oost [1] http://www.hitl.washington.edu/artoolkit/mail-archive/message-thread-00277-Re--YUV420P-for-ARToolKi.html [2] http://www.ims.tuwien.ac.at/~thomas/artoolkit.php [3] http://www.eden.net.nz/phil/develop/artoolkit/ |
From: | "Eike M. Lang" <lang@i ......................> | Received: | Oct 30, 2004 |
To | ARToolKit <artoolkit@h ..................> | ||
Subject: | Re: YUV420P to RGB | ||
Am Fr, den 29.10.2004 schrieb Peter Oost um 23:15: Hi Peter, > I'm trying to get the linux version of the ARToolKit to work with my > Philips PCVC730K webcamera (pwc/pwcx driver). This camera seems to work > in YUV420P mode instead of RGB24 or RGB32 which the toolkit apparently > wants to use. > An earlier discussion on this mailinglist [1] led to the site of Thomas > Pintaric [2]. He apparently solved this, but it appears to be windows > only. Also, I'm unable to find what he added to the toolkit. > Philip Lambs version [3] is an adaptation of Pintaric's and should work > under linux. That version however doesn't 'automatically' convert my > camera's image to RGB. Am I missing a configuration option or is it not > there? There's another discussion on this mailing list that should lead to a modified 2.61 version that can deal with those cams (or rather their color model). The patch and additional files work nicely with 2.68_2. I have the relevant data at the office (i.e. not available right now) but if you don't manage to get a hold of the stuff until Tuesday I can tar it up and pass it to you. I really should try to get a hold of the original modifier and ask him if it is ok to include in ARTK, prepare a patch and send it on to Philip. (This is more a matter of politeness, if I'm not mistaken it'd probably be ok license-wise to include it anyways, in case I can't get a hold of him.) Best Regards, Eike -- Eike M. Lang <lang@i ......................> |
From: | Philip Lamb <phil@e ..........> | Received: | Oct 30, 2004 |
To | Peter Oost <h.b.oost@s .................>, ARToolKit <artoolkit@h ..................> | ||
Subject: | Re: YUV420P to RGB | ||
Hi Peter, There is YUV image support in various places in ARToolKit 2.68.2, but its a bit patchy, platform-specific, and most of it can be invoked only at compile-time. The support comes in 3 places: 1) libARVideo (frame capture). I added compile-time support on Mac OS X for generating frames in two common Mac OS X YUV formats (more accurately, YCbCr422 formats). Thomas Pintaric's DSVideoLib includes support for some Windows YUV formats, and various drivers under Linux will return YUV data. 2) libAR (marker detection). I have added rudimentary support to libAR to handle YUV data in the two common Mac OS X formats. Both are subsampled, with one luma sample per 16 bits. In one format, the first byte of each 16 bits is luma, and in the other its the second byte. I make no guarantees that these will be suitable for use on any other platform, but if they are, you can invoke them by defining either AR_PIX_FORMAT_2vuy or AR_PIX_FORMAT_yuvs when compiling libAR. 3) libARgsub_lite, libARgsub (frame display). Actually displaying YUV data correctly on an RGB video device will require support in your OpenGL implementation. I added support for displaying YUV pixel data using OpenGL on Mac OS X using the GL_APPLE_ycbcr_422 extension. This extension or a similar one may be available on your Linux OpenGL implementation which you could use, for example GL_EXT_422_pixels <http://oss.sgi.com/projects/ogl-sample/registry/EXT/422_pixels.txt> or GL_MESA_ycbcr_texture <http://oss.sgi.com/projects/ogl-sample/registry/MESA/ycbcr_texture.txt>. Check your implementations extensions string for support. The net result of this is (at least on Mac OS X) that if AR_PIX_FORMAT_2vuy or AR_PIX_FORMAT_yuvs is defined at the time the libraries are compiled, data will be maintained in YUV format all the way from the camera to the graphics card. This results in some big performance improvements. Ideally, the pixel format used by the various ARToolKit libraries would be specified at runtime. I'd guess reason these changes haven't been implemented already is partly due to performance (having lots of switch(pixelFormat){} statements in core image processing loops could be costly), and partly the lack of widespread OpenGL extension support for displaying YUV data. Of course, an alternative to all this is just to massage the pixel data returned by libARvideo into RGB format yourself, and then use as normal in libAR and libARgsub_lite. This shouldn't be hard, but will cost a few CPU cycles. Regards, Phil. At 11:15 PM +0200 29/10/04, Peter Oost wrote: >Hello, > >I'm trying to get the linux version of the ARToolKit to work with my >Philips PCVC730K webcamera (pwc/pwcx driver). This camera seems to work >in YUV420P mode instead of RGB24 or RGB32 which the toolkit apparently >wants to use. >An earlier discussion on this mailinglist [1] led to the site of Thomas >Pintaric [2]. He apparently solved this, but it appears to be windows >only. Also, I'm unable to find what he added to the toolkit. >Philip Lambs version [3] is an adaptation of Pintaric's and should work >under linux. That version however doesn't 'automatically' convert my >camera's image to RGB. Am I missing a configuration option or is it not >there? > >Regards, >-Peter Oost > >[1] >http://www.hitl.washington.edu/artoolkit/mail-archive/message-thread-00277-Re--YUV420P-for-ARToolKi.html > >[2] http://www.ims.tuwien.ac.at/~thomas/artoolkit.php > >[3] http://www.eden.net.nz/phil/develop/artoolkit/ -- Philip Lamb Research Student, Human Interface Technology Laboratory New Zealand, University of Canterbury, Christchurch, NZ. +64 3 3642987 x3070 |
From: | Peter Oost <h.b.oost@s .................> | Received: | Oct 30, 2004 |
To | ARToolKit <artoolkit@h ..................> | ||
Subject: | Re: YUV420P to RGB | ||
At 11:15 PM +0200 29/10/04, Peter Oost wrote: > > >I'm trying to get the linux version of the ARToolKit to work with my > >Philips PCVC730K webcamera (pwc/pwcx driver). This camera seems to work > >in YUV420P mode instead of RGB24 or RGB32 which the toolkit apparently > >wants to use. On Sat, 2004-10-30 at 13:38 +1300, Philip Lamb wrote: > > There is YUV image support in various places in ARToolKit 2.68.2, but > its a bit patchy, platform-specific, and most of it can be invoked > only at compile-time. > > The support comes in 3 places: > 1) libARVideo (frame capture). I added compile-time support on Mac OS > X for generating frames in two common Mac OS X YUV formats (more > accurately, YCbCr422 formats). Thomas Pintaric's DSVideoLib includes > support for some Windows YUV formats, and various drivers under Linux > will return YUV data. > > 2) libAR (marker detection). I have added rudimentary support to > libAR to handle YUV data in the two common Mac OS X formats. Both are > subsampled, with one luma sample per 16 bits. In one format, the > first byte of each 16 bits is luma, and in the other its the second > byte. I make no guarantees that these will be suitable for use on any > other platform, but if they are, you can invoke them by defining > either AR_PIX_FORMAT_2vuy or AR_PIX_FORMAT_yuvs when compiling libAR. > > 3) libARgsub_lite, libARgsub (frame display). Actually displaying YUV > data correctly on an RGB video device will require support in your > OpenGL implementation. I added support for displaying YUV pixel data > using OpenGL on Mac OS X using the GL_APPLE_ycbcr_422 extension. This > extension or a similar one may be available on your Linux OpenGL > implementation which you could use, for example GL_EXT_422_pixels > <http://oss.sgi.com/projects/ogl-sample/registry/EXT/422_pixels.txt> > or GL_MESA_ycbcr_texture > <http://oss.sgi.com/projects/ogl-sample/registry/MESA/ycbcr_texture.txt>. > Check your implementations extensions string for support. > > The net result of this is (at least on Mac OS X) that if > AR_PIX_FORMAT_2vuy or AR_PIX_FORMAT_yuvs is defined at the time the > libraries are compiled, data will be maintained in YUV format all the > way from the camera to the graphics card. This results in some big > performance improvements. > > Ideally, the pixel format used by the various ARToolKit libraries > would be specified at runtime. I'd guess reason these changes haven't > been implemented already is partly due to performance (having lots of > switch(pixelFormat){} statements in core image processing loops could > be costly), and partly the lack of widespread OpenGL extension > support for displaying YUV data. > > Of course, an alternative to all this is just to massage the pixel > data returned by libARvideo into RGB format yourself, and then use as > normal in libAR and libARgsub_lite. This shouldn't be hard, but will > cost a few CPU cycles. > > Regards, > Phil. That sounds interesting. However I doubt I have the time / knowledge to do this quickly. I'll be sure to have a look at it out of interest when I have time though. > Am Fr, den 29.10.2004 schrieb Peter Oost um 23:15: > > There's another discussion on this mailing list that should lead to a > modified 2.61 version that can deal with those cams (or rather their > color model). The patch and additional files work nicely with 2.68_2. > I have the relevant data at the office (i.e. not available right now) > but if you don't manage to get a hold of the stuff until Tuesday I can > tar it up and pass it to you. > > I really should try to get a hold of the original modifier and ask him > if it is ok to include in ARTK, prepare a patch and send it on to > Philip. (This is more a matter of politeness, if I'm not mistaken it'd > probably be ok license-wise to include it anyways, in case I can't get > a hold of him.) You are referring to the patch by Uwe Woessner? I have read about his patch but have been unable to find the patch itself. I would really appreciate it if you could send me the patch. In the mean time I have found a few (partially) working patches for older versions of the toolkit. I'll play around with those and with Phil's suggestion. Thanks, -Peter |
From: | Peter Oost <h.b.oost@s .................> | Received: | Oct 31, 2004 |
To | ARToolKit <artoolkit@h ..................> | ||
Subject: | Re: YUV420P to RGB | ||
On Sun, 2004-10-31 at 09:45 +0100, Uwe Woessner wrote: > Hi Peter, > I added support for YUV420 a while ago, you can find the files here: > > http://www.hlrs.de/people/woessner/Austausch/ARToolKit > ARToolKit2.61_YUV420P.tar.gz is the full ARToolkit code with changes. > changes is a diff and ccvt* are the additional files (taken from the one > who coded the Linux driver for Philips Cameras) > see http://www.smcc.demon.nl/webcam/ Thank you Uwe. Your implementation works like a charm. My camera returns an image mirrored on the x-axis but I'm sure I can flip an RGB-image :) After that I'm good to start on my project. Thanks, -Peter |