Forums > Jitter

Divide a space in grid?

September 15, 2012 | 8:22 am

I am taking the video feed from a Kinect and need to track if the right hand is in a certain quadrant. basically, I am dividing the space in 8 equal squares. If the hand is in that space then it triggers an event in Max. In the past I have done something alike using if-then statements but I believe that it is not the best way and there must be something better. Anyone has an idea?



MJ
September 15, 2012 | 10:53 pm

like this ?

– Pasted Max Patch, click to expand. –

September 16, 2012 | 5:02 pm

Nice! Thank you. I will work a bit with this.


September 16, 2012 | 5:08 pm

You can also do it with a scale object (and change to not re-bang within the same section/number)

– Pasted Max Patch, click to expand. –


MJ
September 16, 2012 | 10:09 pm

well i also tried it with a scale object , but it gives different results….

– Pasted Max Patch, click to expand. –

September 16, 2012 | 10:26 pm

Interesting that it’s so different. It’s the +1 that’s the difference I guess. It comes down to how you want to space it as in yours the "8" isn’t a section of the slider. It’s the tippy top of the slider. That’s probably the best mapping if you’re mapping it to something, but maybe not ideal if you want 8 equal slices.


September 17, 2012 | 2:48 pm

Actually, I have 2 columns of 4 squares each. I will duplicate the patch, one for the x values, one for the Y-values and then match the bangs. And off course test what results are the mmost accurate.


September 18, 2012 | 12:27 pm

Almost there. I pack the X and Y values in a list and match them. The only problem I have is that I am not getting a bang if the Y value changes but the X stays the same. What should I do for that? When I simply send a bang to the pack object, there are sometimes two matches instead of one.

– Pasted Max Patch, click to expand. –


MJ
September 19, 2012 | 2:42 pm

use pak instead of pack


September 20, 2012 | 11:00 am

Pak is nice but I sometimes get two or even three bangs where there should only be one bang. What am I doing wrong?

– Pasted Max Patch, click to expand. –

September 21, 2012 | 11:45 am

Sorry to reply to my own post but I found the problem is with the match object. I am feeding it a list but the object takes the list as a sequence so if you send <1 1> and then < 1 2> it will see <1 1> and then when you send <1 2 > he will match the <1 2> but also the interpolated < 1 1>. Now, is there a way to get around this?


Viewing 11 posts - 1 through 11 (of 11 total)