3DiVi Face SDK  3.24.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
pbio::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...

#include <VideoWorker.h>

Classes

struct  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...
 
struct  MatchFoundCallbackData
 MatchFound callback data. More...
 
struct  Params
 Parameters of the VideoWorker constructor. More...
 
struct  SearchResult
 Template search result (for VideoWorker::MatchFoundCallbackFuncU). More...
 
struct  StiPersonOutdatedCallbackData
 StiPersonOutdated callback data. More...
 
struct  TemplateCreatedCallbackData
 TemplateCreated callback data. More...
 
struct  TrackingCallbackData
 Tracking callback data. More...
 
struct  TrackingLostCallbackData
 TrackingLost callback data. More...
 

Public Types

typedef LightSmartPtr
< VideoWorker >::tPtr 
Ptr
 Alias for the type of a smart pointer to VideoWorker.
 
typedef void(* TrackingCallbackFunc )(const int stream_id, const int frame_id, const std::vector< RawSample::Ptr > &samples, const std::vector< bool > &samples_weak, const std::vector< float > &samples_quality, void *const userdata)
 Callback function type for a Tracking event. More...
 
typedef void(* TrackingCallbackU )(const TrackingCallbackData &data, void *const 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...
 
typedef void(* TrackingCallbackFuncU )(const TrackingCallbackData &data, void *const userdata)
 Callback function type for a Tracking event. More...
 
typedef void(* TemplateCreatedCallbackFunc )(const int stream_id, const int frame_id, const RawSample::Ptr &sample, const float quality, const Template::Ptr &templ, void *const userdata)
 Callback function type for a TemplateCreated event. More...
 
typedef void(* TemplateCreatedCallbackU )(const TemplateCreatedCallbackData &data, void *const userdata)
 Callback function type for a TemplateCreated event. More...
 
typedef void(* TemplateCreatedCallbackFuncU )(const TemplateCreatedCallbackData &data, void *const userdata)
 Callback function type for a TemplateCreated event. More...
 
typedef void(* MatchFoundCallbackFunc )(const int stream_id, const int frame_id, const uint64_t person_id, const uint64_t element_id, const RawSample::Ptr &sample, const float quality, const Template::Ptr &templ, const Recognizer::MatchResult match_result, void *const userdata)
 Callback function type for a MatchFound event. More...
 
typedef void(* MatchFoundCallbackFuncExt )(const int stream_id, const int frame_id, const RawSample::Ptr &sample, const float quality, const Template::Ptr &templ, const std::vector< SearchResult > &search_result, void *const userdata)
 Callback function type for a MatchFound event. More...
 
typedef void(* MatchFoundCallbackU )(const MatchFoundCallbackData &data, void *const userdata)
 Callback function type for a MatchFound event. More...
 
typedef void(* MatchFoundCallbackFuncU )(const MatchFoundCallbackData &data, void *const userdata)
 Callback function type for a MatchFound event. More...
 
typedef void(* TrackingLostCallbackFunc )(const int stream_id, const int first_frame_id, const int last_frame_id, const float best_quality, const int best_quality_frame_id, const RawSample::Ptr &best_quality_sample, const Template::Ptr &best_quality_templ, void *const userdata)
 Callback function type for a TrackingLost event (e.g. when a person leaves the frame). More...
 
typedef void(* TrackingLostCallbackU )(const TrackingLostCallbackData &data, void *const userdata)
 Callback function type for a TrackingLost event (e.g. when a person leaves the frame). More...
 
typedef void(* TrackingLostCallbackFuncU )(const TrackingLostCallbackData &data, void *const userdata)
 Callback function type for a TrackingLost event (e.g. when a person leaves the frame). More...
 
typedef void(* StiPersonOutdatedCallbackU )(const StiPersonOutdatedCallbackData &data, void *const userdata)
 Callback function type for an StiPersonOutdated event. More...
 

Public Member Functions

std::string getMethodName () const
 Get a method name of the recognizer used. Thread-safe. More...
 
int getStreamsCount () const
 Get a number of video streams. Thread-safe. More...
 
int getTrackingConveyorSize (const int stream_id) const
 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 (const std::vector< DatabaseElement > &elements, const Recognizer::SearchAccelerationType acceleration=Recognizer::SEARCH_ACCELERATION_1)
 Set / replace the database (can be called at any time). Available only if matching_threads_count > 0. Thread-safe. More...
 
int addVideoFrame (const RawImage frame, const int stream_id, const uint64_t timestamp_microsec=uint64_t(-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 (const DepthMapRaw &depth_frame, const int stream_id, const uint64_t timestamp_microsec)
 Add a new depth frame for a specific stream. Thread-safe. More...
 
void addIRFrame (const IRFrameRaw &ir_frame, const int stream_id, const uint64_t timestamp_microsec)
 Add a new IR frame for a specific stream. Thread-safe. More...
 
void resetTrackerOnStream (const int stream_id)
 Reset tracker state for a specified video stream. Thread-safe. More...
 
int resetStream (const 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 (const TrackingCallbackFunc callback, void *const userdata)
 Add a handler for a Tracking event. Thread-safe. More...
 
int addTrackingCallbackU (const TrackingCallbackU callback, void *const userdata)
 Add a handler for a Tracking event. Thread-safe. More...
 
int addTemplateCreatedCallback (const TemplateCreatedCallbackFunc callback, void *const userdata)
 Add a handler for a TemplateCreated event. Thread-safe. More...
 
int addTemplateCreatedCallbackU (const TemplateCreatedCallbackU callback, void *const userdata)
 Add a handler for a TemplateCreated event. Thread-safe. More...
 
int addMatchFoundCallback (const MatchFoundCallbackFunc callback, void *const userdata)
 Add a handler for a MatchFound event. Thread-safe. More...
 
int addMatchFoundCallbackExt (const MatchFoundCallbackFuncExt callback, void *const userdata)
 Add a handler for a MatchFound event. Thread-safe. More...
 
int addMatchFoundCallbackU (const MatchFoundCallbackU callback, void *const userdata)
 Add a handler for a MatchFound event. Thread-safe. More...
 
int addStiPersonOutdatedCallbackU (const StiPersonOutdatedCallbackU callback, void *const userdata)
 Add a handler for an StiPersonOutdated event. Thread-safe. More...
 
int addTrackingLostCallback (const TrackingLostCallbackFunc callback, void *const userdata)
 Add a handler for a TrackingLost event. Thread-safe. More...
 
int addTrackingLostCallbackU (const TrackingLostCallbackU callback, void *const userdata)
 Add a handler for a TrackingLost event. Thread-safe. More...
 
void removeTrackingCallback (const int callback_id)
 Remove a handler for Tracking event. Thread-safe. More...
 
void removeTemplateCreatedCallback (const int callback_id)
 Remove a handler for TemplateCreated event. Thread-safe. More...
 
void removeMatchFoundCallback (const int callback_id)
 Remove a handler for MatchFound event. Thread-safe. More...
 
void removeStiPersonOutdatedCallback (const int callback_id)
 Remove a handler for an StiPersonOutdated event. Thread-safe. More...
 
void removeTrackingLostCallback (const int callback_id)
 Remove a handler for TrackingLost event. Thread-safe. More...
 
void disableProcessingOnStream (const int stream_id)
 Disable the creation of templates for a given stream. After that, the matching stops as well. Thread-safe. More...
 
void enableProcessingOnStream (const 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 (const int stream_id)
 Disable age and gender estimation for a given stream. Thread-safe. More...
 
void enableAgeGenderEstimationOnStream (const int stream_id)
 Enable age and gender estimation for a given stream. Thread-safe. More...
 
void disableEmotionsEstimationOnStream (const int stream_id)
 Disable estimation of emotions for a given stream. Thread-safe. More...
 
void enableEmotionsEstimationOnStream (const int stream_id)
 Enable estimation of emotions for a given stream. Thread-safe. More...
 

Static Public Attributes

static const uint64_t MATCH_NOT_FOUND_ID = (uint64_t) (-1)
 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 Typedef Documentation

typedef void(* pbio::VideoWorker::MatchFoundCallbackFunc)(const int stream_id, const int frame_id, const uint64_t person_id, const uint64_t element_id, const RawSample::Ptr &sample, const float quality, const Template::Ptr &templ, const Recognizer::MatchResult match_result, void *const userdata)

Callback function type for a MatchFound event.

Warning
This is a deprecated version (see the new one VideoWorker::MatchFoundCallbackU)
Parameters
[in]stream_idsee the description in VideoWorker::MatchFoundCallbackData.
[in]frame_idsee the description in VideoWorker::MatchFoundCallbackData.
[in]person_idsee search_results in VideoWorker::MatchFoundCallbackData
[in]element_idsee search_results in VideoWorker::MatchFoundCallbackData.
[in]samplesee the description in VideoWorker::MatchFoundCallbackData.
[in]qualitysee the description in VideoWorker::MatchFoundCallbackData.
[in]templsee the description in VideoWorker::MatchFoundCallbackData.
[in]match_resultsee search_results in VideoWorker::MatchFoundCallbackData.
[in]userdataPointer to data submitted by the user when calling the VideoWorker::addMatchFoundCallback method.
typedef void(* pbio::VideoWorker::MatchFoundCallbackFuncExt)(const int stream_id, const int frame_id, const RawSample::Ptr &sample, const float quality, const Template::Ptr &templ, const std::vector< SearchResult > &search_result, void *const userdata)

Callback function type for a MatchFound event.

Warning
This is a deprecated version (see the new one VideoWorker::MatchFoundCallbackU)

Similar to VideoWorker::MatchFoundCallbackFunc 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 tagged as search_k).

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.

typedef void(* pbio::VideoWorker::MatchFoundCallbackFuncU)(const MatchFoundCallbackData &data, void *const userdata)

Callback function type for a MatchFound event.

Warning
This is a deprecated version (see the new one VideoWorker::MatchFoundCallbackU)
typedef void(* pbio::VideoWorker::MatchFoundCallbackU)(const MatchFoundCallbackData &data, void *const 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 tagged as 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.

Parameters
[in]dataMatchFound callback data.
[in]userdataPointer to data submitted by the user when calling the VideoWorker::addMatchFoundCallbackU method.
typedef void(* pbio::VideoWorker::StiPersonOutdatedCallbackU)(const StiPersonOutdatedCallbackData &data, void *const userdata)

Callback function type for an StiPersonOutdated event.

Parameters
[in]dataStiPersonOutdated callback data.
[in]userdataPointer to the data submitted by the user when calling the VideoWorker::addStiPersonOutdatedCallbackU method.
typedef void(* pbio::VideoWorker::TemplateCreatedCallbackFunc)(const int stream_id, const int frame_id, const RawSample::Ptr &sample, const float quality, const Template::Ptr &templ, void *const userdata)

Callback function type for a TemplateCreated event.

Warning
This is a deprecated version (see the new one VideoWorker::TemplateCreatedCallbackU)
Parameters
[in]stream_idsee the description in VideoWorker::TemplateCreatedCallbackData
[in]frame_idsee the description in VideoWorker::TemplateCreatedCallbackData
[in]samplesee the description in VideoWorker::TemplateCreatedCallbackData
[in]qualitysee the description in VideoWorker::TemplateCreatedCallbackData
[in]templsee the description in VideoWorker::TemplateCreatedCallbackData
[in]userdataPointer to data submitted by the user when calling the VideoWorker::addTemplateCreatedCallback method.
typedef void(* pbio::VideoWorker::TemplateCreatedCallbackFuncU)(const TemplateCreatedCallbackData &data, void *const userdata)

Callback function type for a TemplateCreated event.

Warning
This is a deprecated version (see the new one VideoWorker::TemplateCreatedCallbackU)
typedef void(* pbio::VideoWorker::TemplateCreatedCallbackU)(const TemplateCreatedCallbackData &data, void *const 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()).

Parameters
[in]dataTemplateCreated callback data.
[in]userdataPointer to data submitted by the user when calling the VideoWorker::addTemplateCreatedCallbackU method.
typedef void(* pbio::VideoWorker::TrackingCallbackFunc)(const int stream_id, const int frame_id, const std::vector< RawSample::Ptr > &samples, const std::vector< bool > &samples_weak, const std::vector< float > &samples_quality, void *const userdata)

Callback function type for a Tracking event.

Warning
This is a deprecated version (see the new one VideoWorker::TrackingCallbackU)
Parameters
[in]stream_idsee the description in VideoWorker::TrackingCallbackData
[in]frame_idsee the description in VideoWorker::TrackingCallbackData
[in]samplessee the description in VideoWorker::TrackingCallbackData
[in]samples_weaksee the description in VideoWorker::TrackingCallbackData
[in]samples_qualitysee the description in VideoWorker::TrackingCallbackData
[in]userdataPointer to data submitted by the user when calling the VideoWorker::addTrackingCallback method.
typedef void(* pbio::VideoWorker::TrackingCallbackFuncU)(const TrackingCallbackData &data, void *const userdata)

Callback function type for a Tracking event.

Warning
This is a deprecated version (see the new one VideoWorker::TrackingCallbackU)
typedef void(* pbio::VideoWorker::TrackingCallbackU)(const TrackingCallbackData &data, void *const 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.

Parameters
[in]dataTracking callback data.
[in]userdataPointer to data submitted by the user when calling the VideoWorker::addTrackingCallbackU method.
typedef void(* pbio::VideoWorker::TrackingLostCallbackFunc)(const int stream_id, const int first_frame_id, const int last_frame_id, const float best_quality, const int best_quality_frame_id, const RawSample::Ptr &best_quality_sample, const Template::Ptr &best_quality_templ, void *const userdata)

Callback function type for a TrackingLost event (e.g. when a person leaves the frame).

Warning
This is a deprecated version (see the new one VideoWorker::TrackingLostCallbackU).
Parameters
[in]stream_idsee the description in VideoWorker::TrackingLostCallbackData.
[in]first_frame_idsee the description in VideoWorker::TrackingLostCallbackData.
[in]last_frame_idsee the description in VideoWorker::TrackingLostCallbackData.
[in]best_qualitysee the description in VideoWorker::TrackingLostCallbackData.
[in]best_quality_frame_idsee the description in VideoWorker::TrackingLostCallbackData.
[in]best_quality_samplesee the description in VideoWorker::TrackingLostCallbackData.
[in]best_quality_templsee the description in VideoWorker::TrackingLostCallbackData.
[in]userdataPointer to the data submitted by the user when calling the VideoWorker::addTrackingLostCallback method.
typedef void(* pbio::VideoWorker::TrackingLostCallbackFuncU)(const TrackingLostCallbackData &data, void *const userdata)

Callback function type for a TrackingLost event (e.g. when a person leaves the frame).

Warning
This is a deprecated version (see the new one VideoWorker::TrackingLostCallbackU).
typedef void(* pbio::VideoWorker::TrackingLostCallbackU)(const TrackingLostCallbackData &data, void *const 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 exactly one TrackingLost callback.

Parameters
[in]dataTrackingLost callback data.
[in]userdataPointer to the data submitted by the user when calling the VideoWorker::addTrackingLostCallbackU method.

Member Function Documentation

void VideoWorker::addDepthFrame ( const DepthMapRaw depth_frame,
const int  stream_id,
const uint64_t  timestamp_microsec 
)
inline

Add a new depth frame for a specific stream. Thread-safe.

Parameters
[in]depth_frameDepth frame (DepthMapRaw) that contains depth data.
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
[in]timestamp_microsecTimestamp of the frame in microseconds
void VideoWorker::addIRFrame ( const IRFrameRaw ir_frame,
const int  stream_id,
const uint64_t  timestamp_microsec 
)
inline

Add a new IR frame for a specific stream. Thread-safe.

Parameters
[in]ir_frameIR frame (IRFrameRaw) that contains IR data.
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
[in]timestamp_microsecTimestamp of a frame in microseconds.
int VideoWorker::addMatchFoundCallback ( const MatchFoundCallbackFunc  callback,
void *const  userdata 
)
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.
[in]userdataAny pointer. It will be passed to the callback as a userdata argument.
Returns
Integer id for this callback. Use it for passing to VideoWorker::removeMatchFoundCallback to unsubscribe.
int VideoWorker::addMatchFoundCallbackExt ( const MatchFoundCallbackFuncExt  callback,
void *const  userdata 
)
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.
[in]userdataAny pointer. It will be passed to the callback as a userdata argument.
Returns
Integer id for this callback. Use it for passing to VideoWorker::removeMatchFoundCallback to unsubscribe.
int VideoWorker::addMatchFoundCallbackU ( const MatchFoundCallbackU  callback,
void *const  userdata 
)
inline

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

Parameters
[in]callbackCallback function.
[in]userdataAny pointer. It will be passed to the callback as a userdata argument.
Returns
Integer id for this callback. Use it for passing to VideoWorker::removeMatchFoundCallback to unsubscribe.
int VideoWorker::addStiPersonOutdatedCallbackU ( const StiPersonOutdatedCallbackU  callback,
void *const  userdata 
)
inline

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

Parameters
[in]callbackCallback function.
[in]userdataAny pointer. When the callback is called, this pointer is passed as a userdata argument.
Returns
Integer id for this callback. To unsubscribe, pass it to VideoWorker::removeStiPersonOutdatedCallback.
int VideoWorker::addTemplateCreatedCallback ( const TemplateCreatedCallbackFunc  callback,
void *const  userdata 
)
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.
[in]userdataAny pointer. It will be passed to the callback as a userdata argument.
Returns
Integer id for this callback. Use it for passing to VideoWorker::removeTemplateCreatedCallback to unsubscribe.
int VideoWorker::addTemplateCreatedCallbackU ( const TemplateCreatedCallbackU  callback,
void *const  userdata 
)
inline

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

Parameters
[in]callbackCallback function.
[in]userdataAny pointer. It will be passed to the callback as a userdata argument.
Returns
Integer id for this callback. Use it for passing to VideoWorker::removeTemplateCreatedCallback to unsubscribe.
int VideoWorker::addTrackingCallback ( const TrackingCallbackFunc  callback,
void *const  userdata 
)
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.
[in]userdataAny pointer. It will be passed to the callback as a userdata argument.
Returns
Integer id for this callback. Use it for passing to VideoWorker::removeTrackingCallback to unsubscribe.
int VideoWorker::addTrackingCallbackU ( const TrackingCallbackU  callback,
void *const  userdata 
)
inline

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

Parameters
[in]callbackCallback function.
[in]userdataAny pointer. It will be passed to the callback as a userdata argument.
Returns
Integer id for this callback. Use it for passing to VideoWorker::removeTrackingCallback to unsubscribe.
int VideoWorker::addTrackingLostCallback ( const TrackingLostCallbackFunc  callback,
void *const  userdata 
)
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.
[in]userdataAny pointer. It will be passed to the callback as a userdata argument.
Returns
Integer id for this callback. Use it for passing to VideoWorker::removeTrackingLostCallback to unsubscribe.
int VideoWorker::addTrackingLostCallbackU ( const TrackingLostCallbackU  callback,
void *const  userdata 
)
inline

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

Parameters
[in]callbackCallback function.
[in]userdataAny pointer. It will be passed to the callback as a userdata argument.
Returns
Integer id for this callback. Use it for passing to VideoWorker::removeTrackingLostCallback to unsubscribe.
int VideoWorker::addVideoFrame ( const RawImage  frame,
const int  stream_id,
const uint64_t  timestamp_microsec = uint64_t(-1) 
)
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. IRawImage::FORMAT_RGB, IRawImage::FORMAT_BGR, IRawImage::FORMAT_YUV_NV21 and IRawImage::FORMAT_YUV_NV12).
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
[in]timestamp_microsecTimestamp of the frame in microseconds
Returns
Integer id for this frame, unique for this video stream. This id will be used to identify this frame in the callbacks.
void VideoWorker::disableAgeGenderEstimationOnStream ( const 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 VideoWorker::disableEmotionsEstimationOnStream ( const 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 VideoWorker::disableProcessingOnStream ( const 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 VideoWorker::enableAgeGenderEstimationOnStream ( const 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 VideoWorker::enableEmotionsEstimationOnStream ( const 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 VideoWorker::enableProcessingOnStream ( const 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).
std::string VideoWorker::getMethodName ( ) const
inline

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

Returns
The name of the method.
int VideoWorker::getStreamsCount ( ) const
inline

Get a number of video streams. Thread-safe.

Returns
Number of video streams.
int VideoWorker::getTrackingConveyorSize ( const int  stream_id) const
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.
void VideoWorker::removeMatchFoundCallback ( const int  callback_id)
inline

Remove a handler for MatchFound event. Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker::addMatchFoundCallback or VideoWorker::addMatchFoundCallbackExt.
void VideoWorker::removeStiPersonOutdatedCallback ( const int  callback_id)
inline

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

Parameters
[in]callback_idInteger callback id returned by VideoWorker::addStiPersonOutdatedCallbackU.
void VideoWorker::removeTemplateCreatedCallback ( const int  callback_id)
inline

Remove a handler for TemplateCreated event. Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker::addTemplateCreatedCallback.
void VideoWorker::removeTrackingCallback ( const int  callback_id)
inline

Remove a handler for Tracking event. Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker::addTrackingCallback.
void VideoWorker::removeTrackingLostCallback ( const int  callback_id)
inline

Remove a handler for TrackingLost event. Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker::addTrackingLostCallback.
int VideoWorker::resetStream ( const 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 VideoWorker::resetTrackerOnStream ( const 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 VideoWorker::setDatabase ( const std::vector< DatabaseElement > &  elements,
const Recognizer::SearchAccelerationType  acceleration = Recognizer::SEARCH_ACCELERATION_1 
)
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.