diff options
| author | morefigs <morefigs@gmail.com> | 2019-03-09 11:47:27 +1100 |
|---|---|---|
| committer | morefigs <morefigs@gmail.com> | 2019-03-09 11:47:27 +1100 |
| commit | 91d599433c65a4b55864682131337ed29c2b8d9c (patch) | |
| tree | 8dfab39b0efccbe91e96a85d4843646cdea8bb0e /examples/camera | |
| parent | 6ee63831f3c0ed991fc9b617c1697ef91bc7100d (diff) | |
| download | pymba-91d599433c65a4b55864682131337ed29c2b8d9c.tar.gz pymba-91d599433c65a4b55864682131337ed29c2b8d9c.zip | |
v0.3.2
Diffstat (limited to 'examples/camera')
| -rw-r--r-- | examples/camera/display_frame.py | 12 |
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) |
