Software

From FabLabGenovaWiki
Revision as of 19:14, 8 February 2013 by Alberto (talk | contribs) (Created page with "preliminary python code <code> import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np img=mpimg.imread('C:\Users\Alberto Parmiggiani\Desktop\lenna...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

preliminary python code import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np img=mpimg.imread('C:\Users\Alberto Parmiggiani\Desktop\lenna-lg_BW.png')

  1. imgplot = plt.imshow(img)
  2. plt.show()

idx = np.where(img == 0) nodes = np.vstack((idx[0],idx[1])) print idx, idx[0] print print np.concatenate((idx[0],idx[1]), axis=0) print print

np.savetxt('program_path.txt', nodes.T, fmt='%u', delimiter=' ', newline='\n')

file=open('program_path','w')

  1. file.write(initial)

file.close() <\code>