Forums > MaxMSP

Conditionned Average points

June 25, 2009 | 9:46 am

hello all,

I use a detection movement patch I made using cv.jit.
for each frame, I receive a list of between 20 and 40 couples (x,y).
what I need to do is to create average points with those points (that I receive from the movement detection).
I explain, if 3 points (2, 4, 5 or more) are close to each other (x2-x1<30 and x3-x2<30 for example),
I create an average point (x1+x2+x3/3; y1+y2+y3/3).

I know it looks quite simple, but I can’t reach what I want..
If anyone have an idea which could help me to solve it (or objects, externals), it would be much appreciated!
Many thanks,
J.



MIB
June 25, 2009 | 10:12 pm

not sure, but maybe something like this will get you started:

– Pasted Max Patch, click to expand. –

June 25, 2009 | 10:46 pm

You might want an [abs] in between each of the [- 0.] and [< = 30] objects or your patch will "break" when x1 < x2

lh



MIB
June 25, 2009 | 10:50 pm

true enough. thanks for catching this. Smile


June 27, 2009 | 2:55 pm

Hi

I’ve made an patch to detect changes in an determined position of an video window.

I used some "average engine" to let the patch knowing the suns position and changes in the light, to trigger only with heavy changes (like some one walking in front of the camera).

Copy the folder to your desktop and open demo.maxpat

To use with an list with two elements (x, y) you just have to duplicate the "blue backgound" patch.

enjoy!


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