.helpers.rectangle
Create a shape object for a watcher descriptor.

Returns

1
{
2
type: 'rectangle',
3
data: {
4
posX: number,
5
posY: number,
6
width: number,
7
height: number
8
}
9
}
Copied!

Example

NOTE that all of the ways to create a button specified below are equivalent.
1
import lampix from '@lampix/core';
2
3
const callback = ([recognizedObject]) => {
4
if (Number(recognizedObject.classTag) === 1) {
5
console.log('yay!');
6
} else {
7
console.log('nay!');
8
}
9
};
10
11
const watcher = {
12
name: 'NeuralNetworkClassifier',
13
shape: lampix.helpers.rectangle(50, 50, 50, 50),
14
onClassification: callback,
15
params: {
16
neural_network_name: 'fingers'
17
}
18
};
Copied!
Last modified 3yr ago
Copy link