We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpVideo Capture,  Movie Playback,  Vision Libraries › Motion tracking, and Defining moving object
Page Index Toggle Pages: 1
Motion tracking, and Defining moving object (Read 5843 times)
Motion tracking, and Defining moving object
Jun 3rd, 2005, 7:13pm
 
I'd like to make a motion-detectionscript for webcam that  distinguises between objects of different size and shape, and find the centerpoint, width and height of these objects..

I would also like to calculate the direction of the moving object (like my hand), so that i can transfer that to an object in processing..

Searched abit on google, but couldn't find anything good..
Any pointers?

-seltar
Re: Motion tracking, and Defining moving object
Reply #1 - Jun 3rd, 2005, 10:24pm
 
Exhibiting work based on this at the moment, using v3ga's library (will have the link up soon v3ga - we're still adding things and fine tuning - but folks were impressed):

http://robotacid.com/PBeta/blobV3ga.pde (original library - adapted to Beta)

This is also in the libraries section of the reference and the libraries thread. It has the width, height and center point properties. You can sift these properties out of the class by doing a search for draw(). Then you can rewrite how the blobs are drawn (to an array in my case). I was going to have a crack at writing my own version when I realised that there's no need to re-invent the wheel and v3ga's a nice enough guy.

Your problem is going to be that we humans distinguish objects by recognising patterns and using the focal distance of binocular vision to create an edge around an object. We can still be fooled by optical illusions (say a grey flat object on a background of similar colour - try it out, this is something that has been researched by illusion scientists, it doesn't work with round objects).

The blob detection works on the principle of applying an edge detection filter to an image along a certain threshold, so we get a line around a particular bandwidth of colour. Then you can draw a bounding box around that "blob".

If you want to track an object, your object is going to need to be distinct against it's background (handy if you're looking at someone in front of a projector - like Golan Levin's work).

I hope this is of use.
Re: Motion tracking, and Defining moving object
Reply #2 - Jun 7th, 2005, 1:54pm
 
interesting ...
but slow ...
Re: Motion tracking, and Defining moving object
Reply #3 - Jun 27th, 2005, 3:28pm
 
you can use jmyron its freeware. works well with processing, you can track for shapes, or just centerpoints. i can give you a script which looks for the size of the object.
Re: Motion tracking, and Defining moving object
Reply #4 - Jul 7th, 2005, 6:09am
 
I did some quick 'frames per seconds' experiments on
the code that st33d submitted (which uses the Processing
video library) vs. JMyron's code called "Myron_tracking",
which "appears" to do the same basic function (blob
detection/segmentation). I set the sizes to 320 x 240
and used P3D for both.

The difference is staggering: about 4-5 fps on JMyron
tracking and about 32-36 fps for the other code (almost
a factor of 10 difference).

Do others notice similar behavior?
Re: Motion tracking, and Defining moving object
Reply #5 - Jul 20th, 2005, 8:03pm
 
I went to a motion capture course in Prague recently and was shown EyesWeb doing edge-detection and object tracking. It was about a million times faster than what I was mucking about with and apparently has been adapted for motion capture as well. ChrisOShea tells me EyesWeb can communicate with Processing through midi.

The moral of the story is; if Aaron St33d's done it, there's a faster way of doing it. Sad
Re: Motion tracking, and Defining moving object
Reply #6 - Jul 21st, 2005, 10:18am
 

I personally haven't done any camera tracking in Processing yet. I found Jmyron a bit too slow really. v3ga's library is great, although I've not used it extensively.

The first problem is that good video tracking uses a lot of processing power. One option would be to run two computers, one that does camera tracking and the second Processing.

Secondly, recognising the shape of people is hard. I highly recommend you read 'Computer Vision for Artists and Designers: Pedagogic Tools and Techniques for Novice Programmers' by Golan Levin:
http://www.flong.com/writings/texts/essay_cvad.html

If you are on Windows, you can indeed use Eyesweb
http://www.eyesweb.org/

You could then use Open Sound Control (not midi) to pass the position, size and direction vector into Processing.
Re: Motion tracking, and Defining moving object
Reply #7 - Jul 26th, 2005, 11:29pm
 
I personally have done some motion tracking in processing. And for a few days, in eyesweb. I can honestly say that for this specific task, processing is dead to me Smiley
Of course, EW is something else. It's patch oriented, has no opengl, and no out of the box pixel-level access (you can write your own "elements" though). So processing is still my friend, but not for that specific task.

I also tried some simple communication between the two through OSC and it works like a charm, for a project I'm working using both. What I did in about a week in processing took me about .. half an hour in EW (granted, whithout previous experinence in none of them, so EW had the advantage of being patch oriented). Not to mention the speed EW sports.

So, to me, it's a winning combination. I want to be able to do what I want as fast & easy as possible. I'm all about the right tool for the right job.
Re: Motion tracking, and Defining moving object
Reply #8 - Jul 28th, 2005, 5:47pm
 
I've played with eyesweb myself, that's why i've been trying to get the same working in processing (which would be awesome).. but with no luck.. and yeah, processing isn't the way to go with motiontracking and such.. at most a simple colortracker, like nudemengarden (in exhibition somewhere, i think)

-seltar
Re: Motion tracking, and Defining moving object
Reply #9 - Feb 12th, 2006, 4:51pm
 
Looks like I'm about half a year late posting on this thread, but thought it might be of use to someone.. I've used both JMyron and BlobDetection extensively.

BlobDetection works completely differently to JMyron (metaballs technique). metaphorz, it is NOT faster than JMyron like-for like as it uses a considerably scaled down image to work with (having said this it does not require as high res as JMyron generally for reasonable results). JMyron is better for more precise contour analysis with higher resolutions (ie if you want to get curvature values on the contour at high res). I run a very high spec'd computer and side-by side tests showed JMyron to be faster (setting BlobDetection to use a full-frame image instead of down-scaling, and doing some contour analysis work on the results of both). Remember, JMyron uses external C++ libaries which are bound to run faster than the Java (also, I may be wrong here, but I imagine it runs in a seperate thread which may help you squeeze more juice from your multicore/HT processor). Having said this I found occasional inexplicable bugs in JMyron (count your globs with globBoxes, for instance, not globEdgePoints or you may get incorrect (null) results). Both have problems sometimes closing the contour correctly when shapes are more intricate.

JMyron also has built-in motion detection (inc adaptivity over time).

JMyron however is not multi-instanciable (at time of writing). I heard this is planned but doesnt exist yet (so only one per sketch (or JVM). BlobDetection is.

Well anyway, horses for courses. Both are very good and different. I could go on.... but i won't. Good luck with whatever you're doing.
Re: Motion tracking, and Defining moving object
Reply #10 - Mar 17th, 2006, 3:49pm
 
Hi !

I've been using Eyesweb to track moving objects (in my case balls). I'm not really happy with the results cause it seems the tracking is quite simple and sometimes mixes two objects which are going different ways. In my case, i'm trying to follow juggling balls and I can't afford mixing two balls.

Do you think v3ga would give better results ?

Cheers
Olivier !
Page Index Toggle Pages: 1