-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathcheck_vid.py
60 lines (44 loc) · 1.42 KB
/
check_vid.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
'''
For cross-checking the generated dataset and csv file for scene cut detection
Can be used for manually validating the results of the detection as well
'''
import pandas as pd
import cv2
import numpy as np
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-no','--video_no',type=str,default='1',
help='Video no')
args = parser.parse_args()
num=args.video_no
vid_name='./aug_final.mp4'
scene_cut=pd.read_csv('csv_aug_data.csv',index_col=0)
frame_nos=scene_cut['frame_no']
print(frame_nos)
start_frames=frame_nos.as_matrix()
cap = cv2.VideoCapture(vid_name)
_,frame_prev=cap.read()
_,frame_curr=cap.read()
h,w,_=frame_curr.shape
print (cap)
count=1
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
frame_prev2=frame_prev
frame_prev=frame_curr
frame_curr=frame
panel=np.hstack([frame_prev2,frame_prev,frame_curr])
panel_resized=cv2.resize(panel, (int(w*1.5),int(h/2.0)))
cv2.imshow('Panel',panel_resized)
if count in start_frames:
print("Frame Change\n")
cv2.waitKey(1000)
count+=1
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
cap.release()
cv2.destroyAllWindows()