Forums > MaxMSP

how to keep a number from going to its default preference or position(127)

January 10, 2011 | 2:57 am

Hi everyone. I am tracking movement in camera using cv.jit.centroids but when the camera isn’t tracking anything the number that is being track defaults to 127. I want that number to pause when a person tabs a key only until the camera starts tracking again. so if the number is going from 0 – 127, and the person tabs a key at 100 the number stays in 100 instead of 127 until the tracking begins again.

in the following patch I can only make it pause for a specific period of time (using the line object) but after the time passes and the gate switches it defaults to 127 again.

I should know how to do this, its been bothering me a couple of days..
Thanks

– Pasted Max Patch, click to expand. –

January 10, 2011 | 6:10 am

is this what you mean?

– Pasted Max Patch, click to expand. –

January 10, 2011 | 6:39 am

thanks mxf hacker, but I am beginning to think this is impossible. Your answer makes sense but it is not what I am looking for I need to be able to release the key since I am controlling 6 keys at different intervals.

to recap – One number is coming out of the unpack of a cv.jit.centroids when the tracking goes out of the camera view the number of the unpack defaults to 127 – it would be great if [1] the number stayed at the position the tracking left the screen, automatically, Or [2] if I press a key before I move away from the camera locking the number so it dosn’t default to 127. The problem is that when I go back to camera tracking I want to override the lock until next number position is locked.
so far it works great as long as the gate stays in the number that I locked in, but as soon as the line object changes the gate it goes back to 127 grrrrr. help?


January 10, 2011 | 7:23 am

would it be possible to send the patch so I can have a better look as i’m not completely following what you want.


January 10, 2011 | 7:58 am

ok I hope you are stil around . I am using an infrared camera so the circle of the centroid sometimes leaves the screen, when it does it defaults to 127 (because I have the scale) if not it would default to 0 (I prefer 127). But nevertheless I want to be able to hold the number before the centroid leaves so instead of the number defaulting to 127 when the detected centroid leaves the screen it stays at the number I held when I pressed a key. Until Again the detected centroid appears again. I guess you won’t see the number defaulting to 127 as long as you have detection happening, as sioon as detection stops it goes to 127.

patch is a bit messy

– Pasted Max Patch, click to expand. –

January 10, 2011 | 11:37 am

Ive been looking in tutorials, objects in the forum. can’t figure this one out, I think is a matter of expression

if the gswitch2 switches and the right number outlet does not equal the left number outlet make the right outlet be the same as the left outlet wait 4 seconds if the right outlet is equal to 127 make the right outlet still be equal to the left outlet
if after 4 seconds the right outlet equals any other number besides 127 make that new numbers be the right outlet until gswitch is pressed again.

I am hoping for help.


January 10, 2011 | 12:06 pm

Not exactly sure how to go about it, but it sounds like you should use [i] to store at least one if not both of your numbers (or use number boxes with "set $1" to store). Then they’ll be available to bang back out as needed. These kinds of seemingly-simple things can actually be quite tricky until you figure them out, then there tends to be some forehead-slapping…

I looked at the patch but it’s still kind of confusing.


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