Monday, August 13, 2012

Python: convert a numpy array to list

One more little trick I didn't know:


  inputImage = np.zeros(inputImage.shape)
  for i in range(0, inputImage.shape[0]):
    for j in range(0, inputImage.shape[1]):  
      inputIndices[i, j] = (i, j)
  inputIndices =  inputIndices.tolist() 

No comments:

Post a Comment