Save RGB-D image as RGBA
Posted: 22 Feb 2022, 14:34
Hello,
I would like to ask if there is a way to save 4 channel image with depth information as a 4th channel.
I tried to make a custom buffer which get together color image and depth from vision sensor, but I am not successful with transformation to image.
colorBuffer = sim.getVisionSensorImage(cameras[2])
depthBuffer = sim.getVisionSensorDepthBuffer(cameras[2])
table.move(depthBuffer, 1, #depthBuffer, #colorBuffer + 1, colorBuffer)
packedImage = sim.packTable(colorBuffer,0)
imageBuffer,res = sim.loadImage(1,packedImage)
and then I would like to use sim.saveImage.
Is there some better way or could someone help me with right formats of the buffers, because it is quite hard to debug this in Lua.
Thank you
I would like to ask if there is a way to save 4 channel image with depth information as a 4th channel.
I tried to make a custom buffer which get together color image and depth from vision sensor, but I am not successful with transformation to image.
colorBuffer = sim.getVisionSensorImage(cameras[2])
depthBuffer = sim.getVisionSensorDepthBuffer(cameras[2])
table.move(depthBuffer, 1, #depthBuffer, #colorBuffer + 1, colorBuffer)
packedImage = sim.packTable(colorBuffer,0)
imageBuffer,res = sim.loadImage(1,packedImage)
and then I would like to use sim.saveImage.
Is there some better way or could someone help me with right formats of the buffers, because it is quite hard to debug this in Lua.
Thank you