Kinect RGB through Python Remote connection
Posted: 23 Mar 2024, 23:18
Hello, I am now using kinect camera to get the RGB image and the disparity image in copelliasim.
Here is my code:
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:
Is anything wrong with my code?
Thank you guys
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)
I got the handle object by the following code:
Code: Select all
_, camRgbHandle = sim.simxGetObjectHandle(clientID, camRgbName, sim.simx_opmode_blocking)
Thank you guys