我有以下代码:
image_1 = cv2.imread('headshot13-14-2.jpg')
image_1_rgb = cv2.cvtColor(image_1, cv2.COLOR_BGR2RGB)
image_1_gray = cv2.cvtColor(image_1_rgb, cv2.COLOR_BGR2GRAY)
p = "shape_predictor_68_face_landmarks.dat"
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(p)
face = detector(image_1_gray)
face_landmarks = predictor(image_1_gray, face)
我收到以下错误face = predictor(image_1_gray, face)
:
TypeError: __call__(): incompatible function arguments. The following argument types are supported:
1. (self: dlib.shape_predictor, image: array, box: dlib.rectangle) -> dlib.full_object_detection
但是,我检查了人脸的类型(它是 dlib.rectangles),并且 image_1_gray 是一个 numpy ndarray。有谁知道为什么这个错误仍然出现?