Hi,
I was wondering...
Say we have a np.ndarray A of two dimensions (a grayscale image for
example). If we want to access x:2, y:3, we have to do A[3,2]. Why is
the order of x and y reversed?
This is reversed in Matlab too, because Matlab is a matrix package and
matrix are often used this way.
Almar Klein wrote:
Hi,
I was wondering...
Say we have a np.ndarray A of two dimensions (a grayscale image for
example). If we want to access x:2, y:3, we have to do A[3,2]. Why is
the order of x and y reversed?
This is reversed in Matlab too, because Matlab is a matrix package and
matrix
Almar Klein wrote:
Hi,
I was wondering...
Say we have a np.ndarray A of two dimensions (a grayscale image for
example). If we want to access x:2, y:3, we have to do A[3,2]. Why is
the order of x and y reversed?
Because images are stored by rows, not by columns. So column 3, row 2,
is row
Basically, we want a[i][j] == a[i,j]. Since there is no literal syntax for
numpy arrays, we need to be able to convert from a sequence of sequences to
an array. The indexing needs to correspond between the two.
Thanks for the reply. I guess that explains the *why*...
Adopt the numpy order.
Almar Klein wrote:
Basically, we want a[i][j] == a[i,j]. Since there is no literal
syntax for numpy arrays, we need to be able to convert from a
sequence of sequences to an array. The indexing needs to correspond
between the two.
Thanks for the reply. I guess that explains