Image Plugin API reference

Plugin for processing images in V-REP

simIM.abs

Description Calculates an absolute value of each pixel.
Lua synopsis int handle=simIM.abs(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.absdiff

Description Calculates the per-element absolute difference between two arrays.
Lua synopsis int handle=simIM.absdiff(int handle1, int handle2, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.absdiffK

Description Calculates the per-element absolute difference between an array and a scalar.
Lua synopsis int handle=simIM.absdiffK(int handle, table k, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.add

Description Calculates the per-element sum of two arrays.
Lua synopsis int handle=simIM.add(int handle1, int handle2, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.addK

Description Calculates the per-element sum of an array and a scalar.
Lua synopsis int handle=simIM.addK(int handle, table k, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.addWeighted

Description Calculates the weighted sum of two arrays, i.e. DST(i) = SRC1(i)*alpha + SRC2(i)*beta + gamma.
Lua synopsis int handle=simIM.addWeighted(int handle1, int handle2, float alpha, float beta, float gamma, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.arrowedLine

Description Draw a arrow segment starting from (x1,y1) and pointing to (x2,y2).
Lua synopsis simIM.arrowedLine(int handle, table_2 p1, table_2 p2, table_3 color, int thickness=1, int type=8, int shift=0, float tipLength=0.1)
Lua parameters
handle (int): 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 -
See also

simIM.bitwiseAnd

Description Calculates the per-element bit-wise conjunction of two arrays.
Lua synopsis int handle=simIM.bitwiseAnd(int handle1, int handle2, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.bitwiseAndK

Description Calculates the per-element bit-wise conjunction of an array and a scalar.
Lua synopsis int handle=simIM.bitwiseAndK(int handle, table k, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.bitwiseNot

Description Inverts every bit of an array.
Lua synopsis int handle=simIM.bitwiseNot(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.bitwiseOr

Description Calculates the per-element bit-wise disjunction of two arrays.
Lua synopsis int handle=simIM.bitwiseOr(int handle1, int handle2, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.bitwiseOrK

Description Calculates the per-element bit-wise disjunction of an array and a scalar.
Lua synopsis int handle=simIM.bitwiseOrK(int handle, table k, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.bitwiseXor

Description Calculates the per-element bit-wise exclusive-or of two arrays.
Lua synopsis int handle=simIM.bitwiseXor(int handle1, int handle2, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.bitwiseXorK

Description Calculates the per-element bit-wise exclusive-or of an array and a scalar.
Lua synopsis int handle=simIM.bitwiseXorK(int handle, table k, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.cart2polar

Description Calculates magnitude and angle coordinates of 2D vectors from their x and y coordinates.
Lua synopsis int handle1, int handle2=simIM.cart2polar(int handle1, int handle2, bool angleInDegrees=false)
Lua parameters
handle1 (int): handle to first image (x)
handle2 (int): 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 (int): handle of resulting image (magnitude)
handle2 (int): handle of resulting image (angle)
See also

simIM.circle

Description Draw a circle with center (cx,cy) and radius r.
Lua synopsis simIM.circle(int handle, table_2 center, int radius, table_3 color, int thickness=1, int type=8, int shift=0)
Lua parameters
handle (int): 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 -
See also

simIM.clipLine

Description Clips the line against the image rectangle.
Lua synopsis bool valid, table_2 p1, table_2 p2=simIM.clipLine(int handle, table_2 p1, table_2 p2)
Lua parameters
handle (int): 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
See also

simIM.closeVideoCapture

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

simIM.compare

Description Performs the per-element comparison of two arrays.
Lua synopsis int handle=simIM.compare(int handle1, int handle2, int op, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.compareK

Description Performs the per-element comparison of an array and scalar value.
Lua synopsis int handle=simIM.compareK(int handle, table k, int op, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.convert

Description Convert the image to a different format.
Lua synopsis int handle=simIM.convert(int handle, int format, float scale=1.0, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle to the converted image
See also

simIM.copy

Description Copy a (portion of) image to another image.
Lua synopsis simIM.copy(int srcHandle, table_2 srcOffset, int dstHandle, table_2 dstOffset, table_2 size)
Lua parameters
srcHandle (int): handle to source image
srcOffset (table of int, size 2): x, y offset in the source image
dstHandle (int): 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 -
See also

simIM.create

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

simIM.createFromData

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

simIM.destroy

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

simIM.distanceTransform

Description Calculates the distance to the closest zero pixel for each pixel of the source image.
Lua synopsis int handle=simIM.distanceTransform(int handle, int distanceType=sim_im_dist_L2, int maskSize=sim_im_masksize_precise, bool inPlace=false)
Lua parameters
handle (int): handle to image
distanceType (int, default: sim_im_dist_L2): type of distance (see simIM.dist)
maskSize (int, default: sim_im_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 (int): handle to image
See also

simIM.divide

Description Calculates the per-element division of two arrays.
Lua synopsis int handle=simIM.divide(int handle1, int handle2, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.divideK

Description Calculates the per-element division of a scalar by an array.
Lua synopsis int handle=simIM.divideK(table k, int handle, bool inPlace=false)
Lua parameters
k (table of float): scalar
handle (int): 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 (int): handle of resulting image
See also

simIM.ellipse

Description Draw an ellipse with center (cx,cy) and axes (rx,ry) points in the image.
Lua synopsis simIM.ellipse(int handle, table_2 center, table_2 radius, float angle=0.0, float startAngle=0.0, float endAngle=360.0, table_3 color, int thickness=1, int type=8, int shift=0)
Lua parameters
handle (int): 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): 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 -
See also

simIM.exp

Description Calculates the exponential of every array element.
Lua synopsis int handle=simIM.exp(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.fillConvexPoly

Description Fills a convex polygon.
Lua synopsis simIM.fillConvexPoly(int handle, table points, table_3 color, int type=8, int shift=0)
Lua parameters
handle (int): 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 -
See also

simIM.fillPoly

Description Fills the area bounded by one or more polygon.
Lua synopsis simIM.fillPoly(int handle, table points, table numPoints, table_2 offset, table_3 color, int type=8, int shift=0)
Lua parameters
handle (int): 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 -
See also

simIM.flip

Description Flips an image around vertical, horizontal, or both axes.
Lua synopsis int handle=simIM.flip(int handle, int op=0, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.get

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

simIM.gray2rgb

Description Convert the specified grayscale image to RGB.
Lua synopsis int handle=simIM.gray2rgb(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle to the converted image
See also

simIM.handles

Description Get all the active handles.
Lua synopsis table handles=simIM.handles()
Lua parameters -
Lua return values
handles (table of int): handles
See also

simIM.hls2rgb

Description Convert the specified HLS image to RGB.
Lua synopsis int handle=simIM.hls2rgb(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle to the converted image
See also

simIM.hsv2rgb

Description Convert the specified HSV image to RGB.
Lua synopsis int handle=simIM.hsv2rgb(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle to the converted image
See also

simIM.line

Description Draw a line segment between (x1,y1) and (x2,y2) points in the image.
Lua synopsis simIM.line(int handle, table_2 p1, table_2 p2, table_3 color, int thickness=1, int type=8, int shift=0)
Lua parameters
handle (int): 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 -
See also

simIM.log

Description Calculates the natural logarithm of every array element.
Lua synopsis int handle=simIM.log(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.magnitude

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

simIM.merge

Description Merge many single channel images into a multichannel image.
Lua synopsis int handle=simIM.merge(table handles)
Lua parameters
handles (table of int): handles to individual channel images
Lua return values
handle (int): handle to merged image
See also

simIM.mixChannels

Description Mix many single channel images into many multichannel images.
Lua synopsis simIM.mixChannels(table inputHandles, table outputHandles, table fromTo)
Lua parameters
inputHandles (table of int): handles to input images
outputHandles (table of int): 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 -
See also

simIM.multiply

Description Calculates the per-element product of two arrays.
Lua synopsis int handle=simIM.multiply(int handle1, int handle2, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.openVideoCapture

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

simIM.phase

Description Calculates the rotation angle of 2D vectors, i.e. DST(i) = atan2(SRC2(i), SRC1(i)).
Lua synopsis int handle=simIM.phase(int handle1, int handle2, bool angleInDegrees=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.polar2cart

Description Calculates x and y coordinates of 2D vectors from their magnitude and angle.
Lua synopsis int handle1, int handle2=simIM.polar2cart(int handle1, int handle2, bool angleInDegrees=false)
Lua parameters
handle1 (int): handle to first image (magnitude)
handle2 (int): 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 (int): handle of resulting image (x)
handle2 (int): handle of resulting image (y)
See also

simIM.polylines

Description Draw several polygonal curves.
Lua synopsis simIM.polylines(int handle, table points, table numPoints, bool isClosed, table_3 color, int thickness=1, int type=8, int shift=0)
Lua parameters
handle (int): 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 -
See also

simIM.pow

Description Raises every array element to a power.
Lua synopsis int handle=simIM.pow(int handle, float power, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.read

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

simIM.readFromVideoCapture

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

simIM.readFromVisionSensor

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

simIM.rectangle

Description Draw a rectangle with corners (x1,y1) and (x2,y2) points in the image.
Lua synopsis simIM.rectangle(int handle, table_2 p1, table_2 p2, table_3 color, int thickness=1, int type=8, int shift=0)
Lua parameters
handle (int): 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 -
See also

simIM.reduce

Description Reduces a matrix to a vector.
Lua synopsis int handle=simIM.reduce(int handle, int dim, int op, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.repeat

Description Fills the output array with repeated copies of the input array.
Lua synopsis int handle=simIM.repeat(int handle, int nx, int ny, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.resize

Description Resize an image and return the resized image (original image is not modified).
Lua synopsis int handle=simIM.resize(int handle, int width, int height, int interpolation=sim_im_interp_linear, bool inPlace=false)
Lua parameters
handle (int): handle to image
width (int): width of the new image
height (int): height of the new image
interpolation (int, default: sim_im_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 (int): handle to resized image
See also

simIM.rgb2gray

Description Convert the specified RGB image to gray.
Lua synopsis int handle=simIM.rgb2gray(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle to the converted image
See also

simIM.rgb2hls

Description Convert the specified RGB image to HLS.
Lua synopsis int handle=simIM.rgb2hls(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle to the converted image
See also

simIM.rgb2hsv

Description Convert the specified RGB image to HSV.
Lua synopsis int handle=simIM.rgb2hsv(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle to the converted image
See also

simIM.scaleAdd

Description Calculates the sum of a scaled array and another array, i.e. DST(i) = SRC1(i)*scale + SRC2(i).
Lua synopsis int handle=simIM.scaleAdd(int handle1, int handle2, float alpha, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.set

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

simIM.size

Description Get the size of an image.
Lua synopsis table_2 size=simIM.size(int handle)
Lua parameters
handle (int): handle to image
Lua return values
size (table of int, size 2): size (width, height) of the image
See also

simIM.split

Description Split a multichannel image.
Lua synopsis table handles=simIM.split(int handle)
Lua parameters
handle (int): handle to image
Lua return values
handles (table of int): handles to individual channel images
See also

simIM.sqrt

Description Calculates the square root of every array element.
Lua synopsis int handle=simIM.sqrt(int handle, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.subtract

Description Calculates the per-element difference of two arrays.
Lua synopsis int handle=simIM.subtract(int handle1, int handle2, bool inPlace=false)
Lua parameters
handle1 (int): handle to first image
handle2 (int): 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 (int): handle of resulting image
See also

simIM.subtractK

Description Calculates the per-element difference of an array and a scalar.
Lua synopsis int handle=simIM.subtractK(int handle, table k, bool inPlace=false)
Lua parameters
handle (int): 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 (int): handle of resulting image
See also

simIM.text

Description Drawn a text string.
Lua synopsis simIM.text(int handle, string str, table_2 pos, int fontFace=sim_im_fontface_simplex, bool italic=false, float fontScale=1.0, table_3 color, int thickness=1, int type=8, bool bottomLeftOrigin=false)
Lua parameters
handle (int): 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: sim_im_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): 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 -
See also

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=sim_im_fontface_simplex, bool italic=false, float fontScale=1.0, int thickness=1)
Lua parameters
str (string): text string to be drawn
fontFace (int, default: sim_im_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
See also

simIM.write

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

simIM.writeToVisionSensor

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



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