Re: [Numpy-discussion] Finding Unique Pixel Values

2010-07-23 Thread Ian Mallett
On Fri, Jul 23, 2010 at 12:13 AM, Jon Wright wrote: > Ian Mallett wrote: > > > > To the second, actually, I need to increment the number of times the > > index is there. For example, if b=[1,5,6,6,6,9], then a[6-1] would have > > to be incremented by +3 = +1+1+1. I tried simply a[b-1]+=1, but i

Re: [Numpy-discussion] Finding Unique Pixel Values

2010-07-23 Thread Jon Wright
Ian Mallett wrote: > > To the second, actually, I need to increment the number of times the > index is there. For example, if b=[1,5,6,6,6,9], then a[6-1] would have > to be incremented by +3 = +1+1+1. I tried simply a[b-1]+=1, but it > seems to only increment values once, even if there are mo

Re: [Numpy-discussion] Finding Unique Pixel Values

2010-07-22 Thread Ian Mallett
On Thu, Jul 22, 2010 at 10:05 PM, Charles R Harris < charlesr.har...@gmail.com> wrote: > Is that what you want, or do you just want to know how many unique indices > there are? As to encoding the RGB, unless there is a existing program your > best bet is probably to use a dot product, i.e., if pix

Re: [Numpy-discussion] Finding Unique Pixel Values

2010-07-22 Thread Charles R Harris
On Thu, Jul 22, 2010 at 9:59 PM, Ian Mallett wrote: > Hi again, > > I've condensed the problem down a lot, because I both presented it in an > overcomplicated way, and did not explain it particularly well. > > Condensed problem: > a = np.zeros(num_patches) > b = np.array(...) #created, and is siz

Re: [Numpy-discussion] Finding Unique Pixel Values

2010-07-22 Thread Ian Mallett
Hi again, I've condensed the problem down a lot, because I both presented it in an overcomplicated way, and did not explain it particularly well. Condensed problem: a = np.zeros(num_patches) b = np.array(...) #created, and is size 512^512 = 262,144 #Each value in "b" is an index into "a". #For ea

[Numpy-discussion] Finding Unique Pixel Values

2010-07-22 Thread Ian Mallett
Hi, So, I'm working on a radiosity renderer, and it's basically finished. I'm now trying to optimize it. Currently, by far the most computationally expensive operation is visibility testing, where pixels are counted by the type of patch that was drawn on them. Here's my current code, which I'm