I have computer-vision project where I am inferencing on live video feed from usb camera. Although the camera is logitech full HD camera but because of the installation issues, it is installed a bit far from where the person normally works. Application detects the faces of the person and if it is unrecognized or not present in the database, application starts saving the face images so that the images can be used for retrain the face recognition model. Below is how the complete pipeline works: Frame -> Person detection in frame -> Person tracking starts |-> Face detection from person image -> Face recognition |-> If unrecognized starts saving face images Now lets take below frame image: As you can see that the image is quite clear and face is properly visible. Now after running the person detection on this and saving the person image, it looks like something below: Now if we detect face in above person image and save the face image, it looks like below: Now as you can see that the face image size is very small and thus we need to resize it a bit so that its properly visible. So after resizing it looks like below: Now after resizing it, it looks a bit blurry and due to which it sometimes ignored by face recognition or not recognized. Below is the code I am using to save and resize image: width = face_endX - face_startX height = face_endY - face_startY face_image = person_image[face_startY:face_startY + height, face_startX:face_startX + width] scale_percent = 150 width = int(face_image.shape[1] * scale_percent / 100) height = int(face_image.shape[0] * scale_percent / 100) dim = (width, height) resized_img = cv2.resize(image, dim, interpolation=cv2.INTER_LANCZOS4) cv2.imwrite("face_image.jpg", resized_img) So in above code I am first getting the width and height and then using the face bounding box coordinates, I am creating a face image. I am then setting the scale_percent to 150 and then resizing and saving the image. Can anyone please help me in suggesting some good ways by which the image can be resized a bit and also retains the image quality. Continue reading...