|
From: Fred L. <ff...@ab...> - 2006-03-15 17:32:27
|
All,
I'm having a strange problem, which I think is a bug in javaclient2...
Here is a bit of code, mostly coming from an example for 1.6.5 modified
for 2.0 (we actually use a recent (1.5 weeks ago about) cvs version):
static byte[] imageData;
PlayerClient robot = new PlayerClient("localhost", 6665);
CameraInterface cam
= robot.requestInterfaceCamera(0,
PlayerConstants.PLAYER_OPEN_MODE);
PlayerCameraData camdata = new PlayerCameraData();
camdata = cam.getData();
int width = camdata.getWidth ();
int height = camdata.getHeight ();
int isize = camdata.getImage_count();
imageData = camdata.getImage ();
saveImage (imageData, isize, width, height, "/tmp/camera"+i+".pnm");
with save image containing (and other stuff as well):
for (int i = 0; i < isize; i++)
file.write(imageData[i]);
When the images are saved, only the top quarter of the image contains data
(the remaining being black) and that top part contains 4 almost copies of
the image (there are slight variations).
The slight variations seem to say that the interlacing of the data is
wrong. The fact that 3 quarters of it is black (but there, isize being
right) seems to show that it's missing a lot of data. The former problem
is easy enough to solve (just coordinates manipulation) but the latter is
not...
It's not coming from player because when the driver (camerav4l) is started
with the option "save 1", the saved images are correct.
All the values in the camera interface seem correct (width and height are
200, isize is 120000 (not always though, see below), format is 5 (RGB888)
and compress is 0 (no compression).
What is going on?
Also, sometimes, the size (getImage_count()) of the image is 0 (but not
systematically) and player outputs loads of warnings and errors related to
full queues (don't have the exact messages with me at the moment). These
(but not the 0 size) disappear when images are saved by player (presumably
slowing it down). This is with a recent cvs version of player. The
following might be the culprit (haven't tried):
robot.runThreaded (-1, -1);
Any suggestions?
Cheers,
Fred
P.S. Please reply to all so that the CC gets it as well. Thanks.
|