[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] colorspace and other vision functions, where do they belong?



hi,

nice work.

I think the colorspace stuff should go in the color module too.  What
do you think Marcus?  The main difference is that the Color type works
on one pixel at a time -- whereas the colorspace function would work
on a surface at a time.

I think the optical flow stuff could go in transform for now, and we
can decide where it goes finally in the pygame 1.9 release.  I think
at that stage we will have a better idea of what the functions are and
where they can go.


here's some todo's for the camera module:
- unittests
- separate out v4l2 specific stuff.
    - camera.c
    - camera_v4l2.c  camera_quicktime.c camera_directshow.c  ... etc
- keep python wrappers separate from C code.
    - we are doing this separation for all stuff in pygame 1.9.
        - at the moment pygame doesn't follow this for all
functionality, but mostly non-python-wrapping code is kept separate.
        - So the C stuff can be used outside of the CPython wrappers.
    - eg, the PyCameraObject stuff should be kept separate.
        - rgb_to_hsv24 (PyCameraObject* self, const void* src, void* dst)
            - rgb_to_hsv24 (CameraObject* self, const void* src, void* dst)
        - Probably have a separate camera structure which
PyCameraObject refers to.
- enumerating available cameras.
    - get a list of cameras that are available to initialise.
    - like how the joystick module can return what joysticks are available.


cheers,




On Fri, Jun 27, 2008 at 11:37 AM, Nirav Patel <olpc@xxxxxxxxxxxxxx> wrote:
> Hello all,
>
> I've added support for outputting different colorspaces from the
> camera, and a Mask.get_centroid() to my pygame branch:
> http://git.n0r.org/?p=pygame-nrp;a=summary
>
> With the functions I'm writing now, I'm not sure what modules they
> would belong in, or if they should be in a new module.  The functions
> are things like converting the colorspace of a whole Surface, and
> computing optical flow between two surfaces.  It makes sense that the
> colorspace stuff would go in the color module, except that that module
> is currently just for the Color class.  Optical flow could go in
> transform, but it's not really a transform (though neither is
> threshold, which is in it).
>
> The colorspaces function would basically be as follows:
>
> colorspace(Surface, colorspace, colorspace) returns Surface, where the
> starting and ending colorspace is "RGB" "YUV" or "HSV".
>
> Nirav
>