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. (In Matlab the data is actually stored
last-dimensions-first too.)

I suspect numpy has good reasons to do so too, but they are not clear to
me. I find myself quite a lot wondering if I have to use (or implement) a
method with order x-y-z, or the other way around. And I suspect this can
cause quite a lot of confusion and bugs!

If I make a function to do some image operation in a certain dimension:
def some_operation(image, dim):
    ....
Would it make more sense if dim=0 means x, or y?

Can anyone shed some light on why this is and how I can determine which
order to adopt when I create a function like the one above?

Thanks,
  Almar
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to