Vision plugin API reference

API functions for performing simple image processing, and handling special types of vision algorithms.

simVision.addBuffer1ToWorkImg
simVision.addWorkImgToBuffer1
simVision.binaryWorkImg
simVision.blobDetectionOnWorkImg
simVision.buffer1ToWorkImg
simVision.buffer2ToWorkImg
simVision.changedPixelsOnWorkImg
simVision.circularCutWorkImg
simVision.colorSegmentationOnWorkImg
simVision.coordinatesFromWorkImg
simVision.createVelodyneHDL64E
simVision.createVelodyneVPL16
simVision.destroyVelodyneHDL64E
simVision.destroyVelodyneVPL16
simVision.distort
simVision.edgeDetectionOnWorkImg
simVision.handleAnaglyphStereo
simVision.handleSpherical
simVision.handleVelodyneHDL64E
simVision.handleVelodyneVPL16
simVision.horizontalFlipWorkImg
simVision.intensityScaleOnWorkImg
simVision.matrix3x3OnWorkImg
simVision.matrix5x5OnWorkImg
simVision.multiplyWorkImgWithBuffer1
simVision.normalizeWorkImg
simVision.rectangularCutWorkImg
simVision.resizeWorkImg
simVision.rotateWorkImg
simVision.scaleAndOffsetWorkImg
simVision.selectiveColorOnWorkImg
simVision.sensorDepthMapToWorkImg
simVision.sensorImgToWorkImg
simVision.sharpenWorkImg
simVision.shiftWorkImg
simVision.subtractBuffer1FromWorkImg
simVision.subtractWorkImgFromBuffer1
simVision.swapBuffers
simVision.swapWorkImgWithBuffer1
simVision.uniformImgToWorkImg
simVision.velodyneDataFromWorkImg
simVision.verticalFlipWorkImg
simVision.workImgToBuffer1
simVision.workImgToBuffer2
simVision.workImgToSensorDepthMap
simVision.workImgToSensorImg

Handling special types of sensors

simVision.createVelodyneHDL64E
simVision.createVelodyneVPL16
simVision.destroyVelodyneHDL64E
simVision.destroyVelodyneVPL16
simVision.distort
simVision.handleAnaglyphStereo
simVision.handleSpherical
simVision.handleVelodyneHDL64E
simVision.handleVelodyneVPL16

Simple image handling and processing

simVision.addBuffer1ToWorkImg
simVision.addWorkImgToBuffer1
simVision.binaryWorkImg
simVision.blobDetectionOnWorkImg
simVision.buffer1ToWorkImg
simVision.buffer2ToWorkImg
simVision.changedPixelsOnWorkImg
simVision.circularCutWorkImg
simVision.colorSegmentationOnWorkImg
simVision.coordinatesFromWorkImg
simVision.edgeDetectionOnWorkImg
simVision.horizontalFlipWorkImg
simVision.intensityScaleOnWorkImg
simVision.matrix3x3OnWorkImg
simVision.matrix5x5OnWorkImg
simVision.multiplyWorkImgWithBuffer1
simVision.normalizeWorkImg
simVision.rectangularCutWorkImg
simVision.resizeWorkImg
simVision.rotateWorkImg
simVision.scaleAndOffsetWorkImg
simVision.selectiveColorOnWorkImg
simVision.sensorDepthMapToWorkImg
simVision.sensorImgToWorkImg
simVision.sharpenWorkImg
simVision.shiftWorkImg
simVision.subtractBuffer1FromWorkImg
simVision.subtractWorkImgFromBuffer1
simVision.swapBuffers
simVision.swapWorkImgWithBuffer1
simVision.uniformImgToWorkImg
simVision.velodyneDataFromWorkImg
simVision.verticalFlipWorkImg
simVision.workImgToBuffer1
simVision.workImgToBuffer2
simVision.workImgToSensorDepthMap
simVision.workImgToSensorImg

simVision.createVelodyneHDL64E

Description Creates a handle for generating data similar to a Velodyne HDL64E. See also simVision.destroyVelodyneHDL64E and simVision.handleVelodyneHDL64E.
Lua synopsis int handle=simVision.createVelodyneHDL64E(int[4] visionSensorHandles,float frequency,int options=0,int pointSize=2,float[2] coloring_closeFarDist={1,5},float displayScalingFactor=1,int pointCloudHandle=-1)
Lua parameters
rgbVisionSensorHandle: handle of a passive vision sensor, receiving the computed RGB image.
visionSensorHandles: the handles of 4 active vision sensors, looking to the front, left, rear and right.
frequency: the rotation frequency.
options: bit-coded options:
bit0 set (i.e. 1): do not display points
bit1 set( i.e. 2): display only current points.
bit2 set( i.e. 4): returned data is polar (otherwise cartesian).
bit3 set( i.e. 8): displayed points are emissive.
pointSize: the size of the displayed points, in pixels.
coloring_closeFarDist: the close and far distances, used to adjust intensity coloring.
displayScalingFactor: a scaling factor applied radially to each point. Can be used to bring points slightly closer to the sensor, to avoid points being hidden behind surfaces due to depth map resolution.
pointCloudHandle: the optional handle of a point cloud object (that will be in charge of displaying the detected points.
Lua return values
handle: the created Velodyne HDL64E handle.
Python synopsis int handle=simVision.createVelodyneHDL64E(list visionSensorHandles,float frequency,int options=0,int pointSize=2,list coloring_closeFarDist=[1,5],float displayScalingFactor=1,int pointCloudHandle=-1)

simVision.createVelodyneVPL16

Description Creates a handle for generating data similar to a Velodyne VPL16. See also simVision.destroyVelodyneVPL16 and simVision.handleVelodyneVPL16.
Lua synopsis int handle=simVision.createVelodyneVPL16(int[4] visionSensorHandles,float frequency,int options=0,int pointSize=2,float[2] coloring_closeFarDist={1,5},float displayScalingFactor=1,int pointCloudHandle=-1)
Lua parameters
rgbVisionSensorHandle: handle of a passive vision sensor, receiving the computed RGB image.
visionSensorHandles: the handles of 4 active vision sensors, looking to the front, left, rear and right.
frequency: the rotation frequency.
options: bit-coded options:
bit0 set (i.e. 1): do not display points
bit1 set( i.e. 2): display only current points.
bit2 set( i.e. 4): returned data is polar (otherwise cartesian).
bit3 set( i.e. 8): displayed points are emissive.
pointSize: the size of the displayed points, in pixels.
coloring_closeFarDist: the close and far distances, used to adjust intensity coloring.
displayScalingFactor: a scaling factor applied radially to each point. Can be used to bring points slightly closer to the sensor, to avoid points being hidden behind surfaces due to depth map resolution.
pointCloudHandle: the optional handle of a point cloud object (that will be in charge of displaying the detected points.
Lua return values
handle: the created Velodyne VPL16 handle.
Python synopsis int handle=simVision.createVelodyneVPL16(list visionSensorHandles,float frequency,int options=0,int pointSize=2,list coloring_closeFarDist=[1,5],float displayScalingFactor=1,int pointCloudHandle=-1)

simVision.destroyVelodyneHDL64E

Description Deletes a Velodyne HDL64E handle previously created with simVision.createVelodyneHDL64E.
Lua synopsis simVision.destroyVelodyneHDL64E(int velodyneHandle)
Lua parameters
velodyneHandle: a handle previously returned by simVision.createVelodyneHDL64E.
Lua return values
Python synopsis simVision.destroyVelodyneHDL64E(int velodyneHandle)

simVision.destroyVelodyneVPL16

Description Deletes a Velodyne VPL16 handle previously created with simVision.createVelodyneVPL16.
Lua synopsis simVision.destroyVelodyneVPL16(int velodyneHandle)
Lua parameters
velodyneHandle: a handle previously returned by simVision.createVelodyneVPL16.
Lua return values
Python synopsis simVision.destroyVelodyneVPL16(int velodyneHandle)

simVision.distort

Description Transforms (distorts) a vision sensor image via pixel remapping.
Lua synopsis simVision.distort(int visionSensorHandle,int[] pixelMap=nil,float[] depthScalings=nil)
Lua parameters
visionSensorHandle: the handle of the vision sensor.
pixelMap: a table containing indices to new pixel positions. Should be of size resX*resY. Consecutive, incremental indices (starting at 0) represents the identity transformation. Can be omitted if a map was previously provided and doesn't need change.
depthScaling: an optional table containing scaling factors for each depth value.
Lua return values
Python synopsis simVision.distort(int visionSensorHandle,list pixelMap=None,list depthScalings=None)

simVision.handleAnaglyphStereo

Description Allows to generate an anaglyph stereo image from two individual vision sensors (for the left and right eye).
Lua synopsis simVision.handleAnaglyphStereo(int rgbVisionSensorHandle,int[2] handlesOfTwoVisionSensors,float[6] leftAndRightColors=nil)
Lua parameters
rgbVisionSensorHandle: handle of a passive vision sensor, receiving the computed RGB image.
handlesOfTwoVisionSensors: the handles of two active vision sensors (for the left and right eye).
leftAndRightColors: the colors for the left and right eye rendering.
Lua return values
Python synopsis simVision.handleAnaglyphStereo(int rgbVisionSensorHandle,list handlesOfTwoVisionSensors,list leftAndRightColors=None)

simVision.handleSpherical

Description Allows to generate an RGB and/or depth image that covers all directions, i.e. spherical vision, based on the input of 6 individual vision sensors, each looking into a different and perpendicular direction.
Lua synopsis simVision.handleSpherical(int rgbVisionSensorHandle,int[6] handlesOfSixVisionSensors,float horizontalAngle,float verticalAngle,int depthVisionSensorHandle=-1)
Lua parameters
rgbVisionSensorHandle: handle of a passive vision sensor, receiving the computed RGB spherical image.
handlesOfSixVisionSensors: the handles of 6 mutually perpendicular, looking into a different direction active vision sensors.
horizontalAngle: the desired horizontal view angle, in radians (e.g. 2*math.pi).
horizontalAngle: the desired vertical view angle, in radians (e.g. math.pi).
depthVisionSensorHandle: handle of a passive vision sensor, receiving the computed depth image representation of the spherical depth map.
Lua return values
Python synopsis simVision.handleSpherical(int rgbVisionSensorHandle,list handlesOfSixVisionSensors,float horizontalAngle,float verticalAngle,int depthVisionSensorHandle=-1)

simVision.handleVelodyneHDL64E

Description Handles a velodyne HDL64E sensor (i.e. generates and displays detection points. See also simVision.createVelodyneHDL64E.
Lua synopsis buffer points,buffer colors=simVision.handleVelodyneHDL64E(int velodyneHandle,float dt)
Lua parameters
velodyneHandle: a handle previously returned by simVision.createVelodyneHDL64E that should be combined with sim.handleflag_codedstring. Can also be combined with sim.handleflag_abscoords to retrieve points relative to the absolute reference frame, instead of the reference frame of the sensor
dt: the time duration since last call to this function. Typically the simulation time step.
Lua return values
points: a coded string containing the detected points.
colors: a coded string containing the colors of each point (3 byte values for each point (RGB)). The colors are only returned if the Velodyne model is appropriately configured.
Python synopsis bytes points,bytes colors=simVision.handleVelodyneHDL64E(int velodyneHandle,float dt)

simVision.handleVelodyneVPL16

Description Handles a velodyne VPL16 sensor (i.e. generates and displays detection points. See also simVision.createVelodyneVPL16.
Lua synopsis buffer points,buffer colors=simVision.handleVelodyneVPL16(int velodyneHandle,float dt)
Lua parameters
velodyneHandle: a handle previously returned by simVision.createVelodyneVPL16 that should be combined with sim.handleflag_codedstring. Can also be combined with sim.handleflag_abscoords to retrieve points relative to the absolute reference frame, instead of the reference frame of the sensor
dt: the time duration since last call to this function. Typically the simulation time step.
Lua return values
points: a table containing the detected points, or a coded string.
colors: a coded string containing the colors of each point (3 byte values for each point (RGB)). The colors are only returned if the Velodyne model is appropriately configured.
Python synopsis bytes points,bytes colors=simVision.handleVelodyneVPL16(int velodyneHandle,float dt)

simVision.addBuffer1ToWorkImg

Description Performs a pixel wise addition between the work image and buffer buffer1, and stores the result in the work image. See also simVision.addWorkImgToBuffer1 and simVision.subtractBuffer1FromWorkImg.
Lua synopsis simVision.addBuffer1ToWorkImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.addBuffer1ToWorkImg(int handle)

simVision.addWorkImgToBuffer1

Description Performs a pixel wise addition between the work image and buffer buffer1, and stores the result in buffer buffer1. See also simVision.addBuffer1ToWorkImg and simVision.subtractWorkImgFromBuffer1.
Lua synopsis simVision.addWorkImgToBuffer1(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.addWorkImgToBuffer1(int handle)

simVision.binaryWorkImg

Description Transforms the work image into a binary image, with optional triggering.
Lua synopsis int trigger,buffer packedPacket=simVision.binaryWorkImg(int handle,float threshold,float oneProportion,float oneTol,float xCenter,float xCenterTol,float yCenter,float yCenterTol,float orient,float orientTol,float roundness,bool enableTrigger,float[3] overlayColor={1.0,0.0,1.0}))
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
threshold: the threshold for binary 0 or binary 1.
oneProportion: the nominal binary 1 pixels relative amount (0-1), for triggering.
oneTol: the allowed tolerance for oneProportion.
xCenter: the nominal x center of binary 1 pixels (0-1), for triggering.
xCenterTol: the allowed tolerance for xCenter.
yCenter: the nominal y center of binary 1 pixels (0-1), for triggering.
yCenterTol: the allowed tolerance for yCenter.
orient: the nominal orientation, in radians, of the bounding box around binary 1 pixels (0-1), for triggering.
orientTol: the allowed tolerance for orient.
roundness: the nominal roundness value of the bounding box around binary 1 pixels (0-1), for triggering.
enableTrigger: if true and the triggering conditions are met, then return value trigger will be true.
overlayColor: an overlay color used to visualize triggering conditions. Set to nil for no overlay.
Lua return values
trigger: true if the filter has triggered.
packedPacket: a packed packet (use sim.unpackFloatTable to unpack) containing:
a) the binary image proportion value
b) the binary image posX value
c) the binary image posY value
d) the binary image angle value
e) the binary image roundness value
Python synopsis int trigger,bytes packedPacket=simVision.binaryWorkImg(int handle,float threshold,float oneProportion,float oneTol,float xCenter,float xCenterTol,float yCenter,float yCenterTol,float orient,float orientTol,float roundness,bool enableTrigger,list overlayColor=[1.0,0.0,1.0]))

simVision.blobDetectionOnWorkImg

Description Performs blob detection on the work image.
Lua synopsis int trigger,buffer packedPacket=simVision.blobDetectionOnWorkImg(int handle,float threshold,float minBlobSize,bool diffColor,float[3] overlayColor={1.0,0.0,1.0}))
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
threshold: the intensity threshold for a pixel to be considered on.
minBlobSize: the minimum size of a blob (in relation to the total image surface).
diffColor: if true then each blob will be represented in a different color.
overlayColor: an overlay color used to visualize the blobs. Set to nil for no overlay.
Lua return values
trigger: always false. Not used.
packedPacket: a packed packet (use sim.unpackFloatTable to unpack) containing:
a) the number of detected blobs
b) the number of values returned for each blob
then for each blob:
c.1) the blob relative size
c.2) the blob orientation
c.3) the blob relative position X
c.4) the blob relative position Y
c.5) the blob bounding box relative width
c.6) the blob bounding box relative height
Python synopsis int trigger,bytes packedPacket=simVision.blobDetectionOnWorkImg(int handle,float threshold,float minBlobSize,bool diffColor,list overlayColor=[1.0,0.0,1.0]))

simVision.buffer1ToWorkImg

Description Copies buffer buffer1 to the work image. See also simVision.buffer2ToWorkImg, simVision.workImgToBuffer1, simVision.swapBuffers and simVision.swapWorkImgWithBuffer1.
Lua synopsis simVision.buffer1ToWorkImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.buffer1ToWorkImg(int handle)

simVision.buffer2ToWorkImg

Description Copies buffer buffer2 to the work image. See also simVision.buffer1ToWorkImg, simVision.workImgToBuffer2 and simVision.swapBuffers.
Lua synopsis simVision.buffer2ToWorkImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.buffer2ToWorkImg(int handle)

simVision.changedPixelsOnWorkImg

Description Returns the pixels that changed the work image, from one frame to the next.
Lua synopsis int trigger,buffer packedPacket=simVision.changedPixelsOnWorkImg(int handle,float threshold)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
threshold: the minimum intensity variation for a pixel to have changed.
Lua return values
trigger: always false. Not used.
packedPacket: a packed packet (use sim.unpackFloatTable to unpack) containing for each changed pixel:
a.1) 1 if the pixel became brighter, -1 otherwise
a.2) the x coordinate of the pixel
a.3) the y coordinate of the pixel
Python synopsis int trigger,bytes packedPacket=simVision.changedPixelsOnWorkImg(int handle,float threshold)

simVision.circularCutWorkImg

Description Performs a circular cut on the work image.
Lua synopsis simVision.circularCutWorkImg(int handle,float radius,bool toBuffer1)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
radius: the radius of the disc, expressed proportionally to the image resolution. Pixels outside of the disc's bounds are removed.
toBuffer1: if true, then the removed pixels are copied to buffer buffer1.
Lua return values
Python synopsis simVision.circularCutWorkImg(int handle,float radius,bool toBuffer1)

simVision.colorSegmentationOnWorkImg

Description Performs a color segmentation on the work image.
Lua synopsis simVision.colorSegmentationOnWorkImg(int handle,float colorDistance)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
colorDistance: the color distance to be used as threshold.
Lua return values
Python synopsis simVision.colorSegmentationOnWorkImg(int handle,float colorDistance)

simVision.coordinatesFromWorkImg

Description Extracts coordinates from the work image (based on the view field of a vision sensor).
Lua synopsis int trigger,buffer packedPacket,buffer colorData=simVision.coordinatesFromWorkImg(int handle,int[2] pointCount,bool angularSpace,bool returnColorData)
Lua parameters
handle: handle of the vision sensor. Can be combined with sim.handleflag_abscoords in order to retrieve points relative to the absolute reference frame, instead of the vision sensor reference frame.
pointCount: the desired point count along X and Y.
angularSpace: whether the point sampling happens in the cartesian or angular space (within a given direction).
returnColorData: whether to also return color data for each point. If true, then the vision sensor's image data should be located in buffer buffer1.
Lua return values
trigger: always false. Not used.
packedPacket: a packed packet (use sim.unpackFloatTable to unpack) containing:
a) the number of points along X
b) the number of points along Y
then for each points:
c.1) the x coordinate of the point
c.2) the y coordinate of the point
c.3) the z coordinate of the point
c.4) the distance to the point
colorData: optional color data (use sim.unpackUInt8Table to unpack) containing RGB triplets for each point.
Python synopsis int trigger,bytes packedPacket,bytes colorData=simVision.coordinatesFromWorkImg(int handle,list pointCount,bool angularSpace,bool returnColorData)

simVision.edgeDetectionOnWorkImg

Description Applies an edge detection filter to the work image. See also simVision.matrix3x3OnWorkImg and simVision.matrix5x5OnWorkImg.
Lua synopsis simVision.edgeDetectionOnWorkImg(int handle,float threshold)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
threshold: the threshold value.
Lua return values
Python synopsis simVision.edgeDetectionOnWorkImg(int handle,float threshold)

simVision.horizontalFlipWorkImg

Description Horizontally flips the work image. See also simVision.verticalFlipWorkImg.
Lua synopsis simVision.horizontalFlipWorkImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.horizontalFlipWorkImg(int handle)

simVision.intensityScaleOnWorkImg

Description Transforms the work image into an intensity representation.
Lua synopsis simVision.intensityScaleOnWorkImg(int handle,float start,float end,bool greyscale)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
start: the value representing the minimum intensity.
end: the value representing the maximum intensity.
greyscale: if true, the output is a grey scale image, otherwise it is a color coded intensity image.
Lua return values
Python synopsis simVision.intensityScaleOnWorkImg(int handle,float start,float end,bool greyscale)

simVision.matrix3x3OnWorkImg

Description Applies a 3X3 matrix filter to the work image.
Lua synopsis simVision.matrix3x3OnWorkImg(int handle,int passes,float multiplier,float[9] matrix)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
passes: the number of desired filter passes.
multiplier: a matrix multiplier.
matrix: the 3X3 matrix.
Lua return values
Python synopsis simVision.matrix3x3OnWorkImg(int handle,int passes,float multiplier,list matrix)

simVision.matrix5x5OnWorkImg

Description Applies a 5X5 matrix filter to the work image.
Lua synopsis simVision.matrix5x5OnWorkImg(int handle,int passes,float multiplier,float[25] matrix)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
passes: the int of desired filter passes.
multiplier: a matrix multiplier.
matrix: the 5X5 matrix.
Lua return values
Python synopsis simVision.matrix5x5OnWorkImg(int handle,int passes,float multiplier,list matrix)

simVision.multiplyWorkImgWithBuffer1

Description Multiplies (pixel wise) the work image with buffer buffer1, and stores the result in the work image.
Lua synopsis simVision.multiplyWorkImgWithBuffer1(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.multiplyWorkImgWithBuffer1(int handle)

simVision.normalizeWorkImg

Description Normalizes the work image.
Lua synopsis simVision.normalizeWorkImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.normalizeWorkImg(int handle)

simVision.rectangularCutWorkImg

Description Performs a rectangular cut on the work image.
Lua synopsis simVision.rectangularCutWorkImg(int handle,float[2] rectangle,bool toBuffer1)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
rectangle: the x/y size of the rectangle, expressed proportionally to the image resolution. Pixels outside of the rectangle's bounds are removed.
toBuffer1: if true, then the removed pixels are copied to buffer buffer1.
Lua return values
Python synopsis simVision.rectangularCutWorkImg(int handle,list rectangle,bool toBuffer1)

simVision.resizeWorkImg

Description Scales the work image. The resolution remains same.
Lua synopsis simVision.resizeWorkImg(int handle,float[2] scaling)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
scaling: the x/y scaling.
Lua return values
Python synopsis simVision.resizeWorkImg(int handle,list scaling)

simVision.rotateWorkImg

Description Performs a rotation of the work image.
Lua synopsis simVision.rotateWorkImg(int handle,float angle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
angle: the rotation angle in radians.
Lua return values
Python synopsis simVision.rotateWorkImg(int handle,float angle)

simVision.scaleAndOffsetWorkImg

Description Shifts and scales colors of the work image, in the RGB or HSL space: colorOut=postOffset+(colorIn+preOffset)*scaling
Lua synopsis simVision.scaleAndOffsetWorkImg(int handle,float[3] colorPreOffset,float[3] colorScaling,float[3] colorPostOffset,bool rgbSpace)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
colorPreOffset: the pre-offset, in RGB or HSL space.
colorScaling: the scaling, in RGB or HSL space.
colorPostOffset: the post-offset, in RGB or HSL space.
rgbSpace: if true, values are in the RGB space, otherwise they are in the HSL space.
Lua return values
Python synopsis simVision.scaleAndOffsetWorkImg(int handle,list colorPreOffset,list colorScaling,list colorPostOffset,bool rgbSpace)

simVision.selectiveColorOnWorkImg

Description Selects a specific color in the RGB or HSL space of the work image.
Lua synopsis simVision.selectiveColorOnWorkImg(int handle,float[3] nominalColor,float[3] colorTolerance,bool rgbSpace,bool keepColor,bool toBuffer1)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
nominalColor: the nominal color to select, in RGB or HSL space.
colorTolerance: the tolerance around the nominal color, in RGB or HSL space.
rgbSpace: if true, values are in the RGB space, otherwise they are in the HSL space.
keepColor: if true, the specified color is kept, otherwise it is removed.
toBuffer1: if true, the removed color is copied to buffer buffer1.
Lua return values
Python synopsis simVision.selectiveColorOnWorkImg(int handle,list nominalColor,list colorTolerance,bool rgbSpace,bool keepColor,bool toBuffer1)

simVision.sensorDepthMapToWorkImg

Description Copies the depth buffer acquired by a vision sensor to the work image (buffer used for image processing). see also simVision.sensorImgToWorkImg and simVision.workImgToSensorImg.
Lua synopsis simVision.sensorDepthMapToWorkImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.sensorDepthMapToWorkImg(int handle)

simVision.sensorImgToWorkImg

Description Copies the RGB image acquired by a vision sensor to the work image (buffer used for image processing). See also simVision.sensorDepthMapToWorkImg and simVision.workImgToSensorImg.
Lua synopsis simVision.sensorImgToWorkImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.sensorImgToWorkImg(int handle)

simVision.sharpenWorkImg

Description Sharpens the work image. See also simVision.matrix3x3OnWorkImg and simVision.matrix5x5OnWorkImg.
Lua synopsis simVision.sharpenWorkImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.sharpenWorkImg(int handle)

simVision.shiftWorkImg

Description Shifts the work image.
Lua synopsis simVision.shiftWorkImg(int handle,float[2] shift,bool wrap)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
shift: the x/y shift amount, proportional to the image resolution (0=no shift, 1=shift by x/y resolution pixels).
wrap: whether parts shifted outside the image frame wrap around.
Lua return values
Python synopsis simVision.shiftWorkImg(int handle,list shift,bool wrap)

simVision.subtractBuffer1FromWorkImg

Description Subtracts (pixel wise subtraction) buffer buffer1 from the work image. See also simVision.subtractWorkImgFromBuffer1 and simVision.addBuffer1ToWorkImg.
Lua synopsis simVision.subtractBuffer1FromWorkImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.subtractBuffer1FromWorkImg(int handle)

simVision.subtractWorkImgFromBuffer1

Description Subtracts (pixel wise subtraction) the work image from buffer buffer1. See also simVision.subtractBuffer1FromWorkImg and simVision.addWorkImgToBuffer1.
Lua synopsis simVision.subtractWorkImgFromBuffer1(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.subtractWorkImgFromBuffer1(int handle)

simVision.swapBuffers

Description Swaps buffer buffer1 with buffer buffer2. See also simVision.swapWorkImgWithBuffer1.
Lua synopsis simVision.swapBuffers(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.swapBuffers(int handle)

simVision.swapWorkImgWithBuffer1

Description Swaps the work image with buffer buffer1. See also simVision.swapBuffers.
Lua synopsis simVision.swapWorkImgWithBuffer1(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.swapWorkImgWithBuffer1(int handle)

simVision.uniformImgToWorkImg

Description Applies a uniform color to the work image (buffer used for image processing)
Lua synopsis simVision.uniformImgToWorkImg(int handle,float[3] color)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
color: a table containing the RGB-triplet for the color (in the range of 0-1).
Lua return values
Python synopsis simVision.uniformImgToWorkImg(int handle,list color)

simVision.velodyneDataFromWorkImg

Description Extracts Velodyne coordinates from the work image (based on the view field of a vision sensor).
Lua synopsis int trigger,buffer packedPacket,buffer colorData=simVision.velodyneDataFromWorkImg(int handle,int[2] pointCount,float verticalScanAngle,bool returnColorData=false)
Lua parameters
handle: handle of the vision sensor. Can be combined with sim.handleflag_abscoords in order to retrieve points relative to the absolute reference frame, instead of the vision sensor reference frame.
pointCount: the desired point count along X and Y.
verticalScanAngle: the vertical scan angle.
returnColorData: whether to also return color data for each point. If true, then the vision sensor's image data should be located in buffer buffer1.
Lua return values
trigger: always false. Not used.
packedPacket: a packed packet (use sim.unpackFloatTable to unpack) containing:
a) the number of points along X
b) the number of points along Y
then for each points:
c.1) the x coordinate of the point
c.2) the y coordinate of the point
c.3) the z coordinate of the point
c.4) the distance from the sensor to the point
colorData: optional color data (use sim.unpackUInt8Table to unpack) containing RGB triplets for each point.
Python synopsis int trigger,bytes packedPacket,bytes colorData=simVision.velodyneDataFromWorkImg(int handle,list pointCount,float verticalScanAngle,bool returnColorData=False)

simVision.verticalFlipWorkImg

Description Vertically flips the work image. See also simVision.horizontalFlipWorkImg.
Lua synopsis simVision.verticalFlipWorkImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.verticalFlipWorkImg(int handle)

simVision.workImgToBuffer1

Description Copies the work image to buffer buffer1. See also simVision.workImgToBuffer2, simVision.buffer1ToWorkImg, simVision.swapBuffers and simVision.swapWorkImgWithBuffer1.
Lua synopsis simVision.workImgToBuffer1(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.workImgToBuffer1(int handle)

simVision.workImgToBuffer2

Description Copies the work image to buffer buffer2. See also simVision.workImgToBuffer1, simVision.buffer2ToWorkImg and simVision.swapBuffers.
Lua synopsis simVision.workImgToBuffer2(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.workImgToBuffer2(int handle)

simVision.workImgToSensorDepthMap

Description Copies the work image (buffer used for image processing) to a vision sensor's depth buffer (each depth buffer pixel will be averaged from the image RGB-triplet). See also simVision.workImgToSensorImg.
Lua synopsis simVision.workImgToSensorDepthMap(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.workImgToSensorDepthMap(int handle)

simVision.workImgToSensorImg

Description Copies the work image (buffer used for image processing) to a vision sensor's RGB buffer. See also simVision.sensorImgToWorkImg.
Lua synopsis simVision.workImgToSensorImg(int handle)
Lua parameters
handle: handle of the vision sensor, or sim.handle_self if the object attached to this script is the vision sensor.
Lua return values
Python synopsis simVision.workImgToSensorImg(int handle)