[IMAGE-SIG] Interlaced images?

Fredrik Lundh fredrik@pythonware.com
Fri, 5 Dec 1997 11:49:28 +0100


>Is there any modules for handling interlaced images?  For example
>calling split() on an image could give you 2 images, one being
>the top field (even lines) and the other being the bottom field (odd
>lines) =20

Just use use the transform method:

def getfield(im, field=3D0):
    x, y =3D im.size
    if field:
        box =3D (0, 0.5, x, y+0.5)
    else:
        box =3D (0, -0.5, x, y-0.5)
    return im.transform((x, y/2), Image.EXTENT, box)

>On a related note, by now someone must have written a ImageFile class
>for handling YUV (or YCbCr) images in 4:2:0 or 4:2:2,  right?

Hmm. You can actually handle the YUV=3D>RGB mapping via a "colour
twist" transform, but there's no code in there to handle subsampled
video modes.  Maybe there's something in the standard "imageop"
module that could be used together with tostring/fromstring...  if you
cannot sort it out yourself, mail me a format description and a sample
or two, and I'll see what I can do.

Cheers /F
fredrik@pythonware.com
http://www.pythonware.com


_______________
IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org
_______________