[visionegg] Re: mirroring a text strimulus?

  • From: Dav Clark <davclark@xxxxxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Tue, 18 Nov 2008 15:22:55 -0800

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.py


This will require the latest VE from svn, however. If that's a pain, you
should 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 Texture
to 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 with
that. There would be an OpenGL way to do it also, but I don't know
   off 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

Other related posts: