Re: [PD] opencv motion tracker external HELP!

2007-05-30 Thread nosehair911
Martin,
Thanks for all your help.  I have a final question about the sprintf solution.  
I have managed to get the 
out going(I think) but I am not quite undestanding the atol()inlet part.  I 
have this.

 void window_getframe(t_window *x, t_symbol *sym)
{
char* decode;
char symstr;
x-sym-s_name = decode;
symstr = atol(decode);
frame = symstr;
}
But I get invalid conversion from 'char' to IplImage*'. I have to read some 
more. If I used sprintf to write  
to an array a string/image formatted as a pointer and then turned that pointer 
to a symbol, how do i 
now convert the symbol back to a pointer of the original image, which I assume 
should still be in 
buffer?
Alain

 You can only work with atoms in pd's message system, and each atom usually 
 contains a bang, a 
float or a symbol. You could convert the pointer to a float but it probably 
won't work because the 
pointer is a large integer that won't be accurately represented as a float. You 
could convert the pointer 
to a symbol using something like: 
 char symstr[10];
 t_symbol sym;
 sprintf(symstr, %p, frame);
 sym = gensym(symstr);
 ...then send sym through the outlet and convert it back to a pointer at the 
 receiving end by extracting 
the string from the s_name field of the symbol and passing it to atol().
 
 Martin
 


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


Re: [PD] opencv motion tracker external HELP!

2007-05-30 Thread martin.peach
Alain wrote:
  void window_getframe(t_window *x, t_symbol *sym)
 {
   char* decode;
   char symstr;
   x-sym-s_name = decode;
   symstr = atol(decode);
   frame = symstr;
 }
Is this the receiving function? I would write it more like:

void window_getframe(t_window *x, t_symbol *sym)
{
IplImage * frame;

frame = (IplImage *)atol(sym-s_name);
}

Martin 


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


Re: [PD] opencv motion tracker external HELP!

2007-05-30 Thread Mike Wozniewski
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 

Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread nosehair911
Thanks for helping.  Well I basically have a rough sketch of all the objects 
but I am having a tough 
time with the outlet system.  In a nutshell opencv uses an image structure 
called typedef struct 
_IplImage.  Acording to them The structure IplImage came from Intel Image 
Processing Library 
where the format is native.  I can give you more information about it if you 
need it.  My problem is 
sending the result from IplImage to an outlet and being able to receive it from 
an inlet.  So far that is 
my bigest hurdle.  I have this code:

IplImage *frame = 0;

x-x_outlet = outlet_new(x-x_obj, s_anything);
outlet_anything(x-x_outlet, frame);

Obviously with more stuff in the middle but I keep getting this error from the 
compiler:

error: cannot convert IplImage* to t_symbol for argument 2 to void 
outlet_anything(_outlet*, 
t_symbol*, int, t_atom*)

I still havent figured a way around this.  I am sure its easy but... Anyway Im 
trying to figure out the 
outlet first before I tackle the inlet.  Any advise?
Alain
 
 From: Tim Boykett [EMAIL PROTECTED]
 Date: 2007/05/29 Tue AM 05:18:54 EDT
 To: [EMAIL PROTECTED] [EMAIL PROTECTED]
 Subject: Re:  opencv motion tracker external HELP!
 
 
 Hi Alain,
 
 how is this coming along? I gather that you got the tracker working
 as a standalone, but no luck with the external yet. Is that right?
 
 I would be interested in perhaps helping, but I thought I would check to
 see what was already working.
 
 cheers,
 
 tim
 
 
 On 27/05/2007, at 10:35 PM, [EMAIL PROTECTED]  
 [EMAIL PROTECTED] wrote:
 
  For the last 2 weeks I have been trying to write a motion tracking  
  external using the blob motion
  tracker in opencv.  I had success with writing a program that  
  recieves a path to an avi and motion
  tracks the blobs and prints their position.  Now I am writing the  
  set of Pd externals using the same
  code with very little success. I need someone that knows what they  
  are doing to look at my Pd code
  and show me what I am doing wrong.  I have read and followed  
  IOhannes guide on external writing.
  Also, I have looked at the zexy and pdp sorce code in order to  
  learn but still I am not getting it to work.
  The externals are based on the already working code I was able to  
  frankenstein together.  I am
  calling it FTIR_Tools.  It consist of the following (if I ever get  
  them to work!):
 
  1. FTIR_Cam: detects webcam and sends out frames to outlet.
  2. FTIR_VPlayer: reads quicktimes from path and sends out frames to  
  outlet.
  3. FTIR_Tracker: tracks blobs, sends out matrix blob# position to  
  outlet2 and frames to outlet 1.
  you can also turn on and off visuals for center point and bounding  
  box.
  4. FTIR_Window: displays frames in an X11 window.
 
  Please look at my code and show me how to fix it. I am getting  
  nowhere.  In the cvBloblib.zip is the
  program I put together called Tracker and the code called  
  Tracker.cpp.  If you want to see how it
  works drag it to terminal and follow it with a path to an .avi. You  
  must have opencv and fink installed.
  If you have ploblems installing opencv post and I will be glad to  
  help.
  Thanks,
  Alain
  FTIR_Tools(src).zip
  cvBloblib.zip
  ___
  PD-list@iem.at mailing list
  UNSUBSCRIBE and account-management - http://lists.puredata.info/ 
  listinfo/pd-list
 
 


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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread IOhannes m zmoelnig
[EMAIL PROTECTED] wrote:
 Thanks for helping.  Well I basically have a rough sketch of all the objects 
 but I am having a tough 
 time with the outlet system.  In a nutshell opencv uses an image structure 
 called typedef struct 
 _IplImage.  Acording to them The structure IplImage came from Intel Image 
 Processing Library 
 where the format is native.  I can give you more information about it if you 
 need it.  My problem is 
 sending the result from IplImage to an outlet and being able to receive it 
 from an inlet.  So far that is 
 my bigest hurdle.  I have this code:
 
 IplImage *frame = 0;
 
 x-x_outlet = outlet_new(x-x_obj, s_anything);
 outlet_anything(x-x_outlet, frame);
 
 Obviously with more stuff in the middle but I keep getting this error from 
 the compiler:


whoa don't do that.

if you are sure that you have to send pointers around, then you should
a) have a look at Gem (where this is done) or GridFlow and
b) don't do it (Gem is using this for legacy reasons); really. even
though pd has pointers, they are not meant for passing arbitrary data
around.

if you want to do it the clean way, you will have to create ids (numeric
or symbolic), associate your data-chunks with ids, pass the ids through
pd's messaging system and look them up at the receiving side.
pdp does it like this.

an alternative might be mrpeach's string/blob patch, but then you
would rely on a patched pd, which is not a very good idea.

if you are not sure, then i suggest to not do it that way (unless you
want to spend some time in getting into coding)


otoh, why don't you just use the Gem framework?
i guess that you could fit the IplImage into an imageStruct with not
much overhead (but then i don't know this structure; if it is
fundamentally different from Gem's imageStruct you might lose everything
you gained speedwise)



if nothing else works, it might be simplest to just write your own
application (without pd) and send the data to pd via your favourite
protocol (FUDI, OSC, SMTP...)

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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread nosehair911
I dont think I quite understood.  I tried:

#define FRAMEOUT frame

IplImage *frame = 0;

x-x_outlet = outlet_new(x-x_obj, s_anything);
outlet_anything(x-x_outlet, FRAMEOUT);

with the same results.  Maybe someone can dumb it down for me?
Alain
 
 From: IOhannes m zmoelnig [EMAIL PROTECTED]
 Date: 2007/05/29 Tue AM 10:40:29 EDT
 To: [EMAIL PROTECTED]
 CC: Tim Boykett [EMAIL PROTECTED],   pd-list@iem.at
 Subject: Re: [PD] opencv motion tracker external HELP!
 
 [EMAIL PROTECTED] wrote:
  Thanks for helping.  Well I basically have a rough sketch of all the 
  objects but I am having a tough 
  time with the outlet system.  In a nutshell opencv uses an image structure 
  called typedef struct 
  _IplImage.  Acording to them The structure IplImage came from Intel Image 
  Processing Library 
  where the format is native.  I can give you more information about it if 
  you need it.  My problem is 
  sending the result from IplImage to an outlet and being able to receive it 
  from an inlet.  So far that 
is 
  my bigest hurdle.  I have this code:
  
  IplImage *frame = 0;
  
  x-x_outlet = outlet_new(x-x_obj, s_anything);
  outlet_anything(x-x_outlet, frame);
  
  Obviously with more stuff in the middle but I keep getting this error from 
  the compiler:
 
 
 whoa don't do that.
 
 if you are sure that you have to send pointers around, then you should
 a) have a look at Gem (where this is done) or GridFlow and
 b) don't do it (Gem is using this for legacy reasons); really. even
 though pd has pointers, they are not meant for passing arbitrary data
 around.
 
 if you want to do it the clean way, you will have to create ids (numeric
 or symbolic), associate your data-chunks with ids, pass the ids through
 pd's messaging system and look them up at the receiving side.
 pdp does it like this.
 
 an alternative might be mrpeach's string/blob patch, but then you
 would rely on a patched pd, which is not a very good idea.
 
 if you are not sure, then i suggest to not do it that way (unless you
 want to spend some time in getting into coding)
 
 
 otoh, why don't you just use the Gem framework?
 i guess that you could fit the IplImage into an imageStruct with not
 much overhead (but then i don't know this structure; if it is
 fundamentally different from Gem's imageStruct you might lose everything
 you gained speedwise)
 
 
 
 if nothing else works, it might be simplest to just write your own
 application (without pd) and send the data to pd via your favourite
 protocol (FUDI, OSC, SMTP...)
 


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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread IOhannes m zmoelnig
[EMAIL PROTECTED] wrote:
 I dont think I quite understood.  I tried:
 
 #define FRAMEOUT frame
 
 IplImage *frame = 0;
 
 x-x_outlet = outlet_new(x-x_obj, s_anything);
 outlet_anything(x-x_outlet, FRAMEOUT);
 
 with the same results.  Maybe someone can dumb it down for me?


just out or couriosity: how does this relate to my previous email? :-)

sorry to not be much of a help here, but i currently have not the time
to give you the deep insights into C/C++ and pd that you would be needed.


mfga.sdr.
IOhannes

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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread Tim Boykett

Hi Alain,

wouldn't it be a lot easier to take the system that you already have and
use OSC or FIDO to send the values (that you were printing) to PD
for further processing?

I am greatly in favour of using different systems for different jobs  
and letting
a protocol like OSC or fido (netsend) connect them together.

I could easily help you with that problem, if the code is running  
already.

Cheers,

tim




On 27/05/2007, at 10:35 PM, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote:

 For the last 2 weeks I have been trying to write a motion tracking  
 external using the blob motion
 tracker in opencv.  I had success with writing a program that  
 recieves a path to an avi and motion
 tracks the blobs and prints their position.  Now I am writing the  
 set of Pd externals using the same
 code with very little success. I need someone that knows what they  
 are doing to look at my Pd code
 and show me what I am doing wrong.  I have read and followed  
 IOhannes guide on external writing.
 Also, I have looked at the zexy and pdp sorce code in order to  
 learn but still I am not getting it to work.
 The externals are based on the already working code I was able to  
 frankenstein together.  I am
 calling it FTIR_Tools.  It consist of the following (if I ever get  
 them to work!):

 1. FTIR_Cam: detects webcam and sends out frames to outlet.
 2. FTIR_VPlayer: reads quicktimes from path and sends out frames to  
 outlet.
 3. FTIR_Tracker: tracks blobs, sends out matrix blob# position to  
 outlet2 and frames to outlet 1.
 you can also turn on and off visuals for center point and bounding  
 box.
 4. FTIR_Window: displays frames in an X11 window.

 Please look at my code and show me how to fix it. I am getting  
 nowhere.  In the cvBloblib.zip is the
 program I put together called Tracker and the code called  
 Tracker.cpp.  If you want to see how it
 works drag it to terminal and follow it with a path to an .avi. You  
 must have opencv and fink installed.
 If you have ploblems installing opencv post and I will be glad to  
 help.
 Thanks,
 Alain
 FTIR_Tools(src).zip
 cvBloblib.zip
 ___
 PD-list@iem.at mailing list
 UNSUBSCRIBE and account-management - http://lists.puredata.info/ 
 listinfo/pd-list


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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread nosehair911
Martin,
Thanks for your insight. I will look into that.  It seems like sprintf/atoi is 
what I need to be looking at.
Alain
 
 From: [EMAIL PROTECTED]
 Date: 2007/05/29 Tue AM 11:51:36 EDT
 To: pd-list@iem.at
 CC: Tim Boykett [EMAIL PROTECTED], IOhannes m zmoelnig [EMAIL PROTECTED], 
[EMAIL PROTECTED]
 Subject: Re: Re: [PD] opencv motion tracker external HELP!
 
  I dont think I quite understood.  I tried:
  
  #define FRAMEOUT frame
  
  IplImage *frame = 0;
  
  x-x_outlet = outlet_new(x-x_obj, s_anything);
  outlet_anything(x-x_outlet, FRAMEOUT);
  
  with the same results.  Maybe someone can dumb it down for me?
 
 You can only work with atoms in pd's message system, and each atom usually 
 contains a bang, a 
float or a symbol. You could convert the pointer to a float but it probably 
won't work because the 
pointer is a large integer that won't be accurately represented as a float. You 
could convert the pointer 
to a symbol using something like: 
 char symstr[10];
 t_symbol sym;
 sprintf(symstr, %p, frame);
 sym = gensym(symstr);
 ...then send sym through the outlet and convert it back to a pointer at the 
 receiving end by extracting 
the string from the s_name field of the symbol and passing it to atol().
 
 Martin
 


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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread chris clepper
The Intel library struct is a different data type than the Pd symbol
data type.  Pd doesn't have any idea what your frame pointer is
pointing to so it throw that error.  You really need to have a working
knowledge of C data types to do what you want to do.

On 5/29/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I dont think I quite understood.  I tried:

 #define FRAMEOUT frame

 IplImage *frame = 0;

 x-x_outlet = outlet_new(x-x_obj, s_anything);
 outlet_anything(x-x_outlet, FRAMEOUT);

 with the same results.  Maybe someone can dumb it down for me?
 Alain
 
  From: IOhannes m zmoelnig [EMAIL PROTECTED]
  Date: 2007/05/29 Tue AM 10:40:29 EDT
  To: [EMAIL PROTECTED]
  CC: Tim Boykett [EMAIL PROTECTED],   pd-list@iem.at
  Subject: Re: [PD] opencv motion tracker external HELP!
 
  [EMAIL PROTECTED] wrote:
   Thanks for helping.  Well I basically have a rough sketch of all the 
   objects but I am having a tough
   time with the outlet system.  In a nutshell opencv uses an image 
   structure called typedef struct
   _IplImage.  Acording to them The structure IplImage came from Intel 
   Image Processing Library
   where the format is native.  I can give you more information about it if 
   you need it.  My problem is
   sending the result from IplImage to an outlet and being able to receive 
   it from an inlet.  So far that
 is
   my bigest hurdle.  I have this code:
  
   IplImage *frame = 0;
  
   x-x_outlet = outlet_new(x-x_obj, s_anything);
   outlet_anything(x-x_outlet, frame);
  
   Obviously with more stuff in the middle but I keep getting this error 
   from the compiler:
 
 
  whoa don't do that.
 
  if you are sure that you have to send pointers around, then you should
  a) have a look at Gem (where this is done) or GridFlow and
  b) don't do it (Gem is using this for legacy reasons); really. even
  though pd has pointers, they are not meant for passing arbitrary data
  around.
 
  if you want to do it the clean way, you will have to create ids (numeric
  or symbolic), associate your data-chunks with ids, pass the ids through
  pd's messaging system and look them up at the receiving side.
  pdp does it like this.
 
  an alternative might be mrpeach's string/blob patch, but then you
  would rely on a patched pd, which is not a very good idea.
 
  if you are not sure, then i suggest to not do it that way (unless you
  want to spend some time in getting into coding)
 
 
  otoh, why don't you just use the Gem framework?
  i guess that you could fit the IplImage into an imageStruct with not
  much overhead (but then i don't know this structure; if it is
  fundamentally different from Gem's imageStruct you might lose everything
  you gained speedwise)
 
 
 
  if nothing else works, it might be simplest to just write your own
  application (without pd) and send the data to pd via your favourite
  protocol (FUDI, OSC, SMTP...)
 


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


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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread nosehair911
You are right it would be.  It would also be easier to make a self contained 
external with just one 
object and just use pd message system to output a list.  I appreciate your 
help. I guess I will try to 
finish what I started using Martins suggestions and work on a standalone app at 
the same time.  Is 
there a good reference webpage on how to integrate OSC that you can point me 
to? would the cpu 
take a buigger performance hit this way?
Alain
 
 From: Tim Boykett [EMAIL PROTECTED]
 Date: 2007/05/29 Tue AM 11:45:08 EDT
 To: [EMAIL PROTECTED] [EMAIL PROTECTED]
 CC: pd-list@iem.at, 
  [EMAIL PROTECTED]
 Subject: Re: [PD] opencv motion tracker external HELP!
 
 
 Hi Alain,
 
 wouldn't it be a lot easier to take the system that you already have and
 use OSC or FIDO to send the values (that you were printing) to PD
 for further processing?
 
 I am greatly in favour of using different systems for different jobs  
 and letting
 a protocol like OSC or fido (netsend) connect them together.
 
 I could easily help you with that problem, if the code is running  
 already.
 
 Cheers,
 
 tim



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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread martin.peach
 I dont think I quite understood.  I tried:
 
 #define FRAMEOUT frame
 
 IplImage *frame = 0;
 
 x-x_outlet = outlet_new(x-x_obj, s_anything);
 outlet_anything(x-x_outlet, FRAMEOUT);
 
 with the same results.  Maybe someone can dumb it down for me?

You can only work with atoms in pd's message system, and each atom usually 
contains a bang, a float or a symbol. You could convert the pointer to a float 
but it probably won't work because the pointer is a large integer that won't be 
accurately represented as a float. You could convert the pointer to a symbol 
using something like: 
char symstr[10];
t_symbol sym;
sprintf(symstr, %p, frame);
sym = gensym(symstr);
...then send sym through the outlet and convert it back to a pointer at the 
receiving end by extracting the string from the s_name field of the symbol and 
passing it to atol().

Martin


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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread nosehair911
I just realized I should be posting in the pd-dev list so from now on any 
questions I have relating to 
this project will be posted there.

Martin,
I am getting a weird error when I try sym = gensym(symstr);  I get
no match for 'operator=' in 'sym = gensym(((char*)( symstr)))'
I dont know what thats all about.  I have seen this used before with no 
problems.
Alain
 
 From: [EMAIL PROTECTED]
 Date: 2007/05/29 Tue AM 11:51:36 EDT
 To: pd-list@iem.at
 CC: Tim Boykett [EMAIL PROTECTED], IOhannes m zmoelnig [EMAIL PROTECTED], 
[EMAIL PROTECTED]
 Subject: Re: Re: [PD] opencv motion tracker external HELP!
 
  I dont think I quite understood.  I tried:
  
  #define FRAMEOUT frame
  
  IplImage *frame = 0;
  
  x-x_outlet = outlet_new(x-x_obj, s_anything);
  outlet_anything(x-x_outlet, FRAMEOUT);
  
  with the same results.  Maybe someone can dumb it down for me?
 
 You can only work with atoms in pd's message system, and each atom usually 
 contains a bang, a 
float or a symbol. You could convert the pointer to a float but it probably 
won't work because the 
pointer is a large integer that won't be accurately represented as a float. You 
could convert the pointer 
to a symbol using something like: 
 char symstr[10];
 t_symbol sym;
 sprintf(symstr, %p, frame);
 sym = gensym(symstr);
 ...then send sym through the outlet and convert it back to a pointer at the 
 receiving end by extracting 
the string from the s_name field of the symbol and passing it to atol().
 
 Martin
 


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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread Mike Wozniewski

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
Description: GNU Zip compressed data
___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread martin.peach
Alain wrote:
 I am getting a weird error when I try sym = gensym(symstr);  I get
 no match for 'operator=' in 'sym = gensym(((char*)( symstr)))'
 I dont know what thats all about.  I have seen this used before with no 
 problems.

That looks like a c++ error to me, maybe you should be compiling it as c?

Martin


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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread Nose Hair
I think I figured it out.  It looks like I have to use t_symbol *sym  
instead of t_symbol sym and the outlet has to be x-outlet_new(x- 
 x_outlet0, *sym).  That seemed to work.  The weird problem I am  
having now it I get an error with the return(void *)x; I get error:
return-statement with a value, in function returning 'void'.
Now I see return(void *)x; on almost all the external codes so I  
don't get it.  I am also getting an error on the void your_class_setup 
(void) { part too.
Error: a function-definition is not allowed here before '{' token.
I am confused.  About compiling as C, the problem is that I am using c 
++ headers from the opencv library and I don't know if I can compile  
as C?
Thanks alot for your help.
Alain
On May 29, 2007, at 5:25 PM, [EMAIL PROTECTED] wrote:

 Alain wrote:
 I am getting a weird error when I try sym = gensym(symstr);  I get
 no match for 'operator=' in 'sym = gensym(((char*)( symstr)))'
 I dont know what thats all about.  I have seen this used before  
 with no problems.

 That looks like a c++ error to me, maybe you should be compiling it  
 as c?

 Martin


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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread Nose Hair
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 mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread Nose Hair

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 mailing list
UNSUBSCRIBE and account-management - http://lists.puredata.info/ 
listinfo/pd-list


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


Re: [PD] opencv motion tracker external HELP!

2007-05-29 Thread Nose Hair
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 mailing list
UNSUBSCRIBE and account-management - http://lists.puredata.info/ 
listinfo/pd-list




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


Re: [PD] opencv motion tracker external HELP!

2007-05-27 Thread Kyle Klipowicz
I haven't looked at this yet, and have no external coding experience.

However, I'm wondering if it would be an easier task to port this
library to mimic the pix_* objects in Gem? Maybe you could look at the
Gem source and figure out how to do this. Or better yet, compare the
code you have here with the pix_multiblob, and try to correct the
algorithms as was suggested earlier.

Good luck!!!

~Kyle

On 5/27/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 For the last 2 weeks I have been trying to write a motion tracking external 
 using the blob motion
 tracker in opencv.  I had success with writing a program that recieves a path 
 to an avi and motion
 tracks the blobs and prints their position.  Now I am writing the set of Pd 
 externals using the same
 code with very little success. I need someone that knows what they are doing 
 to look at my Pd code
 and show me what I am doing wrong.  I have read and followed IOhannes guide 
 on external writing.
 Also, I have looked at the zexy and pdp sorce code in order to learn but 
 still I am not getting it to work.
 The externals are based on the already working code I was able to 
 frankenstein together.  I am
 calling it FTIR_Tools.  It consist of the following (if I ever get them to 
 work!):

 1. FTIR_Cam: detects webcam and sends out frames to outlet.
 2. FTIR_VPlayer: reads quicktimes from path and sends out frames to outlet.
 3. FTIR_Tracker: tracks blobs, sends out matrix blob# position to outlet2 
 and frames to outlet 1.
 you can also turn on and off visuals for center point and bounding box.
 4. FTIR_Window: displays frames in an X11 window.

 Please look at my code and show me how to fix it. I am getting nowhere.  In 
 the cvBloblib.zip is the
 program I put together called Tracker and the code called Tracker.cpp.  If 
 you want to see how it
 works drag it to terminal and follow it with a path to an .avi. You must have 
 opencv and fink installed.
 If you have ploblems installing opencv post and I will be glad to help.
 Thanks,
 Alain

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





-- 
-

 -
  - --
http://perhapsidid.wordpress.com

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


Re: [PD] opencv motion tracker external HELP!

2007-05-27 Thread nosehair911
The Gem stuff is complex and done by people who actually know what they are 
doing.  All I am trying 
to do is port parts of an already made (and very,very simple to code) library 
to Pd.  I also have no 
coding experience except for this project. I have never even seen C code before 
2 weeks ago, but the 
C code for opencv is easy enough for a noob like me to write an application 
that calls on those 
libraries.  If you are interested check out my Tracker.cpp code.  The difficult 
part (for me) is turning that 
code into something Pd can use.  Also since it would require that you compile 
and install opencv I 
think it would be a pain for the enduser to be included inside Gem. I think 
most people that use Gem 
are not interested in a blob tracker.  That is why I needed to write my own.  
My goal is to use the 
tracker output to control Geos in Gem using iemmatrix and other goodies.
BTW the algorithms for pix_multiblob are way, way over my head(seriously)!
Alain
 
 From: Kyle Klipowicz [EMAIL PROTECTED]
 Date: 2007/05/27 Sun PM 10:17:02 EDT
 To: [EMAIL PROTECTED] [EMAIL PROTECTED]
 CC: pd-list@iem.at,  [EMAIL PROTECTED]
 Subject: Re: [PD] opencv motion tracker external HELP!
 
 I haven't looked at this yet, and have no external coding experience.
 
 However, I'm wondering if it would be an easier task to port this
 library to mimic the pix_* objects in Gem? Maybe you could look at the
 Gem source and figure out how to do this. Or better yet, compare the
 code you have here with the pix_multiblob, and try to correct the
 algorithms as was suggested earlier.
 
 Good luck!!!
 
 ~Kyle
 
 On 5/27/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  For the last 2 weeks I have been trying to write a motion tracking external 
  using the blob motion
  tracker in opencv.  I had success with writing a program that recieves a 
  path to an avi and motion
  tracks the blobs and prints their position.  Now I am writing the set of Pd 
  externals using the same
  code with very little success. I need someone that knows what they are 
  doing to look at my Pd 
code
  and show me what I am doing wrong.  I have read and followed IOhannes guide 
  on external 
writing.
  Also, I have looked at the zexy and pdp sorce code in order to learn but 
  still I am not getting it to 
work.
  The externals are based on the already working code I was able to 
  frankenstein together.  I am
  calling it FTIR_Tools.  It consist of the following (if I ever get them to 
  work!):
 
  1. FTIR_Cam: detects webcam and sends out frames to outlet.
  2. FTIR_VPlayer: reads quicktimes from path and sends out frames to outlet.
  3. FTIR_Tracker: tracks blobs, sends out matrix blob# position to outlet2 
  and frames to outlet 1.
  you can also turn on and off visuals for center point and bounding box.
  4. FTIR_Window: displays frames in an X11 window.
 
  Please look at my code and show me how to fix it. I am getting nowhere.  In 
  the cvBloblib.zip is the
  program I put together called Tracker and the code called Tracker.cpp.  If 
  you want to see how it
  works drag it to terminal and follow it with a path to an .avi. You must 
  have opencv and fink 
installed.
  If you have ploblems installing opencv post and I will be glad to help.
  Thanks,
  Alain
 
  ___
  PD-list@iem.at mailing list
  UNSUBSCRIBE and account-management - 
  http://lists.puredata.info/listinfo/pd-list
 
 
 
 
 
 -- 
 -
 
  -
   - --
 http://perhapsidid.wordpress.com
 


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


Re: [PD] opencv motion tracker external HELP!

2007-05-27 Thread nosehair911
The Gem stuff is complex and done by people who actually know what they are 
doing.  All I am trying 
to do is port parts of an already made (and very,very simple to code) library 
to Pd.  I also have no 
coding experience except for this project. I have never even seen C code before 
2 weeks ago, but the 
C code for opencv is easy enough for a noob like me to write an application 
that calls on those 
libraries.  If you are interested check out my Tracker.cpp code.  The difficult 
part (for me) is turning that 
code into something Pd can use.  Also since it would require that you compile 
and install opencv I 
think it would be a pain for the enduser to be included inside Gem. I think 
most people that use Gem 
are not interested in a blob tracker.  That is why I needed to write my own.  
My goal is to use the 
tracker output to control Geos in Gem using iemmatrix and other goodies.
BTW the algorithms for pix_multiblob are way, way over my head(seriously)!
Alain
 
 From: Kyle Klipowicz [EMAIL PROTECTED]
 Date: 2007/05/27 Sun PM 10:17:02 EDT
 To: [EMAIL PROTECTED] [EMAIL PROTECTED]
 CC: pd-list@iem.at,  [EMAIL PROTECTED]
 Subject: Re: [PD] opencv motion tracker external HELP!
 
 I haven't looked at this yet, and have no external coding experience.
 
 However, I'm wondering if it would be an easier task to port this
 library to mimic the pix_* objects in Gem? Maybe you could look at the
 Gem source and figure out how to do this. Or better yet, compare the
 code you have here with the pix_multiblob, and try to correct the
 algorithms as was suggested earlier.
 
 Good luck!!!
 
 ~Kyle
 
 On 5/27/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  For the last 2 weeks I have been trying to write a motion tracking external 
  using the blob motion
  tracker in opencv.  I had success with writing a program that recieves a 
  path to an avi and motion
  tracks the blobs and prints their position.  Now I am writing the set of Pd 
  externals using the same
  code with very little success. I need someone that knows what they are 
  doing to look at my Pd 
code
  and show me what I am doing wrong.  I have read and followed IOhannes guide 
  on external 
writing.
  Also, I have looked at the zexy and pdp sorce code in order to learn but 
  still I am not getting it to 
work.
  The externals are based on the already working code I was able to 
  frankenstein together.  I am
  calling it FTIR_Tools.  It consist of the following (if I ever get them to 
  work!):
 
  1. FTIR_Cam: detects webcam and sends out frames to outlet.
  2. FTIR_VPlayer: reads quicktimes from path and sends out frames to outlet.
  3. FTIR_Tracker: tracks blobs, sends out matrix blob# position to outlet2 
  and frames to outlet 1.
  you can also turn on and off visuals for center point and bounding box.
  4. FTIR_Window: displays frames in an X11 window.
 
  Please look at my code and show me how to fix it. I am getting nowhere.  In 
  the cvBloblib.zip is the
  program I put together called Tracker and the code called Tracker.cpp.  If 
  you want to see how it
  works drag it to terminal and follow it with a path to an .avi. You must 
  have opencv and fink 
installed.
  If you have ploblems installing opencv post and I will be glad to help.
  Thanks,
  Alain
 
  ___
  PD-list@iem.at mailing list
  UNSUBSCRIBE and account-management - 
  http://lists.puredata.info/listinfo/pd-list
 
 
 
 
 
 -- 
 -
 
  -
   - --
 http://perhapsidid.wordpress.com
 


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