That's a good question.

Hrm, well you can easily read and write to arrays which are naturally 1 dimensional. I would first try flattening the image by writing the pixel buffer into a float array.  Then send the width and height as well for reading it back in pd. There currently isn't a way to send an area of memory and I could imagine sending a giant list would be alot slower then using an array.

See the example in https://github.com/danomatika/ofxPd for how to read/write to pd arrays.

Otherwise you could write and external as Mathieu suggests ...

On Aug 27, 2011, at 11:21 PM, Mathieu Bouchard wrote:

On Sat, 20 Aug 2011, ronni montoya wrote:

Hi , Do anybody is working with openframeoworks and libpd? i would like to develop an application that interpret pixels as sounds using libpd addon on openframeworks. I was wondering which would be the best way for sending images(opencvimages ) or pixels arrrays from openframeworks to pd using libpd and receiving it in pd for interpreting it as sound in real time. Do anybody have tried soemthing like this? any idea?

You can make yourself tilde externals for pd, that you embed in your libpd-based app... e.g. one or two outlets, no inlets.

You just call the setup-functions of the externals just after initialising libpd... the externals don't need to be separate files (dll, so, dylib) : they can be part of your main executable instead, which is easier.

I already do that with non-tilde externals. (Haven't had a reason to make tilde externals in that context yet).

_______________________________________________________________________
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC

--------
Dan Wilcox
danomatika.com
robotcowboy.com