Re: [Numpy-discussion] collecting the bluest pixels

2008-10-07 Thread paul taney
Thank you Stefan and Anne for such quick replies. I am writing a gimp plugin, and if anybody is interested in how do that -- there are only about 10-20 examples that I"ve found -- this plugin is attempting to do raster-to-vector conversion on the bluest pixels. It outputs SVG and a python tupl

[Numpy-discussion] collecting the bluest pixels

2008-10-07 Thread paul taney
Hi, I have this silly color filter that Stefan gave me: def vanderwalt(image, f): """colorfilter, thanks to Stefan van der Walt""" RED, GRN, BLU = 0, 1, 2 bluemask = (image[...,BLU] > f*image[...,GRN]) & \ (image[...,BLU] > f*image[...,RED]) return bluemask To c

[Numpy-discussion] newb question

2008-09-19 Thread paul taney
Hi, What am I doing wrong here? The reshape doesn"t take. % cat test1.py import numpy as np a = np.uint8([39, 39, 231, 239, 39, 231, 39, 39, 231, 39, 39, 231, 239, 39, 231, 39, 39, 231, 39, 39, 231, 239, 39, 231, 39, 39, 231, 39, 39, 231, 239, 3

Re: [Numpy-discussion] Medians that ignore values

2008-09-18 Thread paul taney
Hi, > >>> median(m.T) > array([ 1.e+20, 2.12298948e-01, 3.57822574e-01, I believe 1.e+20 is a reserved value and signifys the missing value or NaN in your case. That"s the way it was in a Fortran77 package I worked with ten years ago... --- On Thu, 9/18/08, Peter Saffr

Re: [Numpy-discussion] color filtering

2008-09-17 Thread paul taney
> coords were tossed. > > Can you show me a cheap way to return a line: > > > >line=[(3, 0), (2, 1), (0, 2), (1, 2), (3, 2), (0, > 3), (4, 3), (3, 4)] > > > > type-o-thing? > > Sure, how about > > np.array(bluemask.nonzero()).swapaxes(0,1) > > Does that do what you want? Exactly. Very co

Re: [Numpy-discussion] color filtering

2008-09-17 Thread paul taney
> Maybe this helps: > > # silly algorithm for guessing blue pixels > >>> bluemask = (a[...,2] > 1.25*a[...,1]) & (a[...,2] > 1.25*a[...,0]) > > >>> a[bluemask, :] > array([[107, 11, 185], >[101, 91, 251], >[ 61, 23, 79], >[ 25, 131, 211], >[169, 83, 214], >

[Numpy-discussion] color filtering

2008-09-17 Thread paul taney
Hi, I"m just learning numpy and I am not a math. I just need it. I need to do a color filter; I have it working in python but it runs forever on some of my images. And I dont know enuf c or c++ to use weave (or Boost or Pyrex or...) This looks like the best way, and I have somebody who is a