Hi guys,
So kinect gives xyz data for joints in values between -1 to 1. Only problem is in the space I’m using I don’t use that whole space so my min/max values for hand x/y (all I’m using for now for testng) are something like -0.5 to 0.5. Question is how do I take the MIN and MAX values of the input (fire the patch up, basically sweep my arms in a circle) and scale those to -1 and 1 respectively? I know how to work the math out but in terms of settIng up the CHOPs, what object would I use to sort min/max values (on the fly) to do this? Main reason for this is it will be a sort of auto initialization for any space the kinect is set up in, sweep the arms and basically sets the min/max of -1 and 1 to only as far as the arms reach. I figure will need a toggle control to disable it once the ranges are good but until disabled if the hands go outside the currently scaled zone, it will rescale the furthest points back to -1 and 1 (toggle is mostly to ensure person is in position during init, so scales correctly and is disabled manually when scaled, so that way them walking out of frame etc. doesn’t screw up the scaling). I know how to do this in PureData (easy peasy) but not sure what object/s to use in TD to grab the min/max values and store them, updating them as new min/max values come in.
Sorry for the lengthy explananation of what’s probably super simple but just wanted to make sure I made sense.
Thanks in advance!
-slv
What would be your process in pd?
in pd there’s an object called [moses ], it parts (get it) a stream of numbers; you feed it a value, anything lower goes out one output, anything equal or higher goes out the other (or maybe it’s equal and lower, i forget). basically you’d use 2 moses, one for the high value, one for the low; basically run the output value (higher or lower) back into the moses, so if you sweep to -.075, when you sweep back that moses will have output -.075 as your lowest value… then just dump that as your “low” value, and with your high value scale them from -1 to 1…
should i look into some sort of function or expression editor chop? really i just need something that says “if lower than this value, go over here” then take that value and put it back into the “if lower than” object
idea being just sweep your hands in circles in the space you’re using and instead of -1 and 1 being the max range of the edges of the camera it’ll be the range of your armspan…
seems like an easy way to initialize the kinect to use in any space, for any person, regardless of height/armspan
i think i can do it with the limit CHOP, will test it when i get home
ok, i think i got it working, but feel like it might be a little sloppy… i’m sure i can cut down some of these chops by using more complex expressions but at least it’s working.
if someone wants to test it, basically click the bottom button (just resets everything), then click the top button on, then click and drag the slider a little to the left and right… you’ll see the min/max chops start scaling your range to -1 and 1… then click the top button again and now you’re in “performance” mode, where when you click and drag the slider, it will use the custom range for -1 to 1, and if you go outside the ranges it just limits at -1 and 1…
again idea being, you can initialize (gonna have to set this on a timer or something, maybe reset, 5-10 seconds init, then automatically switch off the init mode) by waving your arms around, essentially only using that range and not the entire range of the kinect input. that way will auto-adjust for people regardless of size, or say they want to move around more they can lean to the sides when initializing…
thanks for all the help guys, and if you think there’s an easier/cleaner way to do this, i’m all ears!
cheers!
kinect space initialization guts.toe (6.65 KB)