-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadFrames.py
More file actions
40 lines (27 loc) · 899 Bytes
/
readFrames.py
File metadata and controls
40 lines (27 loc) · 899 Bytes
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
import sys
import cv2
import numpy as np
cap = cv2.VideoCapture(str(sys.argv[1]))
ret, frame = cap.read()
frame = cv2.resize(frame, (0,0), fx=0.3, fy=0.3)
height = frame.shape[0]
width = frame.shape[1]
while(cap.isOpened()):
ret, frame = cap.read()
frame = cv2.resize(frame, (0,0), fx=0.3, fy=0.3)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('origineel', frame)
for r in range(0, height-1):
for c in range(0, width-1):
#pixeltransformations
frame.itemset((r,c,0),255 - frame.item(r,c,0))
frame.itemset((r,c,1),255 - frame.item(r,c,1))
frame.itemset((r,c,2),255 - frame.item(r,c,2))
cv2.imshow('resultaat', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
while(True):
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()