Skip to content

Commit

Permalink
issue #59
Browse files Browse the repository at this point in the history
fixes the black and white images read issue
  • Loading branch information
pozitronik committed Aug 20, 2023
1 parent 56c32ee commit a6527d8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sinner/handlers/frame/CV2VideoHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def suggest_codec(self) -> int:
def read_image(path: str) -> Frame:
if platform.system().lower() == 'windows': # issue #511
image = cv2.imdecode(fromfile(path, dtype=uint8), cv2.IMREAD_UNCHANGED)
if len(image.shape) == 2: # fixes the b/w images issue
image = cv2.cvtColor(image, cv2.COLOR_GRAY2BGR)
if image.shape[2] == 4: # fixes the alpha-channel issue
image = cv2.cvtColor(image, cv2.COLOR_BGRA2BGR)
return image
Expand Down

0 comments on commit a6527d8

Please sign in to comment.