simIM Plugin API reference

Plugin for processing images

simIM.abs
simIM.absdiff
simIM.absdiffK
simIM.add
simIM.addK
simIM.addWeighted
simIM.arrowedLine
simIM.bitwiseAnd
simIM.bitwiseAndK
simIM.bitwiseNot
simIM.bitwiseOr
simIM.bitwiseOrK
simIM.bitwiseXor
simIM.bitwiseXorK
simIM.cart2polar
simIM.circle
simIM.clipLine
simIM.closeVideoCapture
simIM.compare
simIM.compareK
simIM.convert
simIM.copy
simIM.create
simIM.createFromData
simIM.dataURL
simIM.destroy
simIM.detectMarkers
simIM.distanceTransform
simIM.divide
simIM.divideK
simIM.drawMarker
simIM.ellipse
simIM.encode
simIM.exp
simIM.fillConvexPoly
simIM.fillPoly
simIM.flip
simIM.get
simIM.getFormat
simIM.getMarkerBitSize
simIM.getMarkerDictionary
simIM.gray2rgb
simIM.hls2rgb
simIM.hsv2rgb
simIM.line
simIM.log
simIM.magnitude
simIM.merge
simIM.mixChannels
simIM.multiply
simIM.openVideoCapture
simIM.phase
simIM.polar2cart
simIM.polylines
simIM.pow
simIM.read
simIM.readFromVideoCapture
simIM.readFromVisionSensor
simIM.rectangle
simIM.reduce
simIM.repeat
simIM.resize
simIM.rgb2gray
simIM.rgb2hls
simIM.rgb2hsv
simIM.scaleAdd
simIM.set
simIM.size
simIM.split
simIM.sqrt
simIM.subtract
simIM.subtractK
simIM.text
simIM.textSize
simIM.write
simIM.writeToTexture
simIM.writeToVisionSensor

simIM.abs

Description Calculates an absolute value of each pixel.
Lua synopsis string handle=simIM.abs(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.abs(string handle, bool inPlace=false)

simIM.absdiff

Description Calculates the per-element absolute difference between two arrays.
Lua synopsis string handle=simIM.absdiff(string handle1, string handle2, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.absdiff(string handle1, string handle2, bool inPlace=false)

simIM.absdiffK

Description Calculates the per-element absolute difference between an array and a scalar.
Lua synopsis string handle=simIM.absdiffK(string handle, float[] k, bool inPlace=false)
Lua parameters
handle (string): handle to image
k (table of float): scalar
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.absdiffK(string handle, list k, bool inPlace=false)

simIM.add

Description Calculates the per-element sum of two arrays.
Lua synopsis string handle=simIM.add(string handle1, string handle2, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.add(string handle1, string handle2, bool inPlace=false)

simIM.addK

Description Calculates the per-element sum of an array and a scalar.
Lua synopsis string handle=simIM.addK(string handle, float[] k, bool inPlace=false)
Lua parameters
handle (string): handle to image
k (table of float): scalar
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.addK(string handle, list k, bool inPlace=false)

simIM.addWeighted

Description Calculates the weighted sum of two arrays, i.e. DST(i) = SRC1(i)*alpha + SRC2(i)*beta + gamma.
Lua synopsis string handle=simIM.addWeighted(string handle1, string handle2, float alpha, float beta, float gamma, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
alpha (float): alpha coefficient
beta (float): beta coefficient
gamma (float): gamma coefficient
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.addWeighted(string handle1, string handle2, float alpha, float beta, float gamma, bool inPlace=false)

simIM.arrowedLine

Description Draw a arrow segment starting from (x1,y1) and pointing to (x2,y2).
Lua synopsis simIM.arrowedLine(string handle, int[2] p1, int[2] p2, int[3] color, int thickness=1, int type=8, int shift=0, float tipLength=0.1)
Lua parameters
handle (string): handle to image
p1 (table of int, size 2): x, y coordinates of first point
p2 (table of int, size 2): x, y coordinates of second point
color (table of int, size 3): color (red, green, blue values in range 0..255)
thickness (int, default: 1): line thickness
type (int, default: 8): type of the line (8 for 8-connected line, 4 for 4-connected line, or 16 for antialiased line)
shift (int, default: 0): number of fractional bits in the point coordinates
tipLength (float, default: 0.1): The length of the arrow tip in relation to the arrow length
Lua return values -
Python synopsis simIM.arrowedLine(string handle, list p1, list p2, list color, int thickness=1, int type=8, int shift=0, float tipLength=0.1)

simIM.bitwiseAnd

Description Calculates the per-element bit-wise conjunction of two arrays.
Lua synopsis string handle=simIM.bitwiseAnd(string handle1, string handle2, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.bitwiseAnd(string handle1, string handle2, bool inPlace=false)

simIM.bitwiseAndK

Description Calculates the per-element bit-wise conjunction of an array and a scalar.
Lua synopsis string handle=simIM.bitwiseAndK(string handle, float[] k, bool inPlace=false)
Lua parameters
handle (string): handle to image
k (table of float): scalar
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.bitwiseAndK(string handle, list k, bool inPlace=false)

simIM.bitwiseNot

Description Inverts every bit of an array.
Lua synopsis string handle=simIM.bitwiseNot(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.bitwiseNot(string handle, bool inPlace=false)

simIM.bitwiseOr

Description Calculates the per-element bit-wise disjunction of two arrays.
Lua synopsis string handle=simIM.bitwiseOr(string handle1, string handle2, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.bitwiseOr(string handle1, string handle2, bool inPlace=false)

simIM.bitwiseOrK

Description Calculates the per-element bit-wise disjunction of an array and a scalar.
Lua synopsis string handle=simIM.bitwiseOrK(string handle, float[] k, bool inPlace=false)
Lua parameters
handle (string): handle to image
k (table of float): scalar
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.bitwiseOrK(string handle, list k, bool inPlace=false)

simIM.bitwiseXor

Description Calculates the per-element bit-wise exclusive-or of two arrays.
Lua synopsis string handle=simIM.bitwiseXor(string handle1, string handle2, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.bitwiseXor(string handle1, string handle2, bool inPlace=false)

simIM.bitwiseXorK

Description Calculates the per-element bit-wise exclusive-or of an array and a scalar.
Lua synopsis string handle=simIM.bitwiseXorK(string handle, float[] k, bool inPlace=false)
Lua parameters
handle (string): handle to image
k (table of float): scalar
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.bitwiseXorK(string handle, list k, bool inPlace=false)

simIM.cart2polar

Description Calculates magnitude and angle coordinates of 2D vectors from their x and y coordinates.
Lua synopsis string handle1, string handle2=simIM.cart2polar(string handle1, string handle2, bool angleInDegrees=false)
Lua parameters
handle1 (string): handle to first image (x)
handle2 (string): handle to second image (y)
angleInDegrees (bool, default: false): when true, the function calculates the angle in degrees, otherwise, they are measured in radians
Lua return values
handle1 (string): handle of resulting image (magnitude)
handle2 (string): handle of resulting image (angle)
Python synopsis string handle1, string handle2=simIM.cart2polar(string handle1, string handle2, bool angleInDegrees=false)

simIM.circle

Description Draw a circle with center (cx,cy) and radius r.
Lua synopsis simIM.circle(string handle, int[2] center, int radius, int[3] color, int thickness=1, int type=8, int shift=0)
Lua parameters
handle (string): handle to image
center (table of int, size 2): x, y coordinates of center
radius (int): circle radius
color (table of int, size 3): color (red, green, blue values in range 0..255)
thickness (int, default: 1): line thickness (negative values means rect is filled)
type (int, default: 8): type of the line (8 for 8-connected line, 4 for 4-connected line, or 16 for antialiased line)
shift (int, default: 0): number of fractional bits in the point coordinates
Lua return values -
Python synopsis simIM.circle(string handle, list center, int radius, list color, int thickness=1, int type=8, int shift=0)

simIM.clipLine

Description Clips the line against the image rectangle.
Lua synopsis bool valid, int[2] p1, int[2] p2=simIM.clipLine(string handle, int[2] p1, int[2] p2)
Lua parameters
handle (string): handle to image
p1 (table of int, size 2): x, y coordinates of first point
p2 (table of int, size 2): x, y coordinates of second point
Lua return values
valid (bool): false if the line segment is completely outside the image rectangle, otherwise true.
p1 (table of int, size 2): x, y coordinates of first point
p2 (table of int, size 2): x, y coordinates of second point
Python synopsis bool valid, list p1, list p2=simIM.clipLine(string handle, list p1, list p2)

simIM.closeVideoCapture

Description Close video capture device.
Lua synopsis simIM.closeVideoCapture(int deviceIndex)
Lua parameters
deviceIndex (int): device index (0 based)
Lua return values -
Python synopsis simIM.closeVideoCapture(int deviceIndex)

simIM.compare

Description Performs the per-element comparison of two arrays.
Lua synopsis string handle=simIM.compare(string handle1, string handle2, int op, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
op (int): comparison operator
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.compare(string handle1, string handle2, int op, bool inPlace=false)

simIM.compareK

Description Performs the per-element comparison of an array and scalar value.
Lua synopsis string handle=simIM.compareK(string handle, float[] k, int op, bool inPlace=false)
Lua parameters
handle (string): handle to image
k (table of float): scalar
op (int): comparison operator
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.compareK(string handle, list k, int op, bool inPlace=false)

simIM.convert

Description Convert the image to a different format.
Lua synopsis string handle=simIM.convert(string handle, int format, float scale=1.0, bool inPlace=false)
Lua parameters
handle (string): handle to image
format (int): target image format (see simIM.format)
scale (float, default: 1.0): scale factor
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle to the converted image
Python synopsis string handle=simIM.convert(string handle, int format, float scale=1.0, bool inPlace=false)

simIM.copy

Description Copy a (portion of) image to another image.
Lua synopsis simIM.copy(string srcHandle, int[2] srcOffset, string dstHandle, int[2] dstOffset, int[2] size)
Lua parameters
srcHandle (string): handle to source image
srcOffset (table of int, size 2): x, y offset in the source image
dstHandle (string): handle to destination image
dstOffset (table of int, size 2): x, y offset in the destination image
size (table of int, size 2): size (width, height) of the copied region
Lua return values -
Python synopsis simIM.copy(string srcHandle, list srcOffset, string dstHandle, list dstOffset, list size)

simIM.create

Description Create an image with given size
Lua synopsis string handle=simIM.create(int width, int height, int format=simim_fmt_8UC3, int initialValue=0)
Lua parameters
width (int): width
height (int): height
format (int, default: simim_fmt_8UC3): image format (see simIM.format)
initialValue (int, default: 0): initial value to fill matrix with
Lua return values
handle (string): handle to image
Python synopsis string handle=simIM.create(int width, int height, int format=simim_fmt_8UC3, int initialValue=0)

simIM.createFromData

Description Create an image from given raw data
Lua synopsis string handle=simIM.createFromData(int width, int height, buffer data, int format=simim_fmt_8UC3)
Lua parameters
width (int): width
height (int): height
data (buffer): image data
format (int, default: simim_fmt_8UC3): image format (see simIM.format)
Lua return values
handle (string): handle to image
Python synopsis string handle=simIM.createFromData(int width, int height, buffer data, int format=simim_fmt_8UC3)

simIM.dataURL

Description Encode image data according to "data" URL scheme (RFC 2397)
Lua synopsis string output=simIM.dataURL(string imgHandle, string format='BMP')
Lua parameters
imgHandle (string): Handle to the image
format (string, default: 'BMP'): Image format (BMP, JPG, or PNG)
Lua return values
output (string): Buffer with encoded data
Python synopsis string output=simIM.dataURL(string imgHandle, string format='BMP')

simIM.destroy

Description Destroy (i.e.: free memory) an image with given handle
Lua synopsis simIM.destroy(string handle)
Lua parameters
handle (string): handle to image
Lua return values -
Python synopsis simIM.destroy(string handle)

simIM.detectMarkers

Description Detect markers in the specified image.
Lua synopsis float[] corners, int[] markerIds, float[] rejectedCandidates=simIM.detectMarkers(string handle, string dictionaryHandle)
Lua parameters
handle (string): handle to existing image
dictionaryHandle (string): dictionary handle created with simIM.getMarkerDictionary
Lua return values
corners (table of float): corners of detected markers (4 xy pairs clockwise starting top-left)
markerIds (table of int): ids of detected markers
rejectedCandidates (table of float): corners of rejected candidates (4 xy pairs clockwise starting top-left)
Python synopsis list corners, list markerIds, list rejectedCandidates=simIM.detectMarkers(string handle, string dictionaryHandle)

simIM.distanceTransform

Description Calculates the distance to the closest zero pixel for each pixel of the source image.
Lua synopsis string handle=simIM.distanceTransform(string handle, int distanceType=simim_dist_L2, int maskSize=simim_masksize_precise, bool inPlace=false)
Lua parameters
handle (string): handle to image
distanceType (int, default: simim_dist_L2): type of distance (see simIM.dist)
maskSize (int, default: simim_masksize_precise): mask size (see simIM.masksize)
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle to image
Python synopsis string handle=simIM.distanceTransform(string handle, int distanceType=simim_dist_L2, int maskSize=simim_masksize_precise, bool inPlace=false)

simIM.divide

Description Calculates the per-element division of two arrays.
Lua synopsis string handle=simIM.divide(string handle1, string handle2, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.divide(string handle1, string handle2, bool inPlace=false)

simIM.divideK

Description Calculates the per-element division of a scalar by an array.
Lua synopsis string handle=simIM.divideK(float[] k, string handle, bool inPlace=false)
Lua parameters
k (table of float): scalar
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.divideK(list k, string handle, bool inPlace=false)

simIM.drawMarker

Description Get the specified marker dictionary.
Lua synopsis string handle=simIM.drawMarker(string dictionaryHandle, int markerId, int size, string handle="", int borderSize=1)
Lua parameters
dictionaryHandle (string): dictionary handle created with simIM.getMarkerDictionary
markerId (int): marker identifier
size (int): size in pixels
handle (string, default: ""): handle to existing image, or "" to create and return a new image
borderSize (int, default: 1): border size
Lua return values
handle (string): handle to new image (or existing image if given)
Python synopsis string handle=simIM.drawMarker(string dictionaryHandle, int markerId, int size, string handle="", int borderSize=1)

simIM.ellipse

Description Draw an ellipse with center (cx,cy) and axes (rx,ry) points in the image.
Lua synopsis simIM.ellipse(string handle, int[2] center, int[2] radius, float angle=0.0, float startAngle=0.0, float endAngle=360.0, int[3] color={255,255,255}, int thickness=1, int type=8, int shift=0)
Lua parameters
handle (string): handle to image
center (table of int, size 2): x, y coordinates of center
radius (table of int, size 2): radius along x and y axis
angle (float, default: 0.0): rotation in degrees
startAngle (float, default: 0.0): starting angle of the elliptic arc in degrees
endAngle (float, default: 360.0): ending angle of the elliptic arc in degrees
color (table of int, size 3, default: {255,255,255}): color (red, green, blue values in range 0..255)
thickness (int, default: 1): line thickness (negative values means rect is filled)
type (int, default: 8): type of the line (8 for 8-connected line, 4 for 4-connected line, or 16 for antialiased line)
shift (int, default: 0): number of fractional bits in the point coordinates
Lua return values -
Python synopsis simIM.ellipse(string handle, list center, list radius, float angle=0.0, float startAngle=0.0, float endAngle=360.0, list color={255,255,255}, int thickness=1, int type=8, int shift=0)

simIM.encode

Description Encode the image to a memory buffer.
Lua synopsis string output=simIM.encode(string handle, string format)
Lua parameters
handle (string): handle to image
format (string): image format (e.g. "PNG", "JPG", "BMP")
Lua return values
output (string): output buffer
Python synopsis string output=simIM.encode(string handle, string format)

simIM.exp

Description Calculates the exponential of every array element.
Lua synopsis string handle=simIM.exp(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.exp(string handle, bool inPlace=false)

simIM.fillConvexPoly

Description Fills a convex polygon.
Lua synopsis simIM.fillConvexPoly(string handle, int[] points, int[3] color, int type=8, int shift=0)
Lua parameters
handle (string): handle to image
points (table of int): polygon vertices, i.e. {x1, y1, x2, y2, ..., xN, yN}
color (table of int, size 3): color (red, green, blue values in range 0..255)
type (int, default: 8): type of the line (8 for 8-connected line, 4 for 4-connected line, or 16 for antialiased line)
shift (int, default: 0): number of fractional bits in the point coordinates
Lua return values -
Python synopsis simIM.fillConvexPoly(string handle, list points, list color, int type=8, int shift=0)

simIM.fillPoly

Description Fills the area bounded by one or more polygon.
Lua synopsis simIM.fillPoly(string handle, int[] points, int[] numPoints, int[2] offset, int[3] color, int type=8, int shift=0)
Lua parameters
handle (string): handle to image
points (table of int): contour points, i.e. {c1x1, c1y1, c1x2, c1y2, ..., c1xN1, c1yN1, c2x1, c2y1, ..., c2xN2, c2yN2, ..., cMxNM, cMyNM}
numPoints (table of int): lengths of countours, i.e. {N1, N2, ..., NM}. the sum of numPoints items must be equal to the number of x,y pairs in points.
offset (table of int, size 2): x, y offset for all points
color (table of int, size 3): color (red, green, blue values in range 0..255)
type (int, default: 8): type of the line (8 for 8-connected line, 4 for 4-connected line, or 16 for antialiased line)
shift (int, default: 0): number of fractional bits in the point coordinates
Lua return values -
Python synopsis simIM.fillPoly(string handle, list points, list numPoints, list offset, list color, int type=8, int shift=0)

simIM.flip

Description Flips an image around vertical, horizontal, or both axes.
Lua synopsis string handle=simIM.flip(string handle, int op=0, bool inPlace=false)
Lua parameters
handle (string): handle to image
op (int, default: 0): a flag to specify how to flip the array (see simIM.flipOp)
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.flip(string handle, int op=0, bool inPlace=false)

simIM.get

Description Get pixel at specified coordinate.
Lua synopsis float[] value=simIM.get(string handle, int[2] coord)
Lua parameters
handle (string): handle to image
coord (table of int, size 2): x, y coordinates
Lua return values
value (table of float): value
Python synopsis list value=simIM.get(string handle, list coord)

simIM.getFormat

Description Get the format of the image.
Lua synopsis int format=simIM.getFormat(string handle)
Lua parameters
handle (string): handle to image
Lua return values
format (int): image format (see simIM.format)
Python synopsis int format=simIM.getFormat(string handle)

simIM.getMarkerBitSize

Description Get the bit size of the specified marker dictionary
Lua synopsis int size=simIM.getMarkerBitSize(int dictType)
Lua parameters
dictType (int): type of marker dictionary
Lua return values
size (int): The bit size of the markers
Python synopsis int size=simIM.getMarkerBitSize(int dictType)

simIM.getMarkerDictionary

Description Get the specified marker dictionary.
Lua synopsis string handle=simIM.getMarkerDictionary(int type)
Lua parameters
type (int): dictionary type (see simIM.dict_type)
Lua return values
handle (string): handle to the dictionary
Python synopsis string handle=simIM.getMarkerDictionary(int type)

simIM.gray2rgb

Description Convert the specified grayscale image to RGB.
Lua synopsis string handle=simIM.gray2rgb(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle to the converted image
Python synopsis string handle=simIM.gray2rgb(string handle, bool inPlace=false)

simIM.hls2rgb

Description Convert the specified HLS image to RGB.
Lua synopsis string handle=simIM.hls2rgb(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle to the converted image
Python synopsis string handle=simIM.hls2rgb(string handle, bool inPlace=false)

simIM.hsv2rgb

Description Convert the specified HSV image to RGB.
Lua synopsis string handle=simIM.hsv2rgb(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle to the converted image
Python synopsis string handle=simIM.hsv2rgb(string handle, bool inPlace=false)

simIM.line

Description Draw a line segment between (x1,y1) and (x2,y2) points in the image.
Lua synopsis simIM.line(string handle, int[2] p1, int[2] p2, int[3] color, int thickness=1, int type=8, int shift=0)
Lua parameters
handle (string): handle to image
p1 (table of int, size 2): x, y coordinates of first point
p2 (table of int, size 2): x, y coordinates of second point
color (table of int, size 3): color (red, green, blue values in range 0..255)
thickness (int, default: 1): line thickness
type (int, default: 8): type of the line (8 for 8-connected line, 4 for 4-connected line, or 16 for antialiased line)
shift (int, default: 0): number of fractional bits in the point coordinates
Lua return values -
Python synopsis simIM.line(string handle, list p1, list p2, list color, int thickness=1, int type=8, int shift=0)

simIM.log

Description Calculates the natural logarithm of every array element.
Lua synopsis string handle=simIM.log(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.log(string handle, bool inPlace=false)

simIM.magnitude

Description Calculates the magnitude of 2D vectors, i.e. DST(i) = sqrt(SRC1(i)^2, SRC2(i)^2).
Lua synopsis string handle=simIM.magnitude(string handle1, string handle2)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.magnitude(string handle1, string handle2)

simIM.merge

Description Merge many single channel images into a multichannel image.
Lua synopsis string handle=simIM.merge(string[] handles)
Lua parameters
handles (table of string): handles to individual channel images
Lua return values
handle (string): handle to merged image
Python synopsis string handle=simIM.merge(list handles)

simIM.mixChannels

Description Mix many single channel images into many multichannel images.
Lua synopsis simIM.mixChannels(string[] inputHandles, string[] outputHandles, int[] fromTo)
Lua parameters
inputHandles (table of string): handles to input images
outputHandles (table of string): handles to output images
fromTo (table of int): array of index pairs, i.e. {src1,dst1,src2,dst2,...,srcN,dstN}. see here for details
Lua return values -
Python synopsis simIM.mixChannels(list inputHandles, list outputHandles, list fromTo)

simIM.multiply

Description Calculates the per-element product of two arrays.
Lua synopsis string handle=simIM.multiply(string handle1, string handle2, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.multiply(string handle1, string handle2, bool inPlace=false)

simIM.openVideoCapture

Description Open video capture device.
Lua synopsis simIM.openVideoCapture(int deviceIndex)
Lua parameters
deviceIndex (int): device index (0 based)
Lua return values -
Python synopsis simIM.openVideoCapture(int deviceIndex)

simIM.phase

Description Calculates the rotation angle of 2D vectors, i.e. DST(i) = atan2(SRC2(i), SRC1(i)).
Lua synopsis string handle=simIM.phase(string handle1, string handle2, bool angleInDegrees=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
angleInDegrees (bool, default: false): when true, the function calculates the angle in degrees, otherwise, they are measured in radians
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.phase(string handle1, string handle2, bool angleInDegrees=false)

simIM.polar2cart

Description Calculates x and y coordinates of 2D vectors from their magnitude and angle.
Lua synopsis string handle1, string handle2=simIM.polar2cart(string handle1, string handle2, bool angleInDegrees=false)
Lua parameters
handle1 (string): handle to first image (magnitude)
handle2 (string): handle to second image (angle)
angleInDegrees (bool, default: false): when true, the function calculates the angle in degrees, otherwise, they are measured in radians
Lua return values
handle1 (string): handle of resulting image (x)
handle2 (string): handle of resulting image (y)
Python synopsis string handle1, string handle2=simIM.polar2cart(string handle1, string handle2, bool angleInDegrees=false)

simIM.polylines

Description Draw several polygonal curves.
Lua synopsis simIM.polylines(string handle, int[] points, int[] numPoints, bool isClosed, int[3] color, int thickness=1, int type=8, int shift=0)
Lua parameters
handle (string): handle to image
points (table of int): curve points, i.e. {c1x1, c1y1, c1x2, c1y2, ..., c1xN1, c1yN1, c2x1, c2y1, ..., c2xN2, c2yN2, ..., cMxNM, cMyNM}
numPoints (table of int): lengths of curves, i.e. {N1, N2, ..., NM}. the sum of numPoints items must be equal to the number of x,y pairs in points.
isClosed (bool): Flag indicating whether the drawn polylines are closed or not. If they are closed, the function draws a line from the last vertex of each curve to its first vertex.
color (table of int, size 3): color (red, green, blue values in range 0..255)
thickness (int, default: 1): line thickness
type (int, default: 8): type of the line (8 for 8-connected line, 4 for 4-connected line, or 16 for antialiased line)
shift (int, default: 0): number of fractional bits in the point coordinates
Lua return values -
Python synopsis simIM.polylines(string handle, list points, list numPoints, bool isClosed, list color, int thickness=1, int type=8, int shift=0)

simIM.pow

Description Raises every array element to a power.
Lua synopsis string handle=simIM.pow(string handle, float power, bool inPlace=false)
Lua parameters
handle (string): handle to image
power (float): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.pow(string handle, float power, bool inPlace=false)

simIM.read

Description Read an image from the specified file.
Lua synopsis string handle=simIM.read(string filename)
Lua parameters
filename (string): file name
Lua return values
handle (string): handle to image
Python synopsis string handle=simIM.read(string filename)

simIM.readFromVideoCapture

Description Read frame from video capture device.
Lua synopsis string handle=simIM.readFromVideoCapture(int deviceIndex, string handle="")
Lua parameters
deviceIndex (int): device index (0 based)
handle (string, default: ""): handle to existing image, or "" to create and return a new image
Lua return values
handle (string): handle to new image (or existing image if given)
Python synopsis string handle=simIM.readFromVideoCapture(int deviceIndex, string handle="")

simIM.readFromVisionSensor

Description Read image from vision sensor.
Lua synopsis string handle=simIM.readFromVisionSensor(int sensorHandle, string handle="")
Lua parameters
sensorHandle (int): handle to vision sensor
handle (string, default: ""): handle to existing image, or "" to create and return a new image
Lua return values
handle (string): handle to new image (or existing image if given)
Python synopsis string handle=simIM.readFromVisionSensor(int sensorHandle, string handle="")

simIM.rectangle

Description Draw a rectangle with corners (x1,y1) and (x2,y2) points in the image.
Lua synopsis simIM.rectangle(string handle, int[2] p1, int[2] p2, int[3] color, int thickness=1, int type=8, int shift=0)
Lua parameters
handle (string): handle to image
p1 (table of int, size 2): x, y coordinates of top-left corner
p2 (table of int, size 2): x, y coordinates of bottom-right corner
color (table of int, size 3): color (red, green, blue values in range 0..255)
thickness (int, default: 1): line thickness (negative values means rect is filled)
type (int, default: 8): type of the line (8 for 8-connected line, 4 for 4-connected line, or 16 for antialiased line)
shift (int, default: 0): number of fractional bits in the point coordinates
Lua return values -
Python synopsis simIM.rectangle(string handle, list p1, list p2, list color, int thickness=1, int type=8, int shift=0)

simIM.reduce

Description Reduces a matrix to a vector.
Lua synopsis string handle=simIM.reduce(string handle, int dim, int op, bool inPlace=false)
Lua parameters
handle (string): handle to image
dim (int): dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row. 1 means that the matrix is reduced to a single column.
op (int): reduction operation (see simIM.reduceOp)
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.reduce(string handle, int dim, int op, bool inPlace=false)

simIM.repeat

Description Fills the output array with repeated copies of the input array.
Lua synopsis string handle=simIM.repeat(string handle, int nx, int ny, bool inPlace=false)
Lua parameters
handle (string): handle to image
nx (int): how many times the src is repeated along the horizontal axis
ny (int): how many times the src is repeated along the vertical axis
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.repeat(string handle, int nx, int ny, bool inPlace=false)

simIM.resize

Description Resize an image and return the resized image (original image is not modified).
Lua synopsis string handle=simIM.resize(string handle, int width, int height, int interpolation=simim_interp_linear, bool inPlace=false)
Lua parameters
handle (string): handle to image
width (int): width of the new image
height (int): height of the new image
interpolation (int, default: simim_interp_linear): type of interpolation (see simIM.interp)
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle to resized image
Python synopsis string handle=simIM.resize(string handle, int width, int height, int interpolation=simim_interp_linear, bool inPlace=false)

simIM.rgb2gray

Description Convert the specified RGB image to gray.
Lua synopsis string handle=simIM.rgb2gray(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle to the converted image
Python synopsis string handle=simIM.rgb2gray(string handle, bool inPlace=false)

simIM.rgb2hls

Description Convert the specified RGB image to HLS.
Lua synopsis string handle=simIM.rgb2hls(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle to the converted image
Python synopsis string handle=simIM.rgb2hls(string handle, bool inPlace=false)

simIM.rgb2hsv

Description Convert the specified RGB image to HSV.
Lua synopsis string handle=simIM.rgb2hsv(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle to the converted image
Python synopsis string handle=simIM.rgb2hsv(string handle, bool inPlace=false)

simIM.scaleAdd

Description Calculates the sum of a scaled array and another array, i.e. DST(i) = SRC1(i)*scale + SRC2(i).
Lua synopsis string handle=simIM.scaleAdd(string handle1, string handle2, float alpha, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
alpha (float): scale coefficient
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.scaleAdd(string handle1, string handle2, float alpha, bool inPlace=false)

simIM.set

Description Set pixel at specified coordinate.
Lua synopsis simIM.set(string handle, int[2] coord, float[] value)
Lua parameters
handle (string): handle to image
coord (table of int, size 2): x, y coordinates
value (table of float): value
Lua return values -
Python synopsis simIM.set(string handle, list coord, list value)

simIM.size

Description Get the size of an image.
Lua synopsis int[2] size=simIM.size(string handle)
Lua parameters
handle (string): handle to image
Lua return values
size (table of int, size 2): size (width, height) of the image
Python synopsis list size=simIM.size(string handle)

simIM.split

Description Split a multichannel image.
Lua synopsis string[] handles=simIM.split(string handle)
Lua parameters
handle (string): handle to image
Lua return values
handles (table of string): handles to individual channel images
Python synopsis list handles=simIM.split(string handle)

simIM.sqrt

Description Calculates the square root of every array element.
Lua synopsis string handle=simIM.sqrt(string handle, bool inPlace=false)
Lua parameters
handle (string): handle to image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.sqrt(string handle, bool inPlace=false)

simIM.subtract

Description Calculates the per-element difference of two arrays.
Lua synopsis string handle=simIM.subtract(string handle1, string handle2, bool inPlace=false)
Lua parameters
handle1 (string): handle to first image
handle2 (string): handle to second image
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.subtract(string handle1, string handle2, bool inPlace=false)

simIM.subtractK

Description Calculates the per-element difference of an array and a scalar.
Lua synopsis string handle=simIM.subtractK(string handle, float[] k, bool inPlace=false)
Lua parameters
handle (string): handle to image
k (table of float): scalar
inPlace (bool, default: false): if true, the original immage will be converted in place. otherwise, the original image will not be modified and a new image is returned.
Lua return values
handle (string): handle of resulting image
Python synopsis string handle=simIM.subtractK(string handle, list k, bool inPlace=false)

simIM.text

Description Drawn a text string.
Lua synopsis simIM.text(string handle, string str, int[2] pos, int fontFace=simim_fontface_simplex, bool italic=false, float fontScale=1.0, int[3] color={255,255,255}, int thickness=1, int type=8, bool bottomLeftOrigin=false)
Lua parameters
handle (string): handle to image
str (string): text string to be drawn
pos (table of int, size 2): x, y coordinates of the origin (bottom-left corner of the string)
fontFace (int, default: simim_fontface_simplex): font face (see simIM.fontFace)
italic (bool, default: false): if true text will have italic style
fontScale (float, default: 1.0): font scale
color (table of int, size 3, default: {255,255,255}): color (red, green, blue values in range 0..255)
thickness (int, default: 1): thickness used to draw a text
type (int, default: 8): type of the line (8 for 8-connected line, 4 for 4-connected line, or 16 for antialiased line)
bottomLeftOrigin (bool, default: false): When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner
Lua return values -
Python synopsis simIM.text(string handle, string str, list pos, int fontFace=simim_fontface_simplex, bool italic=false, float fontScale=1.0, list color={255,255,255}, int thickness=1, int type=8, bool bottomLeftOrigin=false)

simIM.textSize

Description Calculates the width and height of a text string.
Lua synopsis int width, int height, int baseline=simIM.textSize(string str, int fontFace=simim_fontface_simplex, bool italic=false, float fontScale=1.0, int thickness=1)
Lua parameters
str (string): text string to be drawn
fontFace (int, default: simim_fontface_simplex): font face (see simIM.fontFace)
italic (bool, default: false): if true text will have italic style
fontScale (float, default: 1.0): font scale
thickness (int, default: 1): thickness used to draw a text
Lua return values
width (int): width of the text
height (int): height of the text
baseline (int): y-coordinate of the baseline relative to the bottom-most text point
Python synopsis int width, int height, int baseline=simIM.textSize(string str, int fontFace=simim_fontface_simplex, bool italic=false, float fontScale=1.0, int thickness=1)

simIM.write

Description Write the image with given handle to a file.
Lua synopsis simIM.write(string handle, string filename)
Lua parameters
handle (string): handle to image
filename (string): file name
Lua return values -
Python synopsis simIM.write(string handle, string filename)

simIM.writeToTexture

Description Write image to texture.
Lua synopsis simIM.writeToTexture(string handle, int textureId)
Lua parameters
handle (string): handle to existing image
textureId (int): texture id
Lua return values -
Python synopsis simIM.writeToTexture(string handle, int textureId)

simIM.writeToVisionSensor

Description Write image to vision sensor. Make sure the vision sensor is flagged as external input.
Lua synopsis simIM.writeToVisionSensor(string handle, int sensorHandle)
Lua parameters
handle (string): handle to image
sensorHandle (int): handle to vision sensor
Lua return values -
Python synopsis simIM.writeToVisionSensor(string handle, int sensorHandle)



Constants

Constants used in the various functions. Refer to each constant using enumName.constantName, i.e. simUI.curve_type.xy for xy constant in simUI.curve_type enum.

simIM.format

_8UC1: 1 channel, 8 bit unsigned int
_8UC3: 3 channels, 8 bit unsigned int
_8UC4: 4 channels, 8 bit unsigned int
_32FC1: 1 channel, 32 bit float
_32FC3: 3 channels, 32 bit float
_32FC4: 4 channels, 32 bit float

simIM.interp

nearest: nearest-neighbor interpolation
linear: bilinear interpolation
area: resampling using pixel area relation (best for shrinking)
cubic: bicubic interpolation over 4x4 pixel neighborhood
lanczos4: Lanczos interpolation over 8x8 pixel neighborhood

simIM.fontFace

simplex
plain
duplex
complex
triplex
complex_small
script_simplex
script_complex

simIM.cmpOp

eq
gt
ge
lt
le
ne

simIM.reduceOp

sum: the output is the sum of all rows/columns of the matrix.
avg: the output is the mean vector of all rows/columns of the matrix.
max: the output is the maximum (column/row-wise) of all rows/columns of the matrix.
min: the output is the minimum (column/row-wise) of all rows/columns of the matrix.

simIM.flipOp

x: flip around the x-axis
y: flip around the y-axis
both: flip around both axes

simIM.dist

L1
L2
C

simIM.maskSize

_3x3
_5x5
_precise

simIM.dict_type

_4X4_50: 4x4 bits, minimum hamming distance between any two codes = 4, 50 codes
_4X4_100: 4x4 bits, minimum hamming distance between any two codes = 3, 100 codes
_4X4_250: 4x4 bits, minimum hamming distance between any two codes = 3, 250 codes
_4X4_1000: 4x4 bits, minimum hamming distance between any two codes = 2, 1000 codes
_5X5_50: 5x5 bits, minimum hamming distance between any two codes = 8, 50 codes
_5X5_100: 5x5 bits, minimum hamming distance between any two codes = 7, 100 codes
_5X5_250: 5x5 bits, minimum hamming distance between any two codes = 6, 250 codes
_5X5_1000: 5x5 bits, minimum hamming distance between any two codes = 5, 1000 codes
_6X6_50: 6x6 bits, minimum hamming distance between any two codes = 13, 50 codes
_6X6_100: 6x6 bits, minimum hamming distance between any two codes = 12, 100 codes
_6X6_250: 6x6 bits, minimum hamming distance between any two codes = 11, 250 codes
_6X6_1000: 6x6 bits, minimum hamming distance between any two codes = 9, 1000 codes
_7X7_50: 7x7 bits, minimum hamming distance between any two codes = 19, 50 codes
_7X7_100: 7x7 bits, minimum hamming distance between any two codes = 18, 100 codes
_7X7_250: 7x7 bits, minimum hamming distance between any two codes = 17, 250 codes
_7X7_1000: 7x7 bits, minimum hamming distance between any two codes = 14, 1000 codes
_ARUCO_ORIGINAL: 6x6 bits, minimum hamming distance between any two codes = 3, 1024 codes
_APRILTAG_16h5: 4x4 bits, minimum hamming distance between any two codes = 5, 30 codes
_APRILTAG_25h9: 5x5 bits, minimum hamming distance between any two codes = 9, 35 codes
_APRILTAG_36h10: 6x6 bits, minimum hamming distance between any two codes = 10, 2320 codes
_APRILTAG_36h11: 6x6 bits, minimum hamming distance between any two codes = 11, 587 codes