title: How can i detect the forehead region using opencv and dlib?
body: <p>I want to detect the forehead region for research purposes.</p>
  
  <p>I have tried taking the width of my roi as the distance between the leftmost point of the left eye and the rightmost point of the right eye. This seems to work as far as width is concerned however when it comes to height i need a solution that works for all people. Note i do not want hair to appear in my roi. I have an implementation of the height but it does not work for all people.</p>
  
  <pre class="lang-py prettyprint-override"><code>x = int((shape[21][0]+shape[22][0])/2)
  y = int((shape[21][1]+shape[22][1])/2)
  w = abs(shape[39][0]-shape[42][0])
  h = abs(y-shape[29][1])
  
  y_mid = int((y + (y - h)) / 2)
  roi = image[y-h:y_mid,int(x-w/2):int(x+w/2)]
  
  if(roi.shape[0] !=0 and roi.shape[1] != 0):
      roi = imutils.resize(roi, width=250, inter=cv2.INTER_CUBIC)
      cv2.imshow('ROI', roi)
  
  cv2.rectangle(image,(int(x-w/2), int(y-h)), (int(x + w/2), y_mid), (0, 0, 255), 1)
  cv2.imshow('Image', image)
  </code></pre>