comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: More Details on MPEG color problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: More Details on MPEG color problem [message #12081] Mon, 29 June 1998 00:00
menakkis is currently offline  menakkis
Messages: 37
Registered: June 1998
Member
boccio@swarthmore.edu (John Boccio) wrote:
> Let me elaborate on the MPEG color problem.

<He gave routines showing how he saved a coloured .mpg file built from 1-band
paletted images using Xinteranimate, and how he couldn't get this to work
using the MPEG_ calls directly.>

I had a quick glance through IDL's MPEG_ routines (the code), and could see no
means to provide a colour table to go along with single-band images. I also
had a fruitless look at the docs on the IDLgrMPEG object in search of any
obvious mention of colour tables. (Is that even its right name? - I'm a
stranger to IDL object graphics!)

I believe that the MPEG routines will only write grey images if given
single-band imput, and that the only way to get colour out of them is to
provide 3-band truecolour images.

A look through cw_animate.pro confirmed this. (cw_animate.pro is called by
xinteranimate.pro.) cw_animate is rather smart when it comes to grabbing
images from the animation pixmaps to save as mpeg animations. If your screen
is true or directcolour then it will grab in truecolour. (It'll translate
directcolour to truecolour through the current LUTs.) If pseudocolour
(8-bit) then it will grab 8-bit, load the current colour tables, and
translate the grabs through the colour tables to get truecolour images.

In other words, cw_animate saves mpeg in truecolour by main force. You will
have to do the same if working with single-band images.

e.g., say you had your desired colour table (a full 256-element table) in the
arrays RED, GREEN and BLUE, and that you were preparing byte images in the
array IMG(128,128). Firstly, set up an array for a colour image:
CIMG=bytarr(3,128,128). Then in your loop, fill it with:
CIMG[0,0,0]=reform(RED[img],1,128,128)
&CIMG[1,0,0]=reform(GREEN[img],1,128,128)
&CIMG[2,0,0]=reform(BLUE[img],1,128,128) And then specify CIMG in your
MPEG_PUT statement.


Peter Mason
(PS here's hoping that my news poster doesn't trash the formatting in this
post.)

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Help on Krig2d
Next Topic: [Q]Reading XDR format in C on Macintosh?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 16:34:10 PDT 2025

Total time taken to generate the page: 1.18045 seconds