Python matrix convention for the pixel coordinate

i have a very little question, what is the value that the following image takes for the pixel (1,3), using the Python matrix convention for the pixel coordinate?

enter image description here

Arrays are accessed with (row, column) indexing.

image_array = np.array([[20, 21, 22, 23, 24],
                        [15, 16, 17, 18, 19],
                        [10, 11, 12, 13, 14],
                        [5, 6, 7, 8, 9],
                        [0, 1, 2, 3, 4]])

print(image_array[1, 3])

This returns 18

does that depends on the way numpy works?

Yes numpy follows a “matrix” convention (row, column) as previously mentioned, I think scikit image too.

Other packages like opencv, or in ImageJ, KNIME… follows a (x, y) convention such that x is along the columns (width) and y along the lines (height).
In ImageJ you can see it in the toolbar when you hover the mouse over the image.

1 Like

Thanks for answering @LThomas!

I would like to point out that scikit-image has a guide about image coordinates in NumPy here:

https://scikit-image.org/docs/dev/user_guide/numpy_images.html

1 Like