Please use the minimum working code for quick answers.
After you find the face, you have a rectangle. This way you can crop the image and save using opencv functions :
img = cv2.imread("test.jpg") dets = detector.run(img, 1) for i, d in enumerate(dets): print("Detection {}, score: {}, face_type:{}".format( d, scores[i], idx[i])) crop = img[d.top():d.bottom(), d.left():d.right()] cv2.imwrite("cropped.jpg", crop)
Evgeniy
source share