Page 1 of 1

Process Depth Image taken from a perspective vision sensor

Posted: 29 Jul 2021, 03:43
by zhy149
Hello Coppelia,

I've taken an image from the top view to a table, and there are some cubes on the table. I want to get a pure 2d image only with their top faces appearing in the image, but with a perspective vision sensor their side faces appear as well (I need to use a perspective vision sensor). I don't know if I should use depth image segmentation or something else to deal with this case. Also, I've tried the simxGetVisionsensorDepthBuffer function, but it seems my buffer is empty. Could you give me some suggestions?
Thank you very much!

Re: Process Depth Image taken from a perspective vision sensor

Posted: 29 Jul 2021, 15:41
by fferri
Perhaps depth info is disabled in the object properties of the vision sensor? Or objects are not renderable?

Re: Process Depth Image taken from a perspective vision sensor

Posted: 31 Jul 2021, 23:59
by zhy149
fferri wrote: 29 Jul 2021, 15:41 Perhaps depth info is disabled in the object properties of the vision sensor? Or objects are not renderable?
Hi fferri,

Thank you! I changed the mode to blocking and now it works, is this normal? Another question is that for my image 512*512, the buffer length is also 512*512, this makes sense. But I don't quite understand what this buffer means, is it one row by one row stacking all the pixels mapped depth to this buffer list? The value is between 0 and 1 so it should be a ratio, what does this ratio mean?
Thank you very much!

Re: Process Depth Image taken from a perspective vision sensor

Posted: 03 Aug 2021, 10:10
by fferri
Exactly, the buffer is the sequence of pixels read row by row.

Values are normalized between 0...1, however (from sim.getVisionSensorDepthBuffer documentation):
sensorHandle: handle of the vision sensor. Can be combined with sim.handleflag_depthbuffermeters (simply add sim.handleflag_depthbuffermeters to sensorHandle), if you wish to retrieve values in meters.