title: how to store the location of a detected face opencv
body: <p>I can get the values with <code>for (x, y, w, h) in faces:</code> as long as there is a face detected, but after no faces are detected I lose those values. </p>
  
  <p>I want to draw a rectangle to cover the area where the last face was detected and stays there for a certain time, but rectangle dissapears at the moment when face is not detected. </p>
  
  <p>I tried to pass the values to new variables with <code>copy.copy()</code> but the rectangle keeps dissapearing. </p>
  
  <pre><code>faces = faceCascade.detectMultiScale(gray, scaleFactor=1.3, minNeighbors=3, minSize=(0, 0))
  
  for (x, y, w, h) in faces:
      if x&gt;0: x2 = copy.copy(x)
      if y&gt;0: y2 = copy.copy(y)
      if w&gt;0: w2 = copy.copy(w)
      if h&gt;0: h2 = copy.copy(h)
      cv2.rectangle(img, (x2, y2), (x2+w2, y2+h2), (0, 0, 0), -1)
  </code></pre>
  
  <p>Edit:
  For those who want more context, I basically want to track hand movements, Im doing color segmentation to detect skin and the face is interfering with the tracking since sometimes the haar detector doesnt detect the face affecting the hand position estimation, the first aproach I took was removing the face, I know there are better methods but Im new to OpenCV.</p>
  
  <p>I made it storing the values in a list, </p>
  
  <pre><code>faces_t = [None]*4
  
  while(cam.isOpened():
  
  faces = faceCascade.detectMultiScale(grey, scaleFactor=1.3, minNeighbors=3, minSize=(0, 0))
  
  for (x, y, w, h) in faces:
     faces_t.pop(0)
     faces_t.insert(0,x)
     faces_t.pop(1)
     faces_t.insert(1,y)
     faces_t.pop(2)
     faces_t.insert(2,w)
     faces_t.pop(3)
     faces_t.insert(3,w)
  
  X1 = faces_t[0]
  Y1 = faces_t[1]
  W1 = faces_t[2]
  H1 = faces_t[3]
  
  if any(value is None for value in faces_t):
      pass
  else:
      cv2.rectangle(skin_ycrcb, (X1-10, Y1-15), (X1+W1+10, Y1+H1+15), (0, 0, 0), -1)
  </code></pre>