-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from MarkMichon1/staging
merge staging to master
- Loading branch information
Showing
5 changed files
with
43 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,22 @@ | ||
import logging | ||
import os | ||
|
||
import cv2 | ||
|
||
|
||
class VideoFramePuller: | ||
'''This object is loads the BitGlitter-encoded video, and returns one frame at a time to be decoded.''' | ||
|
||
def __init__(self, fileToInput, activePath): | ||
|
||
self.activePath = activePath | ||
def __init__(self, fileToInput): | ||
|
||
self.activeVideo = cv2.VideoCapture(fileToInput) | ||
logging.debug('Video successfully loaded into VideoFramePuller.') | ||
|
||
self.currentFrame = 1 | ||
self.totalFrames = int(self.activeVideo.get(cv2.CAP_PROP_FRAME_COUNT)) | ||
logging.info(f'{self.totalFrames} frame(s) detected in video.') | ||
self.currentFrame = 1 | ||
|
||
|
||
def nextFrame(self): | ||
'''This method will automatically read the next frame from the video, and return the file path to that image.''' | ||
|
||
self.image = self.activeVideo.read() | ||
self.activeImagePath = f"{self.activePath}\\frame{self.currentFrame}.png" | ||
cv2.imwrite(self.activeImagePath, self.image[1]) | ||
return self.activeImagePath | ||
|
||
|
||
def removePreviousFrame(self): | ||
'''After the frame is ran through the decoder, fileslicer will run this method to delete the frame.''' | ||
|
||
os.remove(self.activeImagePath) | ||
self.currentFrame += 1 | ||
self.currentFrame += 1 | ||
return self.activeVideo.read()[1] |