Author Message

<  beginners  ~  ofCvBlobTracker?

PostPosted: Tue May 20, 2008 8:33 pm
Joined: Tue May 20, 2008 1:33 pmPosts: 247
I know this is not finished/available for use yet but can someone give me a quick tutorial on how an ofCvBlobTracker SimpleApp would look like? I'm guessing that from the opencv addon simmple app I would somehow pass the contourFinder blob vector to the blobtracker's trackBlobs function, but first I should setListener on the blobtracker. Then how do I get the event data? Anyway I'm sure I could trial and error it but it would be cool if someone with knowledge would give me a hand.

P.S. This seems very "beginners" to me but if this is the wrong thread I am sorry.
Also if this is something I should not be messing with yet because of reason x I am sorry too.

Ding


Offline Profile
PostPosted: Wed May 21, 2008 3:13 pm
User avatarJoined: Wed Feb 13, 2008 9:11 pmPosts: 175
if you're on a mac, you could try using this app that I put together for when i need to do cv related blobtracking.

its just a mishmash of the old cvBlobTracker that I think stefanix put together updated to work with the actual ofxOpenCv addon.

http://www.stfj.net/cvBase.zip


Offline Profile
PostPosted: Wed May 21, 2008 3:58 pm
Joined: Tue May 20, 2008 1:33 pmPosts: 247
zach_gage,

Thanks for your help I really appreciate it but when I try to download it I get this error:

stfj.net/cvBase.zip doesn't exist.. maybe it never did. Why not check in here?

BTW I am on a mac. The blobtracker I was refering is the one on the updated ofxOpenCv addon that can be downloaded if you go here:

http://wiki.openframeworks.cc/index.php?title=OfLondon

and scroll down to Oli's project (very funny and cool BTW) he's got a link to download it. I sends out blob event data. Im still trying to figure it out.

Thanks,

Ding


Offline Profile
PostPosted: Wed May 21, 2008 4:15 pm
Joined: Tue May 20, 2008 1:33 pmPosts: 247
You Know maybe I should try using the search option more often:

http://www.openframeworks.cc/forum/view ... c&start=15

cant test it now but I assume it works.

BTW nice synth pond thingy!

Ding


Offline Profile
PostPosted: Thu May 22, 2008 12:38 am
User avatarJoined: Wed Feb 13, 2008 9:11 pmPosts: 175
thanks!

oh man, im an idiot sorry!!

heres the proper link if you still need it:

http://www.stfj.net/misc/cvBase.zip


Offline Profile
PostPosted: Thu May 22, 2008 2:14 pm
Joined: Tue May 20, 2008 1:33 pmPosts: 247
thanks,

A blend of both projects was what I was looking for. I am still curious if there is a proper way to get the blob information into the draw part of the app. Right now I'm going to try a "for loop"/iterator on the tracker.blobs vector. I know there are delegates like blobon, blobupdate and bloboff and I was wondering if these might be used instead and how to do it properly.

ding


Offline Profile
PostPosted: Thu May 22, 2008 4:42 pm
User avatarJoined: Tue Jul 10, 2007 6:44 pmPosts: 238Location: nyc
I think I posted the following example a while back. It shows how to hook up the listeners. It is not up to date for OF v0.5 but shows the idea. I am currently in the process of repackaging all that code and it might be more useful then.

http://file.stefanix.net/blobTrackingExample.zip

The crucial parts are:

blobTracker.setListener( this );
and
class testApp : public ofSimpleApp, public ofCvBlobListener { ... }



_________________
stefan hechenberger

http://linear.nortd.com/
Offline Profile
PostPosted: Thu May 22, 2008 5:02 pm
Joined: Tue May 20, 2008 1:33 pmPosts: 247
thanks stefanix,

I was just wondering how to use the blob data to draw with. For example:

when blob is on draw circle 50px
when blob is updated draw circle 10px
when blob is off delete circle

Should I iterate the tracker.blobs vector in the Draw method of my app or is there a better way.

ding


Offline Profile
PostPosted: Thu May 22, 2008 6:23 pm
User avatarJoined: Tue Jul 10, 2007 6:44 pmPosts: 238Location: nyc
This really depends. There is nothing wrong with doing this like you suggested.

I usually make that "circle" an object and then relay the status to it from the touch handlers. So circle would have on, off, moved handlers which I call from the main handlers when the circle is actually touched, moved, etc. Based on that circle should know how to draw itself for these events. This means in the main draw you would only need to call circle.draw()

Hope this helps,



_________________
stefan hechenberger

http://linear.nortd.com/
Offline Profile
PostPosted: Fri May 23, 2008 12:02 am
User avatarJoined: Wed Feb 13, 2008 9:11 pmPosts: 175
Another option is that if you're just drawing circles where the blobs are, simply iterating through the blobtracker.trackedblobs vector and drawing circles at all of its positions every frame..

as long as the background clears every frame this would work.


im not sure if i completely understand your question


Offline Profile
PostPosted: Fri May 23, 2008 1:27 am
Joined: Tue May 20, 2008 1:33 pmPosts: 247
I think stefanix is understanding me. So I would create a class and set up parameters with setters and getters and pass those setters and getters to the touch handlers

like this maybe:

Code:
class Target {

  public:
   
    Target();
    ~Target();

    bool on, off, moved;
    float X, Y;

    draw();
};

-----------------------------------
Target::Target {
    on = moved = false;
    off = true;
}

Target::draw {
   
    if (on || moved) {
        //color red
        ofSetColor(200, 0, 0);
        //draw target
        ofCircle(X, Y, 30);
        ofCircle(X, Y, 20);
        ofCircle(X, Y, 10);
}



and then over on the app part---------------->>

Code:
Target target

void testApp::blobOn( int x, int y, int id, int order ) {
    target.on = true;
    target.X = x;
    target.Y = y;


void testApp::blobMoved( int x, int y, int id, int order) {
     target.moved = true;
     target.X = x;
     target.Y = y;
}

void testApp::blobOff( int x, int y, int id, int order ) {
    target.off = true;
}


but wouldn't this just create one target drawing? I'm a bit confused.

Sorry for the long post

ding


Offline Profile
PostPosted: Fri May 30, 2008 7:52 pm
Joined: Tue May 27, 2008 5:37 amPosts: 85
Thanks Stefanix for the example code,

It seems that when i run the code, my fps drops tremendously from 30 (with no blob tracking) to 10fps (with blob tracking on)....even though i have set the fps to 60.

Is this framerate drop due to tracking being done? Anyway, i am doing this on a laptop with only an in-built Intel media accelerator.


Offline Profile
PostPosted: Tue Aug 11, 2009 4:40 am
Joined: Fri Aug 08, 2008 6:22 pmPosts: 18Location: NYC
are there any examples of blobTracker that work with current oF version? i've tried converting the ones linked in this and other posts but there are too many errors i don't understand.

also - i'm confused, with the current oF fat version which includes ofxOpenCv, is blobTracking still not included, so i need to add code from others, e.g. ofCvBlobTracker from stefanix?

i am doing overhead object detection of people walking around, so i'm starting with the basics and working my way up. afaik, at the current time in oF i will need to use some combination of blob tracking and optical flow, or perhaps the cvvidsurv which is not in ofxOpenCv yet, correct?


Offline Profile
PostPosted: Tue Aug 11, 2009 7:05 am
User avatarSite AdminJoined: Mon Feb 05, 2007 9:31 pmPosts: 1806Location: brooklyn
Quote:
also - i'm confused, with the current oF fat version which includes ofxOpenCv, is blobTracking still not included, so i need to add code from others, e.g. ofCvBlobTracker from stefanix?


yes, it's not a part of the ofxCv addon that comes with the FAT download.

I'll let stefan jump in about any errors, but maybe you can post up what problems you have ?

take care,
zach


Offline Profile
PostPosted: Tue Aug 11, 2009 8:33 am
Joined: Fri Aug 08, 2008 6:22 pmPosts: 18Location: NYC
first i tried updating stefanix code to actual included ofxCV, but then thought it would be faster to update code from zach_gage (http://www.stfj.net/misc/cvBase.zip).

get 847 errors, e.g.:

ofxOpenCV/dll/cv100.dll - no such file

libguide40.dll - no such file

Poco/FIFOEvent.h - no such file

ofAddons.h is deprecated ... !!!

lots and lots of ____ has not been declared

lots and lots of field '____" has incomplete type

etc....


Offline Profile

Display posts from previous:  Sort by:

All times are UTC
Page 1 of 2
20 posts
Go to page 1, 2  Next
Users browsing this forum: Google [Bot], yesyesnono and 1 guest
Search for:
Post new topic  Reply to topic
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron