-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
26 lines (19 loc) · 771 Bytes
/
Copy pathmain.py
File metadata and controls
26 lines (19 loc) · 771 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
import cv2 # using opencv for image capturing
from PIL import Image
from transformers import BlipProcessor, BlipForConditionalGeneration
# putting video file into object to be manipulated
test = cv2.VideoCapture("TestFootage/carspassingby.mp4")
# sets the frame we want to look at
test.set(cv2.CAP_PROP_POS_FRAMES, 9)
# reads the frame at the new position, ret is a boolean to test if the
# VideoCapture object was actually done, frame is the actual frame if it worked
ret, frame = test.read()
# checking if .read() actually did anything
if ret:
# saves frame to image file in Frames folder
cv2.imwrite("TestFootage/Frames/cartestframe10.jpg", frame)
# stop working with video
test.release()
# ---------------------------------
# Testing with BLIP
url = ""