I have an opencv application where I am detecting face. I have drawn a circle 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
cv2.circle(frame, (293, 141), 5, (0, 255, 0), -1)
which means x is 293 and y is 141 for circle. Below is the code for face detection:
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)
f_startX, f_startY, f_endX, f_endY 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:
if f_startX < 293 < f_endX and f_startY > 141 > f_endY:
print("Circle is inside face")
else:
print("Circle is outside face")
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