@@ -54,7 +54,7 @@ def __init__(self, p):
5454 self .config = p
5555 return
5656
57- def flip_image (self , pic ):
57+ def flip_image (self , pic , fliphorizontal = False , flipvertical = False ):
5858 """Flip image if configured in config.
5959
6060 :param pic: 2d array, image array
@@ -66,7 +66,7 @@ def flip_image(self, pic):
6666 pic = np .array (pic [::- 1 , :])
6767 return pic
6868
69- def load_image (self , filename ):
69+ def load_image (self , filename , fliphorizontal = False , flipvertical = False ):
7070 """Load image file. If loading fails (e.g. incomplete file),
7171 retry for 5 seconds (10×0.5s).
7272
@@ -95,14 +95,11 @@ def load_image(self, filename):
9595 if filenamefull .suffix == ".npy" :
9696 image = np .load (filenamefull )
9797 else :
98- image = open_image (
99- str (filenamefull )
100- ) # openImage expects str
98+ image = open_image (filenamefull )
10199 break
102100 except FileNotFoundError :
103101 time .sleep (0.5 )
104-
105- image = self .flip_image (image )
102+ image = self .flip_image (image , fliphorizontal , flipvertical )
106103 image [image < 0 ] = 0
107104 return image
108105
0 commit comments