How to get the real depth information from the vision sensor?

Typically: "How do I... ", "How can I... " questions
Post Reply
Hacher
Posts: 11
Joined: 28 Nov 2024, 02:00

How to get the real depth information from the vision sensor?

Post by Hacher »

The depth info extract from the depth image generated by vision senor is a relative value, which can only reflect the depth of color of objects(from 0~255).
How to btain exactly depth value of a depth image generated by the vision sensor?

Looking forward to your reply. Thank you!

coppelia
Site Admin
Posts: 10626
Joined: 14 Dec 2012, 00:25

Re: How to get the real depth information from the vision sensor?

Post by coppelia »

Hello,

are you using sim.getVisionSensorDepth for that? If yes, make sure to call it with a second argument set to 1.0: in that case the returned depth map indicates values in meters.

Cheers

Hacher
Posts: 11
Joined: 28 Nov 2024, 02:00

Re: How to get the real depth information from the vision sensor?

Post by Hacher »

I use this function sim.getVisionSensorDepth, but I cannot sure the meaning of return value. For example, I set a depth sensor which have 2X2 resolution and pointing to the ground(the sensor height is 1.47m).And the return value I get is [0 0 96 94 0 0 96 94 0 0 96 94 0 0 96 94].I cannot understand that. Why it isn't [1.47 1.47 1.47 1.47]?

coppelia
Site Admin
Posts: 10626
Joined: 14 Dec 2012, 00:25

Re: How to get the real depth information from the vision sensor?

Post by coppelia »

Please read the documentation. The returned depth data is packed. Do something like:

Code: Select all

local packedDepth = sim.getVisionSensorDepth(sensorHandle, 1)
local depthValues = sim.unpackFloatTable(packedDepth)
Cheers

Post Reply