I\'m trying to detect a face and write down area with the face in a separate file. How can I do it? I think that i must use \"faces\" (you can see this var in code). But how?
wtluo, great ! May I propose a slight modification of your code 2. ? Here it is:
for i, detected_box in enumerate(detect_boxes): box = detected_box["box"] face_img = img[ box[1]:box[1] + box[3], box[0]:box[0] + box[2] ] cv2.imwrite("face-{:03d}.jpg".format(i+1), face_img)