<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">For gray values this should work.<div><br><div><div>On Aug 30, 2011, at 6:56 AM, ronni montoya wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>i solved this creating &nbsp;a fuction called send inside AppCore:<br><br>void AppCore::send(unsigned char *pixels) {<br><br><span class="Apple-tab-span" style="white-space:pre">        </span>for(int i = 0; i &lt; array1.size(); i++)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array1[i] = pixels[i]* 1;<br><br><span class="Apple-tab-span" style="white-space:pre">        </span>pd.writeArray("array1", array1);<br>}<br></div></blockquote><div><br></div><div>Here I would send a resize message to the array if the array length is different from you image size. Also, I'm assuming you set the correct size for the array1 vector to be the size of the image pixel buffer aka width*height ...</div><div><br></div><div><div>void AppCore::send(unsigned char *pixels) {<br><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>// check array length</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if(array1.size() !=&nbsp;pd.getArrayLen("array1") {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>//</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>// send resize message to array1</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>//</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>// aka [ ; array1 resize # &lt;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>//</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>pd. &lt;&lt; StartMsg("array1") &lt;&lt; "resize" &lt;&lt; pixelLen &lt;&lt; Finish();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br><span class="Apple-tab-span" style="white-space: pre; ">        </span>for(int i = 0; &nbsp;i &lt; array1.size(); &nbsp;i++)<br>&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span>array1[i] = pixels[i];<br><br><span class="Apple-tab-span" style="white-space: pre; ">        </span>pd.writeArray("array1", array1);<br>}</div></div><br><blockquote type="cite"><div>then im calling the function from testApp.cpp and sending the pixels<br>from a opecv gray image.<br><br><br>void testApp::draw() {<br> core.send(grayImage.getPixels());<br><br>}<br></div></blockquote><div><br></div><div>I'd send the image to pd in the core.update() function. The whole point of the AppCore wrapper classes is to be able to write the same core app code for both desktop and iOS, since iOS requires a Obj-C file for the main Application delegate aka example/src/ios/testApp.m.</div><br><blockquote type="cite"><div>What do you guys think, maybe theres a more effective way?<br></div></blockquote><div><br></div><div>Dunno. Try it out and let us know. I'm pretty sure it may be slow to send a largish image &gt; 640x480, so I'd start out at 120x240 or so. I've streamed realtime color video at that size using binary blobs in OSC without a problem, so I can't imagine small images being too slow ... then again I haven't tried it with libpd.</div><br><blockquote type="cite"><div><br>cheers<br><br><br>R.<br><br><br><br>2011/8/30 IOhannes m zmoelnig &lt;<a href="mailto:zmoelnig@iem.at">zmoelnig@iem.at</a>&gt;:<br><blockquote type="cite">-----BEGIN PGP SIGNED MESSAGE-----<br></blockquote><blockquote type="cite">Hash: SHA1<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On 2011-08-29 20:51, Peter Brinkmann wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Maybe we can have a poll and come up with a better estimate. &nbsp;Here are a few<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">questions:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">1. What sort of use case for long list messages to you have in mind?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">2. Exactly how long would you need the list to be?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">3. Is this really a use case for list messages or would it make more sense<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">to write to an array instead?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">If we converge to a reasonable number, that'll be the new limit. &nbsp;Otherwise,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">the entire approach may have to go.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">personally i do think that any fixed limit is going to impose troubles.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">afaict, the main idea here is to provide an easy to use API, combined<br></blockquote><blockquote type="cite">with some performance.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">somebody _will_ reach your hard limit, and i think that telling them to<br></blockquote><blockquote type="cite">either switch from the "foolproof API" to "export mode" or to redesign<br></blockquote><blockquote type="cite">their patches just because they called "add_element()" once too often<br></blockquote><blockquote type="cite">will not do.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">why not simply resize the internal array as needed, starting with 32<br></blockquote><blockquote type="cite">elements and doubling whenever the limit is reached?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">fgasdr<br></blockquote><blockquote type="cite">IOhannes<br></blockquote><blockquote type="cite">-----BEGIN PGP SIGNATURE-----<br></blockquote><blockquote type="cite">Version: GnuPG v1.4.11 (GNU/Linux)<br></blockquote><blockquote type="cite">Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org/">http://enigmail.mozdev.org/</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">iEYEARECAAYFAk5ckYcACgkQkX2Xpv6ydvQ85gCfWJcNIzEGnhz9hdnz/XBuRYuI<br></blockquote><blockquote type="cite">TMEAnjfytStl5sFDqkJ9HppZ9XQylgni<br></blockquote><blockquote type="cite">=HvJ0<br></blockquote><blockquote type="cite">-----END PGP SIGNATURE-----<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite"><a href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br></blockquote><blockquote type="cite">UNSUBSCRIBE and account-management -&gt; <a href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><br><br></div></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--------</div><div>Dan Wilcox</div><div><a href="http://danomatika.com">danomatika.com</a></div><div><a href="http://robotcowboy.com">robotcowboy.com</a></div><div><br></div></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br></div></body></html>