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

Interface object that stores a captured face sample. More...

Classes

class  Angles
 Face orientation angles. More...
 
enum  FaceCutType
 Face cropping types. More...
 
enum  ImageFormat
 Image formats for saving. More...
 
class  Rectangle
 Rectangle in an image. More...
 
enum  SampleType
 Sample types (see also VDT.FaceRecognition.SDK.Capturer.CapturerType). More...
 

Public Member Functions

void dispose ()
 Release internal object.
 
boolean isDisposed ()
 Check if an object is released. More...
 
Rectangle getRectangle ()
 Get a face bounding rectangle. Thread-safe. More...
 
Vector< PointgetLandmarks ()
 Get anthropometric landmarks. Only frontal samples. Thread-safe. More...
 
Vector< PointgetIrisLandmarks ()
 Get the characteristic points of the eyes. Only frontal samples. Thread-safe. More...
 
Point getLeftEye ()
 Get a point of the left eye. Only frontal samples. Thread-safe. More...
 
Point getRightEye ()
 Get a point of the right eye. Only frontal samples. Thread-safe. More...
 
Angles getAngles ()
 Get a face orientation. Only frontal samples. Thread-safe. More...
 
int getID ()
 Get a face ID. Thread-safe. More...
 
int getFrameID ()
 Get an ID of the frame, in which this RawSample is detected (for samples made with VideoWorker). Thread-safe. More...
 
boolean hasOriginImage ()
 Does the sample store the original image (true for samples made with VideoWorker with enabled store_original_frame_in_raw_sample). Thread-safe. More...
 
float getScore ()
 Get the score of the detected face (for samples made with supported single-shot Capturers). Thread-safe. More...
 
float getFaceVisibilityScore ()
 Get the score of face visibility. Thread-safe. More...
 
RawImage getOriginImage ()
 Get an original image. Throws an exception if a sample doesn’t contain an original image (check with RawSample.hasOriginalImage first). Thread-safe. More...
 
SampleType getType ()
 Get a sample type. Thread-safe. More...
 
Vector< PointgetFaceCutRectangle (FaceCutType cut_type)
 Get a cropping rectangle (for preview) that will be used in RawSample.cutFaceImage. Thread-safe. More...
 
void cutFaceImage (OutputStream binary_stream, ImageFormat format, FaceCutType cut_type)
 Crop the face and save in the specified format. Thread-safe. More...
 
RawImage cutFaceRawImage (RawImage.Format color_model, FaceCutType cut_type)
 Crop face in RawImage format (with raw pixels). Thread-safe. More...
 
void cutFaceImage (final RawImage original_image, OutputStream binary_stream, ImageFormat format, FaceCutType cut_type)
 Crop the face and save it in original size in the specified format. Thread-safe. More...
 
void save (OutputStream binary_stream, ImageFormat format)
 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.loadRawSample. More...
 
void saveWithoutImage (OutputStream 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 FacerecService.loadRawSampleWithoutImage for deserialization. If you transformed the image in some 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.loadRawSampleWithoutImage. More...
 
void saveWithoutImage (OutputStream binary_stream, double space_translation_x, double space_translation_y, double space_scale)
 Save (serialize) all sample information except the image. You have to store the image on your own in order to pass it to FacerecService.loadRawSampleWithoutImage for deserialization. If you transformed the image in some 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.loadRawSampleWithoutImage. More...
 
RawSample downscaleToPreferredSize ()
 Clone this RawSample with an internal face image downscaled to suitable 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 the downscale_rawsamples_to_preferred_size parameter is enabled (enabled by default), but it decreases the performance.
It's recommended to disable downscale_rawsamples_to_preferred_size and use RawSample.downscaleToPreferredSize manually for RawSamples that you need to save or keep in RAM for a long time. More...
 

Detailed Description

Interface object that stores a captured face sample.

Member Function Documentation

void com.vdt.face_recognition.sdk.RawSample.cutFaceImage ( OutputStream  binary_stream,
ImageFormat  format,
FaceCutType  cut_type 
)
inline

Crop the face and save in the specified format. Thread-safe.

Parameters
[out]binary_streamOutput stream object for image saving.
[in]formatImage encoding format.
[in]cut_typeFace cropping types.
void com.vdt.face_recognition.sdk.RawSample.cutFaceImage ( final RawImage  original_image,
OutputStream  binary_stream,
ImageFormat  format,
FaceCutType  cut_type 
)
inline

Crop the face and save it in original size in the specified format. Thread-safe.

Parameters
[in]original_imageImage that was used to create this sample.
[out]binary_streamOutput stream object for image saving.
[in]formatImage encoding format.
[in]cut_typeFace cropping type.
RawImage com.vdt.face_recognition.sdk.RawSample.cutFaceRawImage ( RawImage.Format  color_model,
FaceCutType  cut_type 
)
inline

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
RawSample com.vdt.face_recognition.sdk.RawSample.downscaleToPreferredSize ( )
inline

Clone this RawSample with an internal face image downscaled to suitable 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 the downscale_rawsamples_to_preferred_size parameter is enabled (enabled by default), but it decreases the performance.
It's recommended to disable downscale_rawsamples_to_preferred_size and use RawSample.downscaleToPreferredSize manually for RawSamples that you need to save or keep in RAM for a long time.

Returns
Created RawSample.
Angles com.vdt.face_recognition.sdk.RawSample.getAngles ( )
inline

Get a face orientation. Only frontal samples. Thread-safe.

Returns
Face orientation angles in degrees.
Vector<Point> com.vdt.face_recognition.sdk.RawSample.getFaceCutRectangle ( FaceCutType  cut_type)
inline

Get a cropping rectangle (for preview) that will be used in RawSample.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.
float com.vdt.face_recognition.sdk.RawSample.getFaceVisibilityScore ( )
inline

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].
int com.vdt.face_recognition.sdk.RawSample.getFrameID ( )
inline

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.addVideoFrame) of the frame, in which this RawSample is detected.
int com.vdt.face_recognition.sdk.RawSample.getID ( )
inline

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.
Vector<Point> com.vdt.face_recognition.sdk.RawSample.getIrisLandmarks ( )
inline

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.
Vector<Point> com.vdt.face_recognition.sdk.RawSample.getLandmarks ( )
inline

Get anthropometric landmarks. Only frontal samples. Thread-safe.

Returns
The vector of anthropometric points in the original image.
Point com.vdt.face_recognition.sdk.RawSample.getLeftEye ( )
inline

Get a point of the left eye. Only frontal samples. Thread-safe.

Returns
Point of the left eye.
RawImage com.vdt.face_recognition.sdk.RawSample.getOriginImage ( )
inline

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

Returns
Original image.
Rectangle com.vdt.face_recognition.sdk.RawSample.getRectangle ( )
inline

Get a face bounding rectangle. Thread-safe.

Returns
Rectangle bounding face on the original image.
Point com.vdt.face_recognition.sdk.RawSample.getRightEye ( )
inline

Get a point of the right eye. Only frontal samples. Thread-safe.

Returns
Point of the right eye.
float com.vdt.face_recognition.sdk.RawSample.getScore ( )
inline

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].
SampleType com.vdt.face_recognition.sdk.RawSample.getType ( )
inline

Get a sample type. Thread-safe.

Returns
Type of the sample.
boolean com.vdt.face_recognition.sdk.RawSample.hasOriginImage ( )
inline

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.
boolean com.vdt.face_recognition.sdk.RawSample.isDisposed ( )
inline

Check if an object is released.

Returns
true if an object is released, false otherwise.
void com.vdt.face_recognition.sdk.RawSample.save ( OutputStream  binary_stream,
ImageFormat  format 
)
inline

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.loadRawSample.

Parameters
[out]binary_streamOutput stream object for saving the raw sample.
[in]formatImage encoding format.
void com.vdt.face_recognition.sdk.RawSample.saveWithoutImage ( OutputStream  binary_stream)
inline

Save (serialize) all sample information except the image. You have to store the image on your own in order to pass it to FacerecService.loadRawSampleWithoutImage for deserialization. If you transformed the image in some 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.loadRawSampleWithoutImage.

Parameters
[out]binary_streamOutput stream object for saving the raw sample.
void com.vdt.face_recognition.sdk.RawSample.saveWithoutImage ( OutputStream  binary_stream,
double  space_translation_x,
double  space_translation_y,
double  space_scale 
)
inline

Save (serialize) all sample information except the image. You have to store the image on your own in order to pass it to FacerecService.loadRawSampleWithoutImage for deserialization. If you transformed the image in some 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.loadRawSampleWithoutImage.

Parameters
[out]binary_streamOutput stream object for saving the raw sample.
[in]space_translation_xCoordinate space transform parameter.
[in]space_translation_yCoordinate space transform parameter.
[in]space_scaleCoordinate space transform parameter.