forked from Koreauniv-step05/Video_Recognizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVideo_Detector.py
36 lines (29 loc) · 920 Bytes
/
Video_Detector.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import cv2
import sys
#from test import drawcontour_
from Video_CharsRecognizer import drawcontour_
import numpy as np
import os
video_dir = "data/mov"
video_filename = 'video1.mp4'
video_filename = 'KakaoTalk_Video_2017-03-03-14-41-55 (1).mp4'
video_filename = os.path.join(video_dir, video_filename)
alive_flag = False
if alive_flag:
video_capture = cv2.VideoCapture(0)
else:
video_capture = cv2.VideoCapture(video_filename)
from LetterRecognizer import recognizer_forContourRecognizer
predictor = recognizer_forContourRecognizer.init()
while True:
ret, frame = video_capture.read()
draw_flag = drawcontour_(frame, predictor)
cv2.namedWindow('video', cv2.WINDOW_NORMAL)
cv2.imshow('video',frame)
if draw_flag:
cv2.waitKey(0)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()