Conditionned Average points

Jun 25, 2009 at 9:46am

Conditionned Average points

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.

#44534
Jun 25, 2009 at 10:12pm

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

– Pasted Max Patch, click to expand. –
#160194
Jun 25, 2009 at 10:46pm

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

lh

#160195
Jun 25, 2009 at 10:50pm

true enough. thanks for catching this. Smile

#160196
Jun 27, 2009 at 2:55pm

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!

#160197

You must be logged in to reply to this topic.