Yeah, I took the openCV blobtrack code from the examples and modified it just slightly. I didn't document all the changes, because it was never meant to last for more than one project. I simply added the pd netsend stuff, added a few sliders to control parameters, added an automatic background model refresher, and blacked out some areas of the image that I didn't want processed.

Attached is the patch that I use to receive the blob data in Pd (also with some customizations).

-Mike

Nose Hair wrote:
Sorry forgot to ask. Do you have a pd abstraction for this? If not I will see what I can cook up. I think iemmatrix might do the trick.
Alain
On May 29, 2007, at 8:08 PM, Nose Hair wrote:

I see you have the ability to capture from an avi built in already:
avi_name = argv[i];
if (avi_name) pCap = cvCaptureFromFile(avi_name);
else pCap = cvCaptureFromCAM( 0 )
This is code looks great. I could figure it out from the code but if you have any use instructions let me know. It would be great to get a gui for this thing. I will try to figure that out.
Thank you,
Alain

On May 29, 2007, at 6:58 PM, Nose Hair wrote:

Thanks Mike,

Its awsome how helpful people in this community can be. I will check out you code and modify it if need be, like add the option to use an avi in order to be able to calibrate things and such and I will post it. I will also continue to figure out the external because I think that would be a neater approach and cause I dont accept defeat very easily.
Alain


On May 29, 2007, at 4:55 PM, Mike Wozniewski wrote:

Hi Alain,

I've used the OpenCV blobtracker with Pd before, and I simply send blob positions and sizes over UDP using u_pdsend.c

I've attached my code and makefile... look in blobtrack.c and search for where I use the pdsend_init() and pdsend_message() functions... it's pretty simple.

Then you just use [netreceive] in Pd and parse the list as you deem necessary.

Hope this helps,
-Mike


P.S. my blobtracker code is meant for use with a live camera, not with .avi files.
<blobTracker.tar.gz>


_______________________________________________
PD-list@iem.at <mailto:PD-list@iem.at> mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list



#N struct trackerBlob float x float y float left float right float
top float bottom symbol s;
#N canvas 106 312 848 581 10;
#X obj 106 -74 netreceive 8779;
#X floatatom 206 -48 5 0 0 0 - - -;
#N canvas 766 236 481 416 blob-data 0;
#X scalar trackerBlob 127 312 -14 14 -13.5 13.5 blob1 \;;
#X scalar trackerBlob 487 114 -13 13 -14.5 14.5 blob2 \;;
#X scalar trackerBlob 471 63 -12.5 12.5 -14.5 14.5 blob3 \;;
#X scalar trackerBlob 508 335 -16 16 -13 13 blob4 \;;
#X scalar trackerBlob 184 285 -14.5 14.5 -19 19 blob5 \;;
#X scalar trackerBlob 174 278 -17 17 -19.5 19.5 blob6 \;;
#X coords 0 0 640 480 320 240 1;
#X restore 436 -8 pd blob-data;
#N canvas 84 22 1043 689 draw-blobs 0;
#X obj 379 615 pointer;
#X msg 379 593 traverse pd-blob-data \, next;
#X obj 409 505 pointer;
#X msg 409 483 traverse pd-blob-data \, next \, next;
#X obj 409 462 loadbang;
#X obj 379 572 loadbang;
#X obj 441 401 pointer;
#X obj 441 358 loadbang;
#X msg 441 379 traverse pd-blob-data \, next \, next \, next;
#X obj 485 297 pointer;
#X obj 485 254 loadbang;
#X msg 485 275 traverse pd-blob-data \, next \, next \, next \, next
;
#X obj 97 640 set trackerBlob x y left right top bottom;
#X obj 48 64 inlet;
#X obj 238 615 * 0.5;
#X obj 285 615 * -0.5;
#X obj 191 615 * -0.5;
#X obj 97 578 unpack 0 0 0 0;
#X obj 332 615 * 0.5;
#X obj 127 530 set trackerBlob x y left right top bottom;
#X obj 268 505 * 0.5;
#X obj 315 505 * -0.5;
#X obj 221 505 * -0.5;
#X obj 127 468 unpack 0 0 0 0;
#X obj 362 505 * 0.5;
#X obj 159 426 set trackerBlob x y left right top bottom;
#X obj 300 401 * 0.5;
#X obj 347 401 * -0.5;
#X obj 253 401 * -0.5;
#X obj 159 364 unpack 0 0 0 0;
#X obj 394 401 * 0.5;
#X obj 203 322 set trackerBlob x y left right top bottom;
#X obj 344 297 * 0.5;
#X obj 391 297 * -0.5;
#X obj 297 297 * -0.5;
#X obj 203 260 unpack 0 0 0 0;
#X obj 438 297 * 0.5;
#X obj 48 92 route 1 2 3 4 5 6;
#X obj 511 192 pointer;
#X obj 511 149 loadbang;
#X obj 229 217 set trackerBlob x y left right top bottom;
#X obj 370 192 * 0.5;
#X obj 417 192 * -0.5;
#X obj 323 192 * -0.5;
#X obj 229 155 unpack 0 0 0 0;
#X obj 464 192 * 0.5;
#X msg 511 170 traverse pd-blob-data \, next \, next \, next \, next
\, next;
#X obj 531 82 pointer;
#X obj 531 39 loadbang;
#X obj 249 107 set trackerBlob x y left right top bottom;
#X obj 390 82 * 0.5;
#X obj 437 82 * -0.5;
#X obj 343 82 * -0.5;
#X obj 249 45 unpack 0 0 0 0;
#X obj 484 82 * 0.5;
#X msg 531 60 traverse pd-blob-data \, next \, next \, next \, next
\, next \, next;
#X connect 0 0 12 6;
#X connect 1 0 0 0;
#X connect 2 0 19 6;
#X connect 3 0 2 0;
#X connect 4 0 3 0;
#X connect 5 0 1 0;
#X connect 6 0 25 6;
#X connect 7 0 8 0;
#X connect 8 0 6 0;
#X connect 9 0 31 6;
#X connect 10 0 11 0;
#X connect 11 0 9 0;
#X connect 13 0 37 0;
#X connect 14 0 12 3;
#X connect 15 0 12 4;
#X connect 16 0 12 2;
#X connect 17 0 12 0;
#X connect 17 1 12 1;
#X connect 17 2 14 0;
#X connect 17 2 16 0;
#X connect 17 3 15 0;
#X connect 17 3 18 0;
#X connect 18 0 12 5;
#X connect 20 0 19 3;
#X connect 21 0 19 4;
#X connect 22 0 19 2;
#X connect 23 0 19 0;
#X connect 23 1 19 1;
#X connect 23 2 20 0;
#X connect 23 2 22 0;
#X connect 23 3 21 0;
#X connect 23 3 24 0;
#X connect 24 0 19 5;
#X connect 26 0 25 3;
#X connect 27 0 25 4;
#X connect 28 0 25 2;
#X connect 29 0 25 0;
#X connect 29 1 25 1;
#X connect 29 2 26 0;
#X connect 29 2 28 0;
#X connect 29 3 27 0;
#X connect 29 3 30 0;
#X connect 30 0 25 5;
#X connect 32 0 31 3;
#X connect 33 0 31 4;
#X connect 34 0 31 2;
#X connect 35 0 31 0;
#X connect 35 1 31 1;
#X connect 35 2 32 0;
#X connect 35 2 34 0;
#X connect 35 3 33 0;
#X connect 35 3 36 0;
#X connect 36 0 31 5;
#X connect 37 0 17 0;
#X connect 37 1 23 0;
#X connect 37 2 29 0;
#X connect 37 3 35 0;
#X connect 37 4 44 0;
#X connect 37 5 53 0;
#X connect 38 0 40 6;
#X connect 39 0 46 0;
#X connect 41 0 40 3;
#X connect 42 0 40 4;
#X connect 43 0 40 2;
#X connect 44 0 40 0;
#X connect 44 1 40 1;
#X connect 44 2 41 0;
#X connect 44 2 43 0;
#X connect 44 3 42 0;
#X connect 44 3 45 0;
#X connect 45 0 40 5;
#X connect 46 0 38 0;
#X connect 47 0 49 6;
#X connect 48 0 55 0;
#X connect 50 0 49 3;
#X connect 51 0 49 4;
#X connect 52 0 49 2;
#X connect 53 0 49 0;
#X connect 53 1 49 1;
#X connect 53 2 50 0;
#X connect 53 2 52 0;
#X connect 53 3 51 0;
#X connect 53 3 54 0;
#X connect 54 0 49 5;
#X connect 55 0 47 0;
#X restore 380 355 pd draw-blobs;
#N canvas 240 96 580 193 trackerBlob 0;
#X obj 37 35 struct trackerBlob float x float y float left float right
float top float bottom symbol s;
#X obj 39 71 filledcurve 9 left 0 0 bottom right 0 0 top left 0;
#X obj 45 112 drawsymbol s -25 -40 0 1 blob;
#X restore 656 232 pd trackerBlob;
#X obj 436 302 tgl 25 0 empty empty DEBUG -10 -15 1 12 -262144 -1 -1
0 1;
#X obj 379 314 spigot;
#X text 434 -24 0;
#X text 732 -24 640;
#X obj 491 273 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10
-262144 -1 -1 0 256;
#X obj 551 273 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10
-262144 -1 -1 0 256;
#X obj 482 324 hotpack7 6 0 0 0 0;
#X msg 619 279 40;
#X text 760 -9 0;
#X text 760 219 480;
#X obj 105 296 route 1 2 3 4 5 6;
#X obj 181 434 s 1-blob-data;
#X obj 191 414 s 2-blob-data;
#X obj 201 394 s 3-blob-data;
#X obj 231 334 s 6-blob-data;
#X obj 221 354 s 5-blob-data;
#X obj 211 374 s 4-blob-data;
#X obj 106 274 spigot;
#X obj 163 259 tgl 25 0 empty empty TRACKING_ENABLE -10 -15 1 12 -262144
-1 -1 1 1;
#X obj 159 36 split 0 480;
#X obj 107 -8 unpack 0 0 0 0 0;
#X obj 105 189 pack 0 0 0 0 0;
#X msg 230 113 -1;
#X obj 143 136 != -1;
#X obj 106 161 spigot;
#X floatatom 268 87 5 0 0 1 low - -;
#X floatatom 257 6 5 0 0 0 - - -;
#X text 327 74 clip on Y;
#X text 258 17 clip on X;
#X floatatom 307 256 5 0 0 0 - - -;
#X floatatom 356 256 5 0 0 0 - - -;
#X floatatom 266 70 5 0 0 1 hi - -;
#X floatatom 401 255 5 0 0 0 - - -;
#X obj 333 188 unpack 0 0 0;
#X obj 135 80 split 90 610;
#X obj 164 219 r blob-tracker;
#X connect 0 0 25 0;
#X connect 0 1 1 0;
#X connect 5 0 6 1;
#X connect 6 0 3 0;
#X connect 9 0 11 1;
#X connect 10 0 11 2;
#X connect 11 0 3 0;
#X connect 12 0 11 4;
#X connect 12 0 11 3;
#X connect 15 0 16 0;
#X connect 15 0 38 0;
#X connect 15 1 17 0;
#X connect 15 2 18 0;
#X connect 15 3 21 0;
#X connect 15 4 20 0;
#X connect 15 5 19 0;
#X connect 22 0 15 0;
#X connect 23 0 22 1;
#X connect 24 0 28 0;
#X connect 24 0 26 2;
#X connect 24 1 27 0;
#X connect 25 0 29 0;
#X connect 25 1 39 0;
#X connect 25 2 24 0;
#X connect 25 3 26 3;
#X connect 25 4 26 4;
#X connect 26 0 22 0;
#X connect 26 0 6 0;
#X connect 27 0 28 0;
#X connect 28 0 29 1;
#X connect 29 0 26 0;
#X connect 30 0 39 1;
#X connect 31 0 24 1;
#X connect 36 0 39 2;
#X connect 38 0 34 0;
#X connect 38 1 35 0;
#X connect 38 2 37 0;
#X connect 39 0 28 0;
#X connect 39 0 26 1;
#X connect 39 1 27 0;
#X connect 40 0 23 0;
_______________________________________________
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to