Forums > Jitter

Colour tracking with a webcam in Jitter

June 4, 2011 | 4:40 pm

Is it possible to do this with jitter?
I tried to replace the jit.qt.movie in tutorial25 with jit.dx.grab but that doesnt seem to work?



MIB
June 4, 2011 | 6:13 pm

yes of course it’s possible. that’s why there is a tutorial for it ;)
we need a bit more info. what did you try? what didn’t work? what were you expecting and what did you get? did you give jit.findbounds good values to track? did you look into [suckah] to get color values for jit.findbounds?

post a patch!!


June 4, 2011 | 8:47 pm

You may also want to check out cv.jit.*

http://jmpelletier.com/cvjit/


June 5, 2011 | 9:30 am

@MIB I i’m following the tutorial nr 25 from the Jitter Tutorials, but thats not with a webcam but with a normal video.
I just replaced the jit.qt.movie with a jit.dx.grab but this will probably too simplistic?
My jit.findbounds values stay on -1.

Thx for the replies!


June 5, 2011 | 2:51 pm

http://waxandwires.com/color-tracking-jitter-controls-ableton-live/2009/06/01/

I’m trying to do the same as he is doing, but my valeus stay at -1



MIB
June 5, 2011 | 6:07 pm

try the below. Works great for me…

– Pasted Max Patch, click to expand. –

June 6, 2011 | 2:12 pm

cool, works great.
how do you change the padding of the color ?
can’t understand the little formula you made there :D



MIB
June 6, 2011 | 5:34 pm

[vexpr $f1 - ($f1 * 0.01) @scalarmode 1]

$f1… take the list from the first inlet
$f1 * 0.01 …. get 10% of each element of that list
add or subtract the padding to the original list
@scalarmode 1… operate on each element of the list

HTH



Joe
June 30, 2013 | 8:30 am

I had a bit of trouble with the patch you posted unfortunately.

I have converted tutorial 25 to work with webcam video but the tracking of colour isn’t working. Could someone have a look at what is wrong with it? And is there a way of setting what colour to look for?

All the best,

– Pasted Max Patch, click to expand. –


MIB
July 1, 2013 | 2:38 pm

works fine for me when I change it to look for red (I am wearing a red t-shirt right now)… what’s the issue?? more info is always good ;)



Joe
July 1, 2013 | 3:00 pm

hmm thats odd. I open webcam and turn it on and I see me moving about.. but not change in numbers :/

how have you changed it to look for red?

all the best

J



Joe
July 3, 2013 | 5:17 am

Hey

still having a bit of trouble with this patch, I think I have set it to search only for red, but I still get no movement from the sliders or floats.

Any suggestions?

J

<code>

– Pasted Max Patch, click to expand. –

</code>



Joe
July 3, 2013 | 5:44 am

I have noticed the max window is outputting, "could not build preview graph"

what does that mean?

j


July 3, 2013 | 6:57 am

Hi Joe

Your patch is working fine on my computer (OSX, Max 6.1.3) – I changed it only a bit:

- ’cause I’m not using CV I’m using jit.grab
- changed "unpack" to "unpack i i"
- added manual control for min and max (be sure you always using "1." for alpha value – not "0.1"!)

<code>

– Pasted Max Patch, click to expand. –

</code>



Joe
July 3, 2013 | 7:18 am

Hmm this is really odd. I am testing your patch and still getting no tracking. Even when I put a red pen lid right up to the webcam I get no movement of the sliders.


July 3, 2013 | 7:23 am

Joe, please make for me a screenshot of your patch with parameters (min and max, etc.). I’m sure we can find a solution ;-)


July 3, 2013 | 7:28 am

And test attached patch:

<code>

– Pasted Max Patch, click to expand. –

</code>



Joe
July 3, 2013 | 7:31 am

that patch works perfectly!

what colour is it tracking though?


July 3, 2013 | 7:34 am

Just white and light-grey. Your problem is (or was) related to min and max parameters – I have an idea, how to do it, wait a bit for next patch.


July 3, 2013 | 8:00 am

A lot of optimisations possible, but this is good enough for beginning…

Just click on "pwindow" to select color to track and use "tolerance" slider to tune sensitivity of the tracker. And have hun ;-)

<code>

– Pasted Max Patch, click to expand. –

</code>



Joe
July 3, 2013 | 12:06 pm

Interesting approach, really like the ability to click on the colour to track.

I am getting some very sporadic results mind, not sure if I have set it up right but I (change in numbers) until the tolerance is increased to about 0.6 and even then I don’t think it is tracking what I want it to.

Any suggestions?


July 3, 2013 | 12:42 pm

Interesting… I think I can return to the patch tomorrow ;-)


July 3, 2013 | 2:15 pm

Hmmm… I played with the patch a bit. Maybe i’s something wrong with the jit.findbounds (I can reproduce your problem on my computer) or there’s a bug in the patch – I’m not sure. But we can workaround this problem anyway.

Check attached patch – I moved some parts of the work into jit.pix and jit.fastblur objects. Hope, this is helpful.

<code>

– Pasted Max Patch, click to expand. –

</code>



Joe
July 3, 2013 | 3:10 pm

Its strange because I have built a patch pretty similar to this that tracks my white iphone really well. The patch you posted doesnt seem to track the colour selected.

Interestingly the data that is produced in the number boxs out of the two unpack i i seems to stay around 200, 60, 277 and 137 even when I change the colour I am looking for..

Not sure if that helps with your diagnostic of the patch


July 3, 2013 | 3:54 pm

On my computer I can track selected colour, I’m sure. Please make screenshots of the patch during tracking with source and processed image. I can’t reproduce this issue.

Maybe this is something PC specific or your camera (and lighting condition) is producing noisy image. Try also play with "range" attribute of jit.fastblur (it’s simply with attached patch).

<code>

– Pasted Max Patch, click to expand. –

</code>



Joe
July 4, 2013 | 5:45 am

Hi

Yeah those changes have cleared it right up. thank you so much for your effort.

I can now change it to fit my patch and get some decent tracking results.

All the best

J


July 4, 2013 | 6:29 am

Joe!

Great! That was surprisingly spooky topic… I’m glad we solved all the problems.

I attached once again a bit cleared version of the patch – maybe it will be inspiring for somebody in the future.

<code>

– Pasted Max Patch, click to expand. –

</code>


November 24, 2013 | 3:09 pm

Yaniki – this patch just saved me an entire day! Thank you!


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