Andrew - couldn't you also use numpy.asarray on self.texels? This would also have the benefit of the same behavior for ndarrays as well as Image.Image and pygame.surface.Surface objects. Namely, they would all be a view on the actual data held by the Texture object.
Likewise, is there a reason that you don't use Image.fromarray in get_texels_as_image? Same arguments for uniformity apply.
Happy to submit a patch if you'd like - either via git or svn diff. Or otherwise let me know where my thinking is wrong here!
Cheers, DC On Nov 18, 2008, at 1:54 PM, Andrew Straw wrote:
Hi Gary, I just added such functionality including a demo script. The new demo can be seen at http://visionegg.org/trac/browser/trunk/visionegg/demo/texture_as_numpy_array.pyThis will require the latest VE from svn, however. If that's a pain, youshould just be able to take the latest VisionEgg/Textures.py from the source repository and overwrite the version in your installation. Test it with the new demo script. -Andrew Gary Lupyan wrote:Thanks! Do you know offhand what the command is for converting Textureto a numpy buffer and back? -Gary On Tue, Nov 18, 2008 at 3:17 PM, Dav Clark <davclark@xxxxxxxxxxxx <mailto:davclark@xxxxxxxxxxxx>> wrote: It would be trivial to take your texture as a numpy buffer or similar and flip it (in numpy) and create a second stimulus withthat. There would be an OpenGL way to do it also, but I don't knowoff the top of my head... reversing in numpy: swapd = a[:,::-1] Cheers, Dav On Nov 18, 2008, at 11:26 AM, Gary Lupyan wrote: Hey everyone, is there a way to flip (i.e., mirror) a texture stimulus about the x or y axis? Thanks. ====================================== The Vision Egg mailing list Archives: //www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html-- Dr. Andrew D. Straw California Institute of Technology http://www.its.caltech.edu/~astraw/ ====================================== The Vision Egg mailing list Archives: //www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html
====================================== The Vision Egg mailing list Archives: //www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html