Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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)