Contour + Expr

Hi,

I’m using the “contour” to do tracking for a multitouch interface project (using vvvv and processing). I have a “displacement” between the coordinate returned by “contour” and what I’m drawing with processing/projecting on the interface.

To correct the displacement I’m thinking to use a parabola equation “A*sqr(X)”. Feeding two “expr” objects with the x and y returned by “contour”.
The problem is that I need to have at least two blobs (detected by “contour”) for getting a value out of “expr”. With only one “expr” returns O

I must be missing something really obvious …

Thanks.
ps: i’m new to vvvv …:-(… but working hard to change that

does that make any sense…
few hours qfter posting this I have still not figure it out.

the patch (heavely based the contour help)

patch.jpg (39.5 kB)

the contour returns an empty spread when there is nothing to detect. as there is no value to do any calculations with, the result of many nodes (such as expr) is also an empty spread.

you can detect the presence of an empty spread with the Count node. it will return the number of elements in a spread. if Count returns zero you can use Switch to branch to a different behaviour.

note that Expr is sometimes slow - the Power can be used to do squares. even faster for your formula might be a * (Value) with three inputs (use the inspector)

hi guys as ususal ,m not sure if i understood you but if you want that a position from a blob remains you can use count + s+h and maybe getslice for the blobs you want , change the mouse for contour ; D

Countandremain.v4p (5.4 kB)

Thanks Oschatz…you put me on the good direction when you said: “note that Expr is sometimes slow - the Power can be used to do squares. even faster for your formula might be a * (Value) with three inputs (use the inspector)” … I don’t understand why, but if I do the same equation by “hand” it works… instead of using “expr” and use a combination of “power”, “*” and “+”.

Thanks.

ps: Colorsound: thanks for presenting me “S+H” …