Hello all,
We are working on getting values from an image to a pd array. We are using maxlib's [tabset] to write the values to an array but the values are ints ranging from 0-255 and we'd like to get floats from -1 to 1. Since gridflow deals only with ints currently, are operations on lists possible in pd?
Thank you,
Alexandre and Stephanie
stephaniebrodeur@rogers.com wrote:
Hello all,
We are working on getting values from an image to a pd array. We are using maxlib's [tabset] to write the values to an array but the values are ints ranging from 0-255 and we'd like to get floats from -1 to 1. Since gridflow deals only with ints currently, are operations on lists possible in pd?
not in the core pd.
but there are libraries like Gem, providing [v+] [v*] (for adding/multiplication vectors and scalars), zexy [.] (in product of either 2 vectors or 1 vector and 1 scalar; note: zexy also provides a [tabset] so you might get a name-clash)
furthermore there should be johannes taelman's SMlib, which provides a lot of objects for dealing with vectors (and very complex operations too)
if you don't want to use any other lib, you could copy the content of one table to another table (with [tabread] & [tabwrite] and doing the math on scalars)
mfg.asd.r IOhannes
On Fri, 9 Jan 2004 stephaniebrodeur@rogers.com wrote:
We are working on getting values from an image to a pd array. We are using maxlib's [tabset] to write the values to an array but the values are ints ranging from 0-255 and we'd like to get floats from -1 to 1. Since gridflow deals only with ints currently, are operations on lists possible in pd?
GF got float support in last April (0.7.2) but you have to specify it explicitly, because GF doesn't know which you want, and assumes integers because of compatibility with all previous GF patches.
You can do what you want to do like this:
[@cast float32] | [@ / ( float32 # 127.5 )] | [@ - ( float32 # 1 )] | [@export_list]
Alternatively, you can also build equivalents to jMax's [list+] and such (it's not spelt [list +] !) using Ruby code like this:
class ListPlus < GridFlow::FObject def _0_initialize(*right) @right=right end def _1_list(*right) @right=right end def _0_list(*left) send_out 0, :list, *(0...left.length).map{|i| left[i] + @right[i] } end install "list+", 2, 1 end
And likewise for the other ones.
Mathieu Bouchard http://artengine.ca/matju