2018-06-04 21:12:43 +08:00
|
|
|
from enum import IntEnum
|
|
|
|
|
|
|
|
class FaceType(IntEnum):
|
2019-08-26 02:32:21 +08:00
|
|
|
#enumerating in order "next contains prev"
|
2019-10-05 20:26:23 +08:00
|
|
|
HALF = 0
|
|
|
|
MID_FULL = 1
|
|
|
|
FULL = 2
|
|
|
|
FULL_NO_ALIGN = 3
|
2020-02-21 20:21:04 +08:00
|
|
|
WHOLE_FACE = 4
|
2020-04-04 13:28:06 +08:00
|
|
|
HEAD = 10
|
|
|
|
HEAD_NO_ALIGN = 20
|
2020-01-26 01:58:19 +08:00
|
|
|
|
2020-04-04 13:28:06 +08:00
|
|
|
MARK_ONLY = 100, #no align at all, just embedded faceinfo
|
2019-08-24 16:57:29 +08:00
|
|
|
|
2018-06-04 21:12:43 +08:00
|
|
|
@staticmethod
|
|
|
|
def fromString (s):
|
|
|
|
r = from_string_dict.get (s.lower())
|
|
|
|
if r is None:
|
|
|
|
raise Exception ('FaceType.fromString value error')
|
2019-03-20 03:53:27 +08:00
|
|
|
return r
|
|
|
|
|
|
|
|
@staticmethod
|
2018-06-04 21:12:43 +08:00
|
|
|
def toString (face_type):
|
2019-08-11 15:17:22 +08:00
|
|
|
return to_string_dict[face_type]
|
2019-03-20 03:53:27 +08:00
|
|
|
|
2020-04-04 13:28:06 +08:00
|
|
|
to_string_dict = { FaceType.HALF : 'half_face',
|
2019-10-05 20:26:23 +08:00
|
|
|
FaceType.MID_FULL : 'midfull_face',
|
2019-08-11 15:17:22 +08:00
|
|
|
FaceType.FULL : 'full_face',
|
2020-04-04 13:28:06 +08:00
|
|
|
FaceType.FULL_NO_ALIGN : 'full_face_no_align',
|
2020-02-21 20:21:04 +08:00
|
|
|
FaceType.WHOLE_FACE : 'whole_face',
|
2019-08-11 15:17:22 +08:00
|
|
|
FaceType.HEAD : 'head',
|
2020-04-04 13:28:06 +08:00
|
|
|
FaceType.HEAD_NO_ALIGN : 'head_no_align',
|
|
|
|
|
|
|
|
FaceType.MARK_ONLY :'mark_only',
|
2019-08-11 15:17:22 +08:00
|
|
|
}
|
2020-04-04 13:28:06 +08:00
|
|
|
|
|
|
|
from_string_dict = { to_string_dict[x] : x for x in to_string_dict.keys() }
|