Forums > Jitter

video threshold to bang or simple number?

Jan 25 2011 | 10:02 pm

I’ve been trying to find a way to do simple motion detection. I was thinking that I could do somethign like the following: put the camera image through a difference effect, and then down to b&w (no greys) and then doing something as simple as adding up the white pixels in each frame and comparing that number to the number in the next frame. Assume anything under 50 pixels of white is just noise, but anything above is motion and then sending a bang do do other things with that info.

So, first question, is this a viable idea of how this could work?

2nd question, I haven’t figured out a way to get a concrete value (or bang) out of video put through some object. From the name, I thought cv.jit.threshold would do it, but it looks to be just another image processor. Is there a way to get a simple number out of that or some other object from a video source? Or is there another way I should be thinking about this?

Thanks much, Ian

Jan 25 2011 | 10:15 pm

one way of doing what you described:

-- Pasted Max Patch, click to expand. --

Jan 25 2011 | 11:23 pm

Well, I think that got me. I think this is faster and cleaner than what I was coming up with for the video processing side of things, and jit.3m was the key piece to get the data out.

For the jit.slide piece, it looks sort of like a motion blur, and seems to have effect of making fewer bangs out of the same motion instead of banging the whole time. Is that the intent of that piece?


Jan 27 2011 | 3:17 am

jit.slide is simply a motion smoother, or a low pass filter for the image…it smooths out transitions between frames…it eliminates motion detection from camera noise or really small amounts of motion..try taking it out and see what you get

onebang is the object that is limiting the number of bangs you’re getting from the motion detection

Jan 29 2011 | 1:14 am

Gotcha. Thank you.

Feb 02 2011 | 9:33 pm

Don’t know whether it’s best to reply to this or start a new post, but it’s inversely related, so I’ll follow up on this one.

I’ve been tweaking the settings and the video input into this type of setup and I’ve gotten it to work fairly well. I’m trying to do something where the LACK of motion also causes things to happen.

What I’ve been trying to do so far is take this same block of code and change out the section with the greater than (> 250) to a less than. Specifically, >150 causes a start bang, and <140 causes a stop bang, and still using the onebang to smooth things out. The start bangs seem to have no problem. However, the stop bangs don't work as well. Watching the video and the numbers, I'm getting fairly close to the values put out by noise in the system (camera, and crumblies through the processing), but the numbers do get consistently below 140. However, every once in a while I will not get a stop bang, and then the system runs on until a "more obvious" high to low situation happens, like walking through the area.

I’m not at the machine (it’s currently installed), but I’m thinking that maybe the onebang could be the problem? If I took out the onebang for the stop/"lack of motion" action, and then lowered the low number into the top of the noise range, would I get a better stop? I’d think that this could help as then the system would be more vigilant about dropping under, I’d just have to find a safe value for the stop action.

Any ideas for a better method for low/no motion detection?

Feb 03 2011 | 2:44 am

hard to say without seeing the patch. onebang and < 140 should work... then again, don't know your setup or what kind of noise you are getting.

Feb 03 2011 | 9:11 pm

Thanks, I’ll play around a bit more. It works fairly well as is, it’s just that sometimes when a person barely grazes a detection zone, they’ll trigger the motion, but not the anti-motion. I don’t have Max on this machine or I’d post the patch.

I wonder if my initial idea of having space between the two values (>150 and <130 or whatever I have them set to right now) is sort of flawed. Maybe I should just do >150 and <150. It's either that or the < value needs to be higher.

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

Forums > Jitter