numpy choosing groups / clusters of values

2009-04-29 Thread T Kirstine
I have a numpy array and would like to get the values from the array where groups of values are the same. Select the groups of 0 where group is > 3 and change 0 to 5 This [3, 2, 1, 0, 0], [1, 0, 3, 0, 0], [2, 0, 1, 3, 0], [0, 2, 3, 3, 0] to this [3, 2, 1, 5, 5], [1, 0, 3, 5, 5], [2, 0, 1, 3, 5]

image exclude values from resize

2009-03-06 Thread T Kirstine
I've been downsampling RGB images using pil, but know I would like to exclude black 0,0,0 values from the resize calculations. I was hoping that applying a alapha mask to black areas and creating RGBA image then performing the resample would fix the issue but no such luck. any ideas? -- http://