Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added frame capture methods #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
mav.parm
mav.tlog
mav.tlog.raw
vision/.vs
Binary file added vision/Frame Capture/robot_underwater.mp4
Binary file not shown.
Empty file added vision/__init__.py
Empty file.
Empty file added vision/ui/__init__.py
Empty file.
31 changes: 31 additions & 0 deletions vision/ui/video_stream_capture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import cv2 as cv2
import numpy as np

class Video_Stream_Capture:

index_of_select = 0
videos = []
frame = None
file_paths = []

def __init__(self, file_paths):
self.file_paths = file_paths
for path in file_paths:
videos.append(cv2.VideoCapture(file_paths))

def next(self):
if ((len(videos) - 1) > index_of_select):
index_of_select = index_of_select + 1
else:
index_of_select = 0

def frames(self):
i=0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable isn't getting used anywhere

captures = []
for video in videos:
ret, frame = video.read()
if ret == False:
break
captures.append(frame)
i+=1
return captures[index_of_select]