ARToolKit | Mailing List Archive |
![]() |
From: | Blair MacIntyre <blair@c ............> | Received: | May 6, 2005 |
To | "Eike M.Lang" <lang@i ......................> | ||
Subject: | Re: Convert YUV to RGB | ||
I think ARTag can work on greyscale images; just take the Y channel =20 (luminance) and use it to create a greyscale image. On May 6, 2005, at 9:13 AM, Eike M.Lang wrote: > Hi everyone, > > I'd like to experiment a bit with the ARTag library but in order to =20= > do that I need to convert the image I get from my cam from YUV to =20 > RGB (I use ARToolkit on a Mac and my quick perusal of the Code =20 > indicates I'm dealing with 'yuvu'). > > I hope I'll figure the conversion out eventually, but I'd like to =20 > take this opportunity to check whether any list susbscribers have =20 > had to make that conversion and would be willing to share their code. > > Best regards, > Eike > > --=20 > Dipl.-Inform. Eike M. Lang > Universit=E4t Duisburg-Essen (Standort Duisburg) > Institut f=FCr Informatik und Interaktive Systeme > Lotharstrasse 65, Raum LF 284, 47057 Duisburg > > email: lang@i ...................... > Tel. : +49 203 379-1417 Fax -3557 > |
From: | Eike M.Lang <lang@i ......................> | Received: | May 6, 2005 |
To | ARToolkit ARToolKit <artoolkit@h ..................> | ||
Subject: | Convert YUV to RGB | ||
Hi everyone, I'd like to experiment a bit with the ARTag library but in order to do=20= that I need to convert the image I get from my cam from YUV to RGB (I=20 use ARToolkit on a Mac and my quick perusal of the Code indicates I'm=20 dealing with 'yuvu'). I hope I'll figure the conversion out eventually, but I'd like to take=20= this opportunity to check whether any list susbscribers have had to=20 make that conversion and would be willing to share their code. Best regards, Eike --=20 Dipl.-Inform. Eike M. Lang Universit=E4t Duisburg-Essen (Standort Duisburg) Institut f=FCr Informatik und Interaktive Systeme Lotharstrasse 65, Raum LF 284, 47057 Duisburg email: lang@i ...................... Tel. : +49 203 379-1417 Fax -3557 |
From: | Eike M.Lang <lang@i ......................> | Received: | May 6, 2005 |
To | ARToolkit ARToolKit <artoolkit@h ..................> | ||
Subject: | Re: Convert YUV to RGB | ||
Am 06.05.2005 um 16:00 schrieb Blair MacIntyre: > I think ARTag can work on greyscale images; just take the Y channel=20= > (luminance) and use it to create a greyscale image. That was my first idea but when it didn't work I concluded (wrongly, it=20= seems) that taking the Y channel is not close enough to real grayscale=20= for this to work. Seems I did something wrong. Just to be on the safe side: Am I correct in assuming that the 640x480=20= 'yuvu' image I get from ARToolkit should consist of 640x480x2 ARUint8's=20= ordered Y0 Cb Y1 Cr Y2 Cb Y3 ... and so forth (Cb an Cr shared between=20= Yn and Y(n+1), n in {0,2,4...}) so I'd only need to take every other=20 ARUint8 from the image, starting at index 0, to get my greyscale image? Best regards, Eike --=20 Dipl.-Inform. Eike M. Lang Universit=E4t Duisburg-Essen (Standort Duisburg) Institut f=FCr Informatik und Interaktive Systeme Lotharstrasse 65, Raum LF 284, 47057 Duisburg email: lang@i ...................... Tel. : +49 203 379-1417 Fax -3557 |
From: | Philip Lamb <phil@e ..........> | Received: | May 7, 2005 |
To | Eike M.Lang <lang@i ......................> | ||
Subject: | Re: Convert YUV to RGB | ||
Eike, Are you sure you're getting 'yuvu' data? The only YUV formats supported=20= natively by the toolkit on Mac OS X are '2vuy' and 'yuvs'. (See=20 http://developer.apple.com/quicktime/icefloe/dispatch020.html) for the=20= layout of these pixel formats. All other formats are only supported by=20= having them converted to ARGB (internally to libARVideo.) At present in the toolkit (v2.70.1) the video format used is determined=20= at compile-time, by options in config.h. Take a look and see what=20 format is being used. Phil. On 07/05/2005, at 2:11 AM, Eike M.Lang wrote: > > Am 06.05.2005 um 16:00 schrieb Blair MacIntyre: > >> I think ARTag can work on greyscale images; just take the Y channel=20= >> (luminance) and use it to create a greyscale image. > > That was my first idea but when it didn't work I concluded (wrongly,=20= > it seems) that taking the Y channel is not close enough to real=20 > grayscale for this to work. Seems I did something wrong. > > Just to be on the safe side: Am I correct in assuming that the 640x480=20= > 'yuvu' image I get from ARToolkit should consist of 640x480x2=20 > ARUint8's ordered Y0 Cb Y1 Cr Y2 Cb Y3 ... and so forth (Cb an Cr=20 > shared between Yn and Y(n+1), n in {0,2,4...}) so I'd only need to=20 > take every other ARUint8 from the image, starting at index 0, to get=20= > my greyscale image? > > Best regards, > Eike > > --=20 > Dipl.-Inform. Eike M. Lang > Universit=E4t Duisburg-Essen (Standort Duisburg) > Institut f=FCr Informatik und Interaktive Systeme > Lotharstrasse 65, Raum LF 284, 47057 Duisburg > > email: lang@i ...................... > Tel. : +49 203 379-1417 Fax -3557 > Philip Lamb |
From: | Eike M.Lang <lang@i ......................> | Received: | May 9, 2005 |
To | Philip Lamb <phil@e ..........>, ARToolkit ARToolKit <artoolkit@h ..................> | ||
Subject: | Re: Convert YUV to RGB | ||
Am 07.05.2005 um 00:40 schrieb Philip Lamb: Hi Phil, > Are you sure you're getting 'yuvu' data? I was until you brought up the question ;) I'm just now trying to=20 figure out what made me think it had to be yuvu but I'm sure it has=20 something to do with digging around in the MacOS version of video.c=20 instead of checking config.h... > The only YUV formats supported natively by the toolkit on Mac OS X are=20= > '2vuy' and 'yuvs'. (See=20 > http://developer.apple.com/quicktime/icefloe/dispatch020.html) for the=20= > layout of these pixel formats. Yeah, found that page when googling for the "kYUVUPixelFormat" string I=20= stumbled over in video.c > At present in the toolkit (v2.70.1) the video format used is=20 > determined at compile-time, by options in config.h. Take a look and=20 > see what format is being used. It is, of course, 2vuy -- by taking all uneven bytes instead of taking=20= the even ones I finally get me the grayscale image artag can deal=20 with... Thanks a lot for your hint. Best Regards, Eike --=20 Dipl.-Inform. Eike M. Lang Universit=E4t Duisburg-Essen (Standort Duisburg) Institut f=FCr Informatik und Interaktive Systeme Lotharstrasse 65, Raum LF 284, 47057 Duisburg email: lang@i ...................... Tel. : +49 203 379-1417 Fax -3557 |
From: | Eike Michael Lang <lang@i ......................> | Received: | May 9, 2005 |
To | ARToolKit <artoolkit@h ..................> | ||
Subject: | Re: Convert YUV to RGB | ||
Am 09.05.2005 um 22:07 schrieb Philip Lamb: > One thing to be aware of with 2vuy data, is that it it has =20 > different black and white levels to what you might expect. Black =20 > level is 16 and white 235. Values outside these ranges should be =20 > clamped. If you only need to threshold the data (as ARToolKit does) =20= > you can pretty safely ignore this. If you want to display it as a =20 > grayscale image, you can use the opengl extensions for data with =20 > that range (again, as ARToolKit on the Mac does.) If however you =20 > want to get the full dynamic range from luma samples (int L) in =20 > 2vuy data, you will want to take int L' =3D (int)((float)(L-16) * =20 > 1.1643836) For now, all I want is something artag will find markers in and first =20= tests indicate it works well enough for the moment. I'll keep those =20 formulas handy in case I'll have to do it properly, thanks. Regards, Eike --=20 Dipl.-Inform. Eike M. Lang Universit=E4t Duisburg-Essen (Standort Duisburg) Institut f=FCr Informatik und Interaktive Systeme Lotharstrasse 65, Raum LF 284, 47057 Duisburg email: lang@i ...................... Tel. : +49 203 379-1417 Fax -3557 |
From: | Philip Lamb <phil@e ..........> | Received: | May 10, 2005 |
To | Eike M.Lang <lang@i ......................> | ||
Subject: | Re: Convert YUV to RGB | ||
On 09/05/2005, at 9:59 PM, Eike M.Lang wrote: > Am 07.05.2005 um 00:40 schrieb Philip Lamb: >> The only YUV formats supported natively by the toolkit on Mac OS X >> are '2vuy' and 'yuvs'. (See >> http://developer.apple.com/quicktime/icefloe/dispatch020.html) for >> the layout of these pixel formats. > > > It is, of course, 2vuy -- by taking all uneven bytes instead of taking > the even ones I finally get me the grayscale image artag can deal > with... > Thanks a lot for your hint. One thing to be aware of with 2vuy data, is that it it has different black and white levels to what you might expect. Black level is 16 and white 235. Values outside these ranges should be clamped. If you only need to threshold the data (as ARToolKit does) you can pretty safely ignore this. If you want to display it as a grayscale image, you can use the opengl extensions for data with that range (again, as ARToolKit on the Mac does.) If however you want to get the full dynamic range from luma samples (int L) in 2vuy data, you will want to take int L' = (int)((float)(L-16) * 1.1643836) Regards, Phil. Philip Lamb |
From: | Yongduek SEO <yndk@s ...........> | Received: | Jun 10, 2005 |
To | ARToolkit <artoolkit@h ..................> | ||
Subject: | Re: Convert YUV to RGB | ||
--Apple-Mail-3-491147526 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed I'm very curious why the video format has been set to '2yuv' instead of 'ARGB' which is conceptually very simple. Would you let me know the reason? Today, I modified the header file 'config.h': // #define AR_PIX_FORMAT_2yuv #define AR_PIX_FORMAT_ARGB then make clean; make After this, I could get ARGB image directly in the program: simpleLite.c At first I thought this is automatic through QuickTime; but I wonder whether this is a result of calling a converting function inside ARToolkit libraries? YNDK. On 09/05/2005, at 9:59 PM, Eike M.Lang wrote: > Am 07.05.2005 um 00:40 schrieb Philip Lamb: >> The only YUV formats supported natively by the toolkit on Mac OS X >> are '2vuy' and 'yuvs'. (See >> http://developer.apple.com/quicktime/icefloe/dispatch020.html) for >> the layout of these pixel formats. > > > It is, of course, 2vuy -- by taking all uneven bytes instead of taking > the even ones I finally get me the grayscale image artag can deal > with... > Thanks a lot for your hint. One thing to be aware of with 2vuy data, is that it it has different black and white levels to what you might expect. Black level is 16 and white 235. Values outside these ranges should be clamped. If you only need to threshold the data (as ARToolKit does) you can pretty safely ignore this. If you want to display it as a grayscale image, you can use the opengl extensions for data with that range (again, as ARToolKit on the Mac does.) If however you want to get the full dynamic range from luma samples (int L) in 2vuy data, you will want to take int L' = (int)((float)(L-16) * 1.1643836) Regards, Phil. Philip Lamb --Apple-Mail-3-491147526 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 <HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; = -khtml-line-break: after-white-space; "><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">I'm very curious why the = video format has been set to '2yuv' instead of 'ARGB' which is = conceptually very simple. Would you let me know the = reason?</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; = margin-bottom: 0px; margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier"><BR class=3D"khtml-block-placeholder"></FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">Today, I modified the header file = 'config.h':</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: = 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0=A0 =A0</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">// #define = AR_PIX_FORMAT_2yuv</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0=A0 =A0#define = AR_PIX_FORMAT_ARGB</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">then</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">make= clean; make</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: = 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">After this, I could get ARGB = image directly in the program: simpleLite.c</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">At = first I thought this is automatic through QuickTime; but I wonder = whether this</FONT><FONT class=3D"Apple-style-span" face=3D"Courier"> is = a result of calling a converting function inside ARToolkit = libraries?</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; = margin-bottom: 0px; margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier"><BR class=3D"khtml-block-placeholder"></FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">YNDK.</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">On 09/05/2005, at 9:59 PM, = Eike M.Lang wrote:</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal = normal normal 13px/normal Courier; min-height: 16px; "><BR></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">>= Am 07.05.2005 um 00:40 schrieb Philip Lamb:</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">>> The only YUV formats supported natively by the = toolkit on Mac OS X</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">>> are '2vuy' and = 'yuvs'. (See</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">>> <A = href=3D"http://developer.apple.com/quicktime/icefloe/dispatch020.html">htt= p://developer.apple.com/quicktime/icefloe/dispatch020.html</A>) = for</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">>> the layout of these = pixel formats.</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: = 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">></FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">></FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">> It is, of course, 2vuy = -- by taking all uneven bytes instead of taking</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">>= the even ones I finally get me the grayscale image artag can = deal</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">> = with...</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; = margin-bottom: 0px; margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">> Thanks a lot for your hint.</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; font: normal normal normal 13px/normal Courier; = min-height: 16px; "><BR></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">One thing to be aware of = with 2vuy data, is that it it has different</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">black and white levels to what you might expect. Black = level is 16 and</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">white 235. Values outside = these ranges should be clamped. If you only</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">need= to threshold the data (as ARToolKit does) you can pretty = safely</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">ignore this. If you want to = display it as a grayscale image, you can</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">use = the opengl extensions for data with that range (again, as = ARToolKit</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">on the Mac does.) If however = you want to get the full dynamic range</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">from= luma samples (int L) in 2vuy data, you will want to take int L' = =3D</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">(int)((float)(L-16) * = 1.1643836)</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; = margin-bottom: 0px; margin-left: 0px; font: normal normal normal = 13px/normal Courier; min-height: 16px; "><BR></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">Regards,</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">Phil.</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">Philip Lamb</FONT></DIV></BODY></HTML>= --Apple-Mail-3-491147526-- |
From: | Philip Lamb <phil@e ..........> | Received: | Jul 27, 2005 |
To | Yongduek SEO <yndk@s ...........> | ||
Subject: | Re: Convert YUV to RGB | ||
--Apple-Mail-2-309587586 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed 2yuv data is 2 bytes per pixel, whereas argb is 4 bytes per pixel. Moving less data around gives better performance. If you ask for argb (by changing config.h) Quicktime converts the data to argb for you. Regards, Phil. On 09/06/2005, at 11:26 PM, Yongduek SEO wrote: > I'm very curious why the video format has been set to '2yuv' > instead of 'ARGB' which is conceptually very simple. Would you let > me know the reason? > > Today, I modified the header file 'config.h': > > // #define AR_PIX_FORMAT_2yuv > #define AR_PIX_FORMAT_ARGB > > then > make clean; make > > After this, I could get ARGB image directly in the program: > simpleLite.c > At first I thought this is automatic through QuickTime; but I > wonder whether this is a result of calling a converting function > inside ARToolkit libraries? > > > YNDK. > > On 09/05/2005, at 9:59 PM, Eike M.Lang wrote: > > > Am 07.05.2005 um 00:40 schrieb Philip Lamb: > >> The only YUV formats supported natively by the toolkit on Mac OS X > >> are '2vuy' and 'yuvs'. (See > >> http://developer.apple.com/quicktime/icefloe/dispatch020.html) for > >> the layout of these pixel formats. > > > > > > It is, of course, 2vuy -- by taking all uneven bytes instead of > taking > > the even ones I finally get me the grayscale image artag can deal > > with... > > Thanks a lot for your hint. > > One thing to be aware of with 2vuy data, is that it it has different > black and white levels to what you might expect. Black level is 16 and > white 235. Values outside these ranges should be clamped. If you only > need to threshold the data (as ARToolKit does) you can pretty safely > ignore this. If you want to display it as a grayscale image, you can > use the opengl extensions for data with that range (again, as > ARToolKit > on the Mac does.) If however you want to get the full dynamic range > from luma samples (int L) in 2vuy data, you will want to take int L' = > (int)((float)(L-16) * 1.1643836) > > Regards, > Phil. > Philip Lamb --Apple-Mail-2-309587586 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 <HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; = -khtml-line-break: after-white-space; ">2yuv data is 2 bytes per pixel, = whereas argb is 4 bytes per pixel. Moving less data around gives better = performance. If you ask for argb (by changing config.h) Quicktime = converts the data to argb for you.<DIV><BR = class=3D"khtml-block-placeholder"></DIV><DIV>Regards,</DIV><DIV>Phil.</DIV= ><DIV><BR><DIV><DIV>On 09/06/2005, at 11:26 PM, Yongduek SEO = wrote:</DIV><BR class=3D"Apple-interchange-newline"><BLOCKQUOTE = type=3D"cite"><DIV style=3D"margin-top: 0px; margin-right: 0px; = margin-bottom: 0px; margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">I'm very curious why the video format has been set to = '2yuv' instead of 'ARGB' which is conceptually very simple. Would you = let me know the reason?</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">Today, I modified the header = file 'config.h':</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0=A0 =A0</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">// #define = AR_PIX_FORMAT_2yuv</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0=A0 =A0#define = AR_PIX_FORMAT_ARGB</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">then</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">make= clean; make</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: = 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">After this, I could get ARGB = image directly in the program: simpleLite.c</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">At = first I thought this is automatic through QuickTime; but I wonder = whether this</FONT><FONT class=3D"Apple-style-span" face=3D"Courier"> is = a result of calling a converting function inside ARToolkit = libraries?</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; = margin-bottom: 0px; margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier"><BR class=3D"khtml-block-placeholder"></FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">YNDK.</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier"><BR = class=3D"khtml-block-placeholder"></FONT></DIV><DIV style=3D"margin-top: = 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">On 09/05/2005, at 9:59 PM, = Eike M.Lang wrote:</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal = normal normal 13px/normal Courier; min-height: 16px; "><BR></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">>= Am 07.05.2005 um 00:40 schrieb Philip Lamb:</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">>> The only YUV formats supported natively by the = toolkit on Mac OS X</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">>> are '2vuy' and = 'yuvs'. (See</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">>> <A = href=3D"http://developer.apple.com/quicktime/icefloe/dispatch020.html">htt= p://developer.apple.com/quicktime/icefloe/dispatch020.html</A>) = for</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">>> the layout of these = pixel formats.</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: = 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">></FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">></FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">> It is, of course, 2vuy = -- by taking all uneven bytes instead of taking</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">>= the even ones I finally get me the grayscale image artag can = deal</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">> = with...</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; = margin-bottom: 0px; margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">> Thanks a lot for your hint.</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; font: normal normal normal 13px/normal Courier; = min-height: 16px; "><BR></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">One thing to be aware of = with 2vuy data, is that it it has different</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">black and white levels to what you might expect. Black = level is 16 and</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">white 235. Values outside = these ranges should be clamped. If you only</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">need= to threshold the data (as ARToolKit does) you can pretty = safely</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">ignore this. If you want to = display it as a grayscale image, you can</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">use = the opengl extensions for data with that range (again, as = ARToolKit</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">on the Mac does.) If however = you want to get the full dynamic range</FONT><FONT = class=3D"Apple-style-span" face=3D"Courier">=A0</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Courier">from= luma samples (int L) in 2vuy data, you will want to take int L' = =3D</FONT><FONT class=3D"Apple-style-span" = face=3D"Courier">=A0</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">(int)((float)(L-16) * = 1.1643836)</FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; = margin-bottom: 0px; margin-left: 0px; font: normal normal normal = 13px/normal Courier; min-height: 16px; "><BR></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">Regards,</FONT></DIV><DIV style=3D"margin-top: 0px; = margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT = class=3D"Apple-style-span" face=3D"Courier">Phil.</FONT></DIV><DIV = style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; = margin-left: 0px; "><FONT class=3D"Apple-style-span" = face=3D"Courier">Philip = Lamb</FONT></DIV></BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>= --Apple-Mail-2-309587586-- |