Regular API function
simGetVisionSensorImg / sim.getVisionSensorImg
Description
|
Reads the image of a vision sensor. The returned data doesn't make sense if sim.handleVisionSensor wasn't called previously (sim.handleVisionSensor is called by default in the main script if the vision sensor is not tagged as explicit handling). See also sim.saveImage and other vision sensor related API functions |
C/C++ synopsis
|
simUChar* simGetVisionSensorImg(simInt sensorHandle,simInt options,simFloat rgbaCutOff,const simInt* pos,const simInt* size,simInt* resolution) |
C/C++ parameters |
sensorHandle: handle of the vision sensor
options: options, bit-coded:
bit0 set (1): the returned image will by a greyscale image (1 byte per pixel), otherwise an RGB image
bit1 set (2): the returned image will have one additional byte per pixel, as alpha channel (RGBA or greyscale+A)
rgbaCutOff: when an RGBA image is returned, the alpha component will be 255 for all depth values below rgbaCutOff, and 0 for all depth values above rgbaCutOff. 0 corresponds to the near clipping plane, 1 to the far clipping plane
pos: position of the image portion to retrieve. Can be nullptr, which defaults to {0,0}
size: size of the image portion to retrieve. Can be nullptr which defaults to {0,0}, which corresponds to {resolutionX,resolutionY}
resolution: the returned vision sensor resolution. Can be nullptr
|
C/C++ return value
|
the image buffer or nullptr in case of an error. The user is in charge of releasing the returned buffer with simReleaseBuffer
|
Lua synopsis
|
buffer image,int[2] resolution=sim.getVisionSensorImg(int sensorHandle,int options=0,float rgbaCutOff=0.0,pos={0,0},size={0,0}) |
Lua parameters |
sensorHandle: handle of the vision sensor
options: options, bit-coded:
bit0 set (1): the returned image will by a greyscale image (1 byte per pixel), otherwise an RGB image
bit1 set (2): the returned image will have one additional byte per pixel, as alpha channel (RGBA or greyscale+A)
rgbaCutOff: when an RGBA image is returned, the alpha component will be 255 for all depth values below rgbaCutOff, and 0 for all depth values above rgbaCutOff. 0 corresponds to the near clipping plane, 1 to the far clipping plane
pos: position of the image portion to retrieve. Default is {0,0}
size: size of the image portion to retrieve. Default is {0,0}, which corresponds to {resolutionX,resolutionY}
|
Lua return values
|
resolution: the vision sensor resolution
|
Python synopsis |
bytes image,list resolution=sim.getVisionSensorImg(int sensorHandle,int options=0,float rgbaCutOff=0.0,list pos=[0,0],list size=[0,0]) |
|