-
Notifications
You must be signed in to change notification settings - Fork 0
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
Returning frames as PIL images #37
Open
timmarkhuff
wants to merge
11
commits into
main
Choose a base branch
from
tim/pil-images
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a18b3d7
returning frames as PIL images
de062a0
Automatically reformatting code with black and isort
13a7b19
updating tests to use PIL images
15ed075
Merge branch 'tim/pil-images' of github.com:groundlight/framegrab int…
81a5116
fixing a typo
726dbf8
responding to PR feedback
6b6a629
Automatically reformatting code with black and isort
9e3f6ed
updating docstrings
5916794
Merge branch 'tim/pil-images' of github.com:groundlight/framegrab int…
2d4edee
updating more docstrings
0dece03
some adjustments to motion detection so that it can handle PIL images
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,24 @@ | ||
#!/usr/bin/env python3 | ||
"""Reads framegrab configuration from a yaml file, creates FrameGrabber objects, and grabs images from each camera. | ||
Remember to adjust sample_config.yaml according to your needs. | ||
""" | ||
|
||
from framegrab import FrameGrabber | ||
import yaml | ||
import cv2 | ||
|
||
# load the configurations from yaml | ||
config_path = 'sample_config.yaml' | ||
with open(config_path, 'r') as f: | ||
configs = yaml.safe_load(f)['image_sources'] | ||
|
||
print('Loaded the following configurations from yaml:') | ||
print(configs) | ||
|
||
# Create the grabbers | ||
grabbers = FrameGrabber.create_grabbers(configs) | ||
|
||
while True: | ||
# Get a frame from each camera | ||
for camera_name, grabber in grabbers.items(): | ||
frame = grabber.grab() | ||
|
||
cv2.imshow(camera_name, frame) | ||
|
||
key = cv2.waitKey(30) | ||
|
||
if key == ord('q'): | ||
break | ||
|
||
cv2.destroyAllWindows() | ||
for camera_name, grabber in grabbers.items(): | ||
frame = grabber.grabimg() | ||
frame.show() | ||
|
||
for grabber in grabbers.values(): | ||
grabber.release() | ||
|
||
|
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,9 +1,7 @@ | ||
#!/usr/bin/env python3 | ||
"""Finds a single USB camera (or built-in webcam) and displays its feed in a window. | ||
Press 'q' to quit. | ||
"""Finds a single USB camera (or built-in webcam), grabs an image and displays the image in a window. | ||
""" | ||
|
||
import cv2 | ||
from framegrab import FrameGrabber | ||
|
||
config = { | ||
|
@@ -13,15 +11,8 @@ | |
|
||
grabber = FrameGrabber.create_grabber(config) | ||
|
||
while True: | ||
frame = grabber.grab() | ||
frame = grabber.grabimg() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changing to |
||
|
||
cv2.imshow('FrameGrab Single-Camera Demo', frame) | ||
|
||
key = cv2.waitKey(30) | ||
if key == ord('q'): | ||
break | ||
|
||
cv2.destroyAllWindows() | ||
frame.show() | ||
|
||
grabber.release() |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updating to use
grabimg
as that is our preferred method