| ARToolKit | Mailing List Archive |
|
| From: | Yongduek SEO <yndk@s ...........> | Received: | May 26, 2005 |
| To | artoolkit@h .................. | ||
| Subject: | [Q] captured image saved but | ||
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();
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;
}
write_PPM (filename, r,g,b);
arDispImage (dataPtr, 0, 0);
arVideoCapStart();
arVideoCapNext();
Strange to say, the color of the saved file is not consistent.
Any comments please.
Best,
Y.
|
|||
| From: | Philip Lamb <phil@e ..........> | Received: | May 27, 2005 |
| To | Yongduek SEO <yndk@s ...........> | ||
| Subject: | Re: [Q] captured image saved but | ||
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. |
|||