Depth image stream from kinect in matlab with ROS IO package
Hello all,
I'm currently trying to generate image streams in Matlab from Kinect with the relatively new ROS IO Package. I am able to generate an RGB stream with the following code:
figure(1)
width = message.getWidth();
height = message.getHeight();
offset = message.getData().arrayOffset();
indexB = offset+1:3:width*height*3+offset;
indexG = indexB+1;
indexR = indexG+1;
imgCol = typecast(message.getData().array(), 'uint8');
img = reshape([imgCol(indexR); imgCol(indexG); imgCol(indexB)], width, height, 3);
img = permute(img, [2 1 3]);
imshow(img);
drawnow;
But I have no idea how to generate the depth stream. For the master, I'm running the freenect package in a terminal. Here's how I'm setting up the node:
>> node = rosmatlab.node('kinect', master_uri);
>> subdep = node.addSubscriber('/camera/depth/image_rect', 'sensor_msgs/Image', 10);
>> subdep.setOnNewMessageListeners({@function});
I read somewhere that the encoding type for the /image_rect topic is 32FC1 and for /image_raw is 16UC1. Is that relevant somehow?
Thanks for the help.