darsia.matrixToCartesianIndexing#

matrixToCartesianIndexing(img, dim=2)[source]#

Reordering data indexing converting from (row,col) to (x,y) indexing.

The conventional matrix indexing uses the (row, col) format, such that the top left corner is the (0,0) pixel. On the other hand, Cartesian indexing uses the (x,y) order and thereby identifies the lower left corner by (0,0). This routine is in particular useful when communicating image data to conventional simulators, which use the Cartesian indexing.

Parameters:
imgnp.ndarray

Image array with matrix indexing.

dimint

Dimension of the image, default is 2.

Returns:
np.ndarray

Image array with Cartesian indexing.