Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38720] |
Fri, 26 March 2004 13:10 |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
"David Fanning" wrote...
> Karl Schultz writes:
>
>> Besides, I gave up on VCR's and am now using a TiVo. :-)
>
> I haven't owned a television in over 15 years, I guess.
> But I was visiting my mother a week or so ago, and she
> has DirectTV. My goodness, I had no idea there were
> so many channels, all filled with crap!
This is precisely why you *need* a TiVo or ReplayTV (my PVR of choice). I
haven't watched a bad television show since I bought my Replay! ( Well,
occasionally I do have to sit thru one of my Wife's shows ;)
I think you'll wish you had one up in Deadhorse since there doesn't seem to
be a lot to do outside.
-Rick
|
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38726 is a reply to message #38724] |
Fri, 26 March 2004 11:13  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Karl Schultz writes:
> Besides, I gave up on VCR's and am now using a TiVo. :-)
I haven't owned a television in over 15 years, I guess.
But I was visiting my mother a week or so ago, and she
has DirectTV. My goodness, I had no idea there were
so many channels, all filled with crap!
Anyway, I thought I might watch a game late one night, so
I picked up one of the (many!) remote controllers and
starting clicking like mad, but the channel would only
change intermittently, and then in really weird ways.
Finally, I had to call my youngest son in to figure out
what was wrong. "Uh, Dad, you have to point it at *this*
thing, not *that* thing." Oh... :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38727 is a reply to message #38726] |
Fri, 26 March 2004 10:33  |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1ace1fc69e93828198971c@news.frii.com...
> David Fanning writes:
>
>> Karl might be the second person in the world (at least
>> among my acquaintances) that has managed to get a
>> DirectColor visual working correctly. Surely this
>> ranks up there with programming the VCR for the rest
>> of us!
>
> And even if you did get it to run on your machine,
> you *know* it ain't gonna run on your bosses machine!!
There's some truth to that...
I did my test on a machine that could support 24 and 8 bit deep windows at
the same time and had multiple hardware colormaps, so there were no
"flashing" effects. On a machine without such support, you would have to go
through a lot of trouble to prevent these problems or just give up and go
back to TrueColor. Unless you are doing palette animations or other palette
tricks, TrueColor is often a lot easier to deal with. In general, it is
pretty hard to write X applications (IDL or not) that use more than a
handful of colors, don't cause colormap flashing, and run on all possible X
visual configurations. I had thought I would offer the DirectColor approach
to Philip in case that would work well for him.
Besides, I gave up on VCR's and am now using a TiVo. :-)
Karl
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38729 is a reply to message #38727] |
Fri, 26 March 2004 10:09  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> Karl might be the second person in the world (at least
> among my acquaintances) that has managed to get a
> DirectColor visual working correctly. Surely this
> ranks up there with programming the VCR for the rest
> of us!
And even if you did get it to run on your machine,
you *know* it ain't gonna run on your bosses machine!!
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38730 is a reply to message #38729] |
Fri, 26 March 2004 10:07  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Karl Schultz writes:
> You can use a color table in this situation if your machine has a
> DirectColor visual.
Karl might be the second person in the world (at least
among my acquaintances) that has managed to get a
DirectColor visual working correctly. Surely this
ranks up there with programming the VCR for the rest
of us!
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38731 is a reply to message #38730] |
Fri, 26 March 2004 09:57  |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
You can use a color table in this situation if your machine has a
DirectColor visual.
You can check this by running the command 'xdpyinfo' and see if the X server
lists a DirectColor visual.
Another way is to issue 'HELP, /DEVICE' in IDL and see which visual you are
using. However, this may be affected by any DEVICE commands you may have in
an IDL startup file.
Anyway, I just sat down at a machine with a DirectColor 24-bit visual and
issued:
read_jpeg, FILEPATH('rose.jpg', SUBDIRECTORY=['examples','data']), image
v = 255 - BINDGEN(256)
tvlct, v, v, v
tv, image, /true
and I got the expected reverse-colored image.
There is also a useful note in the IDL documentation that discusses X
Windows visuals:
"IDL's color table does not map directly to a hardware color table for a
TrueColor visual. If IDL's color table is modified, for example
using the LOADCT or TVLCT routines, then the new color table will only take
effect for graphics that are drawn after it has been modified."
This makes sense because IDL cannot modify a static color map.
However, you do need to pay attention to the color table translation control
in the DEVICE command.
If you are using a TrueColor visual and you want to really apply a color
table while writing the image to the screen, issue
DEVICE, BYPASS_TRANSLATION=0
and then the above code will draw the reverse-colored image while using a
TrueColor visual.
The default setting for bypass_translation is a little complicated, but in
this case, the translation is bypassed for performance reasons. In most
cases, the true-color image is ready to be displayed without modification.
But you do get the choice of applying the color table to your image data
yourself, or letting IDL do it via the bypass_translation control in the
DEVICE command.
Karl
"Philip Kershaw" <p.j.kershaw@rl.ac.uk> wrote in message
news:c41n71$3ds@newton.cc.rl.ac.uk...
> Yes, I did need to check that I'd done that. The problem persisted but it
> seems I have a solution in that I actually apply the RGB stretch to the
> image itself.
>
> Thanks for your help,
> Phil
> "Antonio Santiago" <d6522117@est.fib.upc.es> wrote in message
> news:406441FD.6010606@est.fib.upc.es...
>> Maybe you forgot update your image with the new colors. As you see in
>> "color_example.pro" of the master Fanning, he cautch the event
>> "xcolors_load" and then does redraw the image.
>>
>> Bye :)
>>
>>
>> Philip Kershaw wrote:
>>> Hello,
>>>
>>> I'm developing a colour editor for use with an image display program
for
>>> Linux and Sun Solaris. I've found that when I update the colour table
> for
>>> an RGB image, the image display isn't updated. However, when I run
the
> same
>>> program under Windows 2000, the image IS updated as expected.
>>>
>>> I'm running IDL 6.0 set with
>>>
>>> Device, Decomposed=0
>>>
>>> The display is 24-bit in each case for Windows, Linux and Solaris
> platforms.
>>>
>>> When I alter the colour table I re-display the image using
>>>
>>> TV, image, True=3
>>>
>>> The image has dimensions (m, n, 3)
>>>
>>> As a test, I tried adapting one of Dave Fanning's programs (thank you
> for
>>> this!), "color_example.pro" to run loading the RGB image. Again, it
> works
>>> under Windows but not Linux or Solaris.
>>>
>>> Has anyone come across anything like this? Any ideas?
>>>
>>> With thanks,
>>> Phil
>>> ____________________________________________
>>>
>>> Philip Kershaw
>>> Space Science & Technology Department
>>> Rutherford Appleton Laboratory
>>> UK
>>> ____________________________________________
>>>
>>>
>>>
>>>
>>
>
>
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38732 is a reply to message #38731] |
Fri, 26 March 2004 08:54  |
Philip Kershaw
Messages: 5 Registered: March 2004
|
Junior Member |
|
|
Yes, I did need to check that I'd done that. The problem persisted but it
seems I have a solution in that I actually apply the RGB stretch to the
image itself.
Thanks for your help,
Phil
"Antonio Santiago" <d6522117@est.fib.upc.es> wrote in message
news:406441FD.6010606@est.fib.upc.es...
> Maybe you forgot update your image with the new colors. As you see in
> "color_example.pro" of the master Fanning, he cautch the event
> "xcolors_load" and then does redraw the image.
>
> Bye :)
>
>
> Philip Kershaw wrote:
>> Hello,
>>
>> I'm developing a colour editor for use with an image display program for
>> Linux and Sun Solaris. I've found that when I update the colour table
for
>> an RGB image, the image display isn't updated. However, when I run the
same
>> program under Windows 2000, the image IS updated as expected.
>>
>> I'm running IDL 6.0 set with
>>
>> Device, Decomposed=0
>>
>> The display is 24-bit in each case for Windows, Linux and Solaris
platforms.
>>
>> When I alter the colour table I re-display the image using
>>
>> TV, image, True=3
>>
>> The image has dimensions (m, n, 3)
>>
>> As a test, I tried adapting one of Dave Fanning's programs (thank you
for
>> this!), "color_example.pro" to run loading the RGB image. Again, it
works
>> under Windows but not Linux or Solaris.
>>
>> Has anyone come across anything like this? Any ideas?
>>
>> With thanks,
>> Phil
>> ____________________________________________
>>
>> Philip Kershaw
>> Space Science & Technology Department
>> Rutherford Appleton Laboratory
>> UK
>> ____________________________________________
>>
>>
>>
>>
>
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38733 is a reply to message #38732] |
Fri, 26 March 2004 08:49  |
Philip Kershaw
Messages: 5 Registered: March 2004
|
Junior Member |
|
|
Your solution is the same as a colleague of mine had tried. I will go with
that. - It confirms things + from your explanation it makes more sense.
I did want to avoid actually altering the image but I can make a temporary
copy so it's not really a problem. I'm only displaying the image viewport
at any one time so it takes up little extra memory.
Thanks for your help,
Phil
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1acdf1f2f128526e989718@news.frii.com...
> David Fanning writes:
>
>> Philip Kershaw writes:
>>
>>> When I alter the colour table I re-display the image using
>>>
>>> TV, image, True=3
>>
>> Oh, the substituted TVIMAGE command should be this:
>>
>> TVIMAGE, image
>>
>> It can figure the "true" stuff out at the same time it is
>> figuring out what kind of device it is on.
>
> Oh, dear! Working too fast this morning. My mind is
> on finding more warm clothes around the house. :-(
>
> Here is what I think is happening.
>
> On UNIX machines, a true-color image is a true-color
> image. There is no color table involved whatsoever.
> (This is the way it *ought* to be, IMHO. I think it is
> Windows who is nuts.) A true-color image carries around
> its own color table, always! Otherwise, what would be
> the point?
>
> Of course, this makes it more difficult to deal with
> color tables, but there really is no *point* to a color
> table with a true-color image. If you want to work with
> color tables, use 2D images. If you insist on working
> with true-color images, then you will have to create
> your own true-color image from the color table in
> question:
>
>
> TVLCT, r, g, b, /Get
> myimage[*,*,0] = r[myimage[*,*,0]
> myimage[*,*,1] = g[myimage[*,*,1]
> myimage[*,*,2] = b[myimage[*,*,0]
> TV, myimage, True=3
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38740 is a reply to message #38733] |
Fri, 26 March 2004 06:58  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> TVLCT, r, g, b, /Get
> myimage[*,*,0] = r[myimage[*,*,0]
> myimage[*,*,1] = g[myimage[*,*,1]
> myimage[*,*,2] = b[myimage[*,*,0]
> TV, myimage, True=3
Whoops!
myimage[*,*,2] = b[myimage[*,*,2]
Of course.
Now, where is that damn balaclava!!!
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38741 is a reply to message #38740] |
Fri, 26 March 2004 06:53  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> Philip Kershaw writes:
>
>> When I alter the colour table I re-display the image using
>>
>> TV, image, True=3
>
> Oh, the substituted TVIMAGE command should be this:
>
> TVIMAGE, image
>
> It can figure the "true" stuff out at the same time it is
> figuring out what kind of device it is on.
Oh, dear! Working too fast this morning. My mind is
on finding more warm clothes around the house. :-(
Here is what I think is happening.
On UNIX machines, a true-color image is a true-color
image. There is no color table involved whatsoever.
(This is the way it *ought* to be, IMHO. I think it is
Windows who is nuts.) A true-color image carries around
its own color table, always! Otherwise, what would be
the point?
Of course, this makes it more difficult to deal with
color tables, but there really is no *point* to a color
table with a true-color image. If you want to work with
color tables, use 2D images. If you insist on working
with true-color images, then you will have to create
your own true-color image from the color table in
question:
TVLCT, r, g, b, /Get
myimage[*,*,0] = r[myimage[*,*,0]
myimage[*,*,1] = g[myimage[*,*,1]
myimage[*,*,2] = b[myimage[*,*,0]
TV, myimage, True=3
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38742 is a reply to message #38741] |
Fri, 26 March 2004 06:45  |
Antonio Santiago
Messages: 201 Registered: February 2004
|
Senior Member |
|
|
Maybe you forgot update your image with the new colors. As you see in
"color_example.pro" of the master Fanning, he cautch the event
"xcolors_load" and then does redraw the image.
Bye :)
Philip Kershaw wrote:
> Hello,
>
> I'm developing a colour editor for use with an image display program for
> Linux and Sun Solaris. I've found that when I update the colour table for
> an RGB image, the image display isn't updated. However, when I run the same
> program under Windows 2000, the image IS updated as expected.
>
> I'm running IDL 6.0 set with
>
> Device, Decomposed=0
>
> The display is 24-bit in each case for Windows, Linux and Solaris platforms.
>
> When I alter the colour table I re-display the image using
>
> TV, image, True=3
>
> The image has dimensions (m, n, 3)
>
> As a test, I tried adapting one of Dave Fanning's programs (thank you for
> this!), "color_example.pro" to run loading the RGB image. Again, it works
> under Windows but not Linux or Solaris.
>
> Has anyone come across anything like this? Any ideas?
>
> With thanks,
> Phil
> ____________________________________________
>
> Philip Kershaw
> Space Science & Technology Department
> Rutherford Appleton Laboratory
> UK
> ____________________________________________
>
>
>
>
|
|
|
|
Re: Changing the Colour Table for RGB images on Linux/Solaris [message #38744 is a reply to message #38743] |
Fri, 26 March 2004 06:42  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Philip Kershaw writes:
> I'm developing a colour editor for use with an image display program for
> Linux and Sun Solaris. I've found that when I update the colour table for
> an RGB image, the image display isn't updated. However, when I run the same
> program under Windows 2000, the image IS updated as expected.
>
> I'm running IDL 6.0 set with
>
> Device, Decomposed=0
>
> The display is 24-bit in each case for Windows, Linux and Solaris platforms.
>
> When I alter the colour table I re-display the image using
>
> TV, image, True=3
>
> The image has dimensions (m, n, 3)
>
> As a test, I tried adapting one of Dave Fanning's programs (thank you for
> this!), "color_example.pro" to run loading the RGB image. Again, it works
> under Windows but not Linux or Solaris.
>
> Has anyone come across anything like this? Any ideas?
Well, maybe you are running in *Windows* with Device, Decomposed=0,
but I doubt you are doing the same on your UNIX machines. :-)
Take that Color_Example program and substitute TVIMAGE for every
TV. *Then* see what happens!
Cheers,
David
P.S. Let's just say, there are a number of image display programs
around that are device independent, but none from RSI. :-(
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|