import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import cv2
import numpy as np

img=mpimg.imread('cleaned_skeleton_ROADS_robot.pgm')
img2=mpimg.imread('ROADS_INTERSECTIONS.pgm')




array=(np.argwhere(img2 == 255))
print(array)
#######################PRIDANE UKLADANIE UZLOV
import csv

with open("finded_nodes.csv", "w", newline="") as f:
    writer = csv.writer(f)
    writer.writerows(array)
#######################PRIDANE UKLADANIE UZLOV


imgplot = plt.imshow(img,cmap='gray',alpha=0.5)
imgplot = plt.imshow(img2,alpha=0.5)
plt.scatter(array[:,[1]],array[:,[0]], color='red', s=40)
plt.show()
