On 26/05/2005, at 8:50 PM, Yongduek SEO wrote:
> OS: Windows XP
> ARToolkit Version: 7.0
>
> I grabbed a frame and saved it into a ppm file, but the color seems
> very much strange, does not show a correct one; well partly it is
> correct but change frame by frame.
>
> My code is like this (from simpleTest):
>
> dataPtr = arVideoGetImage();
> arVideoCapStop();
Do not call arVideoCapStop() unless you are finished capturing.
Certainly not every frame!
> arDrawMode2D();
> for (i=k=0; i<Height; i++) for (j=0; j<Width; j++)
> b[i][j] = dataPtr[k+2];
> g[i][j] = dataPtr[k+1];
> r[i][j] = dataPtr[k+0];
> k+= 4;
> }
On Windows, the colour components in each pixel are ordered bgra. So
your indexes should be k+0, k+1, and k+2.
> write_PPM (filename, r,g,b);
> arDispImage (dataPtr, 0, 0);
> arVideoCapStart();
Remove this as well.
> arVideoCapNext();
>
> Strange to say, the color of the saved file is not consistent.
>
> Any comments please.
> Best,
> Y.
>
>
Hope this helps.
Phil.
|