I try to use Dlib shape_predictor_68_landmark to mark my photos. I use OpenCV to read and resize photos(all of photos are portrait photographs
capture from a video). Then I use those processed photos to run the function dlib.get_frontal_face_detector()
.
Here is my code:
detector=dlib.get_frontal_face_detector()
for filename in os.listdir("/content/drive/MyDrive/new"):
frame = cv2.imread("/content/drive/MyDrive/new/" + filename)
frame = cv2.resize(frame, (720, 720), interpolation=cv2.INTER_NEAREST)
faces = detector(frame, 0)
print('File name:',filename)
print('Face=',faces)
the faces = detector(frame, 0)
should output a rectangles[]
, but when I print it for check, its output turn out to be an empty rectangles[]
. the result(partly) is below:
File name: frame_484.jpg
Face= rectangles[]
I don't know how to let it output a correct output(in other words, a not empty rectangles[]).