Regular API function

simSetVisionSensorImg / sim.setVisionSensorImg

Description Writes the image of a vision sensor (and applies any image processing via the vision callback functions). Make sure the vision sensor is flagged as external input. See also the other vision sensor related API functions
C/C++
synopsis
simInt simSetVisionSensorImg(simInt sensorHandle,const simUChar* img,simInt options,const simInt* pos,const simInt* size)
C/C++
parameters
sensorHandle: handle of the vision sensor object
img: a buffer containing the image
options: options, bit-coded:
bit0 set (1): the provided image is a greyscale image (1 byte per pixel), otherwise an RGB image (3 bytes per pixel)
bit1 set (2): the provided image has one additional byte per pixel, as alpha channel (RGBA or greyscale+A)
pos: position of the image portion to write. Can be nullptr, which defaults to {0,0}
size: size of the image portion to write. Can be nullptr which defaults to {0,0}, which corresponds to {resolutionX,resolutionY}
C/C++
return value
-1 if operation was not successful
Lua
synopsis
sim.setVisionSensorImg(int sensorHandle,buffer image,int options,int[2] pos={0,0},int[2] size={0,0})
Lua
parameters
sensorHandle: handle of the vision sensor object
img: a buffer containing the image
options: options, bit-coded:
bit0 set (1): the provided image is a greyscale image (1 byte per pixel), otherwise an RGB image (3 bytes per pixel)
bit1 set (2): the provided image has one additional byte per pixel, as alpha channel (RGBA or greyscale+A)
pos: position of the image portion to write, defaults to {0,0}
size: size of the image portion to write, defaults to {0,0}, which corresponds to {resolutionX,resolutionY}
Lua
return values
Python
synopsis
sim.setVisionSensorImg(int sensorHandle,bytes image,int options=0,list pos=[0,0],list size=[0,0])