0

I have an image of size (1080,1920,3) stored in a numpy array and am trying to index it using an index array of size (6,2). My code is below and it runs, however the output dimensions are (2,6,3), which is not what I expect.

A = inPix[np.arange(6), 2darray]

This method above is from the answers here. Can anyone help me understand whats wrong and how I can get a (6,3) output array?

1 Answer 1

0

I found out that if you split the indices into columns, it works.

A = inPix[2darray[:,0],2darray[:,1]]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.