Skip to content
Hriddhi Dey edited this page Jan 29, 2018 · 6 revisions

Welcome to the Visage wiki!

The module consists of two classes - DetectLandmarks and ApplyMakeup. The functionalities provided by them are as mentioned below:

This class handles all operations related to facial landmark detection. It provides three functions-


1. get_face_data(image_file, flag):

Returns all detected landmarks for a face.

Arguments:

  1. image_file: Either of three options:
  • (int) Image data after being read with cv2.imread()
  • File path of a locally stored image file.
  • Byte stream being received over multipart network request.
  1. flag (str): Used to denote the type of image_file parameter being passed. Possible values are IMG_DATA, FILE_READ, NETWORK_BYTE_STREAM respectively. By default, its value is IMAGE_DATA, and assumes imread() has been performed, and the returned matrice is passed.

Returns: String with a list of all the detected landmark points of a face.

Error: Returns None if face not found in the image.


2. get_lips(image_file, flag):

Returns points of lips for a face.

Arguments, return value, and error are all same as for get_face_data()


3. get_upper_eyelids(image_file, flag):

Returns points of upper eyelids for a face.

Arguments, return value, and error are all same as for get_face_data()


This class handles the application of makeup. Functions available for use:


1. apply_lipstick(filename, red, blue, green):

Applies lipstick on the passed image of a face.

Arguments:

  1. filename (str): Path for stored input image file.
  2. red (int): Red value of RGB colour code of lipstick shade.
  3. blue (int): Blue value of RGB colour code of lipstick shade.
  4. green (int): Green value of RGB colour code of lipstick shade.

Returns: filepath (str) of the saved output file, with applied lipstick.


2. apply_liner(filename):

Applies black eyeliner on the passed image of a face.

Arguments:

  1. filename (str): Path for stored input image file.

Returns: filepath (str) of the saved output file, with applied lipstick.