Skip to content

Commit

Permalink
Remove alpha channel from LA images
Browse files Browse the repository at this point in the history
  • Loading branch information
andbue committed Feb 25, 2022
1 parent dfe453c commit 29903c3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions calamari_ocr/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def load_image(self, image_path: str) -> np.ndarray:

if img_channels == self.params.channels:
pass # good
elif img_channels == 2 and self.params.channels == 1:
img = img[:, :, 0]
elif img_channels == 3 and self.params.channels == 1:
if self.params.to_gray_method == "avg":
img = np.mean(img.astype("float32"), axis=-1).astype(dtype=img.dtype)
Expand Down

0 comments on commit 29903c3

Please sign in to comment.