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

Home » Public Forums » archive » color_quan - how for exactly 256 colors?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: color_quan - how for exactly 256 colors? [message #36749 is a reply to message #36682] Fri, 17 October 2003 14:35 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Fri, 17 Oct 2003 11:57:31 -0700, JD Smith wrote:

> On Fri, 17 Oct 2003 01:01:33 -0700, Oliver Thilmann wrote:
>
>>> David Fanning <david@dfanning.com> wrote in message
>>> news:<MPG.19f86c414eaf8be5989719@news.frii.com>...
>>
>>> What does this mean!? By definition, there will be no "exact" results
>>> when you sample 16.7 million colors down to 256. It just, uh...,
>>> mathematically can't be done. :-)
>>
>> What I mean is: I know that my image contains not more than 256
>> different RGB colors (out of 16.7 million) - I created the RGB image
>> from an indexed image and now I want to transform it back. This can be
>> done exactly and I wondered whether IDL provides a method to get that
>> done. Cheers,
>
> Yes, with HISTOGRAM:
>
> rgb_image=r+256L*(g+256L*b)
> h=histogram(rgb_image,OMIN=om)
> wh=where(h gt 0,cnt) # Should be fewer than 256 h[wh]=bindgen(cnt)
> index_image=h[rgb_image]

I think I meant:
index_image=h[rgb_image-om]

Of course, I still haven't tested it...

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Create a matrix using repmat
Next Topic: Re: Sorry Re: which OS is faster for idl?

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

Current Time: Fri Oct 10 09:33:33 PDT 2025

Total time taken to generate the page: 0.87978 seconds