Skip to content

Commit

Permalink
Merge pull request #334 from OpenTrafficCam/feature/2434-show-backgro…
Browse files Browse the repository at this point in the history
…und-image-in-grayscale

feature/2434-show-background-image-in-grayscale
  • Loading branch information
martinbaerwolff committed Sep 21, 2023
2 parents 0cd9b3f + b54292d commit c791c9c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion OTAnalytics/plugin_video_processing/video_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from OTAnalytics.domain.track import PilImage, TrackImage
from OTAnalytics.domain.video import VideoReader

GRAYSCALE = "L"


class InvalidVideoError(Exception):
pass
Expand Down Expand Up @@ -41,4 +43,4 @@ def get_frame(self, video_path: Path, index: int) -> TrackImage:
clip.close()
if found is None:
raise FrameDoesNotExistError(f"frame number '{index}' does not exist")
return PilImage(Image.fromarray(found))
return PilImage(Image.fromarray(found).convert(GRAYSCALE))

0 comments on commit c791c9c

Please sign in to comment.