API Reference

Vue Support

This page is only relevant for Vue 3 only. If you are using Vue 2, please go to vue2.cameragestures.com

Props

Prop nameTypeDefault ValueDescription
doVerificationBooleantrueIf true, after training gestures the user will be prompted to verify them to establish that the model has been trained correctly. If false, the verification stage will be skipped.
fireOnceBooleantrueIf true, an event will be fired when a user makes a gesture, but will not be fired again until either a different gesture is detected, or the user first returns to the neutral position.
gesturesarrayundefinedSee the Gestures prop notes
modelStringundefinedA trained model, in JSON format. If this is not null or undefined, training and verification will be skipped, and the provided model will be used.
neutralTrainingPromptString'Maintain a neutral position'Displayed while training the neutral position.
neutralVerification PromptString'Verify neutral position'Displayed while training the neutral position.
requiredAccuracyNumber90A number between 0 and 100. Each gesture must have at least this percent accuracy during verification, otherwise the training cycle will repeat.
showCameraFeed AfterTrainingCycleBooleantrueWhether the camera feed will be displayed after the training cycle has finished.
showCameraFeed DuringTrainingBooleantrueWhether the camera feed will be displayed while training gestures.
showCameraFeed DuringVerificationBooleantrueWhether the camera feed will be displayed while verifying gestures.
throttleEventsNumber0Only has an effect if fireOnce is false. Throttles how often an event gets fired (in milliseconds) if the user persists with a gesture. If 0, the event will be fired each frame the user continues persisting with the gesture.
trainingDelayNumber1000The number of milliseconds to wait after first displaying a prompt to train a gesture before the training of that gesture commences. Should be high enough to give the user time to start doing that gesture.
trainingPromptPrefixString'Perform a gesture: 'Displayed before a gesture name when training the model.
trainingTimeNumber3000The number of milliseconds to spend taking snapshots from the camera feed and using them to train a model for a gesture.
trainNeutralLastBooleanfalseBy default, the neutral gesture is trained and verified first. If this prop is true, it will be trained and verified last.
verificationDelayNumber1000The number of milliseconds to wait after first displaying a prompt to verify a gesture before the verification of that gesture commences. Should be high enough to give the user time to start doing that gesture.
verificationPrompt PrefixString'Verify gesture: 'Displayed before a gesture name when verifying the model.
verificationTimeNumber1000The number of milliseconds to spend taking snapshots from the camera feed and using them to verify that a gesture has been successfully trained.

gestures prop

The gestures prop is an array of objects for each gesture. Each object can have the following properties:

Property nameTypeDescription
eventStringMandatory. The name of the event that will be fired when this gesture is detected.
fireOnceBooleanIf true, an event will be fired when a user makes the gesture, but will not be fired again until either a different gesture is detected, or the user first returns to the neutral position.
nameStringThe name of the gesture shown in prompts.
requiredAccuracyNumberA number between 0 and 100. The gesture must have at least this percent accuracy during verification, otherwise the training cycle will repeat.
throttleEventNumberOnly has an effect if fireOnce is false (on this object or in a prop). Throttles how often an event gets fired (in milliseconds) if the user persists with this gesture. If 0, the event will be fired each frame the user continues persisting with the gesture.
trainingDelayNumberHow many milliseconds to spend showing the user the prompt before starting to train the gesture.
trainingPromptStringThe prompt displayed before and while this gesture is being trained.
trainingTimeNumberHow many milliseconds to spend training the gesture.
verificationDelayNumberHow many milliseconds to spend showing the user the prompt before starting to verify the gesture.
verificationPromptStringThe prompt displayed before and while this gesture is being verified.
verificationTimeNumberHow many milliseconds to spend verifying the gesture.

Events

EventArgumentDescription
doneTrainingThe trained model as a JSON stringEmitted when training has finished, and verification is about to start
doneVerificationThe trained model as a JSON stringEmitted when verification has successfully finished. At this point events will be fired if the user repeats the gestures.
neutralEmitted when the neutral position is detected. The frequency is determined by the fireOnce and throttleEvents props.
verificationFailedThe failed model as a JSON stringEmitted when verification has failed to meet the required accuracy. The training cycle will begin again.

Custom events

The gestures prop contains an array of objects where the event property has the name of an event that will be fired when the user performs that gesture.

If the gestures prop is not provided, gestures will be determined based on any events being listened to that are not one of the reserved events listed above.

Slots

SlotSlot PropsDescription
instructionsSee the guideCustomizes the appearance of the instructions
loadingSee the guideCustomizes the appearance of the loading indicator that initially appears while the Mobilenet model is loading
progressSee the guideCustomizes the appearance of the progress bar