Page 1 of 1

Dividing bitmap in two; odd / even line (interlaced) images?

Posted: 2010-08-31T08:50:40-07:00
by eesutton
Can ImageMagick divide an image into odd-line and even-line image files (interlaced) ?

Background
----------------

Basically I want to created odd and even interlace fields from a single image for the purpose of testing encoding techniques, encoding each field separately, then software deinterlacing to recombine the odd/even fields for subjective quality analysis of camera video. I want to decode and put the two fields back together and compare quality to the original. I could write a utility to split an image pretty quickly but every time I think about doing this I learn that ImageMagick already does this.

Thanks in advance for any examples or direction,

-Ed

PS: I apologize if this appeared twice. I was having trouble joining the mailing list and then I re-discovered this server.

Re: Dividing bitmap in two; odd / even line (interlaced) ima

Posted: 2010-08-31T10:45:20-07:00
by fmw42

Re: Dividing bitmap in two; odd / even line (interlaced) ima

Posted: 2010-09-03T19:12:58-07:00
by Drarakel
Not sure if ImageMagick has some simple options for handling interlaced video frames. (Probably not?)
A workaround for just extracting the two fields would be (example with a 720x576 PAL frame):

Code: Select all

convert frame.png -depth 8 rgb:- | convert -depth 8 -size 1440x288 rgb:- -crop 50%x100%+0+0 +repage even.png
convert frame.png -depth 8 rgb:- | convert -depth 8 -size 1440x288 rgb:- -gravity northeast -crop 50%x100%+0+0 +repage odd.png
(Of course, one could make a script that works for all input files.)

Re: Dividing bitmap in two; odd / even line (interlaced) ima

Posted: 2010-09-07T05:10:33-07:00
by eesutton
Excellent! Thank you very much for the examples!

-Ed

Re: Dividing bitmap in two; odd / even line (interlaced) ima

Posted: 2010-09-07T07:03:12-07:00
by anthony
A tricky solution but if you followed the link provided, the better way was a image operation to just ignore every second line... EG use -sample 100x50%\!

If you want the other half, roll the image by one pixel first.

I repeat the link again...
IM Examples, Video Handling, Deinterlacing
http://www.imagemagick.org/Usage/video/#deinterlace

Re: Dividing bitmap in two; odd / even line (interlaced) ima

Posted: 2010-09-07T07:20:30-07:00
by eesutton
Thanks. I will revisit that page again and try to make sense of it.

Thanks again,

-Ed