Regular API function

simSetVisionSensorCharImage / sim.setVisionSensorCharImage

Description Sets the rgb-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. Use sim.getVisionSensorResolution to know the size of the image buffer that you need to provide (buffer size=resolutionX *resolutionY*3). See also sim.setVisionSensorImage.
C synopsis simInt simSetVisionSensorCharImage(simInt sensorHandle,const simUChar* image)
C parameters
sensorHandle: handle of the vision sensor object. Can be combined with sim_handleflag_greyscale (simply add sim_handleflag_greyscale to sensorHandle if you provide grey scale values instead of rgb value) or/and sim_handleflag_rawvalue (simply add sim_handleflag_rawvalue to sensorHandle if you do not wish to trigger image processing).
image: rgb buffer containing the image (buffer size must be resolutionX*resolutionY*3). Values in the buffer should vary between 0 and 255. In case a grey scale image is provided, the buffer size must be resolutionX*resolutionY.
C return value
-1 if operation was not successful. 0 if the image processing didn't trigger anything, 1 if the image processing triggered a detection
Lua synopsis number result=sim.setVisionSensorCharImage(number sensorHandle,string image)
Lua parameters
Similar as C-function
Lua return values
Same as C-function
Remote API equiv.
B0-based remote API: simxSetVisionSensorImage
Legacy remote API: simxSetVisionSensorImage

All regular API functions on one page