#invertovanie binary image aby boli prekazky biele

import cv2


image = cv2.imread('map_entry.pgm',0)
#invert = cv2.bitwise_not(image)
for i in range(len(image)):
    for j in range(len(image[i])):
        if(image[i][j]!=0 and image[i][j]!=254):
            image[i][j]=254
cv2.imwrite('inverted_for_dilation.pgm', image)

image = cv2.imread('inverted_for_dilation.pgm',0)
for i in range(len(image)):
    for j in range(len(image[i])):
        if(image[i][j]==0):
            image[i][j]=1
        if(image[i][j]==254):
            image[i][j]=0

cv2.imwrite('inverted_for_dilation.pgm', image)
