Regular API function

simSetVisionSensorCharImage / sim.setVisionSensorCharImage

Description Sets the rgb-image of a vision sensor (and applies any image processing filter if specified in the vision sensor dialog). 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). The "regular" use of this function is to first read the data from a vision sensor with sim.getVisionSensorCharImage, do some custom filtering, then write the modified image back. The alternate use of this function is to display textures, video images, etc. by using a vision sensor object (without however making use of the vision sensor functionality), since a vision sensor can be "looked through" like camera objects. 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 wish to provide grey scale values instead of rgb values..
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 applied filter didn't trigger anything, 1 if the appIied filter 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