使用Dlib和OpenCV检测到人脸后,我试图使其模糊,但出现此错误
我该如何解决?
frame [x1:y1,x2:y2] = cv2.blur(frame [x1:y1,x2:y2],(23,23)) cv2.error:OpenCV(4.1.0)C:\ projects \ opencv-python \ opencv \ modules \ core \ src \ matrix.cpp:757:error:(-215:Assertion failed)dims <= 2 && step [0 ]> 0在功能'cv :: Mat :: locateROI'
for face in faces:
x1 = face.left()
y1= face.top()
x2= face.right()
y2= face.bottom()
cv2.rectangle(frame,(x1,y1),(x2,y2),(0,255,0),2)
frame[x1:y1, x2:y2]=cv2.blur(frame[x1:y1, x2:y2], (23, 23))
# anonymize_face_pixelate(image=facee,blocks=3)
cv2.putText(frame, "Dlib detector", (x1, y2), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255,0))
landmarks=predictor(gray, face)