Закрытая часть рта выполнена без каких-либо проблема, но когда я пытаюсь оценить движение губ по ориентирам(
Код: Выделить всё
dlib
Вдохновлен примером рта (https://github.com/mauckc/mouth-open/ blob/master/detect_open_mouth.py#L17), я написал следующую функцию:
Код: Выделить всё
def lips_aspect_ratio(shape):
# grab the indexes of the facial landmarks for the lip
(mStart, mEnd) = (61, 68)
lip = shape[mStart:mEnd]
print(len(lip))
# compute the euclidean distances between the two sets of
# vertical lip landmarks (x, y)-coordinates
# to reach landmark 68 I need to get lib[7] not lip[6] (while I get lip[7] I get IndexOutOfBoundError)
A = dist.euclidean(lip[1], lip[6]) # 62, 68
B = dist.euclidean(lip[3], lip[5]) # 64, 66
# compute the euclidean distance between the horizontal
# lip landmark (x, y)-coordinates
C = dist.euclidean(lip[0], lip[4]) # 61, 65
# compute the lip aspect ratio
mar = (A + B) / (2.0 * C)
# return the lip aspect ratio
return mar
Код: Выделить всё
IndexError: index 7 is out of bounds for axis 0 with size 7
Подробнее здесь: https://stackoverflow.com/questions/790 ... ith-size-7