title: how to convert image to dataset to process machine learning
body: <p>How to convert a image to datasets or numpy array and to predict by fiting it to clf </p>
  
  <pre><code>import PIL as pillow
  from PIL import Image
  import numpy as np
  import matplotlib.pyplot as plt
  from sklearn import svm
  
  infilename=input()
  im=Image.open(infilename)
  imarr=np.array(im)
  flatim=imarr.flatten('F')
  
  clf=svm.SVC(gamma=0.0001,C=100)
  x,y=im.size
  
  #how to fit the numpy array to clf 
  clf.fit(flatim[:-1],flatim[:-1])
  print("prediction:",clf.predict(flatim[-1]))
  plt.imshow(flatim,camp=plt.cm.gray_r,interpolation='nearest')
  plt.show()
  </code></pre>
  
  <p>Anyone please and thanks!!!</p>