I'm implementing a Circle Hough Transform, so I have a 3D Numpy array C of counters representing possible Xcenter, Ycenter, Radius combinations. I want to increment the counters that are indexed by another 2D Numpy array I. So, for example, if I is
[[xc0, yc0, r0],
...,
[xcN, ycN, rN]]
then I want to say something like:
C[I] = C[I] + 1
and I want the effect to be:
C[xc0, yc0, r0] = C[xc0, yc0, r0] + 1
...
C[xcN, ycN, rN] = C[xcN, ycN, rN] + 1
However the indexing that's performed seems to be mixed up, referring to the wrong entries in C. Further, I would really prefer to say something like:
C[I] += 1
since this would appear to reduce the amount of index calculation.
So, two questions:
- How can I get the effect of "array indexed by array"?
- Can I get away with using the increment operator, and does it actually save any time?