Conditionned Average points

salvadorpsartek's icon

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
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's icon

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

Max Patch
Copy patch and select New From Clipboard in Max.

Luke Hall's icon

You might want an [abs] in between each of the [- 0.] and [

lh

MIB's icon

true enough. thanks for catching this.

Rui Caldas's icon

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!