3DiVi Face SDK  3.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
RawSample

Classes

class  face_sdk.modules.raw_sample.Angles
 Face orientation angles. More...
 
class  face_sdk.modules.raw_sample.ImageFormat
 Image formats for saving. More...
 
class  face_sdk.modules.raw_sample.SampleType
 Sample types (see also VDT.FaceRecognition.SDK.Capturer.CapturerType). More...
 
class  face_sdk.modules.raw_sample.FaceCutType
 Face cropping types. More...
 
class  face_sdk.modules.raw_sample.RawSample
 Interface object that stores a captured face sample. More...
 

Functions

def face_sdk.modules.raw_sample.Angles.__init__
 Yaw angle in degrees. More...
 
def face_sdk.modules.raw_sample.RawSample.get_left_eye
 Get a point of the left eye. More...
 
def face_sdk.modules.raw_sample.RawSample.get_right_eye
 Get a point of the right eye. More...
 
def face_sdk.modules.raw_sample.RawSample.get_rectangle
 Get a face bounding rectangle. More...
 
def face_sdk.modules.raw_sample.RawSample.get_landmarks
 Get anthropometric landmarks. More...
 
def face_sdk.modules.raw_sample.RawSample.get_iris_landmarks
 Get the characteristic points of the eyes. More...
 
def face_sdk.modules.raw_sample.RawSample.get_angles
 Get a face orientation. More...
 
def face_sdk.modules.raw_sample.RawSample.has_original_image
 Does the sample store the original image (True for samples made with VideoWorker with enabled store_original_frame_in_raw_sample). More...
 
def face_sdk.modules.raw_sample.RawSample.get_score
 Get the score of the detected face (for samples made with supported single-shot Capturers). More...
 
def face_sdk.modules.raw_sample.RawSample.get_face_visibility_score
 Get the score of face visibility. More...
 
def face_sdk.modules.raw_sample.RawSample.get_type
 Get a sample type. More...
 
def face_sdk.modules.raw_sample.RawSample.get_frame_id
 Get an ID of the frame, in which this RawSample is detected (for samples made with VideoWorker). More...
 
def face_sdk.modules.raw_sample.RawSample.get_id
 Get a face ID. More...
 
def face_sdk.modules.raw_sample.RawSample.cut_face_image
 Crop the face and save in the specified format. More...
 
def face_sdk.modules.raw_sample.RawSample.cut_face_raw_image
 Crop face in RawImage format (with raw pixels). More...
 
def face_sdk.modules.raw_sample.RawSample.save
 Save (serialize) the sample. More...
 
def face_sdk.modules.raw_sample.RawSample.get_face_cut_rectangle
 Get a cropping rectangle (for preview) that will be used in cutFaceImage. More...
 
def face_sdk.modules.raw_sample.RawSample.save_without_image
 Save (serialize) all sample information except the image. More...
 
def face_sdk.modules.raw_sample.RawSample.get_original_image
 Get an original image. More...
 
def face_sdk.modules.raw_sample.RawSample.downscale_to_preferred_size
 Clone this RawSample with an internal face image downscaled to preferred size and without an original image. More...
 
def face_sdk.modules.raw_sample.RawSample.to_context
 will transform RawSample into a container-Context More...
 

Detailed Description

Function Documentation

def face_sdk.modules.raw_sample.Angles.__init__ (   self,
  yaw 
)

Yaw angle in degrees.

Pitch angle in degrees.

Roll angle in degrees.

def face_sdk.modules.raw_sample.RawSample.cut_face_image (   self,
  binary_stream 
)

Crop the face and save in the specified format.

Thread-safe.

Parameters
[in]binary_streamOutput stream object for image saving. The file stream (BytesIO) (if any)
[in]formatImage encoding format.
[in]cut_typeFace cropping types.
def face_sdk.modules.raw_sample.RawSample.cut_face_raw_image (   self,
  color_model 
)

Crop face in RawImage format (with raw pixels).

Thread-safe.

Parameters
[in]color_modelImage color model.
[in]cut_typeFace cropping types.
Returns
RawImage with cropped face
def face_sdk.modules.raw_sample.RawSample.downscale_to_preferred_size (   self)

Clone this RawSample with an internal face image downscaled to preferred size and without an original image.

In order to reduce memory consumption (both in RAM and after serialization).
At work Capturer and VideoWorker automatically downscale all RawSamples if downscale_rawsamples_to_preferred_size parameter is enabled (enabled by default), but it decreases the performance.
So it is recommended to disable downscale_rawsamples_to_preferred_size and use RawSample.downscaleToPreferredSize manually for RawSamples that you need to save or hold for a long time in RAM.

Returns
Created RawSample.
def face_sdk.modules.raw_sample.RawSample.get_angles (   self,
  Angles 
)

Get a face orientation.

Only frontal samples. Thread-safe.

Returns
Face orientation angles in degrees.
def face_sdk.modules.raw_sample.RawSample.get_face_cut_rectangle (   self,
  cut_type 
)

Get a cropping rectangle (for preview) that will be used in cutFaceImage.

Thread-safe.

Returns
4 points that are corners of a rectangle in the counterclockwise order starting from the upper left corner.
Parameters
[in]cut_typeFace cropping types.
def face_sdk.modules.raw_sample.RawSample.get_face_visibility_score (   self,
  float 
)

Get the score of face visibility.

Thread-safe.

Returns
One if face is fully visible, zero if face is invisible, otherwise - a number in the range [0 ... 1].
def face_sdk.modules.raw_sample.RawSample.get_frame_id (   self,
  int 
)

Get an ID of the frame, in which this RawSample is detected (for samples made with VideoWorker).

Thread-safe.

Returns
Zero if this RawSample was made not with VideoWorker,
otherwise it's a nonnegative integer - id (that was returned by the VideoWorker.add_video_frame) of the frame, in which this RawSample is detected.
def face_sdk.modules.raw_sample.RawSample.get_id (   self,
  int 
)

Get a face ID.

Thread-safe.

Returns
- A non-negative track id, if this sample was captured by a tracker, or
  • Any meaningless negative value, otherwise.
def face_sdk.modules.raw_sample.RawSample.get_iris_landmarks (   self,
  List,
  Point 
)

Get the characteristic points of the eyes.

Only frontal samples. Thread-safe.

Returns
The vector of the positions of the points of the pupils and the boundaries of the eyelids in the original image.
def face_sdk.modules.raw_sample.RawSample.get_landmarks (   self,
  List,
  Point 
)

Get anthropometric landmarks.

Only frontal samples. Thread-safe.

Returns
The vector of anthropometric points in the original image.
def face_sdk.modules.raw_sample.RawSample.get_left_eye (   self,
  Point 
)

Get a point of the left eye.

Only frontal samples. Thread-safe.

Returns
Point of the left eye.
def face_sdk.modules.raw_sample.RawSample.get_original_image (   self,
  RawImage 
)

Get an original image.

Throws an exception if a sample doesn’t contain an original image (check with hasOriginalImage (RawSample) first). Thread-safe.

Returns
Original image.
def face_sdk.modules.raw_sample.RawSample.get_rectangle (   self,
  Rectangle 
)

Get a face bounding rectangle.

Thread-safe.

Returns
Rectangle bounding face on the original image.
def face_sdk.modules.raw_sample.RawSample.get_right_eye (   self,
  Point 
)

Get a point of the right eye.

Only frontal samples. Thread-safe.

Returns
Point of the right eye.
def face_sdk.modules.raw_sample.RawSample.get_score (   self,
  float 
)

Get the score of the detected face (for samples made with supported single-shot Capturers).

Thread-safe.

Returns
One if this RawSample was made with an unsupported detector, otherwise - a number in the range [0 ... 1].
def face_sdk.modules.raw_sample.RawSample.get_type (   self,
  int 
)

Get a sample type.

Thread-safe.

Returns
Type of the sample.
def face_sdk.modules.raw_sample.RawSample.has_original_image (   self,
  int 
)

Does the sample store the original image (True for samples made with VideoWorker with enabled store_original_frame_in_raw_sample).

Thread-safe.

Returns
True, if it has original image, otherwise false.
def face_sdk.modules.raw_sample.RawSample.save (   self,
  binary_stream 
)

Save (serialize) the sample.

Original image will not be saved (i.e. only the part of an image containing the face is saved). The format is platform-independent. Thread-safe. After saving, you can load it with FacerecService.load_raw_sample.

Parameters
[in]binary_streamOutput stream object for saving the raw sample. The file stream (BytesIO) (if any).
[in]formatImage encoding format.
def face_sdk.modules.raw_sample.RawSample.save_without_image (   self,
  binary_stream 
)

Save (serialize) all sample information except the image.

You have to store the image on your own in order to pass it to the FacerecService.load_raw_sample_without_image for deserialization. If you transformed the image in soma way, you can set the parameters of coordinate space transformation: (x, y) -> ( (x + space_translation_x) * space_scale, (y + space_translation_y) * space_scale ) that will be applied to the information about face position. Note that you must set the same transformation only once - either during serialization or during deserialization, otherwise transformation will be applied twice, which is wrong. The format is platform-independent. Thread-safe. After saving, you can load it with FacerecService.load_raw_sample_without_image.

Parameters
[in]binary_streamOutput stream object for saving the raw sample. The file stream (BytesIO) (if any).
[in]space_translation_xCoordinate space transform parameter.
[in]space_translation_yCoordinate space transform parameter.
[in]space_scaleCoordinate space transform parameter.
def face_sdk.modules.raw_sample.RawSample.to_context (   self)

will transform RawSample into a container-Context

Returns
container-Context