Two Dimensional Images in Python

  • Arrays are indexed starting at 0
  • Multidimensional arrays are stored either row-major or column-major:
    • row-major: C/C++, numpy
    • column-major: Fortran, Julia, R

In [ ]:
import numpy as np

a = np.zeros(12).reshape(4,3)
a[2,1]=1

In [ ]:
print(a)

In [ ]:
%matplotlib inline
import matplotlib.pylab as plt

plt.imshow(a,origin=['Lower'])
plt.colorbar()

Notice the odd interpolation that is going on here.


In [ ]: