A
A
Alexey Belov2019-03-14 16:36:34
Python
Alexey Belov, 2019-03-14 16:36:34

How to scale an image after Open CV?

Hello everyone, there is a little problem, I use Open CV to define the face, I get only the face, but I need the head, how to crop it to fit the head?

if FACE_CROP:
      image = imread(path)
      face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
      eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
    
      faces = face_cascade.detectMultiScale(image, 1.1, 5)

      for (x,y,w,h) in faces:
          image = image[y:y+h, x:x+w]

    else:
      image = imread(path).astype(np.float32) / 255.0
      
    width = image.shape[1]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question