3DiVi Face SDK  3.21.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
com.vdt.face_recognition.sdk.VideoWorker Class Reference

VideoWorker is an interface object for tracking, processing and matching faces on multiple video streams. We recommend you to use VideoWorker instead of Capturer for face tracking on video streams. When VideoWorker is created with matching_thread=0 and processing_thread=0, then the standard Capturer license is used. More...

Classes

class  DatabaseElement
 Database element. If you have several face templates for one person, you should create one element for each template with the same person_id but different element_id. More...
 
interface  MatchFoundCallback
 Callback function type for a MatchFound event. More...
 
interface  MatchFoundCallbackU
 Callback function type for a MatchFound event. More...
 
class  Params
 Parameters of the VideoWorker constructor. More...
 
class  SearchResult
 Template search result (for the VideoWorker.MatchFoundCallback). More...
 
interface  StiPersonOutdatedCallbackU
 Callback function type for an StiPersonOutdated event. More...
 
interface  TemplateCreatedCallback
 Callback function type for a TemplateCreated event. More...
 
interface  TemplateCreatedCallbackU
 Callback function type for a TemplateCreated event. More...
 
interface  TrackingCallback
 Callback function type for a Tracking event. More...
 
interface  TrackingCallbackU
 Callback function type for a Tracking event. This callback is called every time the frame has been processed by the tracker. Tracking callback will be called with frame_id = X not earlier than VideoWorker.addVideoFrame returns the value X + N - 1, where N is the value returned by VideoWorker.getTrackingConveyorSize. More...
 
interface  TrackingLostCallback
 Callback function type for a TrackingLost event (e.g. when a person leaves the frame). More...
 
interface  TrackingLostCallbackU
 Callback function type for a TrackingLost event (e.g. when a person leaves the frame). More...
 

Public Member Functions

void dispose ()
 Release internal object.
 
boolean isDisposed ()
 Check if an object is released. More...
 
String getMethodName ()
 Get a method name of the recognizer used. Thread-safe. More...
 
int getStreamsCount ()
 Get a number of video streams. Thread-safe. More...
 
int getTrackingConveyorSize (final int stream_id)
 Get a size N of tracking conveyor. Tracking callback will be called with frame_id = X not earlier than VideoWorker.addVideoFrame returns the value X + N - 1, where N is the value returned by VideoWorker.getTrackingConveyorSize. Thread-safe. More...
 
void setDatabase (final Vector< DatabaseElement > elements, final Recognizer.SearchAccelerationType acceleration)
 Set / replace the database (can be called at any time). Available only if matching_threads_count > 0. Thread-safe. More...
 
int addVideoFrame (final RawImage frame, final int stream_id)
 Add a new video frame for a specific video stream. Tracking and recognition results will be returned asynchronously via Tracking, MatchFound and TrackingLost callbacks. Thread-safe. More...
 
int addVideoFrame (final RawImage frame, final int stream_id, final long timestamp_microsec)
 
void addDepthFrame (final DepthMapRaw depth_frame, final int stream_id, final long timestamp_microsec)
 
void addIRFrame (final IRFrameRaw ir_frame, final int stream_id, final long timestamp_microsec)
 
void resetTrackerOnStream (final int stream_id)
 Reset tracker state for a specified video stream. Thread-safe. More...
 
int resetStream (final int stream_id)
 Reset work state for the stream. It waits for the callbacks, which are currently being executed, therefore, do not synchronize the resetStream call with the code inside the callbacks, otherwise it can cause a deadlock. After resetStream is executed, no callbacks related to the previous frames or tracks will be called. It is necessary to release the memory allocated for all tracks with track_id less than the return value, since there will be no TrackingLost callback for the tracks removed during this reset. Thread-safe. More...
 
void checkExceptions ()
 Exceptions from the callbacks and inner threads are rethrown when this method is called. Thread-safe.
 
synchronized int addTrackingCallbackU (final TrackingCallbackU callback)
 Add a handler for a Tracking event. Thread-safe. More...
 
synchronized int addTrackingCallback (final TrackingCallback callback)
 Add a handler for a Tracking event. Thread-safe. More...
 
synchronized int addTemplateCreatedCallbackU (final TemplateCreatedCallbackU callback)
 Add a handler for a TemplateCreated event. Thread-safe. More...
 
synchronized int addTemplateCreatedCallback (final TemplateCreatedCallback callback)
 Add a handler for a TemplateCreated event. Thread-safe. More...
 
synchronized int addMatchFoundCallbackU (final MatchFoundCallbackU callback)
 Add a handler for a MatchFound event. Thread-safe. More...
 
synchronized int addMatchFoundCallback (final MatchFoundCallback callback)
 Add a handler for a MatchFound event. Thread-safe. More...
 
synchronized int addTrackingLostCallbackU (final TrackingLostCallbackU callback)
 Add a handler for a TrackingLost event. Thread-safe. More...
 
synchronized int addTrackingLostCallback (final TrackingLostCallback callback)
 Add a handler for a TrackingLost event. Thread-safe. More...
 
synchronized int addStiPersonOutdatedCallbackU (final StiPersonOutdatedCallbackU callback)
 Add a handler for an StiPersonOutdated event. Thread-safe. More...
 
synchronized void removeTrackingCallback (final int callback_id)
 Remove a handler from Tracking event. Thread-safe. More...
 
synchronized void removeTemplateCreatedCallback (final int callback_id)
 Remove a handler from TemplateCreated event. Thread-safe. More...
 
synchronized void removeMatchFoundCallback (final int callback_id)
 Remove a handler from MatchFound event. Thread-safe. More...
 
synchronized void removeTrackingLostCallback (final int callback_id)
 Remove a handler from TrackingLost event. Thread-safe. More...
 
synchronized void removeStiPersonOutdatedCallback (final int callback_id)
 Remove a handler for an StiPersonOutdated event. Thread-safe. More...
 
void disableProcessingOnStream (final int stream_id)
 Disable the creation of templates for a given stream. After that, the matching stops as well. Thread-safe. More...
 
void enableProcessingOnStream (final int stream_id)
 Enable the creation of templates for a given stream. After that, the matching is resumed as well. Thread-safe. More...
 
void disableAgeGenderEstimationOnStream (final int stream_id)
 Disable age and gender estimation for a given stream. Thread-safe. More...
 
void enableAgeGenderEstimationOnStream (final int stream_id)
 Enable age and gender estimation for a given stream. Thread-safe. More...
 
void disableEmotionsEstimationOnStream (final int stream_id)
 Disable estimation of emotions for a given stream. Thread-safe. More...
 
void enableEmotionsEstimationOnStream (final int stream_id)
 Enable estimation of emotions for a given stream. Thread-safe. More...
 

Static Public Attributes

static final long MATCH_NOT_FOUND_ID = Long.MAX_VALUE
 A special value for the person_id and element_id parameters in the MatchFoundCallback.
 

Detailed Description

VideoWorker is an interface object for tracking, processing and matching faces on multiple video streams. We recommend you to use VideoWorker instead of Capturer for face tracking on video streams. When VideoWorker is created with matching_thread=0 and processing_thread=0, then the standard Capturer license is used.

Member Function Documentation

synchronized int com.vdt.face_recognition.sdk.VideoWorker.addMatchFoundCallback ( final MatchFoundCallback  callback)
inline

Add a handler for a MatchFound event. Thread-safe.

Warning
This is a deprecated version (see the new one VideoWorker.addMatchFoundCallbackU)
Parameters
[in]callbackCallback function.
Returns
Integer id for this callback. Use it for passing to VideoWorker.removeMatchFoundCallback to unsubscribe.
synchronized int com.vdt.face_recognition.sdk.VideoWorker.addMatchFoundCallbackU ( final MatchFoundCallbackU  callback)
inline

Add a handler for a MatchFound event. Thread-safe.

Parameters
[in]callbackCallback function.
Returns
Integer id for this callback. Use it for passing to VideoWorker.removeMatchFoundCallback to unsubscribe.
synchronized int com.vdt.face_recognition.sdk.VideoWorker.addStiPersonOutdatedCallbackU ( final StiPersonOutdatedCallbackU  callback)
inline

Add a handler for an StiPersonOutdated event. Thread-safe.

Parameters
[in]callbackCallback function.
Returns
Integer id for this callback. To unsubscribe, pass it to VideoWorker.removeStiPersonOutdatedCallback.
synchronized int com.vdt.face_recognition.sdk.VideoWorker.addTemplateCreatedCallback ( final TemplateCreatedCallback  callback)
inline

Add a handler for a TemplateCreated event. Thread-safe.

Warning
This is a deprecated version (see the new one VideoWorker.addTemplateCreatedCallbackU)
Parameters
[in]callbackCallback function.
Returns
Integer id for this callback. Use it for passing to VideoWorker.removeTemplateCreatedCallback to unsubscribe.
synchronized int com.vdt.face_recognition.sdk.VideoWorker.addTemplateCreatedCallbackU ( final TemplateCreatedCallbackU  callback)
inline

Add a handler for a TemplateCreated event. Thread-safe.

Parameters
[in]callbackCallback function.
Returns
Integer id for this callback. Use it for passing to VideoWorker.removeTemplateCreatedCallback to unsubscribe.
synchronized int com.vdt.face_recognition.sdk.VideoWorker.addTrackingCallback ( final TrackingCallback  callback)
inline

Add a handler for a Tracking event. Thread-safe.

Warning
This is a deprecated version (see the new one VideoWorker.addTrackingCallbackU)
Parameters
[in]callbackCallback function.
Returns
Integer id for this callback. Use it for passing to VideoWorker.removeTrackingCallback to unsubscribe.
synchronized int com.vdt.face_recognition.sdk.VideoWorker.addTrackingCallbackU ( final TrackingCallbackU  callback)
inline

Add a handler for a Tracking event. Thread-safe.

Parameters
[in]callbackCallback function.
Returns
Integer id for this callback. Use it for passing to VideoWorker.removeTrackingCallback to unsubscribe.
synchronized int com.vdt.face_recognition.sdk.VideoWorker.addTrackingLostCallback ( final TrackingLostCallback  callback)
inline

Add a handler for a TrackingLost event. Thread-safe.

Warning
This is a deprecated version (see the new one VideoWorker.addTrackingLostCallbackU)
Parameters
[in]callbackCallback function.
Returns
Integer id for this callback. Use it for passing to VideoWorker.removeTrackingLostCallback to unsubscribe.
synchronized int com.vdt.face_recognition.sdk.VideoWorker.addTrackingLostCallbackU ( final TrackingLostCallbackU  callback)
inline

Add a handler for a TrackingLost event. Thread-safe.

Parameters
[in]callbackCallback function.
Returns
Integer id for this callback. Use it for passing to VideoWorker.removeTrackingLostCallback to unsubscribe.
int com.vdt.face_recognition.sdk.VideoWorker.addVideoFrame ( final RawImage  frame,
final int  stream_id 
)
inline

Add a new video frame for a specific video stream. Tracking and recognition results will be returned asynchronously via Tracking, MatchFound and TrackingLost callbacks. Thread-safe.

Parameters
[in]frameVideo frame. Only colored images are allowed (i.e. RawImage.Format.FORMAT_RGB, RawImage.Format.FORMAT_BGR, RawImage.Format.FORMAT_YUV_NV21 and RawImage.Format.FORMAT_YUV_NV12).
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
Returns
Integer id for this frame, unique for this video stream. This id will be used to identify this frame in the callbacks.
void com.vdt.face_recognition.sdk.VideoWorker.disableAgeGenderEstimationOnStream ( final int  stream_id)
inline

Disable age and gender estimation for a given stream. Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
void com.vdt.face_recognition.sdk.VideoWorker.disableEmotionsEstimationOnStream ( final int  stream_id)
inline

Disable estimation of emotions for a given stream. Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
void com.vdt.face_recognition.sdk.VideoWorker.disableProcessingOnStream ( final int  stream_id)
inline

Disable the creation of templates for a given stream. After that, the matching stops as well. Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
void com.vdt.face_recognition.sdk.VideoWorker.enableAgeGenderEstimationOnStream ( final int  stream_id)
inline

Enable age and gender estimation for a given stream. Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
void com.vdt.face_recognition.sdk.VideoWorker.enableEmotionsEstimationOnStream ( final int  stream_id)
inline

Enable estimation of emotions for a given stream. Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
void com.vdt.face_recognition.sdk.VideoWorker.enableProcessingOnStream ( final int  stream_id)
inline

Enable the creation of templates for a given stream. After that, the matching is resumed as well. Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
String com.vdt.face_recognition.sdk.VideoWorker.getMethodName ( )
inline

Get a method name of the recognizer used. Thread-safe.

Returns
The name of the method.
int com.vdt.face_recognition.sdk.VideoWorker.getStreamsCount ( )
inline

Get a number of video streams. Thread-safe.

Returns
Number of video streams.
int com.vdt.face_recognition.sdk.VideoWorker.getTrackingConveyorSize ( final int  stream_id)
inline

Get a size N of tracking conveyor. Tracking callback will be called with frame_id = X not earlier than VideoWorker.addVideoFrame returns the value X + N - 1, where N is the value returned by VideoWorker.getTrackingConveyorSize. Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
Returns
Size of tracking conveyor.
boolean com.vdt.face_recognition.sdk.VideoWorker.isDisposed ( )
inline

Check if an object is released.

Returns
true if an object is released, false otherwise.
synchronized void com.vdt.face_recognition.sdk.VideoWorker.removeMatchFoundCallback ( final int  callback_id)
inline

Remove a handler from MatchFound event. Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker.addMatchFoundCallback or VideoWorker.addMatchFoundCallbackExt.
synchronized void com.vdt.face_recognition.sdk.VideoWorker.removeStiPersonOutdatedCallback ( final int  callback_id)
inline

Remove a handler for an StiPersonOutdated event. Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker.addStiPersonOutdatedCallbackU.
synchronized void com.vdt.face_recognition.sdk.VideoWorker.removeTemplateCreatedCallback ( final int  callback_id)
inline

Remove a handler from TemplateCreated event. Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker.addTemplateCreatedCallback.
synchronized void com.vdt.face_recognition.sdk.VideoWorker.removeTrackingCallback ( final int  callback_id)
inline

Remove a handler from Tracking event. Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker.addTrackingCallback.
synchronized void com.vdt.face_recognition.sdk.VideoWorker.removeTrackingLostCallback ( final int  callback_id)
inline

Remove a handler from TrackingLost event. Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker.addTrackingLostCallback.
int com.vdt.face_recognition.sdk.VideoWorker.resetStream ( final int  stream_id)
inline

Reset work state for the stream. It waits for the callbacks, which are currently being executed, therefore, do not synchronize the resetStream call with the code inside the callbacks, otherwise it can cause a deadlock. After resetStream is executed, no callbacks related to the previous frames or tracks will be called. It is necessary to release the memory allocated for all tracks with track_id less than the return value, since there will be no TrackingLost callback for the tracks removed during this reset. Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
Returns
Integer track_id_threshold, which means that all tracks that were removed during resetStream had track_id < track_id_threshold, and all new tracks will have track_id >= track_id_threshold.
void com.vdt.face_recognition.sdk.VideoWorker.resetTrackerOnStream ( final int  stream_id)
inline

Reset tracker state for a specified video stream. Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
void com.vdt.face_recognition.sdk.VideoWorker.setDatabase ( final Vector< DatabaseElement elements,
final Recognizer.SearchAccelerationType  acceleration 
)
inline

Set / replace the database (can be called at any time). Available only if matching_threads_count > 0. Thread-safe.

Parameters
[in]elementsVector of database elements.
[in]accelerationAcceleration type.