0

I'm working with some image data of shape (x,y,3). Is a way to use a numpy construct like nditer to iterate over the (r,g,b) tuples corresponding to pixels? Out of the box, nditer iterates over the scalar values, but many numpy functions have something like a axis= argument to change behavoirs like this.

seewalker
  • 1,123
  • 10
  • 18

1 Answers1

0

Check np.ndindex. It's doc may be enough to get you started. Better yet, read its code.

I have answered similar questions by essentially reverse enginerring ndindex. If there isn't a link in the Related sidebar, I'll do a quick search.

shallow iteration with nditer

Community
  • 1
  • 1
hpaulj
  • 221,503
  • 14
  • 230
  • 353