aboutsummaryrefslogtreecommitdiff
path: root/examples/camera/display_frame.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/camera/display_frame.py')
-rw-r--r--examples/camera/display_frame.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/camera/display_frame.py b/examples/camera/display_frame.py
index d0849c9..6dc3f84 100644
--- a/examples/camera/display_frame.py
+++ b/examples/camera/display_frame.py
@@ -4,16 +4,16 @@ from pymba import Frame
# todo add more colours
-PIXEL_FORMAT_MAPPING = {
+PIXEL_FORMATS_CONVERSIONS = {
'BayerRG8': cv2.COLOR_BAYER_RG2RGB,
}
def display_frame(frame: Frame, delay: Optional[int] = 1) -> None:
"""
- Processes the acquired frame.
- :param frame: The frame object to process.
- :param delay: Image display delay in milliseconds, use 0 for indefinite.
+ Displays the acquired frame.
+ :param frame: The frame object to display.
+ :param delay: Display delay in milliseconds, use 0 for indefinite.
"""
print(f'frame {frame.data.frameID}')
@@ -22,12 +22,10 @@ def display_frame(frame: Frame, delay: Optional[int] = 1) -> None:
# convert colour space if desired
try:
- image = cv2.cvtColor(image, PIXEL_FORMAT_MAPPING[frame.pixel_format])
+ image = cv2.cvtColor(image, PIXEL_FORMATS_CONVERSIONS[frame.pixel_format])
except KeyError:
pass
# display image
cv2.imshow('Image', image)
-
- # wait for user to close window
cv2.waitKey(delay)