.. index:: 
  !FaceTemplate.toBit Method
  
.. _id3_face_face_template_to_bit_class_method:

===============================================================================
FaceTemplate.toBit Method
===============================================================================

Module: :ref:`FaceTemplate<id3_face_face_template_class>`

Definition
----------

Exports the face template as a Biometric Information Template (BIT) for enrolment on a smart card equipped with id3 Match-on-Card technology.

.. note:: The threshold value is required and should be set according to the used Face Encoder and desired security level.

.. important:: The reference data qualifier (RDQ) should be defined in accordance with the smart card application specifications.


.. tab-set::

    .. tab-item:: Python
      :sync: Python

      .. code:: Python

        to_bit(self, threshold: int, reference_data_qualifier: int) -> bytearray

      **Parameters**

        .. line-block::

          ``threshold`` int
          :guilabel:`in` The decision threshold, from 0 to 653535, to be applied during the face comparison on the smart card. See FaceMatcherThreshold for a list of typical values.

          ``reference_data_qualifier`` int
          :guilabel:`in` Reference data qualifier.


      **Returns**

        .. line-block::

          ``bytearray``
          A buffer that receives the biometric information template.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.


    .. tab-item:: Dart
      :sync: Dart

      .. code:: Dart

        Uint8List toBit(int threshold, int referenceDataQualifier)

      **Parameters**

        .. line-block::

          ``threshold`` int
          :guilabel:`in` The decision threshold, from 0 to 653535, to be applied during the face comparison on the smart card. See FaceMatcherThreshold for a list of typical values.

          ``referenceDataQualifier`` int
          :guilabel:`in` Reference data qualifier.


      **Returns**

        .. line-block::

          ``Uint8List``
          A buffer that receives the biometric information template.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.


    .. tab-item:: C#
      :sync: C#

      .. code:: C#

        public byte[] ToBit(int threshold, int referenceDataQualifier)

      **Parameters**

        .. line-block::

          ``threshold`` int
          :guilabel:`in` The decision threshold, from 0 to 653535, to be applied during the face comparison on the smart card. See FaceMatcherThreshold for a list of typical values.

          ``referenceDataQualifier`` int
          :guilabel:`in` Reference data qualifier.


      **Returns**

        .. line-block::

          ``byte[]``
          A buffer that receives the biometric information template.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.


    .. tab-item:: Java
      :sync: Java

      .. code:: Java

        public byte[] toBit(int threshold, int referenceDataQualifier) throws FaceException

      **Parameters**

        .. line-block::

          ``threshold`` int
          :guilabel:`in` The decision threshold, from 0 to 653535, to be applied during the face comparison on the smart card. See FaceMatcherThreshold for a list of typical values.

          ``referenceDataQualifier`` int
          :guilabel:`in` Reference data qualifier.


      **Returns**

        .. line-block::

          ``byte[]``
          A buffer that receives the biometric information template.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.


    .. tab-item:: Swift
      :sync: Swift

      .. code:: Swift

        public func toBit(threshold: Int32, referenceDataQualifier: Int32) throws -> [UInt8]

      **Parameters**

        .. line-block::

          ``threshold`` Int32
          :guilabel:`in` The decision threshold, from 0 to 653535, to be applied during the face comparison on the smart card. See FaceMatcherThreshold for a list of typical values.

          ``referenceDataQualifier`` Int32
          :guilabel:`in` Reference data qualifier.


      **Returns**

        .. line-block::

          ``[UInt8]``
          A buffer that receives the biometric information template.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.


    .. tab-item:: C
      :sync: C

      .. code:: C

        int id3FaceTemplate_ToBit (
            ID3_FACE_TEMPLATE hFaceTemplate, 
            int threshold, 
            int referenceDataQualifier, 
            unsigned char * data, 
            int * dataSize)

      **Parameters**

        .. line-block::

          ``hFaceTemplate`` :ref:`ID3_FACE_TEMPLATE<id3_face_face_template_class>`
          :guilabel:`in` Handle to the FaceTemplate object.

          ``threshold`` int
          :guilabel:`in` The decision threshold, from 0 to 653535, to be applied during the face comparison on the smart card. See FaceMatcherThreshold for a list of typical values.

          ``referenceDataQualifier`` int
          :guilabel:`in` Reference data qualifier.

          ``data`` unsigned char *
          :guilabel:`out` A buffer that receives the biometric information template.

          ``dataSize`` int *
          :guilabel:`in` Size of the 'data' buffer. Receives the number of elements in the 'data' array.


      **Returns**

        .. line-block::

          ``int``
          An error code.
          See :ref:`id3FaceError<id3_face_face_error_enum>` file for the list of possible error codes.


