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

Home » Public Forums » archive » Re: color value interpolation from colorbar
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: color value interpolation from colorbar [message #64121] Thu, 04 December 2008 13:23 Go to next message
j.coenia@gmail.com is currently offline  j.coenia@gmail.com
Messages: 36
Registered: December 2008
Member
Thanks. The red-to-yellow colorbar is already on the image -- I don't
create it. The map of gradient values to the 3D colorspace would have
to be determined from this colorbar, which also has errors in it
(garbage in, as Dr. Fanning says.) I suppose this would be an
irregular grid of gradient values within the 3D colorspace.

Basically, there's a color-coded image with a colorbar *on* the
image. The colors, even those in the bar, often have errors because
they were digitized from analog tape recordings. Still, it is
possible to eyeball the images to determine color levels. I want the
computer to do something more quantitative than the eyeball analysis.
Re: color value interpolation from colorbar [message #64122 is a reply to message #64121] Thu, 04 December 2008 13:06 Go to previous messageGo to next message
j.coenia@gmail.com is currently offline  j.coenia@gmail.com
Messages: 36
Registered: December 2008
Member
Thanks for the fast replies.

I agree that the input is garbage, at least relative to the ideal of
directly digitized lossless 30 fps video of 30 minute scanning
sessions... Such data are not available here yet, not with our
equipment, although the equipment is surely available elsewhere with
new advances in frame grabbing and increases in storage capacity.

This garbage is still considered by many to be diagnostic-quality (or
at least research-quality) garbage. The color even on the degraded
recordings is not useless: the colorbars can and have for years been
used to estimate color level in countless papers and for clinical
diagnosis.

I am not asking for the best way to get data; I am asking for the best
way to analyze degraded data.

Degraded data is not necessarily "useless" or "garbage" -- that's an
exaggeration.

The challenge here is to extract something useful from it. Years of
research says that useful information can be extracted by eye from
these degraded recorded colors, although I am having problems doing it
by computer, which is why I posted here in the first place. Or I
could go back and tell the head of the research section to publish
retractions for 15 years of publications... :)
Re: color value interpolation from colorbar [message #64123 is a reply to message #64122] Thu, 04 December 2008 12:11 Go to previous messageGo to next message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Dec 4, 1:15 pm, "j.coe...@gmail.com" <j.coe...@gmail.com> wrote:
> The images are digitized, unfortunately, from analog recordings of
> medical scanning sessions.  This is the reason the colors are not
> true.  There is no way to retrieve the *exact* colors as they
> presumably appeared on the original equipment screen.
>
> Still, the recorded image quality on the tapes is considered good
> enough for review and even diagnosis.  When radiologists look at these
> images, no one objects that the colorbars are incorrect, and that
> their reds and yellows don't exactly match the images' reds and
> yellows.  No one can even tell, in fact.  It is however clear to the
> human eye which areas are more yellow and which are more red.  A
> computer should also be able to both find the image colors and assign
> interpolated colorbar values for more quantitative analysis.
>
> Even without the errors introduced by analog recording onto tape and
> digitization, I can imagine a color-coded image with gradations from
> red to yellow too fine to discern with the human eye.  A colorbar
> could be created with a smaller sampling of discrete representative
> hues from most yellow to most red, say 25 hues.  A human observer
> could interpret such a colorbar.  Isn't it possible to write a
> computer program to interpolate values to the unknown colors from the
> colorspace traversed by a partial colorbar?
>
> Even in the very simple case of a two-hue colorbar, with yellow at 0
> and red at 100, we would still interpolate a value for an orange
> somewhere between 0 and 100, probably 50, based on certain assumptions
> we hold about color gradients.  With more intermediate hues and more
> gradient values, shouldn't it be possible assign a reasonable value
> for that orange?
>
> It's clear that I do not know that much about color theory, but the
> motivation for this is that if a human observer can perform rough
> color interpolation on corrupted color-coded images, then a computer
> should be able to perform finer interpolation.
>
> Thanks

This is a very confusing thread 8^\

The idea of interpolation between colors is difficult because the
color space is three-dimensional. If you say "from red to yellow" you
have to specify what your path is. For instance:

r = replicate(255b,256)
g = bindgen(256)
b = replicate(0b,256)
tvlct, r, g, b

will give you a gradient from red to yellow (maybe "the simplest"?).

But so does b = 2b*[bindgen(128),reverse(bindgen(128)], it just goes
through purple.

Anyway, if this makes no sense just disregard it. I had trouble
figuring out the answer to your question, so this is an answer I
_could_ come up with.

Cheers,
Vince
Re: color value interpolation from colorbar [message #64124 is a reply to message #64123] Thu, 04 December 2008 11:50 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
j.coenia@gmail.com writes:

> It's clear that I do not know that much about color theory, but the
> motivation for this is that if a human observer can perform rough
> color interpolation on corrupted color-coded images, then a computer
> should be able to perform finer interpolation.

You may be too young to have learned the meaning of the
term GIGO in your computer science classes, but I think
it applies here. Personally, I think you are making an
awful lot of assumptions about your data and the way the
colorbar was constructed. Perhaps you are justified in
that. But if it were me, I'd feel like I was treading on
pretty thin ice. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: color value interpolation from colorbar [message #64125 is a reply to message #64124] Thu, 04 December 2008 11:15 Go to previous messageGo to next message
j.coenia@gmail.com is currently offline  j.coenia@gmail.com
Messages: 36
Registered: December 2008
Member
The images are digitized, unfortunately, from analog recordings of
medical scanning sessions. This is the reason the colors are not
true. There is no way to retrieve the *exact* colors as they
presumably appeared on the original equipment screen.

Still, the recorded image quality on the tapes is considered good
enough for review and even diagnosis. When radiologists look at these
images, no one objects that the colorbars are incorrect, and that
their reds and yellows don't exactly match the images' reds and
yellows. No one can even tell, in fact. It is however clear to the
human eye which areas are more yellow and which are more red. A
computer should also be able to both find the image colors and assign
interpolated colorbar values for more quantitative analysis.

Even without the errors introduced by analog recording onto tape and
digitization, I can imagine a color-coded image with gradations from
red to yellow too fine to discern with the human eye. A colorbar
could be created with a smaller sampling of discrete representative
hues from most yellow to most red, say 25 hues. A human observer
could interpret such a colorbar. Isn't it possible to write a
computer program to interpolate values to the unknown colors from the
colorspace traversed by a partial colorbar?

Even in the very simple case of a two-hue colorbar, with yellow at 0
and red at 100, we would still interpolate a value for an orange
somewhere between 0 and 100, probably 50, based on certain assumptions
we hold about color gradients. With more intermediate hues and more
gradient values, shouldn't it be possible assign a reasonable value
for that orange?

It's clear that I do not know that much about color theory, but the
motivation for this is that if a human observer can perform rough
color interpolation on corrupted color-coded images, then a computer
should be able to perform finer interpolation.

Thanks
Re: color value interpolation from colorbar [message #64127 is a reply to message #64125] Thu, 04 December 2008 09:38 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
j.coenia@gmail.com writes:

> I have a color-coded medical image.
>
> There is a colorbar on the image, for example a red-to-yellow gradient
> valued from 1 to 100.
>
> There is *not* a one-to-one correspondence between the colors in the
> colorbar and the colors in the image. There are many more
> intermediate reds, oranges, and yellows in the image than in the
> colorbar.
>
> What is the correct way to interpolate gradient values to all the
> unknown image colors from the discrete colors/gradients defined in the
> colorbar?

First of all, if there are colors in the image that are not
in the colorbar, then the color bar is fairly useless to you.
My guess is that this has been coded incorrectly. (There can
be colors in the colorbar that are not in the image, of course,
but not the other way around.)

I *suppose* a color bar could be drawn with discrete colors from
the image, so that the user could be encouraged to interpolate
values between colors, but this would be a lousy way to run a
railroad and the programmer should probably have his IEPA card
revoked.

> (The documentation for INTERPOL and INTERPOLATE has not helped me so
> far.)

No, I can imagine not. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: color value interpolation from colorbar [message #64219 is a reply to message #64121] Thu, 04 December 2008 13:35 Go to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
So your first step is to "digitize" the color bar:

Create 3 arrays of r,g,b with the colors as a function of pixel size
and an array x of the pixel index number.

Then, show us a plot of r(x), g(x), b(x)

Ciao,
Paolo


j.coenia@gmail.com wrote:
> Thanks. The red-to-yellow colorbar is already on the image -- I don't
> create it. The map of gradient values to the 3D colorspace would have
> to be determined from this colorbar, which also has errors in it
> (garbage in, as Dr. Fanning says.) I suppose this would be an
> irregular grid of gradient values within the 3D colorspace.
>
> Basically, there's a color-coded image with a colorbar *on* the
> image. The colors, even those in the bar, often have errors because
> they were digitized from analog tape recordings. Still, it is
> possible to eyeball the images to determine color levels. I want the
> computer to do something more quantitative than the eyeball analysis.
Re: color value interpolation from colorbar [message #64220 is a reply to message #64121] Thu, 04 December 2008 13:31 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Dec 4, 3:23 pm, "j.coe...@gmail.com" <j.coe...@gmail.com> wrote:
> Thanks.  The red-to-yellow colorbar is already on the image -- I don't
> create it.  The map of gradient values to the 3D colorspace would have
> to be determined from this colorbar, which also has errors in it
> (garbage in, as Dr. Fanning says.)  I suppose this would be an
> irregular grid of gradient values within the 3D colorspace.
>
> Basically, there's a color-coded image with a colorbar *on* the
> image.  The colors, even those in the bar, often have errors because
> they were digitized from analog tape recordings.  Still, it is
> possible to eyeball the images to determine color levels.  I want the
> computer to do something more quantitative than the eyeball analysis.

Would it be possible for you to upload a sample image so that we can
get the idea of what you trying to do?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Obtain Pixel values in ENVI and report those to IDL
Next Topic: Irregular Satellite data plotting

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

Current Time: Wed Oct 08 15:17:54 PDT 2025

Total time taken to generate the page: 0.36436 seconds