I'm trying to use simxGetVisionSensorImage to get an image from a vision sensor through remote API to a python client.
Code/output: https://gyazo.com/95dc0a236b4a5e3e8ac93876009fe737
Code: Select all
retCode, camHandle = sim.simxGetObjectHandle(clientID, 'cam1', sim.simx_opmode_blocking) # get handle of vision sensor 'cam1'
if clientID != -1:
while (sim.simxGetConnectionId(clientID) != -1):
retCode, resolution, image = sim.simxGetVisionSensorImage(clientID,
camHandle,
0,
sim.simx_opmode_buffer)
print(retCode)
print(resolution)
print(image)
if (retCode == sim.simx_return_ok):
img = np.array(image, dtype = np.uint8)
img.resize(resolution[0], resolution[1], 3)
break
else:
print ('Remote API connection failed.')
Any help would be appreciated!