Re: debian packaging... Re: [pygame] mixer/sndarray voes

2010-05-24 Thread Alexandre Quessy
Hello Pygame users,
I have left this email unoticed until now. I now reply since there are
news in this regard. :)

2010/1/27 René Dudfield :
> On Thu, Jan 28, 2010 at 4:01 AM, Olof Bjarnason
>  wrote:
>>
>> 2010/1/27 René Dudfield :
>> >
>> >
>> > On Thu, Jan 28, 2010 at 3:44 AM, Olof Bjarnason 
>> > wrote:
>> >>
>> >> >
>> >> > For ubuntu you may have to compile from source, since they still haven't
>> >> > updated their package in time for ubuntu 9.10:
>> >> >     http://pygame.org/wiki/CompileUbuntu
>> >>
>> >>
>> >> Um a little too much wrong-kind-of-work to be fun.
>> >>
>> >
>> > yeah... hehe.  Well luckily you can pretty much copy/paste these lines to
>> > install.  So not too hard :)
>>
>> Yeah, but the work with debugging such a "script" when it fails is
>> what is much work. Plus how it would severely mess up my system ;)
>>
>> What linux dists' are you guys using, to get more up-to-date developer
>> versions of python+pygame etc.?
>>
>> >
>> >
>> > #install dependencies
>> >
>> > sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev
>> > libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion
>> > libportmidi-dev
>> >
>> >
>> > svn co svn://seul.org/svn/pygame/trunk pygame
>> >
>> > cd pygame
>> > python setup.py build
>> > sudo python setup.py install
>> >
>> >
>>
>>
>>
>> --
>> http://olofb.wordpress.com
>
>
> yeah, ok.  Messing up systems is not good.
>
> I wonder if you can just install the Lucid .deb file... I reckon you
> might be able to.  I guess it would be good to set up a PPA, or maybe
> even compile debs for people to download.  Alexandre has talked about
> becoming the debian maintainer for pygame... so that would be good...
> hopefully it will get updated more quickly in the future.
>
> Alexandre: do you feel like uploading a pygame 1.9.1 .deb for karmic
> somewhere?  Or perhaps setting up a ppa?  Or are you still interested
> in being the debian maintainer?  How is that process going?  It looks
> like Sebastien Bacher uploaded the most recent pygame package for
> ubuntu on the 14th of Jan.
>

Since that time, the MOTU developers in Ubuntu have packaged it for
Lucid. I just uploaded a package for Debian sid, and someone should
upload it for me to the archives soon. The bugtracker issue is
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=544347

Hopefully, I'll announce it has been updated in Debian this week. :)

>
> Marcus uses freebsd.  Lennard uses ubuntu now I think...  Not sure
> what other people are using.  The funny thing is I'm using ubuntu -
> which has been the slowest distro to update pygame.  For me, I compile
> things I work on from source... but often use the system libraries
> unless I'm testing or developing them.  But I dunno... everyone has
> their own needs/uses and so different distros are good for them.
>
>
>
> cya
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] summer of code: OSC networking proposal

2010-04-11 Thread Alexandre Quessy
Hello everyone,
Using OSC with Pygame should already be quite easy with Twisted and our
OSC library. See http://bitbucket.org/arjan/twisted-osc/

I don't really like how pygame re-writes everything in itself, rather
than improving and using already existing code. For example, it would
have been better, IMHO, to put the camera in SDL, not in Pygame. Same
for the MIDI. I also had to port the changes to MIDI upstream. (and I am
planning to bring it all the way to portmidi) The work would only need
to be done, and not twice like right now, if you guys were not
implementing everything in Pygame, instead of where it should be -
upstream.

Regards,
Alexandre


Marcus von Appen wrote:
> Hi Gabe,
> 
> On, Tue Apr 06, 2010, Gabe Silk wrote:
> 
> [...]
> 
>> *Timeline*
>> Week 1: Finalize design and intended API
>> Week 2-3: Implement OSC Server
>> Weeks 4-5: Implement OSC Client and Message classes, work on first example
>> application
>> Week 6-7: Implement Bundles, complete first example application
>> Week 8: Finalize multicast API
>> Week 9-10: Implement multicast, complete second example application
>> Week 11: System and integration testing; complete third example application
>> Week 12: Finish up documentation for system and examples
> 
> I'm not sure, whether it would fit your timeline, but an integration or
> interface of the available portmidi interface of pygame (pygame.midi)
> with your message classes would be quite helpful for most people, I
> think. That would allow some easy bridging from the midi-based
> controller application to an OSC server being available elsewhere
> without having to create the bridge manually.
> 
> Though that might be something edgy for several midi devices (due to the
> open namespaces for OSC) and incompatibilities with MIDI, some generic
> message type might help people to get their stuff up and running much
> faster.
> 
> Regards
> Marcus


[pygame] V4L2 webcams whose format is not supported

2010-03-30 Thread Alexandre Quessy
Hello Pygame developers.
I should say it is very annoying that some image formats of
V4L2-supported USB cameras are not supported by Pygame. I get the
following error when I start Toonloop with many USB cameras:

(, SystemError('ioctl(VIDIOC_S_FMT)
failure: no supported formats',), )

Is it planned to implement other video codecs, and if so, when?
If not, I will speed up my Gstreamer development and drop Pygame. :(

Also, I would like to take this moment to tell you that it would be
nice if this camera development was contributed to SDL, and not kept
only in the Python binding. Same for the MIDI support, and other
goodies. Otherwise, Pygame is a lot more that an SDL binding.

Regards,
-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] Pygame Scene System

2010-02-12 Thread Alexandre Quessy
Hello,
There's also Clutter to look at.
There are Python bindings.

a

Thadeus Burgess wrote:
> Do take a look at PyBTS (Pygame Behind The Scenes) (which MyRTS uses
> this engine) project in hg.thadeusb.com
> 
> It has a scenemanager, world manager, map manager, entity manager, etc
> etc etc.., this was my initial start on a pygame engine.
> 
> -Thadeus
> 
> 
> 
> 
> 
> On Thu, Feb 11, 2010 at 11:32 PM, nikwin  wrote:
>> area or the sidebar for GUI elements. The View class is used to
>> display a portion of a subspace onto the screen itself (or any other
>> surface).  I will implement the entire thing as the fo
> 


Re: [pygame] unsubscribe

2010-01-31 Thread Alexandre Quessy
Eeew! At least OpenSceneGraph, please ! Not Unity3D!!

Bryce Schroeder wrote:
> Unity3D? Eeew. Windows. Proprietary. And I bet it tastes like gophers, too.
> 
> On Sat, Jan 30, 2010 at 11:48 PM, Luke Paireepinart
>  wrote:
>>
>> On Sun, Jan 31, 2010 at 12:25 AM, ryan  wrote:
>>> yes it would appear I did do that wrong.
>>> thank you, and goodbye pygame!
>>>
>>> ive moved onto unity3d and have no need for pygame
>> Oh man, what are we going to do without you?
>>
>>
>>> On Sat, Jan 30, 2010 at 9:27 PM, Russell Cumins 
>>> wrote:
 Try this, if you haven't already.
 http://www.mail-archive.com/pygame-users@seul.org/msg12606.html

 On 31 January 2010 05:14, Luke Paireepinart 
 wrote:
> you're doing it wrong, I think.
>
> On Sat, Jan 30, 2010 at 10:05 PM, ryan  wrote:
>> unsubscribe
>>
> 


[pygame] Twisted wrapper for Pygame

2010-01-18 Thread Alexandre Quessy
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello Pygame users and developers.
Since a few months, I am using a simple class that eases the use of
Pygame with Twisted, a network-driven framework for asynchronous events
handling. I use Twisted to send and receive network messages.
(HTTP, OSC, UDP, Telnet, etc.)

I think it would be nice if I would contribute this simple module
somewhat upstream. Would it be better to be part of Twisted or Pygame ?
I see there are a few effort in Pygame to integrate networking and
games. I think that it should/could be in Pygame.

Of course, Twisted is not easy, but it is quite powerful and flexible.
For instance, Arjan Scherpenisse and I wrote a library to send/receive
OSC in Pygame. See http://bitbucket.org/arjan/twisted-osc/ for that new
module for Twisted. (soon to be officially part of it, we hope)

See my "render" module at
http://bitbucket.org/aalex/toonloop1/src/tip/rats/render.py

Let me know what you think. I think it could be simplified a bit, so
that the user keeps as much as possible of a grasp of his game's main
loop. :)

Alexandre
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJLVT1PAAoJEJQ0pOgl2qx1nKIP/23TxrmYtgsVp0zEK/i8l50u
3Ue7jyVq5C1P6bTIX8jr2Fc+KUCt1/AY8wmHE58f6UCIqCOCXI7vmI4LyOAZ3CdJ
37GPxPVnvzRIiEcudUmp0CFwvWMzIVUodV+ch+Y7Np03+iThOH9hN7ogFS8CJLi5
u2AvquzfV7e48gqFei/6G2OopcKMUWyDuIYFSpB4Ap/eeqVk7hwCmh1yNwS6A1Yw
kRQ8V17BUXV4lHnpt7JzveM6N1TyU8QWytGBcVuwfCfYrQMTCZOs7r2jCsRGNk4z
XPIqSZiMIZrI/8borYI9A9mxombZHEoP2LDddrzD93lw1+6txbjpFX7qFHOmNOj+
+eARHy2gcs3gcErBopTHxVeAfxOLiDZUxEnEUwYyIpQztpI3s+hQw05zfqSU+aIr
6U/bkrcNs+QtEiILZ9S9bh/GtiqDbFiqKJ/2fLfve1Yh8nljvip81uLQBnfPTMF3
Cj96SDm+yNH3VQlp8LlI5iKR3eeN/6e0yk+9AqXbu7PmTNl5tPTTcrQMorpzXzPT
JvY+8jzlq/L+D/bLrJdsbBfeS6mpITjn7qegvR49Y4qOrNFkdjR7JVyV9ZZjRebI
IzqKeGYQ7RCcsdETFGxpC379ipF6StUX7iOJkfNPGYNOkG0wMXxW7OD0pytFgFEs
XOtxQ/jQzg/ucOOeMvu4
=jLaw
-END PGP SIGNATURE-


pygame.camera bit depth (Was "Re: [pygame] Speed up image.tostring with OpenGL ?")

2010-01-18 Thread Alexandre Quessy
Hello again,

I'm trying to ask again : Is there a way to grab an image from the
camera module that has a bit depth different from 24 bits?

Alexandre Quessy wrote:
> René Dudfield wrote:
>> # something like this... untested.
>> w,h = surf.get_size()
>> data = pygame.surfarray.pixels2d(surf)
>> texture = glGenTextures(1)
>> glBindTexture(GL_TEXTURE_2D, texture)
>> glPixelStorei(GL_UNPACK_ALIGNMENT,1)
>> glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, data)
>> # ... etc...
> 
> 
> Since I am reading from the pygame.camera.Camera, the image has a 24 bit
> depth. This format is the only one that is not supported by
> surfarray.pixels2d. Can I change the format that the Camera gives me ?
> 


Thanks !

a


Re: [pygame] Speed up image.tostring with OpenGL ?

2010-01-11 Thread Alexandre Quessy
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello everyone !

René Dudfield wrote:
> Hi,
> 
> try using surfarray.  To avoid converting the data to a python string.
>  pyopengl supports numpy arrays to do this.
> 

This is very nice !
So far, I followed Brian's tip, and changed from RGBX to RGB. It is
already faster.

> 
> # something like this... untested.
> w,h = surf.get_size()
> data = pygame.surfarray.pixels2d(surf)
> texture = glGenTextures(1)
> glBindTexture(GL_TEXTURE_2D, texture)
> glPixelStorei(GL_UNPACK_ALIGNMENT,1)
> glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, data)
> # ... etc...
> 

Since I am reading from the pygame.camera.Camera, the image has a 24 bit
depth. This format is the only one that is not supported by
surfarray.pixels2d. Can I change the format that the Camera gives me ?

> Also to speed up image loading/decoding...
> import pygame.threads
> pygame.threads.init(8)
> surfs = pygame.threads.tmap(pygame.image.load, your_images)
> 
> Another thing to do is to make sure you are reusing textures (if
> possible).  Since allocating a new texture each time can be slow, so
> if you application allows it, reuse textures.
> 

I am much used to that kind of texture reusage. (that's one of the
reasons why I am addicted to OpenGL, even when it would be better not to
use it...) In this case, though, I am reading live from the camera, plus
reading though a very long list of surfaces, often more than the number
of textures I can store on the graphics card.

Thanks a lot for helping !

alex

> 
> 
> cheers,
> 
> 
> On Mon, Jan 4, 2010 at 4:06 AM, Alexandre Quessy  wrote:
>> Hello Pygame users and developers !
>>
>> Is there a way I can speed up the transfert from a surface to an
>> OpenGL texture ? Right now, I use the pygame.image.tostring function,
>> but it seems like converting the pixels to a Python str creates a
>> serious bottle neck in my stop motion application...
>>
>> I think that it should either be implemented directly in Pygame, (best
>> option) or done using something like ctypes in my application. If none
>> of these option is not easy enough, I am thinking about switching to
>> Gstreamer+GTK with the GdkPixBuf, instead of Pygame surfaces. An other
>> option would be to rewrite the whole application in C++...
>>
>> Any suggestion to fix this in a way that is not too long ?
>> My frame rate drops to 4 FPS when there are more than a few surfaces in my 
>> list.
>> Please try Toonloop to test this out. It works well on Linux. If
>> someone get it to work on Mac or Windows, I would need hints for
>> packaging it for those OS too. I convert the surfaces to OpenGL
>> texture in texture_from_image from the file
>> http://bitbucket.org/aalex/toonloop1/src/tip/toon/draw.py on what is
>> currently the line 42.
>> --
>> Alexandre Quessy
>> http://alexandre.quessy.net/
>>
> 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJLSt6RAAoJEJQ0pOgl2qx1Js8P/2bLR2NQt5AM8lxY6fLQ6R5y
LVAGSAYZM1Kn0A2Cdi4au0ua6eUrnusKFLhWs3KSZGxSWX8PNvaOypBTdQiAV31/
f9m7eC3DcqpsmYMWU7MedeqAgPwzAUtj6EW6EGvY0JFRjdN1P7o2eb96+3RJKUtv
v/GwBewjdN1iHJrg0dPN5UEH9dGXl6pNBDHnsey6rhCc3d5bZhjLuXxGd7wKToCf
MgCTdsiq4fQMrDUkZ157oeuWn5douROP2pTK5J78oKFXBVaA2n1skzJ92Kn3iTpY
uJc2KUbFhvBXWn+n+UyFwn85T/WvB+ctpm8q+fjX78JkXvR9INxir9XN8JFLhFRu
kwb36DBbbqtnniRuI0N4ZSYASK/HL1Cxea5K/ANR9pQ80DSy7w1jhfR9h1dg3gPX
HOaooQ9TY2c07oFiM52s2VU8iUOWA8jL1xKcNvbYk27Lzioqj9DQtJDVjubLI9u6
fT4m06YYcZ/XWTw0EnYNjocvBIxmcEgqgnBmMJotKMPKRY1caM8C+1ueT1UltJf9
24VWI/Hce+m/e9gkz7oETGrxPcX5hmbb97Zrny7g5mBS7/owcSEu/WPB/fWqzivo
HEy+nsMaLxgxjc5KNqCb8Cguv6xz8NJaaug52D2dNC1IQY2GtNZkx7MCYuwuk4KL
ENhR8tSqSRFuAzssztDC
=X/rK
-END PGP SIGNATURE-


[pygame] Pygame 1.9 Debian package

2010-01-03 Thread Alexandre Quessy
Hello,
What is the state of the Debian packaging for Pygame 1.9 ?
Arjan Scherpenisse has updated the Debian files. The package can be
found at http://bitbucket.org/aalex/toonloop1/downloads/
Please ask Arjan Scherpenisse at  if the
maintainer needs those files.

Does the Pygame project have a Debian maintainer ? I would like Pygame
1.9 to be packaged with Ubuntu 9.04 and in the Debian Testing distro.
Right now, it seems it is still pygame 1.8 that is there. I am in tthe
process of looking for a mentor to eventually become a maintainer
myself, so I wouldn't mind looking after the packaging of Pygame as
well if necessary.

I would really like Pygame 1.9 to be in Debian and Ubuntu, so that I
can release Toonloop as well.
Thanks !

-- 
Alexandre Quessy
http://alexandre.quessy.net/


[pygame] Speed up image.tostring with OpenGL ?

2010-01-03 Thread Alexandre Quessy
Hello Pygame users and developers !

Is there a way I can speed up the transfert from a surface to an
OpenGL texture ? Right now, I use the pygame.image.tostring function,
but it seems like converting the pixels to a Python str creates a
serious bottle neck in my stop motion application...

I think that it should either be implemented directly in Pygame, (best
option) or done using something like ctypes in my application. If none
of these option is not easy enough, I am thinking about switching to
Gstreamer+GTK with the GdkPixBuf, instead of Pygame surfaces. An other
option would be to rewrite the whole application in C++...

Any suggestion to fix this in a way that is not too long ?
My frame rate drops to 4 FPS when there are more than a few surfaces in my list.
Please try Toonloop to test this out. It works well on Linux. If
someone get it to work on Mac or Windows, I would need hints for
packaging it for those OS too. I convert the surfaces to OpenGL
texture in texture_from_image from the file
http://bitbucket.org/aalex/toonloop1/src/tip/toon/draw.py on what is
currently the line 42.
--
Alexandre Quessy
http://alexandre.quessy.net/


[pygame] Bugtracking for the camera module?

2010-01-03 Thread Alexandre Quessy
Hello,
I have a few bugs and features requests to report for the camera module.
I might be one of the user/developer that uses it the most, with Toonloop.

In the bugtracker at http://pygame.motherhamster.org/bugzilla/ there
is no component named "pygame.camera".
Also, there is no version 1.9 in the choices. There are only 1.8, svn
or unspecified.
Thanks !

-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] camera module: yuv, hsb, controllers and poc game

2009-08-06 Thread Alexandre Quessy
Hello !
Where can I find the installation instructions for Mac OS X?
So far, my application doesn't detect any camera, though a friend had
it successfully working on his computer. Is OpenCV still needed ? Is
it supposed to work under OSX 10.4 or does it require 10.5?
Thanks !

a

2009/8/6 René Dudfield :
> Hi,
>
> nice work!
>
> Also check out the apple performance profiling tools*.  They should let you
> see which objc functions are slow, where as the cprofile module just works
> for python exposed functions.
>
> You probably need to add -pg to the gcc flags so it adds profile information
> when it compiles.
>
> cu,
>
>
> * http://developer.apple.com/tools/sharkoptimize.html
>
>
>
> On Wed, Aug 5, 2009 at 1:24 PM, el lauwer  wrote:
>>
>> Hello,
>>
>> Since, GSOX is drawing into a close I though I post an other update on my
>> progress.
>>
>> First of all, I have added support for yuv and hsb color output with
>> different color depths by using the color transform functions.
>>
>> I have looked into the flip controller, and the only function I could find
>> in the Quicktime API that should be able to do this is
>> SGSetChannelMatrix(channel, matrix) [0]. However when I try to set an mirror
>> matrix (a scale + translate matrix) it return an error that indicates that
>> the transformation matrix isn't supported.
>> Here is the code sniped:
>>
>> MatrixRecord matrix;
>> Fixed minusOne = Long2Fix(-1L);
>> Fixed PlusOne = Long2Fix(1L);
>> Fixed zero = Long2Fix(0L);
>>
>> ScaleMatrix(matrix, fixed1, minusOne, 0, 0);
>> TranslateMatrix(matrix, Long2Fix(self->boundsRect.right), 0);
>> SGSetChannelMatrix(self->channel, &matrix);
>>
>> You can find more context in the file src/camera_mac.m:133
>>
>> Nirav, since you joined Apple, maybe you can ask the good people in
>> Cupertino, how they intended this to be done :P
>>
>> In case there is no way that qt support this controller, should I just
>> keep them out and use transform.flip instead?
>>
>>
>> I have been testing the camera games by nirav (bouncy bal, pointillism,
>> reflectionrejection), pointillism runs very slow, about 2,5 frames a second,
>> and the other don't display an image frame. I haven't found the problem yet.
>>
>>
>> [0]
>> http://developer.apple.com/documentation/QuickTime/Reference/QTRef_SequenceGrabber/Reference/reference.html#//apple_ref/c/func/SGSetChannelMatrix
>>
>> Grtz
>
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] OpenGL

2009-08-06 Thread Alexandre Quessy
Hi !
Try Google codesearch !
http://www.google.com/codesearch?q=import+rabbyt&as_lang=python

a

2009/8/5 Ian Mallett :
> Hi
>
> PyOpenGL is basically OpenGL--it's what I use, and hence I can recommend
> it.  I also know of tutorials (the infamous NeHe has Python ports of lessons
> 1-10).  There's plenty of resources here.
>
> PyGlet is also basically OpenGL, although you'll get a higher level
> interface.  I found the major structure to be inflexible and clunky--but the
> special features/functions to be easily accessible--but I never really got
> into it.
>
> Rabbyt looks like a fast 2D sprite library that uses PyOpenGL/PyGame or
> PyGlet as a backend.  I could be wrong.  Also, it looks like using Rabbyt
> with PyGame is straightforward, although I can't speak from experience
> there.  Googling "rabbyt pygame" returned examples--although not
> tutorials--such as http://www.pygame.org/project/328/?release_id=768.  A
> quick look at Rabbyt looks like integration with PyGame is straightforward.
> E.g.:
>
> pygame.init()
> pygame.display.set_mode(size, pygame.OPENGL | pygame.DOUBLEBUF)
> rabbyt.set_viewport(size)
> rabbyt.set_default_attribs()
>
> Ian
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] is pygame right for my application?

2009-08-03 Thread Alexandre Quessy
Hi!
If you want to make a web-based game, pygame is not what you want.
Look for twisted and the nevow web framework.
You can pick some code in this project I am working on :
https://svn.sat.qc.ca/trac/miville/browser/trunk/py/miville/ui/web
a

2009/8/3 Blogging Account :
> Hi,
>
> I'd like to have suggestions as to whether pygame is right for my
> application.
>
> I'm writing a simulator for a table top wargame. The logical side is
> easy; roll dice, compare against value, look up in table etc.
>
> I have to make a 2D environment simulating the table top in which
> units (battalions/squadrons) are placed.
>
> I need to calculate things like enemy units in front of a unit (for
> firing and threats), supporting units in flank (side) or rear. So, a
> lot of 2D calculations.
>
> Can pygame help me with my 2D calculations and world representation or
> is that outside the scope of pygame?
>
> A visual interface is pretty much essential. Can pygame work through a
> web browser? i.e. use the browser as an output device? I might
> eventually want to turn my application into a server based multi user
> game working through browsers.
>
> Cheers
>
> Neil
>
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] write gif animation?

2009-07-27 Thread Alexandre Quessy
Here is how I have done it using mencoder in Twisted :
http://code.google.com/p/toonloop/source/browse/trunk/py/toon/mencoder.py

a

2009/7/27 Ian Mallett :
> I used to make movies from my PyGame applications by using
> pygame.image.save(...)--or sometimes the OpenGL equivalent--to save to a
> file.  I then imported these into Animation Shop Pro (an old version ~1999)
> and saved as a .gif or .avi.  I definitely think a .gif animation file
> creator would be an excellent addition to PyGame...
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] write gif animation?

2009-07-27 Thread Alexandre Quessy
Hi Jake,
Either install PIL for Python2.5, if possible, or use an other
external software.
I use imageMagick a lot. The command-line executable is called "convert".
See the online doc for how to use it.
I personnally use Twisted for handled subprocesses... but you could
use subprocess or os.system.

a

2009/7/27 Jake b :
> What's the best way to convert to a gif animation? I have a list of
> Surfaces, that I will use as each frame.
> Searching, it looked like PIL is the answer, but the installer requires
> python 2.2, while I have 2.5.
> --
> Jake
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


[pygame] Time-based interpolation :: jitter problem

2009-06-18 Thread Alexandre Quessy
Hi !
I am trying to use an interpolation based on time.time() to create
smooth animations with Pygame and OpenGL.
The idea is to get time-based motion tween, instead of frame-based.
It seems like there is still jitter in my interpolation. The motion is
not uniform.
Anyone can propose a more accurate way to measure time
(human-perceived time, not CPU time) than time.time()?
...or maybe it is my Tween class code that is wrong. It is based on
the excellent Robert Penner easing equations. Maybe there is something
wrong with my Tween.tick(t) method.
Can you guys take a look ?

You can download my tweening test here :
http://alexandre.quessy.net/static/pygame/tween_progress.tar.gz
(this code is part of toonloop.com)
-- 
Alexandre Quessy
http://alexandre.quessy.net/


[pygame] old camera.so file

2009-06-01 Thread Alexandre Quessy
Hi,
How do I get rid of this message every time i repompile pygame ?

"""
/usr/lib/python2.5/site-packages/pkg_resources.py:1166:
RuntimeWarning: Detected old file(s).  Please remove the old files:
/usr/local/lib/python2.5/site-packages/pygame/camera.so
Leaving them there might break pygame.  Cheers!
"""

I get it when I run toonloop.

-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] audio programming with pygame?

2009-05-24 Thread Alexandre Quessy
typo: http://code.google.com/p/toonloop/source/browse/trunk/py/rats/fudi.py

2009/5/24 Alexandre Quessy :
> Hi again,
> I moved my file to
> http://code.google.com/p/toonloop/source/browse/trunk/py/toon/fudi.py
> To install, checkout toonloop and type "python setup.py install"
>
> a
>
> 2009/5/24 Alexandre Quessy :
>> Hi all,
>>
>> 2009/5/23 Devon Scott-Tunkin :
>>> There's also the pure data "language" http://puredata.info/
>>
>> Regarding Pure Data, I have written a very nice FUDI protocol for twisted.
>> FUDI is the protocol used by the netsend and netreceive builtin
>> objects in Pure Data.
>> This way, you can control Pure Data, or receive informations from Pure
>> Data in Python.
>>
>> Here is where you can find this FUDI protocol for twisted :
>> http://code.google.com/p/toonloop/source/browse/trunk/py/toon/fudi.py
>> It is released under GNU GPL. Written by Alexandre Quessy.
>> (forgot to provide a license. Please just copy-paste this line above
>> for now if you reuse it)
>>
>> It is part of the ToonLoop project for now. It will be moved to the
>> rats package soon.
>> See my other email regarding state saving in which I introduce the rats 
>> package.
>>
>> a
>>
>>>
>>> --- On Sat, 5/23/09, Alexandre Quessy  wrote:
>>>
>>>> From: Alexandre Quessy 
>>>> Subject: Re: [pygame] audio programming with pygame?
>>>> To: pygame-users@seul.org
>>>> Date: Saturday, May 23, 2009, 8:46 AM
>>>> Hi,
>>>> ChucK is also an awesome language for sound synthesis. It
>>>> uses the STK library.
>>>> I can't wait until there is a STK Python binding !
>>>>
>>>> a
>>>>
>>>> 2009/5/23 Olaf Nowacki :
>>>> > maybe you would like to try supercollider for making
>>>> the synthesizers and
>>>> > use pygame as UI?
>>>> >
>>>> > http://pypi.python.org/pypi/SC/0.2/
>>>> > http://supercollider.sourceforge.net/
>>>> >
>>>> > On Fri, May 22, 2009 at 11:02 PM, machinim...@gmail.com
>>>> > 
>>>> wrote:
>>>> >>
>>>> >> hi,
>>>> >>
>>>> >> i would like to learn how to program simple
>>>> synthesizers and sound effects
>>>> >> and it would be nice if i could experiment with
>>>> this in python.
>>>> >>
>>>> >> http://en.wikipedia.org/wiki/Jeskola_Buzz
>>>> >> would something like buzz theoretically be
>>>> possible with pygame?
>>>> >>
>>>> >> of course python is slow but if buzz was able to
>>>> handle hundreds of
>>>> >> machines on the hardware of 10 years ago then a
>>>> hand full should be possible
>>>> >> in python today?
>>>> >>
>>>> >> is low level sound programming possible with
>>>> pygame at all or are only
>>>> >> higher level audio features exposed?
>>>>
>>>>
>>>>
>>>> --
>>>> Alexandre Quessy
>>>> http://alexandre.quessy.net/
>>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> Alexandre Quessy
>> http://alexandre.quessy.net/
>>
>
>
>
> --
> Alexandre Quessy
> http://alexandre.quessy.net/
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] audio programming with pygame?

2009-05-24 Thread Alexandre Quessy
Hi again,
I moved my file to
http://code.google.com/p/toonloop/source/browse/trunk/py/toon/fudi.py
To install, checkout toonloop and type "python setup.py install"

a

2009/5/24 Alexandre Quessy :
> Hi all,
>
> 2009/5/23 Devon Scott-Tunkin :
>> There's also the pure data "language" http://puredata.info/
>
> Regarding Pure Data, I have written a very nice FUDI protocol for twisted.
> FUDI is the protocol used by the netsend and netreceive builtin
> objects in Pure Data.
> This way, you can control Pure Data, or receive informations from Pure
> Data in Python.
>
> Here is where you can find this FUDI protocol for twisted :
> http://code.google.com/p/toonloop/source/browse/trunk/py/toon/fudi.py
> It is released under GNU GPL. Written by Alexandre Quessy.
> (forgot to provide a license. Please just copy-paste this line above
> for now if you reuse it)
>
> It is part of the ToonLoop project for now. It will be moved to the
> rats package soon.
> See my other email regarding state saving in which I introduce the rats 
> package.
>
> a
>
>>
>> --- On Sat, 5/23/09, Alexandre Quessy  wrote:
>>
>>> From: Alexandre Quessy 
>>> Subject: Re: [pygame] audio programming with pygame?
>>> To: pygame-users@seul.org
>>> Date: Saturday, May 23, 2009, 8:46 AM
>>> Hi,
>>> ChucK is also an awesome language for sound synthesis. It
>>> uses the STK library.
>>> I can't wait until there is a STK Python binding !
>>>
>>> a
>>>
>>> 2009/5/23 Olaf Nowacki :
>>> > maybe you would like to try supercollider for making
>>> the synthesizers and
>>> > use pygame as UI?
>>> >
>>> > http://pypi.python.org/pypi/SC/0.2/
>>> > http://supercollider.sourceforge.net/
>>> >
>>> > On Fri, May 22, 2009 at 11:02 PM, machinim...@gmail.com
>>> > 
>>> wrote:
>>> >>
>>> >> hi,
>>> >>
>>> >> i would like to learn how to program simple
>>> synthesizers and sound effects
>>> >> and it would be nice if i could experiment with
>>> this in python.
>>> >>
>>> >> http://en.wikipedia.org/wiki/Jeskola_Buzz
>>> >> would something like buzz theoretically be
>>> possible with pygame?
>>> >>
>>> >> of course python is slow but if buzz was able to
>>> handle hundreds of
>>> >> machines on the hardware of 10 years ago then a
>>> hand full should be possible
>>> >> in python today?
>>> >>
>>> >> is low level sound programming possible with
>>> pygame at all or are only
>>> >> higher level audio features exposed?
>>>
>>>
>>>
>>> --
>>> Alexandre Quessy
>>> http://alexandre.quessy.net/
>>>
>>
>>
>>
>>
>
>
>
> --
> Alexandre Quessy
> http://alexandre.quessy.net/
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] audio programming with pygame?

2009-05-24 Thread Alexandre Quessy
Hi all,

2009/5/23 Devon Scott-Tunkin :
> There's also the pure data "language" http://puredata.info/

Regarding Pure Data, I have written a very nice FUDI protocol for twisted.
FUDI is the protocol used by the netsend and netreceive builtin
objects in Pure Data.
This way, you can control Pure Data, or receive informations from Pure
Data in Python.

Here is where you can find this FUDI protocol for twisted :
http://code.google.com/p/toonloop/source/browse/trunk/py/toon/fudi.py
It is released under GNU GPL. Written by Alexandre Quessy.
(forgot to provide a license. Please just copy-paste this line above
for now if you reuse it)

It is part of the ToonLoop project for now. It will be moved to the
rats package soon.
See my other email regarding state saving in which I introduce the rats package.

a

>
> --- On Sat, 5/23/09, Alexandre Quessy  wrote:
>
>> From: Alexandre Quessy 
>> Subject: Re: [pygame] audio programming with pygame?
>> To: pygame-users@seul.org
>> Date: Saturday, May 23, 2009, 8:46 AM
>> Hi,
>> ChucK is also an awesome language for sound synthesis. It
>> uses the STK library.
>> I can't wait until there is a STK Python binding !
>>
>> a
>>
>> 2009/5/23 Olaf Nowacki :
>> > maybe you would like to try supercollider for making
>> the synthesizers and
>> > use pygame as UI?
>> >
>> > http://pypi.python.org/pypi/SC/0.2/
>> > http://supercollider.sourceforge.net/
>> >
>> > On Fri, May 22, 2009 at 11:02 PM, machinim...@gmail.com
>> > 
>> wrote:
>> >>
>> >> hi,
>> >>
>> >> i would like to learn how to program simple
>> synthesizers and sound effects
>> >> and it would be nice if i could experiment with
>> this in python.
>> >>
>> >> http://en.wikipedia.org/wiki/Jeskola_Buzz
>> >> would something like buzz theoretically be
>> possible with pygame?
>> >>
>> >> of course python is slow but if buzz was able to
>> handle hundreds of
>> >> machines on the hardware of 10 years ago then a
>> hand full should be possible
>> >> in python today?
>> >>
>> >> is low level sound programming possible with
>> pygame at all or are only
>> >> higher level audio features exposed?
>>
>>
>>
>> --
>> Alexandre Quessy
>> http://alexandre.quessy.net/
>>
>
>
>
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] Implementing save feature

2009-05-24 Thread Alexandre Quessy
ry.add(get_actor(item))
>>         for scene_id in savedata['scene_walkmaps']:
>>             set_walkmap(scene_id, savedata['scene_walkmaps'][scene_id])
>>         self.hidden_inventory = savedata['hidden_inventory']
>>         set_scene(savedata['current_scene'])
>
>
> On Fri, May 22, 2009 at 11:23 PM, Nevon  wrote:
>>
>> I'm currently part of a group developing a FOSS point-and-click
>> adventure game using Python and Pygame. The game engine is actually a
>> fork of the engine used in the game Colonel Wiljafjord and the
>> Tarbukas Tyranny, and entry in Pyweek #3. Right now we're working on
>> improving the engine in whatever way we can. If you're interested, the
>> source is available here:
>> http://github.com/kallepersson/subterranean/tree/master.
>>
>> So now I'd like to implement a save/load feature, but I don't really
>> know where to start. I have no idea how game save systems are usually
>> constructed, so I'm kind of lost. If anyone has any ideas, links to
>> resources, or pointers on how to best do this, please share.
>>
>> Thank you!
>>
>> Tommy Brunn
>> http://www.blastfromthepast.se/blabbermouth
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] audio programming with pygame?

2009-05-23 Thread Alexandre Quessy
Hi,
ChucK is also an awesome language for sound synthesis. It uses the STK library.
I can't wait until there is a STK Python binding !

a

2009/5/23 Olaf Nowacki :
> maybe you would like to try supercollider for making the synthesizers and
> use pygame as UI?
>
> http://pypi.python.org/pypi/SC/0.2/
> http://supercollider.sourceforge.net/
>
> On Fri, May 22, 2009 at 11:02 PM, machinim...@gmail.com
>  wrote:
>>
>> hi,
>>
>> i would like to learn how to program simple synthesizers and sound effects
>> and it would be nice if i could experiment with this in python.
>>
>> http://en.wikipedia.org/wiki/Jeskola_Buzz
>> would something like buzz theoretically be possible with pygame?
>>
>> of course python is slow but if buzz was able to handle hundreds of
>> machines on the hardware of 10 years ago then a hand full should be possible
>> in python today?
>>
>> is low level sound programming possible with pygame at all or are only
>> higher level audio features exposed?



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] Camera module change proposal

2009-05-18 Thread Alexandre Quessy
Hello Nirav,

For #1, I can say that YUV colorspace is much faster than RGB to
upload to the graphic card when using OpenGL. If for now it is only
RGB that is implemented, it would surely be nice to have the
possibilty to use YUV directly in a near future.

For #2, on Mac OS X, there is at least the "Quicktime Dialog" that can
offer a lot of fine controls on the image source and quality. It
surely should be implemented in the first place.

Regards,

a



2009/5/18 Nirav Patel :
> Hello all,
>
> With 1.9 coming out soon, I think it is best that we decide on a final
> API for the camera module to use going forward.  The current module
> was designed largely for v4l2 on low performance fixed point CPUs, and
> the API reflects that.  With OS X support coming this summer from
> Werner, and Windows support coming soon, we should decide on something
> that works well across all platforms.
>
> 1.  Remove colorspace conversion from the camera module:
> Currently, the camera module can "capture" images as RGB, YUV, or HSV.
>  There are a lot of conversion shortcuts going on under the hood to
> get the quickest path from raw pixel data to the desired colorspace.
> Unfortunately, this also multiplies the amount of code and work
> necessary to bring the camera module to other platforms.  The use
> cases for this feature are also fairly limited, since anyone doing
> serious computer vision is better off using OpenCV.  I propose having
> the camera module do the more relevant task of just capturing RGB
> images, and have a seperate colorspace conversion function, either the
> transform or the color module, which takes any RGB surface and outputs
> an HSV or YUV surface.
>
> 2.  Camera controls:
> I'm not sure what to do here.  V4l2 controls are very useful to have,
> but there doesn't seem to be a Windows or OS X equivalent as far as I
> can tell.
>
> Any ideas on either?
>
> Nirav
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] SDL_ffmpeg vs ffmpeg

2009-05-13 Thread Alexandre Quessy
Hi everyone,
Don't worry, Tyler and Lenard. I am glad if I can help you guys
developing a better support for such formats in Pygame. I really think
it worths it for the reason I mentioned earlier.

Here is an example of a motion-JPEG movie file :
http://toonloop.com/static/black_duck.mov It was made with ToonLoop, a
Python application using Pygame. (exporting JPEG and using mencoder to
convert it to Motion-JPEG)

I will most likely set up a Windows box this summer, for
cross-platform development. For now, I only have Linux and Mac
computers around. I can test on those platform any code you ask me to
test. I know C and C++ as well.

Cheers,

a

2009/5/12 Lenard Lindstrom :
> Hi Tyler,
>
> If licensing permits, an existing ffplay could be included with Pygame on
> Windows. It would likely support more codecs than anything I would build.
> For some reason my first build attempt omitted ffplay.
>
> Lenard
>
> Tyler Laing wrote:
>>
>> Lenard, Rene, and anyone else that is concerned, I was considering that
>> ffplay could be distributed as a statically built executable, so the movie
>> module can, in the worst case scenario, fall back on a working movie player
>> that it knows about, and exactly where it is located. This lessens the need
>> for the user to have vlc, mplayer, or any other video player installed.
>>
>> -
>
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] SDL_ffmpeg vs ffmpeg

2009-05-10 Thread Alexandre Quessy
gt;> If I went with ffmpeg, I was considering a design where we explicitly
>>>> convert the movie from YUV to RGB, with a simple convert function. From the
>>>> point its called, to the point it is called again, the movie is in RGB
>>>> format. It fits with the python philosophy that "Explicit is better than
>>>> implicit." (-The Zen of Python, by Tim Peters)
>>>>
>>>> Personally, I would prefer to work with ffmpeg, because of the greater
>>>> functionality, and the lack of conversion performance hit.
>>>>
>>>> -Tyler
>>>>
>>>> --
>>>> Visit my blog at http://oddco.ca/zeroth/zblog
>>>
>>
>>
>>
>> --
>> Visit my blog at http://oddco.ca/zeroth/zblog
>
>
>
> --
> Visit my blog at http://oddco.ca/zeroth/zblog
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] SDL_ffmpeg vs ffmpeg

2009-05-07 Thread Alexandre Quessy
ython's
>>               reputation already for being slow, having a movie
>>        module take
>>               that kind of hit will result in a further stain to the
>>               reputation, when sometimes, rarely, movies stutter or pause
>>               when they shouldn't. It can take a long time to recover
>>        from a
>>               negative reputation.
>>
>>               For ffmpeg, it offers much the same capability, but without
>>               the SDL conveniences. It does offer far more capability
>>        with
>>               movie files than SDL_ffmpeg does though. I think, but
>>        I'm not
>>               sure, that the pygame surfaces do not need to have the
>>        frames
>>               of the movie be in YUV format? Or its a quick operation to
>>               convert the surface for YUV then back to RGB. Something
>>        like
>>               that, correct me if I'm wrong. So we don't need every
>>        frame to
>>               be converted to RGB, except when we do need it.
>>
>>               If I went with ffmpeg, I was considering a design where we
>>               explicitly convert the movie from YUV to RGB, with a simple
>>               convert function. From the point its called, to the
>>        point it
>>               is called again, the movie is in RGB format. It fits
>>        with the
>>               python philosophy that "Explicit is better than implicit."
>>               (-The Zen of Python, by Tim Peters)
>>
>>               Personally, I would prefer to work with ffmpeg, because
>>        of the
>>               greater functionality, and the lack of conversion
>>        performance hit.
>>
>>               -Tyler
>>
>>               --        Visit my blog at http://oddco.ca/zeroth/zblog
>>
>>
>>
>>
>>
>>        --        Visit my blog at http://oddco.ca/zeroth/zblog
>>
>>
>>
>>
>>
>> --
>> Visit my blog at http://oddco.ca/zeroth/zblog
>
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


[pygame] Camera module roadmap

2009-04-26 Thread Alexandre Quessy
Hi all,
(esp. Nirav, René and Chelsea)
I am interested in getting involved in the pygame camera module, since
I use it for my stop motion software ToonLoop I am developing with
Tristan Matthews. See http://toonloop.com : and yes, I think ToonLoop
is a great free software to test the pygame.camera module with, if you
don't installing Twisted. Creating a cross-platform application is my
main concern, and I feel like there is a lack of cross-platform C
libraries for having a live camera input. Anyways, Python is the way
to go for such a high-level software like mine. I am not so much of an
expert in C, but I can help with the software architecture.

Mac : So, the Mac version uses the OpenCV wrapper for now ? I have
read on Nirav's blog that py-objective-C wasn't well maintained enough
? Does that mean we will stick with the OpenCV camera wrapper this
summer, Chelsea ? Are there build/install instructions for Mac ? It
seems like the camera API is slightly different between Mac and
GNU/Linux. At the end of this email, I provide two code snippets which
illustrates those differences. It's when we initiate the camera, and
when copying a surface from it to a list of surfaces.

Linux : On GNU/Linux, I am having success with v4l2 inputs. What is
the state of the v4l ones ? Has it been reported to work for some
users ? Any plan to support raw1394 cameras ? (libdc1394) When is it
planned to release a .deb with pygame containing the camera module ?
What is the state of your computer vision tools for Pygame, Nirav ?

Windows : What is the state of the camera module on Windows ? The
vidcap module was reported to be working, (Feb 2009) but will it be
officially part of pygame, or should it be using an other tool/driver
?

Any chances I can make py2app and py2exe applications with
pygame.camera support before the end of the summer ?

Thank you !!
--
  Differences between the pygame.camera in Mac v/s GNU/Linux
--
### Initiating the camera ##
video_device_num = 0
size = (320, 240)
if self.IS_MAC:
print "Using camera %s" % (video_device_num)
self.camera = pygame.camera.Camera(video_device_num, size)
else:
print "Using camera /dev/video%d" % (video_device_num)
self.camera = pygame.camera.Camera("/dev/video%d" %
(video_device_num), size)
### Grabbing an image ###
if self.IS_MAC:
self.shot.images.append(self.most_recent_image.copy())
else:
self.shot.images.append(self.most_recent_image)

-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] BUG: JPEG colors saving a pygame.camera surface

2009-04-24 Thread Alexandre Quessy
Here is a screen shot :
http://www.toonloop.com/?q=support

Since that shot, I added a GLSL chroma key.

a

2009/4/20 Nirav Patel :
> Err, oops, I should have proofread that.  It should state:
>
> camlist = camera.list_cameras()
> if len(camlist) > 0:
>  cam = camera.Camera(camlist[0])
>
> Just a caveat though.  The way list_cameras is currently set up, it
> will also detect v4l cameras, which are not actually supported.  I
> will most likely remove this feature before the 1.9 release.
>
> Nirav
>
> On Mon, Apr 20, 2009 at 11:04 AM, Nirav Patel  wrote:
>> I'm not sure what it would be without seeing the error output, but
>> there is a way around that.  camera.list_cameras() will return a list
>> of the cameras plugged into the computer. If the list is empty, you
>> know it found no cameras.  You could use it as follows:
>>
>> camlist = camera.list_cameras()
>> if len(cameras) > 0:
>>  cam = camera.Camera(camlist[0])
>>
>> Nirav
>>
>> On Mon, Apr 20, 2009 at 9:46 AM, Alexandre Quessy  
>> wrote:
>>> Hello René,
>>> We save frames in lists. You can take a frame either by pressing space
>>> bar, or using an intervalometer. (for timelapses) The right region of
>>> the display shows the resulting animation in a loop. (for now) The
>>> left region shows the current video input, plus an optional onion skin
>>> of the last recorded frame. A screen shot will be online soon.
>>>
>>> By the way, there is an other bug. With V4L2, if there is no camera
>>> plugged-in, sometimes, I get a null pointer error and it says "Pygame
>>> parachute", or something. And then it crashes. I have heard it's v4l2
>>> that is a bit flaky, but that some higher-level wrapper, such as
>>> Gstreamer, make sure things don't crash when using v4l2. Of course,
>>> bugs are not reproducable when you need them (so that I could
>>> copy-paste the output here)
>>>
>>> a
>>>
>>>
>>>
>>> 2009/4/19 René Dudfield :
>>>> looks pretty cool :)
>>>>
>>>> How does it work?
>>>>
>>>> I imagine you can take snapshots, and then do playbacks?  Or can you do a
>>>> video recording too?  So in video mode, it'd take snapshots at a given 
>>>> frame
>>>> rate.
>>>>
>>>> Are there any screen shots?
>>>>
>>>>
>>>>
>>>>
>>>> On Sat, Apr 18, 2009 at 12:54 PM, Alexandre Quessy 
>>>> wrote:
>>>>>
>>>>> Problem solved !!
>>>>> Thanks a lot Nirav.
>>>>>
>>>>> If you want to try toonloop, you can checkout the code and run it.
>>>>> The installation instructions for Ubuntu are in here :
>>>>> http://code.google.com/p/toonloop/source/browse/trunk/doc/INSTALL.txt
>>>>>
>>>>> Try ./toonloop.py --help for startup flags, and press "h" while it is
>>>>> running for instructions.
>>>>> It needs a valid pygame camera, of course.
>>>>> See http://toonloop.com for more informations.
>>>>> We need beta testers too. And I think this is a wonderful application
>>>>> of pygame.camera.
>>>>>
>>>>> a
>>>>>
>>>>> 2009/4/17 Nirav Patel :
>>>>> > Also, forgot to mention this, but thanks for using the camera module!
>>>>> > It has yet to experience widespread use, so this kind of beta testing
>>>>> > is great to get it ready for the next pygame release.
>>>>> >
>>>>> > Nirav
>>>>> >
>>>>> > On Fri, Apr 17, 2009 at 11:17 AM, Nirav Patel 
>>>>> > wrote:
>>>>> >> Ah yes, this seems to be a bug in both JPEG saving and in the camera
>>>>> >> module.  Fun stuff.
>>>>> >>
>>>>> >> The JPEG assumes that any 24 bit surface is going to be in the exact
>>>>> >> color order that it expects.  Which is fine, except that the default
>>>>> >> color order for a 24 bit Surface is not that.
>>>>> >>
>>>>> >> This also led me to find a bug in the camera module though, where if
>>>>> >> you are using a 24 bit surface, it will assume you want the default
>>>>> >> color order, regardless of if you hand it a Surface to use that has a
>>>>> >&

Re: [pygame] BUG: JPEG colors saving a pygame.camera surface

2009-04-20 Thread Alexandre Quessy
Hello René,
We save frames in lists. You can take a frame either by pressing space
bar, or using an intervalometer. (for timelapses) The right region of
the display shows the resulting animation in a loop. (for now) The
left region shows the current video input, plus an optional onion skin
of the last recorded frame. A screen shot will be online soon.

By the way, there is an other bug. With V4L2, if there is no camera
plugged-in, sometimes, I get a null pointer error and it says "Pygame
parachute", or something. And then it crashes. I have heard it's v4l2
that is a bit flaky, but that some higher-level wrapper, such as
Gstreamer, make sure things don't crash when using v4l2. Of course,
bugs are not reproducable when you need them (so that I could
copy-paste the output here)

a



2009/4/19 René Dudfield :
> looks pretty cool :)
>
> How does it work?
>
> I imagine you can take snapshots, and then do playbacks?  Or can you do a
> video recording too?  So in video mode, it'd take snapshots at a given frame
> rate.
>
> Are there any screen shots?
>
>
>
>
> On Sat, Apr 18, 2009 at 12:54 PM, Alexandre Quessy 
> wrote:
>>
>> Problem solved !!
>> Thanks a lot Nirav.
>>
>> If you want to try toonloop, you can checkout the code and run it.
>> The installation instructions for Ubuntu are in here :
>> http://code.google.com/p/toonloop/source/browse/trunk/doc/INSTALL.txt
>>
>> Try ./toonloop.py --help for startup flags, and press "h" while it is
>> running for instructions.
>> It needs a valid pygame camera, of course.
>> See http://toonloop.com for more informations.
>> We need beta testers too. And I think this is a wonderful application
>> of pygame.camera.
>>
>> a
>>
>> 2009/4/17 Nirav Patel :
>> > Also, forgot to mention this, but thanks for using the camera module!
>> > It has yet to experience widespread use, so this kind of beta testing
>> > is great to get it ready for the next pygame release.
>> >
>> > Nirav
>> >
>> > On Fri, Apr 17, 2009 at 11:17 AM, Nirav Patel 
>> > wrote:
>> >> Ah yes, this seems to be a bug in both JPEG saving and in the camera
>> >> module.  Fun stuff.
>> >>
>> >> The JPEG assumes that any 24 bit surface is going to be in the exact
>> >> color order that it expects.  Which is fine, except that the default
>> >> color order for a 24 bit Surface is not that.
>> >>
>> >> This also led me to find a bug in the camera module though, where if
>> >> you are using a 24 bit surface, it will assume you want the default
>> >> color order, regardless of if you hand it a Surface to use that has a
>> >> different color order.
>> >>
>> >> I commited the one line fix for JPEG, which just does an additional
>> >> check to see if it needs to create a new surface or not.  Please test
>> >> it if you can.  The fix for the camera module may take longer, as I
>> >> need to rethink some assumptions, though in the vast majority of use
>> >> cases, users should not be effected.
>> >>
>> >> Nirav
>> >>
>> >> On Fri, Apr 17, 2009 at 9:48 AM, René Dudfield 
>> >> wrote:
>> >>> Hi,
>> >>>
>> >>> can you please let me know the result of:
>> >>>
>> >>> cam_surf = X
>> >>> normal_surf = pygame.Surface((1,1))
>> >>> surfs = cam_surf, normal_surf
>> >>>
>> >>> for s in surfs:
>> >>>     print s.get_losses(), s.get_masks(), s.get_shifts()
>> >>>
>> >>> I think maybe the jpeg saving code isn't respecting one of those.
>> >>> Actually... don't worry, I'm pretty sure that's the cause of it.
>> >>> Will fix
>> >>> soon.
>> >>>
>> >>> cheers,
>> >>>
>> >>>
>> >>>
>> >>> On Fri, Apr 17, 2009 at 11:14 PM, Alexandre Quessy
>> >>> 
>> >>> wrote:
>> >>>>
>> >>>> Hello Pygame people,
>> >>>> This is my first post on this list, and more might follow since I am
>> >>>> using pygame for ToonLoop, a stop motion software. The new
>> >>>> pygame.camera module works for me and this is very good job. Thanks
>> >>>> for contributing that !
>> >>>>
>> >>>> I think I found a bug ! Hopefully it is only my code that is wro

Re: [pygame] BUG: JPEG colors saving a pygame.camera surface

2009-04-17 Thread Alexandre Quessy
Allo René,
Here the output of that command, as requested. Maybe it is not more
needed, though.
Their output is the same.

(0, 0, 0, 8) (16711680, 65280, 255, 0) (16, 8, 0, 0)
(0, 0, 0, 8) (16711680, 65280, 255, 0) (16, 8, 0, 0)

a

2009/4/17 René Dudfield :
> Hi,
>
> can you please let me know the result of:
>
> cam_surf = X
> normal_surf = pygame.Surface((1,1))
> surfs = cam_surf, normal_surf
>
> for s in surfs:
>     print s.get_losses(), s.get_masks(), s.get_shifts()
>
> I think maybe the jpeg saving code isn't respecting one of those.
> Actually... don't worry, I'm pretty sure that's the cause of it.   Will fix
> soon.
>
> cheers,
>
>
>
> On Fri, Apr 17, 2009 at 11:14 PM, Alexandre Quessy 
> wrote:
>>
>> Hello Pygame people,
>> This is my first post on this list, and more might follow since I am
>> using pygame for ToonLoop, a stop motion software. The new
>> pygame.camera module works for me and this is very good job. Thanks
>> for contributing that !
>>
>> I think I found a bug ! Hopefully it is only my code that is wrong and
>> this is easy to fix.
>>
>> When I save a Pygame surface that I obtained using pygame.camera to a
>> JPEG using pygame.image.save, the colors are messed up. It looks like
>> the red and blue channels are interchanged. Thus, maybe my surface is
>> RBG, whereas pygame.image expects RGB. A camera image doesn't contain
>> any alpha channel usually.
>>
>> When I display the surface as a pygame sprite the colors are OK.
>> When I display the surface as an OpenGL texture the colors are OK.
>> (using tostring(surface, "RGBX", True))
>> When I save the surface as an other format such as PNG or BMP the colors
>> are OK.
>> When I use a surface obtained by loading a JPG image, the colors are OK.
>> The bug only occurs when I save a surface obtained using the
>> pygame.camera module.
>> It consistently happened on 3 Linux computers.
>>
>> I use Pygame compiled from today's SVN with Python 2.5.2 on Ubuntu
>> GNU/Linux 8.10 using a V4L2 device. (a WinTV card)
>>
>> A short code snippet to reproduce the bug:
>> http://rafb.net/p/gccaJG37.html
>>
>> A JPEG to see how the output looks like :
>> http://toonloop.com/static/tmp/image_color_test_out.jpg
>> A correct image in an other format to compare :
>> http://toonloop.com/static/tmp/image_color_test_out.png
>>
>> If you want to download the code and the test image I use :
>> http://toonloop.com/static/tmp/bug_color_jpeg.tar.gz
>> I also convert the colorbars.jpg files to surface and back to a JPG
>> file for comparison. It works flawlessly.
>>
>> --
>> Alexandre Quessy
>> http://alexandre.quessy.net/
>
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


Re: [pygame] BUG: JPEG colors saving a pygame.camera surface

2009-04-17 Thread Alexandre Quessy
Problem solved !!
Thanks a lot Nirav.

If you want to try toonloop, you can checkout the code and run it.
The installation instructions for Ubuntu are in here :
http://code.google.com/p/toonloop/source/browse/trunk/doc/INSTALL.txt

Try ./toonloop.py --help for startup flags, and press "h" while it is
running for instructions.
It needs a valid pygame camera, of course.
See http://toonloop.com for more informations.
We need beta testers too. And I think this is a wonderful application
of pygame.camera.

a

2009/4/17 Nirav Patel :
> Also, forgot to mention this, but thanks for using the camera module!
> It has yet to experience widespread use, so this kind of beta testing
> is great to get it ready for the next pygame release.
>
> Nirav
>
> On Fri, Apr 17, 2009 at 11:17 AM, Nirav Patel  wrote:
>> Ah yes, this seems to be a bug in both JPEG saving and in the camera
>> module.  Fun stuff.
>>
>> The JPEG assumes that any 24 bit surface is going to be in the exact
>> color order that it expects.  Which is fine, except that the default
>> color order for a 24 bit Surface is not that.
>>
>> This also led me to find a bug in the camera module though, where if
>> you are using a 24 bit surface, it will assume you want the default
>> color order, regardless of if you hand it a Surface to use that has a
>> different color order.
>>
>> I commited the one line fix for JPEG, which just does an additional
>> check to see if it needs to create a new surface or not.  Please test
>> it if you can.  The fix for the camera module may take longer, as I
>> need to rethink some assumptions, though in the vast majority of use
>> cases, users should not be effected.
>>
>> Nirav
>>
>> On Fri, Apr 17, 2009 at 9:48 AM, René Dudfield  wrote:
>>> Hi,
>>>
>>> can you please let me know the result of:
>>>
>>> cam_surf = X
>>> normal_surf = pygame.Surface((1,1))
>>> surfs = cam_surf, normal_surf
>>>
>>> for s in surfs:
>>>     print s.get_losses(), s.get_masks(), s.get_shifts()
>>>
>>> I think maybe the jpeg saving code isn't respecting one of those.
>>> Actually... don't worry, I'm pretty sure that's the cause of it.   Will fix
>>> soon.
>>>
>>> cheers,
>>>
>>>
>>>
>>> On Fri, Apr 17, 2009 at 11:14 PM, Alexandre Quessy 
>>> wrote:
>>>>
>>>> Hello Pygame people,
>>>> This is my first post on this list, and more might follow since I am
>>>> using pygame for ToonLoop, a stop motion software. The new
>>>> pygame.camera module works for me and this is very good job. Thanks
>>>> for contributing that !
>>>>
>>>> I think I found a bug ! Hopefully it is only my code that is wrong and
>>>> this is easy to fix.
>>>>
>>>> When I save a Pygame surface that I obtained using pygame.camera to a
>>>> JPEG using pygame.image.save, the colors are messed up. It looks like
>>>> the red and blue channels are interchanged. Thus, maybe my surface is
>>>> RBG, whereas pygame.image expects RGB. A camera image doesn't contain
>>>> any alpha channel usually.
>>>>
>>>> When I display the surface as a pygame sprite the colors are OK.
>>>> When I display the surface as an OpenGL texture the colors are OK.
>>>> (using tostring(surface, "RGBX", True))
>>>> When I save the surface as an other format such as PNG or BMP the colors
>>>> are OK.
>>>> When I use a surface obtained by loading a JPG image, the colors are OK.
>>>> The bug only occurs when I save a surface obtained using the
>>>> pygame.camera module.
>>>> It consistently happened on 3 Linux computers.
>>>>
>>>> I use Pygame compiled from today's SVN with Python 2.5.2 on Ubuntu
>>>> GNU/Linux 8.10 using a V4L2 device. (a WinTV card)
>>>>
>>>> A short code snippet to reproduce the bug:
>>>> http://rafb.net/p/gccaJG37.html
>>>>
>>>> A JPEG to see how the output looks like :
>>>> http://toonloop.com/static/tmp/image_color_test_out.jpg
>>>> A correct image in an other format to compare :
>>>> http://toonloop.com/static/tmp/image_color_test_out.png
>>>>
>>>> If you want to download the code and the test image I use :
>>>> http://toonloop.com/static/tmp/bug_color_jpeg.tar.gz
>>>> I also convert the colorbars.jpg files to surface and back to a JPG
>>>> file for comparison. It works flawlessly.
>>>>
>>>> --
>>>> Alexandre Quessy
>>>> http://alexandre.quessy.net/
>>>
>>>
>>
>



-- 
Alexandre Quessy
http://alexandre.quessy.net/


[pygame] BUG: JPEG colors saving a pygame.camera surface

2009-04-17 Thread Alexandre Quessy
Hello Pygame people,
This is my first post on this list, and more might follow since I am
using pygame for ToonLoop, a stop motion software. The new
pygame.camera module works for me and this is very good job. Thanks
for contributing that !

I think I found a bug ! Hopefully it is only my code that is wrong and
this is easy to fix.

When I save a Pygame surface that I obtained using pygame.camera to a
JPEG using pygame.image.save, the colors are messed up. It looks like
the red and blue channels are interchanged. Thus, maybe my surface is
RBG, whereas pygame.image expects RGB. A camera image doesn't contain
any alpha channel usually.

When I display the surface as a pygame sprite the colors are OK.
When I display the surface as an OpenGL texture the colors are OK.
(using tostring(surface, "RGBX", True))
When I save the surface as an other format such as PNG or BMP the colors are OK.
When I use a surface obtained by loading a JPG image, the colors are OK.
The bug only occurs when I save a surface obtained using the
pygame.camera module.
It consistently happened on 3 Linux computers.

I use Pygame compiled from today's SVN with Python 2.5.2 on Ubuntu
GNU/Linux 8.10 using a V4L2 device. (a WinTV card)

A short code snippet to reproduce the bug:
http://rafb.net/p/gccaJG37.html

A JPEG to see how the output looks like :
http://toonloop.com/static/tmp/image_color_test_out.jpg
A correct image in an other format to compare :
http://toonloop.com/static/tmp/image_color_test_out.png

If you want to download the code and the test image I use :
http://toonloop.com/static/tmp/bug_color_jpeg.tar.gz
I also convert the colorbars.jpg files to surface and back to a JPG
file for comparison. It works flawlessly.

-- 
Alexandre Quessy
http://alexandre.quessy.net/