Olá, estou querendo fazer reconhecimento de pontos faciais com o Dlib e Open através da WebCam mas estou tendo um erro com o Numpy que não consigo resolver, se alguem puder me dar uma dica seria de grande ajuda.
Meu Codigo.
import cv2
import dlib
def imprimePontos (webcam, pontosFaciais):
for p in pontosFaciais.parts():
cv2.circle(webcam, (p.x, p.y), 2,(0, 255,0), 2)
fonte = cv2.FONT_HERSHEY_COMPLEX_SMALL
webcam = cv2.VideoCapture(0)
detectorFace = dlib.get_frontal_face_detector()
detectorPontosFaciais = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat")
conectado, imagem = webcam.read()
while (True):
conectado, imagem = webcam.read()
facesDetectadas = detectorFace(imagem, 2)
for face in facesDetectadas:
pontos = detectorPontosFaciais(imagem, face)
print(pontos.parts())
print(len(pontos.parts()))
imprimePontos(webcam,pontos)
cv2.imshow('Pontos Faciais', imagem)
if cv2.waitKey(1) & 0xFF == 27:
break
webcam.release()
cv2.destroyAllWindows()
Erro que Aparece
C:\Users\jhona\Anaconda3\envs\dlib\python.exe E:/AnyaOriginal/AnyaVisaoRNA/AnyaVisionRNA.py Traceback (most recent call last): File "E:/AnyaOriginal/AnyaVisaoRNA/AnyaVisionRNA.py", line 23, in points[(260, 203), (262, 222), (266, 240), (271, 257), (279, 273), (291, 286), (305, 297), (321, 304), (337, 305), (352, 302), (365, 292), (375, 279), (383, 264), (389, 247), (391, 229), (392, 212), (391, 194), (276, 183), (284, 174), (296, 171), (309, 172), (320, 177), (341, 175), (351, 169), (362, 166), (373, 168), (381, 175), (333, 192), (334, 205), (336, 217), (338, 230), (322, 239), (330, 241), (337, 243), (344, 240), (350, 237), (290, 197), (298, 192), (307, 191), (315, 197), (307, 199), (298, 200), (346, 195), (354, 188), (363, 187), (370, 191), (364, 195), (355, 196), (310, 265), (321, 259), (331, 257), (337, 258), (343, 256), (351, 257), (359, 261), (352, 270), (344, 274), (338, 276), (331, 275), (321, 272), (315, 265), (331, 263), (337, 263), (343, 262), (355, 262), (343, 265), (337, 267), (331, 267)] imprimePontos(webcam,pontos) File "E:/AnyaOriginal/AnyaVisaoRNA/AnyaVisionRNA.py", line 6, in imprimePontos 68 cv2.circle(webcam, (p.x, p.y), 2,(0, 255,0), 2) TypeError: img is not a numpy array, neither a scalar