Page 1 of 1

Kinect RGB through Python Remote connection

Posted: 23 Mar 2024, 23:18
by t2chiang
Hello, I am now using kinect camera to get the RGB image and the disparity image in copelliasim.

Here is my code:

Code: Select all

err, _, rgbImage = sim.simxGetVisionSensorImage(clientID, camRgbHandle, 0, sim.simx_opmode_oneshot_wait)
image_R = np.array([rgbImage[i] for i in range(0, len(rgbImage), 3)]).reshape(resY, resX).astype(np.uint8)
image_G = np.array([rgbImage[i] for i in range(1, len(rgbImage), 3)]).reshape(resY, resX).astype(np.uint8)
image_B = np.array([rgbImage[i] for i in range(2, len(rgbImage), 3)]).reshape(resY, resX).astype(np.uint8)
However, the err is not equal to sim.simx_return_ok, and the image size is 0 and then simulation stop.

I got the handle object by the following code:

Code: Select all

_, camRgbHandle = sim.simxGetObjectHandle(clientID, camRgbName, sim.simx_opmode_blocking)
Is anything wrong with my code?

Thank you guys

Re: Kinect RGB through Python Remote connection

Posted: 26 Mar 2024, 17:15
by coppelia
Hello,

please use the ZeroMQ remote API, which is much faster, flexible and easy to use. The legacy remote API is deprecated.

Cheers