On 04/04/2011 07:37 PM, cyrille henry wrote:
hello,
after lot's of times to understand the problem, Antoine and me finally realise that artoolkit use RGB image on linux, but pix_opencv provide RGBA image.
well Gem generally provides RGBA images, not only pix_opencv.
He made a working prototype using the code on the svn, and openCV conversion routine.
is there a Gem way to convert RGBA to RGB? (in order to remove openCV dependency) (this look to be mandatory only on linux)
<code> imageStruct*rgbaimage=...; imageStruct rgbimage; rgbimage.convertFrom(rgbaimage, GL_RGB); </code>
simple, isn't it?
Here is the code that we are now using... (makefile should be manually adjusted since we don't know how to deal with autoconf).
next time, it would be great if you could simply send the "svn diff", which is a trifle smaller than the full zip :-)
anyhow, thanks for looking at [pix_artoolkit]. i'm a bit hesitant to blindly include the propsed change, mainly because it seems to be a bit like magic to me. is there any documentation about RGB being used on linux rather than RGBA? the only thing i found is [1], which states that the color is "platform specific" (whatever that means), and that it is usually ARGB though the order of r,g,b components is irrelevant, which i always read is a 32bit pixel. obivously this is wrong. there seems to be a typedef AR_PIXEL_FORMAT, but i haven't seen it being used anywhere (but i only look at the online docs and not at some actual code)
so now the way to proceed would be: - find a way to reliably detect which format is needed by a ARToolkit (preferrably at runtime, rather than at compile time) - convert to the requested format using Gem's convertFrom/convertTo routines (and extend that, if a format is missing)
even better would be if we could tell ARToolkit which format we want to present the data in (it seems a bit weird to let Gem convert from YUV to RGB, and then ARToolkit will convert from RGB to Grayscale)
fgamsdr IOhannes
[1] http://artoolkit.sourceforge.net/apidoc/ar_8h.html#b2868d9587c68fb7255d4f270...