new MojoPerceptionAPI(auth_token, host, port, user_namespace)
Parameters:
Name | Type | Description |
---|---|---|
auth_token |
string | Token generated from a valid API Key. |
host |
string | API Stream host |
port |
string | API Stream port |
user_namespace |
string | Namespace of the current token |
- Source:
Members
-
amusementCallback
-
- Source:
Properties:
Name Type Description handler
for real-time confusion calculation received
-
apiSocket
-
- Source:
Properties:
Name Type Description socket
io
-
attentionCallback
-
- Source:
Properties:
Name Type Description handler
for real-time attention calculation received
-
auth_token
-
- Source:
Properties:
Name Type Description access
key given by the API backend (access token with expiration date depending on the subscription)
-
confusionCallback
-
- Source:
Properties:
Name Type Description handler
for real-time surprise calculation received
-
currentWaitingTime
-
estimate the waiting time of the model to be downloaded in ms.
- Source:
-
emotions
-
- Default Value:
-
- ["attention","confusion","surprise","amusement","engagement","interaction"]
- Source:
Properties:
Name Type Description Default
emotions computed by the API
-
engagementCallback
-
- Source:
Properties:
Name Type Description handler
for real-time engagement calculation received
-
firstEmitDone
-
- Source:
Properties:
Name Type Description Indicate
if the first emit has been done to the SocketIO stream server
-
firstEmitDoneCallback
-
- Source:
Properties:
Name Type Description called
when first emit to SocketIO stream server has been done
-
fps
-
- Source:
Properties:
Name Type Description performance
evaluated while computing
-
host
-
- Source:
Properties:
Name Type Description socket
io stream host
-
<readonly> initialized
-
- Default Value:
-
- false
- Source:
Properties:
Name Type Description set
to true when successfully loaded camera and connected to socketio stream
-
interactionCallback
-
- Source:
Properties:
Name Type Description handler
for real-time interaction calculation received
-
isCameraAccessGranted
-
- Source:
Properties:
Name Type Description True
if camera access has been successfully granted by the user, default false
-
maxWaitingTime
-
- Source:
Properties:
Name Type Description maximum
waiting time for the model to be downloaded after a camera launch. 30 sec default.
-
model
-
- Source:
Properties:
Name Type Description Variable
to use the model that extract anonymized facial keypoints
-
modelLoaded
-
- Source:
Properties:
Name Type Description indicates
when the asynchronous model loading procedure is done
-
nodeToAttachVideo :Node
-
Type:
- Node
- Source:
Properties:
Name Type Description HTML
document node to attach video
-
onErrorCallback
-
- Source:
Properties:
Name Type Description called
if an error occurs
-
port
-
- Source:
Properties:
Name Type Description socket
io stream port
-
sending
-
- Source:
Properties:
Name Type Description set
to false to stop sending to the API
-
socketIoURI
-
- Source:
Properties:
Name Type Description Complete
URI for connection to Socket IO server
-
stepWaitingTime
-
- Source:
Properties:
Name Type Description step
for retrying to check if model is downloaded. 100 ms default.
-
stream
-
- Source:
Properties:
Name Type Description stream
of the user camera if granted, default null
-
subscribeRealtimeOutput
-
- Source:
Properties:
Name Type Description flag
to indicate if the API subscribes to real-time calculation (optional)
-
surpriseCallback
-
- Source:
Properties:
Name Type Description handler
for real-time amusement calculation received
-
user_namespace
-
- Source:
Properties:
Name Type Description namespace
for the user token
-
videoNodeParameters :json
-
Type:
- json
- Source:
Properties:
Name Type Description optional
parameters for the HTML video node element
-
videoSectionName
-
- Default Value:
-
- "video_display"
- Source:
Properties:
Name Type Description Default
name for video tag in browser mode
-
warmUpDoneCallback
-
- Source:
Properties:
Name Type Description called
when camera is loaded + socketio connected + facemesh calculation loop warmed up
Methods
-
<async> computeAnonymizedFaceMeshFromHTMLVideoTag()
-
Compute anonymized facemesh for the current video frame, and call the emit function
- Source:
Returns:
true
- Type
- bool
-
defaultCallback(message)
-
Used by default for all callbacks. Does nothing
Parameters:
Name Type Description message
string not used
- Source:
-
defaultFirstEmitDoneFallback(message)
-
Called when the first emit to the Stream SocketIO server is done
Parameters:
Name Type Description message
string not used
- Source:
-
emitFacemesh(facemesh)
-
Send the facemesh to the streaming SocketIO server
Parameters:
Name Type Description facemesh
facemesh computed facemesh from video input
- Source:
Returns:
true
- Type
- bool
-
<async> init()
-
Initialize MojoPerceptionAPI, called once. Place default callbacks on
calculation reception for each emotion and load the anonymization model- Source:
Returns:
true
- Type
- bool
-
<async> releaseCamera()
-
Release the camera
- Source:
Returns:
true
- Type
- bool
-
setOptions(options)
-
Set options for MojoPerceptionAPI, to change the list of emotions calculated and
manage subscription to realtime outputParameters:
Name Type Description options
dict options["emotions"] : list of emotions to be calculated by the API
options["subscribeRealtimeOutput"] : boolean, true to activate the callbacks @see attentionCallback- Source:
-
<async> setupCameraFromBrowser()
-
Setup camera in browser context
- Source:
Returns:
video tag
- Type
- Future
-
<async> startCameraAndConnectAPI()
-
While model is loaded, get access to the camera and connect to socketIO
- Source:
-
<async> stopFacialExpressionRecognitionAPI()
-
Stop sending to the API, remove video in browser mode, disconnect from the stream
SocketIO server and release the camera.- Source:
Returns:
true
- Type
- bool
-
toString()
-
Return a string representing the MojoPerceptionAPI object
- Source:
Returns:
emotions, socketIoURI, subscription status and key
- Type
- string
-
<async> waitLoadingModelFinished()
-
Waiting loop for initialization purpose, if API calls done before model downloaded
- Source: