Coverage for aftercovid/data/image_grid.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2024-04-25 03:09 +0200

1""" 

2Loads grid images. 

3""" 

4import os 

5import numpy 

6import skimage.io 

7 

8 

9def load_grid_image(name='france_bin.bmp'): 

10 """ 

11 Loads a black and white picture and makes a grid. 

12 :param name: picture name 

13 """ 

14 if not os.path.exists(name): 

15 this = os.path.dirname(__file__) 

16 name2 = os.path.join(this, name) 

17 if os.path.exists(name2): 

18 name = name2 

19 

20 img = skimage.io.imread(name, as_gray=True) 

21 img //= 255 

22 img = 1 - img 

23 return img.astype(numpy.int32)