I initially thought that the rectangle detection that is not removed due to imshow that is why I try to use cv2.imwrite to directly write the image and after checking it frame by frame i realize that it happen especially when there a lot of people some of the detection rectangle for alert ( yellow one ) is being included in the next frame. Is there any solution to this? Thank you