3DiVi Face SDK
3.24.2
|
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... | |
class | MatchFoundCallbackData |
MatchFound callback data. More... | |
class | Params |
Parameters of the VideoWorker constructor. More... | |
class | SearchResult |
Template search result (for the VideoWorker.MatchFoundCallback). More... | |
class | StiPersonOutdatedCallbackData |
StiPersonOutdated callback data. More... | |
class | TemplateCreatedCallbackData |
TemplateCreated callback data. More... | |
class | TrackingCallbackData |
Tracking callback data. More... | |
class | TrackingLostCallbackData |
TrackingLost callback data. More... | |
Public Member Functions | |
delegate void | TrackingCallback (int stream_id, int frame_id, RawSample[] samples, bool[] samples_weak, float[] samples_quality, Object userdata) |
Callback function type for a Tracking event. More... | |
delegate void | TrackingCallbackU (TrackingCallbackData data, Object userdata) |
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 of X + N - 1, where N is the value returned by VideoWorker.getTrackingConveyorSize. More... | |
delegate void | TemplateCreatedCallback (int stream_id, int frame_id, RawSample sample, float quality, Template templ, Object userdata) |
Callback function type for a TemplateCreated event. More... | |
delegate void | TemplateCreatedCallbackU (TemplateCreatedCallbackData data, Object userdata) |
Callback function type for a TemplateCreated event. More... | |
delegate void | MatchFoundCallback (int stream_id, int frame_id, ulong person_id, ulong element_id, RawSample sample, float quality, Template templ, Recognizer.MatchResult match_result, Object userdata) |
Callback function type for a MatchFound event. More... | |
delegate void | MatchFoundCallbackExt (int stream_id, int frame_id, RawSample sample, float quality, Template templ, SearchResult[] search_result, Object userdata) |
Callback function type for a MatchFound event. More... | |
delegate void | MatchFoundCallbackU (MatchFoundCallbackData data, Object userdata) |
Callback function type for a MatchFound event. More... | |
delegate void | TrackingLostCallback (int stream_id, int first_frame_id, int last_frame_id, float best_quality, int best_quality_frame_id, RawSample best_quality_sample, Template best_quality_templ, Object userdata) |
Callback function type for a TrackingLost event (e.g. when a person leaves the frame). More... | |
delegate void | TrackingLostCallbackU (TrackingLostCallbackData data, Object userdata) |
Callback function type for a TrackingLost event (e.g. when a person leaves the frame). More... | |
delegate void | StiPersonOutdatedCallbackU (StiPersonOutdatedCallbackData data, Object userdata) |
Callback function type for an StiPersonOutdated event. 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 (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 (List< DatabaseElement > elements, 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 (RawImage frame, int stream_id, long timestamp=-1) |
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... | |
void | addDepthFrame (DepthMapRaw depth_frame, int stream_id, long timestamp_microsec) |
Add a new depth frame for a specific stream. Thread-safe. More... | |
void | resetTrackerOnStream (int stream_id) |
Reset tracker state for a specified video stream. Thread-safe. More... | |
int | resetStream (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. | |
int | addTrackingCallback (TrackingCallback callback, Object userdata) |
Add a handler for a Tracking event. Thread-safe. More... | |
int | addTrackingCallbackU (TrackingCallbackU callback, Object userdata) |
Add a handler for a Tracking event. Thread-safe. More... | |
int | addTemplateCreatedCallback (TemplateCreatedCallback callback, Object userdata) |
Add a handler for a TemplateCreated event. Thread-safe. More... | |
int | addTemplateCreatedCallbackU (TemplateCreatedCallbackU callback, Object userdata) |
Add a handler for a TemplateCreated event. Thread-safe. More... | |
int | addMatchFoundCallback (MatchFoundCallback callback, Object userdata) |
Add a handler for a MatchFound event. Thread-safe. More... | |
int | addMatchFoundCallbackExt (MatchFoundCallbackExt callback, Object userdata) |
Add a handler for a MatchFound event. Thread-safe. More... | |
int | addMatchFoundCallbackU (MatchFoundCallbackU callback, Object userdata) |
Add a handler for a MatchFound event. Thread-safe. More... | |
int | addTrackingLostCallback (TrackingLostCallback callback, Object userdata) |
Add a handler for a TrackingLost event. Thread-safe. More... | |
int | addTrackingLostCallbackU (TrackingLostCallbackU callback, Object userdata) |
Add a handler for a TrackingLost event. Thread-safe. More... | |
int | addStiPersonOutdatedCallbackU (StiPersonOutdatedCallbackU callback, Object userdata) |
Add a handler for a StiPersonOutdated event. Thread-safe. More... | |
void | removeStiPersonOutdatedCallback (int callback_id) |
Remove a handler for an StiPersonOutdated event. Thread-safe. More... | |
void | removeTrackingCallback (int callback_id) |
Remove a handler from Tracking event. Thread-safe. More... | |
void | removeTemplateCreatedCallback (int callback_id) |
Remove a handler from TemplateCreated event. Thread-safe. More... | |
void | removeMatchFoundCallback (int callback_id) |
Remove a handler from MatchFound event. Thread-safe. More... | |
void | removeTrackingLostCallback (int callback_id) |
Remove a handler from TrackingLost event. Thread-safe. More... | |
void | disableProcessingOnStream (int stream_id) |
Disable the creation of templates for a given stream. After that, the matching stops as well. Thread-safe. More... | |
void | enableProcessingOnStream (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 (int stream_id) |
Disable age and gender estimation for a given stream. Thread-safe. More... | |
void | enableAgeGenderEstimationOnStream (int stream_id) |
Enable age and gender estimation for a given stream. Thread-safe. More... | |
void | disableEmotionsEstimationOnStream (int stream_id) |
Disable estimation of emotions for a given stream. Thread-safe. More... | |
void | enableEmotionsEstimationOnStream (int stream_id) |
Enable estimation of emotions for a given stream. Thread-safe. More... | |
Public Member Functions inherited from VDT.FaceRecognition.SDK.IDisposableObject | |
virtual void | Dispose () |
Release internal object. | |
Static Public Attributes | |
static ulong | MATCH_NOT_FOUND_ID = ulong.MaxValue |
A special value for the person_id and element_id parameters in the MatchFoundCallback. | |
Additional Inherited Members | |
Properties inherited from VDT.FaceRecognition.SDK.IDisposableObject | |
bool | isDisposed [get] |
True if internal object already disposed. | |
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.
|
inline |
Add a new depth frame for a specific stream. Thread-safe.
[in] | depth_frame | Depth frame (DepthMapRaw) that contains depth data. |
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
[in] | timestamp_microsec | Timestamp of the frame in microseconds |
|
inline |
Add a handler for a MatchFound event. Thread-safe.
[in] | callback | Callback function. |
[in] | userdata | Any object. It will be passed to the callback as a userdata argument. |
|
inline |
Add a handler for a MatchFound event. Thread-safe.
[in] | callback | Callback function. |
[in] | userdata | Any object. It will be passed to the callback as a userdata argument. |
|
inline |
Add a handler for a MatchFound event. Thread-safe.
[in] | callback | Callback function. |
[in] | userdata | Any object. It will be passed to the callback as a userdata argument. |
|
inline |
Add a handler for a StiPersonOutdated event. Thread-safe.
[in] | callback | Callback function. |
[in] | userdata | Any object. When the callback is called, it's passed as a userdata argument. |
|
inline |
Add a handler for a TemplateCreated event. Thread-safe.
[in] | callback | Callback function. |
[in] | userdata | Any object. It will be passed to the callback as a userdata argument. |
|
inline |
Add a handler for a TemplateCreated event. Thread-safe.
[in] | callback | Callback function. |
[in] | userdata | Any object. It will be passed to the callback as a userdata argument. |
|
inline |
Add a handler for a Tracking event. Thread-safe.
[in] | callback | Callback function. |
[in] | userdata | Any object. It will be passed to the callback as a userdata argument. |
|
inline |
Add a handler for a Tracking event. Thread-safe.
[in] | callback | Callback function. |
[in] | userdata | Any object. It will be passed to the callback as a userdata argument. |
|
inline |
Add a handler for a TrackingLost event. Thread-safe.
[in] | callback | Callback function. |
[in] | userdata | Any object. It will be passed to the callback as a userdata argument. |
|
inline |
Add a handler for a TrackingLost event. Thread-safe.
[in] | callback | Callback function. |
[in] | userdata | Any object. It will be passed to the callback as a userdata argument. |
|
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.
[in] | frame | Video frame. Only colored images are allowed (i.e. RawImage.FORMAT_RGB, RawImage.FORMAT_BGR, RawImage.FORMAT_YUV_NV21 and RawImage.FORMAT_YUV_NV12). |
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
[in] | timestamp | Timestamp of the frame in microseconds |
|
inline |
Disable age and gender estimation for a given stream. Thread-safe.
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
|
inline |
Disable estimation of emotions for a given stream. Thread-safe.
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
|
inline |
Disable the creation of templates for a given stream. After that, the matching stops as well. Thread-safe.
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
|
inline |
Enable age and gender estimation for a given stream. Thread-safe.
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
|
inline |
Enable estimation of emotions for a given stream. Thread-safe.
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
|
inline |
Enable the creation of templates for a given stream. After that, the matching is resumed as well. Thread-safe.
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
|
inline |
Get a method name of the recognizer used. Thread-safe.
|
inline |
Get a number of video streams. Thread-safe.
|
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.
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
delegate void VDT.FaceRecognition.SDK.VideoWorker.MatchFoundCallback | ( | int | stream_id, |
int | frame_id, | ||
ulong | person_id, | ||
ulong | element_id, | ||
RawSample | sample, | ||
float | quality, | ||
Template | templ, | ||
Recognizer.MatchResult | match_result, | ||
Object | userdata | ||
) |
Callback function type for a MatchFound event.
[in] | stream_id | see the description in VideoWorker.MatchFoundCallbackData. |
[in] | frame_id | see the description in VideoWorker.MatchFoundCallbackData. |
[in] | person_id | see search_results in VideoWorker.MatchFoundCallbackData |
[in] | element_id | see search_results in VideoWorker.MatchFoundCallbackData. |
[in] | sample | see the description in VideoWorker.MatchFoundCallbackData. |
[in] | quality | see the description in VideoWorker.MatchFoundCallbackData. |
[in] | templ | see the description in VideoWorker.MatchFoundCallbackData. |
[in] | match_result | see search_results in VideoWorker.MatchFoundCallbackData. |
[in] | userdata | Object submitted by the user when calling the VideoWorker.addMatchFoundCallback method. |
delegate void VDT.FaceRecognition.SDK.VideoWorker.MatchFoundCallbackExt | ( | int | stream_id, |
int | frame_id, | ||
RawSample | sample, | ||
float | quality, | ||
Template | templ, | ||
SearchResult[] | search_result, | ||
Object | userdata | ||
) |
Callback function type for a MatchFound event.
Similar to VideoWorker.MatchFoundCallback but returns all elements with a distance less than distance_threshold (but not more than k nearest elements, the value of k is set in the configuration file in the search_k tag).
When called after N consecutive mismatches, the first element in search_result will have a zero distance, and person_id and element_id are equal to VideoWorker.MATCH_NOT_FOUND_ID.
delegate void VDT.FaceRecognition.SDK.VideoWorker.MatchFoundCallbackU | ( | MatchFoundCallbackData | data, |
Object | userdata | ||
) |
Callback function type for a MatchFound event.
When a template for a tracked face is created, it is compared with each template in the dataset, and if the distance to the nearest element is less than the distance_threshold specified in this element, then a match is fixed.
MatchFoundCallbackData.search_results contains all elements with a distance less than distance_threshold (but not more than k nearest elements, the value of k is set in the configuration file in the search_k tag).
This callback is called after N sequential matches with the elements that belong to the same person.
The N number can be set in a config file using the <consecutive_match_count_for_match_found_callback> tag.
It is guaranteed that this callback will be called after at least one Tracking callback and before TrackingLost callback with the same stream_id and track_id (track_id = sample.getID()).
Also you can set the value of '1' for the <not_found_match_found_callback> tag to enable this callback after N consecutive mismatches (i.e. when the closest element is beyond its distance_threshold). In this case, match_result of the first element in MatchFoundCallbackData.search_results is at zero distance, and person_id and element_id are equal to VideoWorker.MATCH_NOT_FOUND_ID.
[in] | data | MatchFound callback data. |
[in] | userdata | Object submitted by the user when calling the VideoWorker.addMatchFoundCallbackU method. |
|
inline |
Remove a handler from MatchFound event. Thread-safe.
[in] | callback_id | Integer callback id returned by VideoWorker.addMatchFoundCallback or VideoWorker.addMatchFoundCallbackExt. |
|
inline |
Remove a handler for an StiPersonOutdated event. Thread-safe.
[in] | callback_id | Integer callback id returned by VideoWorker.addStiPersonOutdatedCallbackU. |
|
inline |
Remove a handler from TemplateCreated event. Thread-safe.
[in] | callback_id | Integer callback id returned by VideoWorker.addTemplateCreatedCallback. |
|
inline |
Remove a handler from Tracking event. Thread-safe.
[in] | callback_id | Integer callback id returned by VideoWorker.addTrackingCallback. |
|
inline |
Remove a handler from TrackingLost event. Thread-safe.
[in] | callback_id | Integer callback id returned by VideoWorker.addTrackingLostCallback. |
|
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.
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
|
inline |
Reset tracker state for a specified video stream. Thread-safe.
[in] | stream_id | Integer id of the video stream (0 <= stream_id < streams_count). |
|
inline |
Set / replace the database (can be called at any time). Available only if matching_threads_count > 0. Thread-safe.
[in] | elements | Vector of database elements. |
[in] | acceleration | Acceleration type. |
delegate void VDT.FaceRecognition.SDK.VideoWorker.StiPersonOutdatedCallbackU | ( | StiPersonOutdatedCallbackData | data, |
Object | userdata | ||
) |
Callback function type for an StiPersonOutdated event.
[in] | data | StiPersonOutdated callback data. |
[in] | userdata | Object submitted by the user when calling the VideoWorker.addStiPersonOutdatedCallbackU method. |
delegate void VDT.FaceRecognition.SDK.VideoWorker.TemplateCreatedCallback | ( | int | stream_id, |
int | frame_id, | ||
RawSample | sample, | ||
float | quality, | ||
Template | templ, | ||
Object | userdata | ||
) |
Callback function type for a TemplateCreated event.
[in] | stream_id | see the description in VideoWorker.TemplateCreatedCallbackData |
[in] | frame_id | see the description in VideoWorker.TemplateCreatedCallbackData |
[in] | sample | see the description in VideoWorker.TemplateCreatedCallbackData |
[in] | quality | see the description in VideoWorker.TemplateCreatedCallbackData |
[in] | templ | see the description in VideoWorker.TemplateCreatedCallbackData |
[in] | userdata | Object submitted by the user when calling the VideoWorker.addTemplateCreatedCallback method. |
delegate void VDT.FaceRecognition.SDK.VideoWorker.TemplateCreatedCallbackU | ( | TemplateCreatedCallbackData | data, |
Object | userdata | ||
) |
Callback function type for a TemplateCreated event.
This callback is called whenever a template is created within the VideoWorker.
It is guaranteed that this callback will be called after at least one Tracking callback and before the TrackingLost callback with the same stream_id and track_id (track_id = sample.getID()).
[in] | data | TemplateCreated callback data. |
[in] | userdata | Object submitted by the user when calling the VideoWorker.addTemplateCreatedCallbackU method. |
delegate void VDT.FaceRecognition.SDK.VideoWorker.TrackingCallback | ( | int | stream_id, |
int | frame_id, | ||
RawSample[] | samples, | ||
bool[] | samples_weak, | ||
float[] | samples_quality, | ||
Object | userdata | ||
) |
Callback function type for a Tracking event.
[in] | stream_id | see the description in VideoWorker.TrackingCallbackData |
[in] | frame_id | see the description in VideoWorker.TrackingCallbackData |
[in] | samples | see the description in VideoWorker.TrackingCallbackData |
[in] | samples_weak | see the description in VideoWorker.TrackingCallbackData |
[in] | samples_quality | see the description in VideoWorker.TrackingCallbackData |
[in] | userdata | Object submitted by the user when calling the VideoWorker.addTrackingCallback method. |
delegate void VDT.FaceRecognition.SDK.VideoWorker.TrackingCallbackU | ( | TrackingCallbackData | data, |
Object | userdata | ||
) |
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 of X + N - 1, where N is the value returned by VideoWorker.getTrackingConveyorSize.
Tracking callbacks with the same stream_id are called in ascending frame_id order. So, if you receive a callback with stream_id=2 and frame_id=102 right after a callback with stream_id=2 and frame_id=100, then the frame with frame_id=101 was skipped for the video stream 2.
[in] | data | Tracking callback data. |
[in] | userdata | Object submitted by the user when calling the VideoWorker.addTrackingCallbackU method. |
delegate void VDT.FaceRecognition.SDK.VideoWorker.TrackingLostCallback | ( | int | stream_id, |
int | first_frame_id, | ||
int | last_frame_id, | ||
float | best_quality, | ||
int | best_quality_frame_id, | ||
RawSample | best_quality_sample, | ||
Template | best_quality_templ, | ||
Object | userdata | ||
) |
Callback function type for a TrackingLost event (e.g. when a person leaves the frame).
[in] | stream_id | see the description in VideoWorker.TrackingLostCallbackData. |
[in] | first_frame_id | see the description in VideoWorker.TrackingLostCallbackData. |
[in] | last_frame_id | see the description in VideoWorker.TrackingLostCallbackData. |
[in] | best_quality | see the description in VideoWorker.TrackingLostCallbackData. |
[in] | best_quality_frame_id | see the description in VideoWorker.TrackingLostCallbackData. |
[in] | best_quality_sample | see the description in VideoWorker.TrackingLostCallbackData. |
[in] | best_quality_templ | see the description in VideoWorker.TrackingLostCallbackData. |
[in] | userdata | Object submitted by the user when calling the VideoWorker.addTrackingLostCallback method. |
delegate void VDT.FaceRecognition.SDK.VideoWorker.TrackingLostCallbackU | ( | TrackingLostCallbackData | data, |
Object | userdata | ||
) |
Callback function type for a TrackingLost event (e.g. when a person leaves the frame).
It is guaranteed that this is the last callback for the pair <stream_id, track_id> (track_id is equal to sample.getID() for a sample given in any VideoWorker callback).
So, after this callback, no Tracking, MatchFound or TrackingLost callback for the video stream stream_id can contain a sample with the same track_id.
Also it is guaranteed, that for each pair <stream_id, track_id> that was mentioned in the Tracking callback there will be only one TrackingLost callback.
[in] | data | TrackingLost callback data. |
[in] | userdata | Object submitted by the user when calling the VideoWorker.addTrackingLostCallbackU method. |