title: How to check if cv2.circle lies inside cv2.rectangle in opencv python
body: <p>I have an opencv application where I am detecting face. I have drawn a <code>circle</code> on frame and I need to check if the circle lies inside the bounding box of the face or not. Below is the code to draw circle</p>
  
  <pre><code>cv2.circle(frame, (293, 141), 5, (0, 255, 0), -1)
  </code></pre>
  
  <p>which means x is 293 and y is 141 for circle. Below is the code for face detection:</p>
  
  <pre><code>face_bbox = face.detect_face(frame)
      if face_bbox is not None:
          (f_startX, f_startY, f_endX, f_endY) = face_bbox.astype("int")
          cv2.rectangle(frame, (f_startX, f_startY), (f_endX, f_endY), (0, 0, 0), 2)
  </code></pre>
  
  <p><code>f_startX, f_startY, f_endX, f_endY</code> are the coordinates of the rectangle drawn for face. Now I need to check if circle lies between the bounding box or not. For this I have put below condition:</p>
  
  <pre><code>if f_startX &lt; 293 &lt; f_endX and f_startY &gt; 141 &gt; f_endY:
     print("Circle is inside face")
  else:
    print("Circle is outside face")
  </code></pre>
  
  <p>But this seems not to be working. I am also a bit confuse as to how I should compare the x and y of face with x and y of circle. Can anyone please suggest me a good way. Please help. Thanks</p>