## Mismatch of RGB image and depth image

Typically: "How do I... ", "How can I... " questions
Uio96
Posts: 15
Joined: 09 May 2019, 20:08

### Mismatch of RGB image and depth image

Hi there,

Recently, I met a wired problem of mismatch of RGB image and depth image. E.g. I first run my simulation and then when my objects have not FULLY stopped there, I just pause the simulation (to save time). I find that in some cases, a mismatch of RGB image and depth image will occur. I guess the depth image buffer is different from the RGB one, but I do not know the mechanism is behind it.

Does anybody have a good way to deal with this issue? OR I have to wait until all my objects stop moving. My current thought is to set every object static during the simulation so the depth image buffer could be consistent with the RGB one. But I'm not sure if it could be done.

Thanks a lot.

coppelia
Posts: 7450
Joined: 14 Dec 2012, 00:25

### Re: Mismatch of RGB image and depth image

Hello,

depth and RGB images are acquired at the same time. So you probably are not reading the depth matp and RGB image at the same time. How are you doing this? Inside of a threaded child script?

Cheers

Uio96
Posts: 15
Joined: 09 May 2019, 20:08

### Re: Mismatch of RGB image and depth image

Thanks for the reply. In fact, I do not use the Lua script but use the python remote API instead. I do not think it will make a difference if the depth and RGB images are acquired at the same time.

I used function like:
vrep.simxGetVisionSensorImage
vrep.simxGetVisionSensorDepthBuffer

coppelia
Posts: 7450
Joined: 14 Dec 2012, 00:25

### Re: Mismatch of RGB image and depth image

Sorry about the delay, very busy with the new release...

Yes, this is probably what is happening. If you are using the streaming mode, this shouldn't be the case however.

An alternative would be to acquire both data from within CoppeliaSim, in a script function. Then call that script function from your remote API python client with simxCallScriptFunction.

Cheers

Uio96
Posts: 15
Joined: 09 May 2019, 20:08

### Re: Mismatch of RGB image and depth image

Got you. Thank you so much. I figured out another way to solve my problem indirectly.