MojoPerceptionAPI class

Flutter client for Mojo Perception API

See README for a procedure to generate the required parameters: auth_token, host, port and user_namespace

Constructors

MojoPerceptionAPI(String authToken, String host, String port, String userNamespace)
Initializes the MojoPerceptionAPI client.

Properties

amusementCallback Function
Handler for real-time amusement calculation received
getter/setter pair
apiSocket ↔ Socket
Socket io
getter/setter pair
attentionCallback Function
Handler for real-time attention calculation received
getter/setter pair
authToken String
Access key given by the API backend (access token with expiration date depending on the subscription)
getter/setter pair
cameraController ↔ CameraController?
Controller to get camera imageStream
getter/setter pair
confusionCallback Function
Handler for real-time confusion calculation received
getter/setter pair
emotions List<String>
Default emotions computed by the API
getter/setter pair
engagementCallback Function
Handler for real-time engagement calculation received
getter/setter pair
faceDetectedCallback Function
Called on face detected
getter/setter pair
faceDetectionFrameRate double
Calculate the frame rate of Face Detection
getter/setter pair
faceDetectionInputShape List<int>
Shape of face detection model inputs
getter/setter pair
faceDetectionInterpreter ↔ Interpreter
Variable to use the model that extract anonymized facial keypoints
getter/setter pair
faceDetectionOutputsShapes List<List<int>>
Shapes of face detection model outputs
getter/setter pair
facemeshInputShape List<int>
Shape of landmarks detection model inputs
getter/setter pair
facemeshInterpreter ↔ Interpreter
Variable to use the model that extract anonymized facial keypoints
getter/setter pair
facemeshOutputsShapes List<List<int>>
Shapes of landmarks detection model outputs
getter/setter pair
firstEmitDone bool
Indicate if the first emit has been done to the SocketIO stream server
getter/setter pair
firstEmitDoneCallback Function
Called when first emit to SocketIO stream server has been done
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
host String
Socket io stream host
getter/setter pair
interactionCallback Function
Handler for real-time interaction calculation received
getter/setter pair
logger → Logger
final
noFaceDetectedCallback Function
Called on no face detected
getter/setter pair
onErrorCallback Function
Called if an error occurs
getter/setter pair
onStopCallback Function
Called when API is stopped
getter/setter pair
port String
Socket io stream port
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sending bool
Set to false to stop sending to the API
getter/setter pair
socketIoUri String
Complete URI for connection to Socket IO server
getter/setter pair
subscribeRealtimeOutput bool
Flag to indicate if the API subscribes to real-time calculation (optional)
getter/setter pair
surpriseCallback Function
Handler for real-time surprise calculation received
getter/setter pair
userNamespace String
Namespace for the user token
getter/setter pair

Methods

defaultDataCallback(dynamic data) → void
Used by default for all callbacks taking "data" as parameter. Does nothing. message not used
defaultFirstEmitDoneFallback() → void
Called by default when the first emit to the Stream SocketIO server is done.
defaultNoDataCallback() → void
Used by default for all callbacks taking no parameter. Does nothing. message not used
defaultOnStopCallback() → void
Called by default when the API is stopped
emitFacemesh(List<List<double>>? facemesh) → void
Sends the facemesh to the streaming SocketIO server
faceDetectionInference({required CameraImage cameraImage}) Future<Map<String, dynamic>?>
Computes box limit of detected face for cameraImage using _isolateUtils
facemeshInference({required Image cameraImage}) Future<Map<String, dynamic>?>
Computes anonymized facemesh for cameraImage using _isolateUtils
handleCalculationMessage(Map<String, dynamic> msg) → void
Handles message coming on "calculation" event form socketio and dispatch to appropriate emotions callbacks.
handleCameraImage(CameraImage cameraImage) Future<void>
Called at each new cameraImage from camera image stream
initInterpreters() Future<bool>
Loads tflite model for landmarks detection from assets in facemeshInterpreter
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setOptions(Map<String, dynamic> options) → void
Sets options for MojoPerceptionAPI, to change the list of emotions calculated and manages subscription to realtime output
startCameraAndConnectAPI() Future<CameraController?>
Initializes _isolateUtils and facemeshInterpreter Gets access to the camera, and starts imageStream. Connects to socketIO.
stopFacialExpressionRecognitionAPI() Future<void>
Stops sending to the API, stops camera imageStream, disconnects from the stream and dispose _isolateUtils
toString() String
Returns a string representing the MojoPerceptionAPI object
override

Operators

operator ==(Object other) bool
The equality operator.
inherited