title: OpenCV Python - Reading pgm files
body: <p>I'm trying to read a bunch of pgm files for a facial recognition project.</p>
  
  <p>These files lie in an overall folder called  "negative" and within the negative folder are subfolders. This portion of my script is supposed to go into all of the directories, store the filenames in an array, and store the "image file" in another array using OpenCV.</p>
  
  <pre><code>os.chdir("../negative")
  dirnames = os.listdir(".")
  neg_names = []
  for i in dirnames:                                              
      if os.path.isdir(i): 
          os.chdir(i)   
          neg_names.append(os.listdir("."))  
          os.chdir("..")
          face = cv2.imread(i,-1)
          faces_negatives.append(face)
  print faces_negatives
  </code></pre>
  
  <p>For some reason when it prints the array I get <code>NONE</code> in every index (there are 40 of them). From my understanding I should be getting binary values from this. This code works file with jpg files.</p>