Skip to content

api Lua Interface


ambaout.create

Create a new ambaout object

Arguments:
rt_instance ptr Pointer to an rt_instance object to create into
string moduleName Module name
Returns:
inputmanaged ptr Pointer to an inputmanaged object

Example

ptr = api:.ambaout.create(ptr,moduleName)


ambaout.create

Create a new ambaout object

Arguments:
Solution ptr Pointer to a Solution object to create into
string moduleName Module name
Returns:
inputmanaged ptr Pointer to an inputmanaged object

Example

ptr = api:.ambaout.create(ptr,moduleName)


tracker.create

Create a new object

Arguments:
rt_instance ptr Pointer to an rt_instance object to create into
string moduleName Module name
Returns:
trackermanaged ptr Pointer to casted Tracker object

Example

ptr = api:.tracker.create(ptr,moduleName)


tracker.create

Create a new object

Arguments:
Solution ptr Pointer to an rt_instance object to create into
string moduleName Module name
Returns:
trackermanaged ptr Pointer to casted Tracker object

Example

ptr = api:.tracker.create(ptr,moduleName)


tracker.get

Get an existing trackermanaged object by name

Arguments:
rt_instance ptr Pointer to an rt_instance object to create into
string moduleName Module name
Returns:
trackermanaged ptr Pointer to an trackermanaged object

Example

ptr = api:.tracker.get(ptr,moduleName)


tracker.get

Get an existing trackermanaged object by name

Arguments:
Solution ptr Pointer to an Solution object to create into
string moduleName Module name
Returns:
trackermanaged ptr Pointer to an trackermanaged object

Example

ptr = api:.tracker.get(ptr,moduleName)


tracker.delete

Destroy an existing trackermanaged object by name

Arguments:
rt_instance ptr Pointer to an rt_instance owning the input object
string moduleName Module name

Example

api:.tracker.delete(ptr,moduleName)


tracker.delete

Destroy an existing trackermanaged object by name

Arguments:
Solution ptr Pointer to an Solution owning the input object
string moduleName Module name

Example

api:.tracker.delete(ptr,moduleName)


inference.create

Create a new object

Arguments:
rt_instance ptr Pointer to an instance object to create into
string moduleName Module name
Returns:
inferencemanaged ptr Pointer to casted InferenceEngine object

Example

ptr = api:.inference.create(ptr,moduleName)


inference.create

Create a new object

Arguments:
Solution ptr Pointer to a solution object to create into
string moduleName Module name
Returns:
inferencemanaged ptr Pointer to casted InferenceEngine object

Example

ptr = api:.inference.create(ptr,moduleName)


inference.get

Get an existing inferencemanaged object by name

Arguments:
rt_instance ptr Pointer to an rt_instance object to create into
string moduleName Module name
Returns:
inferencemanaged ptr Pointer to an inferencemanaged object

Example

ptr = api:.inference.get(ptr,moduleName)


inference.get

Get an existing inferencemanaged object by name

Arguments:
Solution ptr Pointer to a Solution object to create into
string moduleName Module name
Returns:
inferencemanaged ptr Pointer to an inferencemanaged object

Example

ptr = api:.inference.get(ptr,moduleName)


inference.delete

Destroy an existing inferencemanaged object by name

Arguments:
rt_instance ptr Pointer to an rt_instance owning the Solution object
string moduleName Module name

Example

api:.inference.delete(ptr,moduleName)


inference.delete

Destroy an existing inferencemanaged object by name

Arguments:
Solution ptr Pointer to a Solution owning the Solution object
string moduleName Module name

Example

api:.inference.delete(ptr,moduleName)


input.create

Create a new inputmanaged object

Arguments:
rt_instance ptr Pointer to an rt_instance object to create into
string moduleName Module name
Returns:
inputmanaged ptr Pointer to an inputmanaged object

Example

ptr = api:.input.create(ptr,moduleName)


input.create

Create a new inputmanaged object

Arguments:
Solution ptr Pointer to a Solution object to create into
string moduleName Module name
Returns:
inputmanaged ptr Pointer to an inputmanaged object

Example

ptr = api:.input.create(ptr,moduleName)


input.get

Get an existing inputmanaged object by name

Arguments:
rt_instance ptr Pointer to an rt_instance object to create into
string moduleName Module name
Returns:
inputmanaged ptr Pointer to an inputmanaged object

Example

ptr = api:.input.get(ptr,moduleName)


input.get

Get an existing inputmanaged object by name

Arguments:
Solution ptr Pointer to a Solution object to create into
string moduleName Module name
Returns:
inputmanaged ptr Pointer to an inputmanaged object

Example

ptr = api:.input.get(ptr,moduleName)


input.delete

Destroy an existing inputmanaged object by name

Arguments:
rt_instance ptr Pointer to an rt_instance owning the input object
string moduleName Module name

Example

api:.input.delete(ptr,moduleName)


input.delete

Destroy an existing inputmanaged object by name

Arguments:
Solution ptr Pointer to a Solution owning the input object
string moduleName Module name

Example

api:.input.delete(ptr,moduleName)


mqtt.create

Create a new object

Arguments:
string moduleName Module name
Returns:
mqttmanaged ptr Pointer to casted MQTT object

Example

ptr = api:.mqtt.create(moduleName)


motion.create

Create a new object

Arguments:
rt_instance ptr Pointer to an instance object to create into
string moduleName Module name
Returns:
motionmanaged ptr Pointer to casted MotionDetection object

Example

ptr = api:.motion.create(ptr,moduleName)


motion.create

Create a new object

Arguments:
Solution ptr Pointer to a solution object to create into
string moduleName Module name
Returns:
motionmanaged ptr Pointer to casted MotionDetection object

Example

ptr = api:.motion.create(ptr,moduleName)


motion.get

Get an existing motionmanaged object by name

Arguments:
rt_instance ptr Pointer to an rt_instance object
string moduleName Module name
Returns:
motionmanaged ptr Pointer to an motionmanaged object

Example

ptr = api:.motion.get(ptr,moduleName)


motion.get

Get an existing motionmanaged object by name

Arguments:
rt_instance ptr Pointer to a Solution object
string moduleName Module name
Returns:
motionmanaged ptr Pointer to an motionmanaged object

Example

ptr = api:.motion.get(ptr,moduleName)


motion.delete

Destroy an existing motionmanaged object by name

Arguments:
rt_instance ptr Pointer to an rt_instance object
string moduleName Module name

Example

api:.motion.delete(ptr,moduleName)


motion.delete

Destroy an existing motionmanaged object by name

Arguments:
Solution ptr Pointer to a Solution object
string moduleName Module name

Example

api:.motion.delete(ptr,moduleName)


output.create

Create a new object

Arguments:
rt_instance ptr Pointer to instance or solution object to create into
string moduleName Module name
Returns:
outputmanaged ptr Pointer to casted Output object

Example

ptr = api:.output.create(ptr,moduleName)


rest.create

Create a new Rest object

Arguments:
any ptr Pointer to instance or solution object to create into
string moduleName Module name
Returns:
zonemanaged ptr Pointer to casted Rest object

Example

ptr = api:.rest.create(ptr,moduleName)


TopBus.create

Create a new object

Arguments:
string moduleName Module name
Returns:
TopBusManaged ptr Pointer to casted topbusonnector object

Example

ptr = api:.TopBus.create(moduleName)


tracker.create

Create a new object

Arguments:
rt_instance ptr Pointer to an rt_instance object to create into
string moduleName Module name
Returns:
trackermanaged ptr Pointer to casted Tracker object

Example

ptr = api:.tracker.create(ptr,moduleName)


tracker.create

Create a new object

Arguments:
Solution ptr Pointer to an rt_instance object to create into
string moduleName Module name
Returns:
trackermanaged ptr Pointer to casted Tracker object

Example

ptr = api:.tracker.create(ptr,moduleName)


tracker.get

Get an existing trackermanaged object by name

Arguments:
rt_instance ptr Pointer to an rt_instance object to create into
string moduleName Module name
Returns:
trackermanaged ptr Pointer to an trackermanaged object

Example

ptr = api:.tracker.get(ptr,moduleName)


tracker.get

Get an existing trackermanaged object by name

Arguments:
Solution ptr Pointer to an Solution object to create into
string moduleName Module name
Returns:
trackermanaged ptr Pointer to an trackermanaged object

Example

ptr = api:.tracker.get(ptr,moduleName)


tracker.delete

Destroy an existing trackermanaged object by name

Arguments:
rt_instance ptr Pointer to an rt_instance owning the input object
string moduleName Module name

Example

api:.tracker.delete(ptr,moduleName)


tracker.delete

Destroy an existing trackermanaged object by name

Arguments:
Solution ptr Pointer to an Solution owning the input object
string moduleName Module name

Example

api:.tracker.delete(ptr,moduleName)


tripwire.create

Create a new object

Arguments:
any ptr Pointer to instance or solution object to create into
string moduleName Module name
Returns:
tripwiremanaged ptr Pointer to casted Tripwire object

Example

ptr = api:.tripwire.create(ptr,moduleName)


writedata.create

Create a new object

Arguments:
any ptr Pointer to instance or solution object to create into
string moduleName Module name
Returns:
writedatamanaged ptr Pointer to casted WriteData object

Example

ptr = api:.writedata.create(ptr,moduleName)


zmq.create

Create a new object

Arguments:
any ptr Pointer to instance or solution object to create into
string moduleName Module name
Returns:
zmqmanaged ptr Pointer to casted ZMQ object

Example

ptr = api:.zmq.create(ptr,moduleName)


zone.create

Create a new object

Arguments:
any ptr Pointer to instance or solution object to create into
string moduleName Module name
Returns:
zonemanaged ptr Pointer to casted Zone object

Example

ptr = api:.zone.create(ptr,moduleName)


initialize

Initialize the system, discover and register all plugins

Arguments:

Example

api:.initialize()


isRunning

Returns the state of the server

Arguments:

Returns:
boolean running Returns true if the server is running

Example

running = api:.isRunning()


shutdown

Shutdown CVEDIA-RT engine

Arguments:

Example

api:.shutdown()


getRegisteredPlugins

Return plugins that were auto-discovered

Arguments:

Returns:
string[] List of plugin names

Example

List = api:.getRegisteredPlugins()


sleep

Sleep thread

Arguments:
number ms Milliseconds to sleep

Example

api:.sleep(ms)


getCurrentInstance

Returns the instance bound to the calling thread.

Arguments:

Returns:
rt_instance rt RT instance found

Example

rt = api:.getCurrentInstance()


create

Create a new buffer

Arguments:
number width Width of the buffer
number height Height of the buffer
number format Format of the buffer ("BGR", "BGRA", "GRAY")

Example

api:.create(width,height,format)


getCapabilities

Returns table with system capabilities info (if available)

Arguments:

Returns:
table Table with system capabilities info

Example

Table = api:.getCapabilities()


generateGuid

Generates and returns a unique GUID

Arguments:

Returns:
string Unique GUID

Example

Unique = api:.generateGuid()


getTime

Get current timestamp from std::chrono::system_clock::now().time_since_epoch().count()

Arguments:

Returns:
number Current time in ns/NanoSeconds (ms * 1000000)

Example

Current = api:.getTime()


discover

Search solutions directories for solutions and instance configuration json files

Arguments:
string paths Configuration path
boolean discover_tree (Optional) Also discover Instances inside Solution

Example

api:.discover(paths,discover_tree)


getNames

Get existing discovered solutions names list

Arguments:

Example

api:.getNames()


getInstanceById

Returns the Instance of an existing instance.

Arguments:
string instanceId ID of the Runtime Instance
Returns:
rt_instance rt RT Instance found

Example

rt = api:.getInstanceById(instanceId)


listen

Start webserver for REST API

Arguments:
string ip IP to listen on
number port Port to listen on

Example

api:.listen(ip,port)


stopListen

Shutdown REST API webserver

Arguments:

Example

api:.stopListen()


client_post

Do a HTTP POST to an url

Arguments:
string ip Url to post to
string path Url path to post to
string payload Data to send
Returns:
string result POST result

Example

result = api:.client_post(ip,path,payload)


client_get

Do a HTTP GET from an url

Arguments:
string ip Url to get from
string path Url path to get from
Returns:
string result GET result

Example

result = api:.client_get(ip,path)


post

Broadcast a global event message that will be run on all bound functions

Arguments:
table data Data to broacast to functions
string name Event name to post and bind to functions
boolean persist (Optional) Specify if event is to be stored on memory or discarded after propagation to subscribers
string source Event source (instance name, etc)
buffer image (Optional) Specify an image cbuffer to attach to event
string timestamp (Optional) Specify event timestamp

Example

api:.post(data,name,persist,source,image,timestamp)


query

Query for global events according to a specified filter

Arguments:
string query Filter to query for events
Returns:
table data List of corresponding global events

Example

data = api:.query(query)


showNotification

Show a notification on the system

Arguments:
string type Notification type (Success,Info,Warning,Error)
string title Notification title (Can be empty)
string message Notification message
string message_arg Notification message argument (Can be formated inside message with %s %d, etc...)
number duration Notification message duration

Example

api:.showNotification(type,title,message,message_arg,duration)


setLoadingBar

Show a loading bar (Set to -1 to hide)

Arguments:
string title Loading bar title
number value Loading bar value

Example

api:.setLoadingBar(title,value)


startConfigTable

Start a layout table for the config methods (required)

Arguments:
string label Unique label to user for header (required even if showHeader is false)
boolean showHeader Whether to show a collapsable header (optional)
number headerFlags ImGui flags to pass to CollapsableHeader (optional)
Returns:
boolean status True if a config table was opened

Example

status = api:.startConfigTable(label,showHeader,headerFlags)


endConfigTable

Closes an open layout table for the config methods

Arguments:

Example

api:.endConfigTable()


configSliderInt

Show a slider for int values

Arguments:
string label Label to display next to config element
rt_instance instance Instance to store configuration in
string keyPath Location to store key
number minValue Minimum slider value
number maxValue Maximum slider value
number defaultValue Default slider value
Returns:
number,boolean values Returns a tuple with the new value and change state

Example

values = api:.configSliderInt(label,instance,keyPath,minValue,maxValue,defaultValue)


configSliderFloat

Show a slider for float values

Arguments:
string label Label to display next to config element
rt_instance instance Instance to store configuration in
string keyPath Location to store key
number minValue Minimum slider value
number maxValue Maximum slider value
number defaultValue Default slider value
Returns:
number,boolean values Returns a tuple with the new value and change state

Example

values = api:.configSliderFloat(label,instance,keyPath,minValue,maxValue,defaultValue)


configCheckbox

Show a checkbox

Arguments:
string label Label to display next to config element
rt_instance instance Instance to store configuration in
string keyPath Location to store key
boolean defaultValue Default checkbox value
Returns:
boolean,boolean values Returns a tuple with the new value and change state

Example

values = api:.configCheckbox(label,instance,keyPath,defaultValue)


configComboBox

Show a combobox

Arguments:
string label Label to display next to config element
rt_instance instance Instance to store configuration in
string keyPath Location to store key
table items Table of key/value pairs: { {key1 = value1}, {key2 = value2}, ... }
string defaultValue Default selected key if the keyPath is not found
Returns:
string,boolean values Returns a tuple with the selected key and change state

Example

values = api:.configComboBox(label,instance,keyPath,items,defaultValue)


configText

Show a text input

Arguments:
string label Label to display next to config element
rt_instance instance Instance to store configuration in
string keyPath Location to store key
string defaultValue Default text input value
Returns:
string,boolean values Returns a tuple with the new value and change state

Example

values = api:.configText(label,instance,keyPath,defaultValue)


configColor

Show a color picker

Arguments:
string label Label to display next to config element
rt_instance instance Instance to store configuration in
string keyPath Location to store key
number defaultValue Default color picker value
Returns:
number,boolean values Returns a tuple with the new value and change state

Example

values = api:.configColor(label,instance,keyPath,defaultValue)


configEmpty

Show an empty line with optional text

Arguments:
string text Text to display

Example

api:.configEmpty(text)


renderOutputImage

[Deprecated] Renders the detection output on a buffer with the preset

Arguments:

Example

api:.renderOutputImage()


createBackend

Create an inference backend.

Arguments:
string uri Path for the neural network
string name Name of the loaded model
string type Type of the loaded model
number poolSize Size of the backend pool (Optional)
Returns:
inferencemanaged inference Inference model

Example

inference = api:.createBackend(uri,name,type,poolSize)


getBackendByName

Returns an inference backend

Arguments:
string name Name of the loaded model
Returns:
inferencemanaged inference Inference model

Example

inference = api:.getBackendByName(name)


getLog

Return the server debug log

Arguments:

Returns:
string log Debug Log

Example

log = api:.getLog()


LogVerbose

Write a string to Log

Arguments:
string msg Message to send to Log

Example

api:.LogVerbose(msg)


LogDebug

Write a string to Log

Arguments:
string msg Message to send to Log

Example

api:.LogDebug(msg)


LogWarning

Write a string to Log

Arguments:
string msg Message to send to Log

Example

api:.LogWarning(msg)


LogError

Write a string to Log

Arguments:
string msg Message to send to Log

Example

api:.LogError(msg)


LogInfo

Write a string to Log

Arguments:
string msg Message to send to Log

Example

api:.LogInfo(msg)


saveJsonToDisk

Write a CValue table to disk

Arguments:
string filename JSON file to write to
table data Table to write

Example

api:.saveJsonToDisk(filename,data)


generateGuid

Generate a GUID string

Arguments:

Returns:
string guid GUID String

Example

guid = api:.generateGuid()


getDynamicString

Parse a string according to CVEDIART tag format

Arguments:
string inputString String to parse
table data (Optional) Object that can be used to get data from
Returns:
string res Resulting string

Example

res = api:.getDynamicString(inputString,data)


NMS

Runs NMS on detected bboxes and rids of duplicates

Arguments:
Detection[] detections List of Detection objects retrieved from the call to runInference()
float nmsIouThreshold The IOU threshold for NMS
float nmsScoreThreshold The confidence score for NMS
Returns:
Detection[] detections List of Detection objects deduplicated

Example

detections = api:.NMS(detections,nmsIouThreshold,nmsScoreThreshold)


saveConfigToDiskAsJson

Save GlobalState configuration to disk

Arguments:

Example

api:.saveConfigToDiskAsJson()


loadConfigJsonFromDisk

Load GlobalState configuration from disk

Arguments:

Example

api:.loadConfigJsonFromDisk()


getConfig

Get Global Config object

Arguments:

Example

api:.getConfig()


getSystemCameras

Get system cameras list

Arguments:

Example

api:.getSystemCameras()


refreshSystemCameras

Refreshes system cameras state, requesting updated information to all cameras

Arguments:

Example

api:.refreshSystemCameras()


addSystemCameras

Add a camera to system cameras list

Arguments:
table cam Table with camera properties

Example

api:.addSystemCameras(cam)


addCustomCamera

Add a custom camera to system cameras list

Arguments:
string name Camera name

Example

api:.addCustomCamera(name)


removeSystemCamera

Remove camera from system cameras list

Arguments:

Example

api:.removeSystemCamera()