[Numpy-discussion] index into a 3d histogram

Chris Colbert sccolbert@gmail....
Sun May 3 18:34:55 CDT 2009

Lets say I have histogram of a color image that is of size [16, 16, 16].

Now, I have a function that converts my rgb image into the format where each
rgb color (i.e. img[x, y, :] = (r, g, b)) is an integer in the range(0, 16)

I want create a new 2d array where new2darray[x, y] = hist[img[x,y, :]]

that is, for each 3 tuple in img, use that as an index into the 3d histogram
and store the value of the histogram into the (x,y) position of the 2d

I've prototyped all the algorithms using for loops, now im just trying to
speed it up.

I can't quite wrap my head fully around this fancy indexing yet.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090503/fdf15851/attachment.html 

More information about the Numpy-discussion mailing list