[PD] opencv motion tracker external HELP!

nosehair911 at bellsouth.net nosehair911 at bellsouth.net
Wed May 30 20:21:27 CEST 2007

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 

> 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

More information about the Pd-list mailing list