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

Home » Public Forums » archive » Re: distribution of colors for an image
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: distribution of colors for an image [message #41349] Wed, 27 October 2004 04:32 Go to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
David Fanning wrote:
> Reimar Bauer writes:
>
>
>> Did someone know a routine to show in a simple XY Plot the distribution
>> of colors for an image?
>
>
> I think that is called a histogram, Reimar. :-)
>
> Cheers,
>
> David
>


fine, I have seen a lot of instruction on your marvellous web page.

But I don't understand the result I got. Lets show an example.

a=dist(20)
h=histogram(a)
print,max(a),max(h)
14.1421 56


u=uniq(a,sort(a))
help,u,h
U LONG = Array[61]
H LONG = Array[15]

Why could be h higher as a?
Why doesn't I got a vector length of 61 as uniq tells?


More and more I believe the first question does not describe what I want. .


Reimar
Re: distribution of colors for an image [message #41365 is a reply to message #41349] Tue, 26 October 2004 10:17 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Reimar Bauer writes:

> Did someone know a routine to show in a simple XY Plot the distribution
> of colors for an image?

I think that is called a histogram, Reimar. :-)

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http:/www.dfanning.com/
Phone: 970-221-0438, IDL Book Orders: 1-888-461-0155
Re: distribution of colors for an image [message #41495 is a reply to message #41349] Wed, 27 October 2004 05:58 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Reimar Bauer writes:

> fine, I have seen a lot of instruction on your marvellous web page.
>
> But I don't understand the result I got. Lets show an example.
>
> a=dist(20)
> h=histogram(a)
> print,max(a),max(h)
> 14.1421 56
>
>
> u=uniq(a,sort(a))
> help,u,h
> U LONG = Array[61]
> H LONG = Array[15]
>
> Why could be h higher as a?
> Why doesn't I got a vector length of 61 as uniq tells?

You asked about color distribution in an image. A histogram
will tell you (with a byte scaled image, of course) how many
pixels in the image have a particular color. It will even
tell you which pixels those are, but that is another story,
best explained with JD's Histogram Tutorial.

In your case H is fifteen elements long, because your data
had values between 0 and 15, and you used a bin size of 1,
by default. The *numbers* returned from histogram, told you
the pixel distribution of those 15 "colors". In one bin, for
example, you had 56 pixels values that fell into that bin.

You had 61 unique numbers in your data, but all 61 of them fell
into one of the 15 bins you set up.

To see your color distribution, you want to plot the histogram
of your data:

data = dist(200)
Plot, Histogram(data), XStyle=1, $
XTitle='Color Distribution', YTitle='Number of Pixels'

Does that help?

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http:/www.dfanning.com/
Phone: 970-221-0438, IDL Book Orders: 1-888-461-0155
Re: distribution of colors for an image [message #41498 is a reply to message #41349] Wed, 27 October 2004 05:06 Go to previous message
Karsten Rodenacker is currently offline  Karsten Rodenacker
Messages: 98
Registered: July 1997
Member
Perhaps
u=uniq(long(a),sort(long(a)))
help,u,h
U LONG = Array[15]
H LONG = Array[15]
tends in the direction of understanding?

Regards
Karsten

On Wed, 27 Oct 2004 13:32:13 +0200, Reimar Bauer <R.Bauer@fz-juelich.de>
wrote:

> David Fanning wrote:
>> Reimar Bauer writes:
>>
>>> Did someone know a routine to show in a simple XY Plot the
>>> distribution of colors for an image?
>> I think that is called a histogram, Reimar. :-)
>> Cheers,
>> David
>>
>
>
> fine, I have seen a lot of instruction on your marvellous web page.
>
> But I don't understand the result I got. Lets show an example.
>
> a=dist(20)
> h=histogram(a)
> print,max(a),max(h)
> 14.1421 56
>
>
> u=uniq(a,sort(a))
> help,u,h
> U LONG = Array[61]
> H LONG = Array[15]
>
> Why could be h higher as a?
> Why doesn't I got a vector length of 61 as uniq tells?
>
>
> More and more I believe the first question does not describe what I
> want. .
>
>
> Reimar
>
>
>



--
Karsten Rodenacker
------------------------------------------------------------ -------- :-)
GSF - Forschungszentrum Institute of Biomathematics and Biometry
D-85758 Oberschleissheim Postfach 11 29
Karsten._R_odenacker@gsf.de | http://ibb.gsf.de/ | DEL _ for reply
http://ibb.gsf.de/homepage/karsten.rodenacker/
Tel: +49 89 31873401 | FAX: ..3369
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL graphics w/ no display
Next Topic: WIDGET_LABEL FONT cross platform compatability

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

Current Time: Wed Oct 08 18:52:41 PDT 2025

Total time taken to generate the page: 0.00593 seconds