|
From: Radu B. R. <ru...@cs...> - 2006-03-27 22:35:31
|
Hi Fred,
Going to do some tests with some live cameras this week and fix this. I
also noticed that by encoding the color in Java byte format (signed,
-127..128), the colors could get messed up, as normally they should be
unsigned (0..255). I will try to change everything to integer and then
test. If that works ok, I'll patch the library and let you know.
Best,
Radu.
Fred Labrosse wrote:
>Hello,
>
>Finally found some time...
>
>On Thursday 16 Mar 2006 10:24, Radu Bogdan Rusu wrote:
>
>
>>Hey Fred,
>>
>>If nobody else figures it out, I will try to do something about it on
>>the plane. In general though, it is better to:
>>- first, test if the data is ready, using the
>><CameraInterface>.isDataReady () method
>>- then try to actually read the data from CameraInterface's buffer.
>>
>>Example:
>>PlayerCameraData camdata = new PlayerCameraData ();
>>
>>if (camdata.isDataReady ())
>>camdata = cam.getData ();
>>
>>
>
>I've done:
>
> System.out.println("Waiting for image to be ready");
> while (!cam.isDataReady())
> {
> // Do nothing, just wait for the data to be ready.
> }
> System.out.println("Getting image");
> camdata = cam.getData();
>
>and that indeed (almost) solves the problem I was reporting. Only almost
>because to save the image I have to do:
>
> for (int h = 0; h < height ; h++)
> for (int w = 0; w < width; w++)
> {
> file.write(data[(w * 3) + (h * width * 3) + 1]); // Red
> file.write(data[(w * 3) + (h * width * 3) + 2]); // Green
> file.write(data[(w * 3) + (h * width * 3) + 0]); // Blue
> }
>
>in order to get the colours right. The interesting bit is that v4l normally
>creates BGR pixels (i.e. blue and red swapped). However, I seem to be
>getting BRG pixels from the CameraInterface. But that's easy enough to fix.
>
>Finally, is the isDataReady()/getData() pair is in a loop, it hangs on the
>second isDataReady() (or am I not supposed to be using it as I do? Also, at
>the same time I do get loads of
>
>warning : tried to push onto a full message queue
>error : tried to push 2/1 from/onto 4/0
>
>while trying to get the second image. This is with version 2.0.1 of
>javaclient and a fairly recent cvs version of player.
>
>Cheers,
>
>Fred
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting language
>that extends applications into web and mobile media. Attend the live webcast
>and join the prime developer group breaking into this new coding territory!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>_______________________________________________
>Java-player-users mailing list
>Jav...@li...
>https://lists.sourceforge.net/lists/listinfo/java-player-users
>
>
--
| Radu Bogdan Rusu | http://rbrusu.com/
| http://www9.cs.tum.edu/people/rusu/
| Intelligent Autonomous Systems
| Technische Universitaet Muenchen
|