Well, to begin with, I should admit that it is a pretty long question and I failed to find possible solutions through googling
I have a video in which an intruder tries to intrude into the other side of the fence.
I can track the intruder, but when he is in the other side, I should be able to save the intrusion duration into a file. The intrusion area would be something like this
I thought these steps:
I. Reading a video file;
II. Getting the very first frame displayed,
1. Pausing the video playback;
2. Manually drawing intrusion area on that frame with a mouse; (making draw and reset buttons as events maybe)
3. Replaying the video again
III. Waiting for the intruder to appear, etc. (III part is not important)
So far, I've done I and II (silly, I know) and should accomplish 1,2,3 subparts of step II.
import cv2
file = "intrusion.mp4"
capture = cv2.VideoCapture(file)
ret, firstFrame= capture.read()
while True:
cv2.imshow("First Frame", firstFrame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
I hope you can give your advice and instructions!
PS: refer to any related posts, blogs or links, I am excited to find out