Page 1 of 1

Camra problem

Posted: Mon May 04, 2009 11:12 pm
by UH
Is there any one how nows have to convert jpg buffter to pixel rbg buffer.

in other words get the date compilede over to raw data so that it can be show on the screne by runing the buffer...

ps i need to work with the data to be able to use it, so i need it to be blocks of [R][G] for itch pixel f.eks in one buffer eller 3buffer

Hope somone can help thanks

Posted: Tue May 05, 2009 5:06 am
by LionX
use libjpg:
http://svn.ps2dev.org/listing.php?repna ... rev=0&sc=0


I include a sample using libjpg called test0:
http://svn.ps2dev.org/listing.php?repna ... rev=0&sc=0


note: when you compile ps2sdk, this sample doesn't get copied to the /samples folder like other samples do.

Posted: Tue May 05, 2009 11:12 pm
by UH
hey

thanks i have been looking at the libjpg, but i can not convert the jpg_buffer to the jpgData buffter that the libjpg are using.

the eksample only show have to send the data to the pc, as a jpeg, but i can not use the jpg data i need the raw data so that i can show it on the screen and there by usign the pixle value to make som image processing,.

when i am trying to convert the buffer the system of the playstation shutdown.

Hope you can help me a littel more thanks

ps. have got the test0 to work and it is nice work

Posted: Wed May 06, 2009 5:33 am
by LionX
ok, after you compile libjpg and include it to you project, this is how you convert the jpeg image to rgb buffer:


the data in jpg_buffer is 100% a jpeg file.


to convet it to rgb:

after you extract the frame with:
ret = PS2CamExtractFrame(devid, jpg_buffer, 500512);


'ret' is the size of the file.

you con open the buffer like this
jpgData *jpg;

jpg = jpgOpenRAW( &jpg_buffer, ret);


then create your rgb buffer like this:
unsigned char my_rgb_buff[640*480*3];



then convert the jpeg to rgb like this:

jpgReadImage(jpg, &my_rgb_buff[0]);

thaky

Posted: Wed May 06, 2009 7:11 pm
by UH
Finaly, the solution thanks.... i have been working in that area but it didden work ontil now


thanky....