Migrating from v0.x.x to v1.0.0-beta.x
0.x.x to 1.x.x
Watcher data structure
v0.x.x
The structure above represents the data required to create a watcher in v0.x.x.
Watcher shape can only be a rectangle. Passing extra information to Lampix can only be done through the .classifier
prop via the parameters sent in an inline string.
v1.x.x
shape
- describes the outline of the watcher. You may uselampix.helpers.rectangle(x, y, w, h)
orlampix.helpers.polygon([...])
to create the shape object.name
- specifies the logic to run for the watcher (examples)params
- provides further information that may be required based on thename
proponClassification
- function triggered by Lampix when something is classified inside the watcheronLocation
- optional function triggered by Lampix watchers beforeonClassification
Watcher names for commonly used classifier strings
cls_loc_fin_all_small
uses a neural network and doesn't provide location information =>
name: 'NeuralNetworkClassifier'
need to specify neural network name =>
params: { neural_network_name: 'fingers' }
You can also use the presets.button
as seen below:
segm_*
This applies to former position classifiers (currently referred to as segmenters) whose string started with segm_
, such as segm_cls_loc_nes
, segm_cls_loc_cars
, segm_cls_loc_bar
etc.
uses a neural network =>
name: 'MovementBasedSegmenter'
need to specify neural network name =>
params: { neural_network_name: '*' }
, where * represents the strings aftersegm_cls_loc
,segm_cls_
orsegm_
Watcher add and remove
v0.x.x
v1.x.x
Promise based API
v0.x.x doesn't notify when an action has completed on the device. v1.x.x fixes this issue via Promises.
Registered watcher object
lampix.watchers.add(w1, w2, ..., wN)
returns a Promise that resolves with N objects through which the newly added watchers can be managed.
The registered watcher object provides convenience features such as .remove()
, .pause()
and .resume()
.
The information used to create the registered watcher can be found in the .source
prop of the registered watcher object.
See the API reference for more information.
Watcher index no longer necessary
v0.x.x provides the index of the watcher where movement is detected along with other relevant information (classes, outlines, metadata), but it is up to the user to always remember what watcher corresponds to a particular index in order to perform custom actions per watcher.
v1.x.x fixes this issue by allowing the user to add an .onClassification
property on watchers either on the source data for the watcher or on the registered watcher itself.
Last updated