--=====================_6341638==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
Hi, this is a question to an old post. I'd like to load an image as
the ARTollKit input, instead of the webcam video. I found this answer
from Kato and it really was helpfull but i'm having problems to load the file.
I thought that loadind the file should be as easy as this:
ARUint8 *arVideoGetImage(void)
{
PUCHAR imag;
FILE *fp;
fp=fopen("t.raw", "rb");
fread(imag, 1, 230400, fp);
fclose(fp);
return imag;
}
For some reason this is not workig. Someone can give me a hand here?
The "t.raw" file is a RGB24 320x240 raw image.
Actually, my source image is RGB16 (RGB565), but first i'm trying to
read the RGB24 because i supose this is the format that artoolkit
supports directly.
By the way, anyone has the code to convert a RGB565 image to RGB24?
Regards,
Bruno.
>Original Answer fom Kato:
>
>You should create your own video function like below.
>Is is very easy. There are just 8 functions.
>Important thing is the pixel format.
>ARUint8 is identical to 'unsigned char'.
>Pixel format is defined in 'include/AR/config.h'.
>When you see 'config.h', you can find that ARToolKit
>supports several pixel formats. If the pixel format of
>your image is same as one of the formats ARToolKit supports,
>You can use your image directly and define the pixel format
>in 'config.h'. If you cannot find the pixel format of your
>image, you have to convert the pixel format of your image
>to one of the pixel formats ARToolKit supports.
>
>
>int arVideoOpen( char *config
>)
>{
> return 0;
>}
>
>int arVideoClose( void )
>{
> return 0;
>}
>
>int arVideoDispOption( void )
>{
> return 0;
>}
>
>
>int arVideoInqSize( int *x, int
>*y )
>{
> *x = xsize; // width of your static image
> *y = ysize; // height of your static image
>}
>
>ARUint8 *arVideoGetImage( void )
>{
> return imagePointer; // address of your
>image data
>}
>
>int arVideoCapStart( void )
>{
> return 0;
>}
>
>int arVideoCapStop( void )
>{
> return 0;
>}
>
>int arVideoCapNext( void )
>{
> return 0;
>}
--=====================_6341638==.ALT
Content-Type: text/html; charset="us-ascii"
<html>
<body>
Hi, this is a question to an old post. I'd like to load an image as the
ARTollKit input, instead of the webcam video. I found this answer from
Kato and it really was helpfull but i'm having problems to load the
file.<br><br>
I thought that loadind the file should be as easy as this:<br><br>
ARUint8 *arVideoGetImage(void)<br>
{<br>
PUCHAR imag;<br>
<x-tab> </x-tab>FILE
*fp;<br>
<x-tab> </x-tab>
fp=fopen("t.raw", "rb");<br>
<x-tab> </x-tab>
fread(imag, 1, 230400, fp);<br>
<x-tab> </x-tab>
fclose(fp);<br>
return imag;<br>
} <br><br>
For some reason this is not workig. Someone can give me a hand
here?<br><br>
The "t.raw" file is a RGB24 320x240 raw image.<br>
Actually, my source image is RGB16 (RGB565), but first i'm trying to read
the RGB24 because i supose this is the format that artoolkit supports
directly. <br><br>
By the way, anyone has the code to convert a RGB565 image to
RGB24?<br><br>
Regards,<br>
Bruno.<br><br>
<br><br>
<blockquote type=cite class=cite cite="">Original Answer fom
Kato:<br><br>
<pre>You should create your own video function like below.
Is is very easy. There are just 8 functions.
Important thing is the pixel format.
ARUint8 is identical to 'unsigned char'.
Pixel format is defined in 'include/AR/config.h'.
When you see 'config.h', you can find that ARToolKit
supports several pixel formats. If the pixel format of
your image is same as one of the formats ARToolKit supports,
You can use your image directly and define the pixel format
in 'config.h'. If you cannot find the pixel format of your
image, you have to convert the pixel format of your image
to one of the pixel formats ARToolKit supports.
int arVideoOpen( char *config
)
{
return 0;
}
int arVideoClose( void )
{
return 0;
}
int arVideoDispOption( void )
{
return 0;
}
int arVideoInqSize( int *x,
int
*y )
{
*x = xsize; // width of your static image
*y = ysize; // height of your static image
}
ARUint8 *arVideoGetImage( void )
{
return imagePointer; // address of your
image data
}
int arVideoCapStart( void )
{
return 0;
}
int arVideoCapStop( void )
{
return 0;
}
int arVideoCapNext( void )
{
return 0;
}
</blockquote></body>
<br>
</html>
--=====================_6341638==.ALT--
|