AIZOOTech/FaceMaskDetection

How to crop images faces without mask

ZIKO94ZIKO opened this issue · 1 comments

how can be add lines for cropping faces without mask and save it in folder/images_without_mask.jpg

@AIZOOTech i add this lines , i want to crop faces without mask and save it in file , "No_mask_date.jpg"

`
        if draw_result:
            if class_id == 1:
                color = (255,0, 0)
               
            cv2.rectangle(image, (xmin, ymin), (xmax, ymax), color, 2)
       
            cv2.putText(image, "%s: %.2f" % (id2class[class_id], conf), (xmin + 2, ymin - 2),
            cv2.FONT_HERSHEY_SIMPLEX, 0.8, color)
            image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
            imCrop = image[ymin:ymax, xmin:xmax]
            date_string = datetime.datetime.now().strftime("%Y-%m-%d-%H:%M:%S")
            cv2.imwrite("img/No_mask"+date_string+".jpg", imCrop)
        
            
        else:
            color = (0, 255, 0)
           
        cv2.rectangle(image, (xmin, ymin), (xmax, ymax), color, 2)
       
        cv2.putText(image, "%s: %.2f" % (id2class[class_id], conf), (xmin + 2, ymin - 2),
                    cv2.FONT_HERSHEY_SIMPLEX, 0.8, color)
    output_info.append([class_id, conf, xmin, ymin, xmax, ymax])

`
the problem tis code cropped one face in each frame , how can be crop multiple faces in one frame?