3DiVi Face SDK  3.24.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
VideoWorker

Classes

class  face_sdk.modules.video_worker.SearchResult
 Template search result (for face_sdk_3divi.modules.video_worker.MatchFoundCallbackFuncU). More...
 
class  face_sdk.modules.video_worker.TrackingCallbackData
 Tracking callback data. More...
 
class  face_sdk.modules.video_worker.TemplateCreatedCallbackData
 TemplateCreated callback data. More...
 
class  face_sdk.modules.video_worker.MatchFoundCallbackData
 MatchFound callback data. More...
 
class  face_sdk.modules.video_worker.TrackingLostCallbackData
 TrackingLost callback data. More...
 
class  face_sdk.modules.video_worker.StiPersonOutdatedCallbackData
 StiPersonOutdated callback data. More...
 
class  face_sdk.modules.video_worker.DatabaseElement
 Database element. More...
 
class  face_sdk.modules.video_worker.Params
 Parameters of the VideoWorker constructor. More...
 
class  face_sdk.modules.video_worker.VideoWorkerSomething
 
class  face_sdk.modules.video_worker.VideoWorker
 VideoWorker is an interface object for tracking, processing and matching faces on multiple video streams. More...
 

Functions

def face_sdk.modules.video_worker.SearchResult.__init__
 Unique id of the person. More...
 
def face_sdk.modules.video_worker.TrackingCallbackData.__init__
 Integer id of the video stream (0 <= stream_id < streams_count). More...
 
def face_sdk.modules.video_worker.TemplateCreatedCallbackData.__init__
 Integer id of the video stream (0 <= stream_id < streams_count). More...
 
def face_sdk.modules.video_worker.MatchFoundCallbackData.__init__
 Found 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). More...
 
def face_sdk.modules.video_worker.TrackingLostCallbackData.__init__
 Integer id of the video stream (0 <= stream_id < streams_count). More...
 
def face_sdk.modules.video_worker.StiPersonOutdatedCallbackData.__init__
 Integer id of the video stream (0 <= stream_id < streams_count). More...
 
def face_sdk.modules.video_worker.DatabaseElement.__init__
 Unique id of the element. More...
 
def face_sdk.modules.video_worker.Params.__init__
 Set the VideoWorker configuration file with optionally overridden parameters. More...
 
def face_sdk.modules.video_worker.VideoWorker.add_video_frame
 Add a new video frame for a specific video stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.add_depth_frame
 Add a new depth frame for a specific stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.add_ir_frame
 Add a new IR frame for a specific stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.reset_tracker_on_stream
 Reset tracker state for a specified video stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.reset_stream
 Reset work state for the stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.check_exception
 Exceptions from the callbacks and inner threads are rethrown when this method is called. More...
 
def face_sdk.modules.video_worker.VideoWorker.add_tracking_callback_u
 Add a handler for a Tracking event. More...
 
def face_sdk.modules.video_worker.VideoWorker.add_template_created_callback_u
 Add a handler for a TemplateCreated event. More...
 
def face_sdk.modules.video_worker.VideoWorker.add_match_found_callback_u
 Add a handler for a MatchFound event. More...
 
def face_sdk.modules.video_worker.VideoWorker.add_match_found_callback_ext
 Add a handler for a MatchFound event. More...
 
def face_sdk.modules.video_worker.VideoWorker.add_tracking_lost_callback_u
 Add a handler for a MatchFound event. More...
 
def face_sdk.modules.video_worker.VideoWorker.add_sti_person_outdated_callback_u
 Add a handler for a MatchFound event. More...
 
def face_sdk.modules.video_worker.VideoWorker.remove_tracking_callback
 Remove a handler for Tracking event. More...
 
def face_sdk.modules.video_worker.VideoWorker.remove_tracking_lost_callback
 Remove a handler for TrackingLost event. More...
 
def face_sdk.modules.video_worker.VideoWorker.remove_template_created_callback
 Remove a handler for TemplateCreated event. More...
 
def face_sdk.modules.video_worker.VideoWorker.remove_match_found_callback
 Remove a handler for MatchFound event. More...
 
def face_sdk.modules.video_worker.VideoWorker.remove_sti_person_outdated_callback
 Remove a handler for StiPersonOutdated event. More...
 
def face_sdk.modules.video_worker.VideoWorker.set_database
 Set / replace the database (can be called at any time). More...
 
def face_sdk.modules.video_worker.VideoWorker.get_tracking_conveyor_size
 Get a size N of tracking conveyor. More...
 
def face_sdk.modules.video_worker.VideoWorker.get_method_name
 Get a method name of the recognizer used. More...
 
def face_sdk.modules.video_worker.VideoWorker.get_streams_count
 Get a number of video streams. More...
 
def face_sdk.modules.video_worker.VideoWorker.disable_processing_on_stream
 Disable the creation of templates for a given stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.enable_processing_on_stream
 Enable the creation of templates for a given stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.disable_age_gender_estimation_on_stream
 Disable age and gender estimation for a given stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.enable_age_gender_estimation_on_stream
 Enable age and gender estimation for a given stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.disable_emotions_estimation_on_stream
 Disable estimation of emotions for a given stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.enable_emotions_estimation_on_stream
 Enable estimation of emotions for a given stream. More...
 
def face_sdk.modules.video_worker.VideoWorker.set_parameter
 Change the parameter value in runtime. More...
 

Detailed Description

Function Documentation

def face_sdk.modules.video_worker.SearchResult.__init__ (   self,
  person_id 
)

Unique id of the person.

Unique id of the element.

Result of template matching.

def face_sdk.modules.video_worker.TrackingCallbackData.__init__ (   self)

Integer id of the video stream (0 <= stream_id < streams_count).

Integer id of the frame (that was returned by VideoWorker.add_video_frame).

Vector of face samples found by the tracker. Most of the samples are received from the frame_id frame but some samples can be received from the previous frames. Use RawSample.get_frame_id to determine which frame the sample belongs to.

Vector of face IDs (track_id). track_id is equal to sample.get_id() for the sample given in any VideoWorker callback. (samples_track_id.size() == samples.size())

Since this is tracking, some samples may be false, so we mark the samples with the "weak" flag if they haven’t passed the recheck with the frontal face detector. Weak samples are not used for recognition (samples_weak.size() == samples.size())

Quality value for the face sample. The same as from the FaceQualityEstimator (samples_quality.size() == samples.size())

The result of checking the sample for good lighting conditions and absence of a strong blur (samples_good_light_and_blur.size() == samples.size())

The result of checking the sample for absence of too high yaw/pitch angles (samples_good_angles.size() == samples.size())

The result of checking the sample for suitable size of a face, see the min_template_generation_face_size parameter in the configuration file. len(samples_good_face_size) == len(samples)

The result of checking the sample with the frontal face detector len(samples_detector_confirmed) == len(samples.size()

The result of checking the sample with DepthLivenessEstimator, depth frames are required, see VideoWorker.addDepthFrame. See face_sdk_3divi.modules.depth_liveness_estimator.Liveness for details. len(samples_depth_liveness_confirmed) == len(samples)

The result of checking the sample with IRLivenessEstimator, depth frames are required, see VideoWorker.addIRFrame. See face_sdk_3divi.modules.ir_liveness_estimator.Liveness for details. len(samples_ir_liveness_confirmed) == samples.size)

Flag indicating that age and gender were estimated for this track. len(samples_track_age_gender_set) == len(samples)

Estimated age and gender for this track. len(samples_track_age_gender) == len(samples)

Flag indicating that emotions were estimated for this track. len(samples_track_emotions_set) == len(samples)

Estimated emotions for this track. len(samples_track_emotions) == len(samples)

Face active liveness check status. See ActiveLiveness::ActiveLivenessStatus for details. (samples_active_liveness_status.size() == samples.size())

def face_sdk.modules.video_worker.TemplateCreatedCallbackData.__init__ (   self,
  stream_id 
)

Integer id of the video stream (0 <= stream_id < streams_count).

Integer id of the frame (that was returned by VideoWorker.add_video_frame).

Face sample quality. The same as from the FaceQualityEstimator.

Face sample.

Template created for this sample.

def face_sdk.modules.video_worker.MatchFoundCallbackData.__init__ (   self,
  stream_id 
)

Found 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).

When called after N consecutive mismatches, the first element in search_results will have a zero distance, and person_id and element_id are equal to face_sdk_3divi.modules.video_worker.MATCH_NOT_FOUND_ID.

def face_sdk.modules.video_worker.TrackingLostCallbackData.__init__ (   self)

Integer id of the video stream (0 <= stream_id < streams_count).

Integer id of the frame on which the face was first detected.

Integer id of the frame after which the face tracking was lost.

Best sample quality over all frames.

Integer id of the frame of the best quality.

ID of the lost face (track_id). track_id is equal to sample.get_id() for a sample given in any VideoWorker callback.

The best quality sample from the best_quality_frame_id frame. Will be NULL if "weak_tracks_in_tracking_callback" is enabled and all samples with that track_id are flagged as "weak=true".

Template created from best_quality_sample. Will be NULL if processing_threads_count is zero or best_quality_sample is NULL.

Flag indicating that sti_person_id is set. sti_person_id is not set, if short time identification is disabled or no templates were generated for this track.

ID of "sti_person", which is a set of tracks formed by short time identification. sti_person_id is equal to track_id of the first member of this "sti_person" set of tracks.

def face_sdk.modules.video_worker.StiPersonOutdatedCallbackData.__init__ (   self,
  stream_id,
  sti_person_id 
)

Integer id of the video stream (0 <= stream_id < streams_count).

ID of "sti_person", which is a set of tracks formed by short time identification. sti_person_id is equal to track_id of the first mebmer of this "sti_person" set of tracks.

def face_sdk.modules.video_worker.DatabaseElement.__init__ (   self,
  element_id 
)

Unique id of the element.

Unique id of the person.

Face template.

Distance threshold for a MatchFound event.

 Setting a different recognition threshold for different persons may be useful in some cases.
 For example, if there is a particular criminal in the blacklist, who is more dangerous
 than the other criminals, and you want to increase the recognition probability for this very person,
 despite the higher probability of a false acceptance error.
def face_sdk.modules.video_worker.Params.__init__ (   self)

Set the VideoWorker configuration file with optionally overridden parameters.

Set the name of the configuration file for Recognizer that will be used inside VideoWorker.

Set the configuration file with optionally overridden parameters for Recognizer that will be used inside VideoWorker.

Set the number of video streams.

Set the number of threads for creating templates.

Set the number of threads for matching templates with the database.

Set the number of threads for age_gender estimation.

Set the number of threads for estimation of emotions.

Set the flag enabling short time #identification.

Set the recognition distance threshold for short time identification.

Set outdate_time in seconds for short time #identification.

Set outdate_time in seconds for short time #identification.


Default constructor, set strings to empty, numbers to zero, flags to false.

def face_sdk.modules.video_worker.VideoWorker.add_depth_frame (   self,
  depth_frame 
)

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
def face_sdk.modules.video_worker.VideoWorker.add_ir_frame (   self,
  ir_frame 
)

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.
def face_sdk.modules.video_worker.VideoWorker.add_match_found_callback_ext (   self,
  callback,
  userdata,
  int 
)

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.remove_match_found_callback to unsubscribe.
def face_sdk.modules.video_worker.VideoWorker.add_match_found_callback_u (   self,
  callback,
  userdata,
  int 
)

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.remove_match_found_callback to unsubscribe.
def face_sdk.modules.video_worker.VideoWorker.add_sti_person_outdated_callback_u (   self,
  callback,
  userdata,
  int 
)

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.remove_sti_person_outdated_callback to unsubscribe.
def face_sdk.modules.video_worker.VideoWorker.add_template_created_callback_u (   self,
  callback,
  userdata,
  int 
)

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.remove_template_created_callback to unsubscribe.
def face_sdk.modules.video_worker.VideoWorker.add_tracking_callback_u (   self,
  callback,
  userdata,
  int 
)

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.remove_tracking_callback to unsubscribe.
def face_sdk.modules.video_worker.VideoWorker.add_tracking_lost_callback_u (   self,
  callback,
  userdata,
  int 
)

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.remove_match_found_callback to unsubscribe.
def face_sdk.modules.video_worker.VideoWorker.add_video_frame (   self,
  frame 
)

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. face_sdk_3divi.modules.raw_image.Format.FORMAT_RGB, face_sdk_3divi.modules.raw_image.Format.FORMAT_BGR, face_sdk_3divi.modules.raw_image.format.FORMAT_YUV_NV21 and face_sdk_3divi.modules.raw_image.Format.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.
def face_sdk.modules.video_worker.VideoWorker.check_exception (   self)

Exceptions from the callbacks and inner threads are rethrown when this method is called.

Thread-safe.

def face_sdk.modules.video_worker.VideoWorker.disable_age_gender_estimation_on_stream (   self,
  stream_id 
)

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).
def face_sdk.modules.video_worker.VideoWorker.disable_emotions_estimation_on_stream (   self,
  stream_id 
)

Disable estimation of emotions for a given stream.

Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
def face_sdk.modules.video_worker.VideoWorker.disable_processing_on_stream (   self,
  stream_id 
)

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).
def face_sdk.modules.video_worker.VideoWorker.enable_age_gender_estimation_on_stream (   self,
  stream_id 
)

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).
def face_sdk.modules.video_worker.VideoWorker.enable_emotions_estimation_on_stream (   self,
  stream_id 
)

Enable estimation of emotions for a given stream.

Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
def face_sdk.modules.video_worker.VideoWorker.enable_processing_on_stream (   self,
  stream_id 
)

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).
def face_sdk.modules.video_worker.VideoWorker.get_method_name (   self,
  str 
)

Get a method name of the recognizer used.

Thread-safe.

Returns
The name of the method.
def face_sdk.modules.video_worker.VideoWorker.get_streams_count (   self)

Get a number of video streams.

Thread-safe.

Returns
Number of video streams.
def face_sdk.modules.video_worker.VideoWorker.get_tracking_conveyor_size (   self,
  stream_id 
)

Get a size N of tracking conveyor.

Tracking callback will be called with frame_id = X not earlier than VideoWorker.add_video_frame returns the value X + N - 1, where N is the value returned by VideoWorker.get_tracking_conveyor_size. Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
Returns
Size of tracking conveyor.
def face_sdk.modules.video_worker.VideoWorker.remove_match_found_callback (   self,
  callback_id 
)

Remove a handler for MatchFound event.

Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker.add_match_found_callback.
def face_sdk.modules.video_worker.VideoWorker.remove_sti_person_outdated_callback (   self,
  callback_id 
)

Remove a handler for StiPersonOutdated event.

Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker.add_sti_person_outdated_callback.
def face_sdk.modules.video_worker.VideoWorker.remove_template_created_callback (   self,
  callback_id 
)

Remove a handler for TemplateCreated event.

Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker.add_template_created_callback.
def face_sdk.modules.video_worker.VideoWorker.remove_tracking_callback (   self,
  callback_id 
)

Remove a handler for Tracking event.

Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker.add_tracking_callback.
def face_sdk.modules.video_worker.VideoWorker.remove_tracking_lost_callback (   self,
  callback_id 
)

Remove a handler for TrackingLost event.

Thread-safe.

Parameters
[in]callback_idInteger callback id returned by VideoWorker.add_tracking_lost_callback.
def face_sdk.modules.video_worker.VideoWorker.reset_stream (   self,
  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.

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.
def face_sdk.modules.video_worker.VideoWorker.reset_tracker_on_stream (   self,
  stream_id 
)

Reset tracker state for a specified video stream.

Thread-safe.

Parameters
[in]stream_idInteger id of the video stream (0 <= stream_id < streams_count).
def face_sdk.modules.video_worker.VideoWorker.set_database (   self,
  elements 
)

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.
def face_sdk.modules.video_worker.VideoWorker.set_parameter (   self,
  parameter 
)

Change the parameter value in runtime.

Parameters
[in]parameterParameter name (tag name in the .xml config file).
[in]valueNew parameter value.