drawing 'ribbons' based on video tracking

snackwell's icon

I'm an old hat at MAX/MSP but very new to Jitter. I am working on a dance piece and would like to track a bright point on the dancer (I can do that part in a variety of ways) that creates a projected line or 'ribbon' as that point moves. Ideally, the ribbon would be erasing the oldest points to keep a maximum length, though I could also use an 'erase' if necessary. Another nice touch would be to vary the ribbon's thickness by the mass or speed of the centroid I am tracking.

I've looked at a variety of approaches on this forum, but have either missed or not been able to connect all the dots from the various approaches to do what I want. I've looked at jit.slide examples, jit.gl.slab, jit.gl.sketch examples, downloaded the cv.jit objects, and looked at most of the posts for generating 'trails,' though I would like to be actually drawing, and not blurring movs.

If there are any good examples out there that can be shared, or that I have missed on this forum, please let me know. I'm a week into this and my deadline approaches quickly.

J.

jazmatajz's icon

just an idea
maybe jitter particles can do the job, something like: http://www.videocopilot.net/tutorial.html?id=29*

jazmatajz's icon

another idea
a-hspline3d from www.s373.net/code/a-objects

andré sier's icon

haa,
that was from game programming gems! nice gem.

a

On Jun 24, 2008, at 10:29 PM, jasmin wrote:

>
> another idea
> a-hspline3d from www.s373.net/code/a-objects
>
> --
> jaz

snackwell's icon

Thanks for both sites. The Videocopilot one was excellent for other reasons, though it might be beyond my novice status at the moment to translate the After Effects techniques into Jitter patches.

And I certainly will try out the a-hspline3d object--in fact, the whole set of objects looks very promising.

I'd still be interested if anyone had any working examples of drawing by tracking out there.

Thanks for the help so far,

Jeff

nesa's icon

Hi,

pasted below is an example on how to draw curves using jit.gl.sketch,
added on top of the example jasch posted in another thread.

enjoy,
nesa

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

yair reshef's icon

----------begin_max4_patcher-- ?

On Fri, Jun 27, 2008 at 2:08 AM, nesa wrote:

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

> Hi,
>
> pasted below is an example on how to draw curves using jit.gl.sketch, added
> on top of the example jasch posted in another thread.
>
> enjoy,
> nesa
>
>
>
>
>

nesa's icon

he he, give me ten minutes to repatch...

On Jun 27, 2008, at 1:18 AM, yair reshef wrote:

> ----------begin_max4_patcher-- ?
>
>
> On Fri, Jun 27, 2008 at 2:08 AM, nesa wrote:
> Hi,
>
> pasted below is an example on how to draw curves using
> jit.gl.sketch, added on top of the example jasch posted in another
> thread.
>
> enjoy,
> nesa

nesa's icon
Max Patch
Copy patch and select New From Clipboard in Max.

On Jun 27, 2008, at 1:27 AM, nesa wrote:

> he he, give me ten minutes to repatch...
>
> On Jun 27, 2008, at 1:18 AM, yair reshef wrote:
>
>> ----------begin_max4_patcher-- ?
>>
>>
>> On Fri, Jun 27, 2008 at 2:08 AM, nesa wrote:
>> Hi,
>>
>> pasted below is an example on how to draw curves using
>> jit.gl.sketch, added on top of the example jasch posted in another
>> thread.
>>
>> enjoy,
>> nesa

snackwell's icon

Nesa,
Thank you so much--that is just what I was looking for. I am having great fun adding attributes and my knowledge of gl has multiplied many orders of magnitude. I notice that quick moves of the mouse will give a more contoured ribbon...while I think I have figured out most of what is happening, I have not been able to replicate that effect at a lower speed. If you consider that the 320 pixels will represent a 40'-wide stage, I'd have to have a VERY fast dancer to recreate that effect--any suggestions on how to do that at a lower speed?
Thanks SO much again,
Jeff

nesa's icon

Hi,

well, then easiest solution is to hire Bruce Lee to move fast enough,
but since he's not available for quite some time now, we'll have to
figure out something differenct.

My guess is that when you move mouse faster - you have less points per
length. So, in 'camera' case you would have to apply some kind of data
reduction. This is pretty common problem for all sensors(and camera is
just another sensor), so perhaps it would be good idea to search the
forum and try to find the best solution for your application.

One way to do data reduction would be to add a new point only when
line angle(and distance) changes more then some threshold level.
If you look at the 'p mapping' sub-patch, you'll see that there is 'p
delta' sub-patch which calculates the difference between coordinates
of the current and previous point. Output of delta is connected to the
cartopol object which calculates the angle and distance between these
two points.
This is the place where you could check for these values, and based on
that decide if you want to open the gate and trigger 'pack 0. 0. 0.'
to add a point.

Hope this helps,
and thanks for nice question.

-nesa

snackwell's icon

Ha, I just figured it out before checking the forum again. Yes, it is the delta subpatch--I can change the scaling values and get the contouring results I need! And I also added a multiply factor for the delta value. In fact, changing them in realtime based on tracking data makes the patch even more dynamic.

I was thinking more of a catapult for the dancer. Thanks again--I think I got even more than I need to continue on with my piece now. My first encounter with the Jitter forum has provided 100% satisfaction...thank you all.

Jeff

lisamarie's icon

Hi,

I am attempting to modify the below patch posted by nesa using jit.gl.sketch to draw ribbon-like trails. The patch I am using is really complicated so it is easier for me to refer to nesa's original post. The problem I am running into has to do with the color of the trail which is in the encapsulated patch "add a point". If I remove the "strokeparam color" message from this encapsulated patch in order to create a separate message that I can send color values to, the trail settings break. I have to keep triggering the reset button to get the trail to appear but it disappears after a short time.

Can someone explain to me how I could change the color of the trail "live" with color settings either attached to the current "add a point" encapsulated patch or how to make a new message that won't cause the odd behavior of the trail disappearing?
I've searched for more information about the strokeparam message but have not found anything helpful in the documentation.

Any help is greatly appreciated!!

Lisa Marie

nesa wrote on Thu, 26 June 2008 19:08

Hi,

pasted below is an example on how to draw curves using jit.gl.sketch,
added on top of the example jasch posted in another thread.

enjoy,
nesa

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

seejayjames's icon

Cool patch!

To use different colors you'd need to set the message "strokeparam color" with your RGBA values, using a [swatch] or something. Just make the [pak] take a bigger list that can have the colors separated. I rearranged some things and exposed some of the parameters in this version:

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

lisamarie's icon

Hi seejayjames-

Thank you for responding to my question!!!
I have been working with your suggestion and am still coming up with funny results. I was able to get the swatch object to change the brightness of the trails but not the hue. I decided to make a very simple patch using the pack object, the color swatch and the strokeparam object found in the patch created by nesa. If you open this patch and look at the max window, the values coming out of the swatch are very different than the values coming out of the strokeparam color message. I have no idea what is causing this. Do you?

Thank you again for your response!
Lisa Marie

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