Function BYTSCL [message #24652] |
Tue, 10 April 2001 01:29  |
Steffen Kernchen
Messages: 4 Registered: April 2001
|
Junior Member |
|
|
Hi...
I�m just starting with IDL, so here is my first question: ;-)
what function(s) can I use instead of BYTSCL?
I have an array and I want to transform it to get a better contrast.
But I should NOT use BYTSCL.... :(
bye
steffen
|
|
|
Re: Function BYTSCL [message #24765 is a reply to message #24652] |
Wed, 11 April 2001 23:12  |
Steffen Kernchen
Messages: 4 Registered: April 2001
|
Junior Member |
|
|
hi david...
> Alright, enough time has passed that Seffen has
> probably passed or failed the final. Here is
> my take on what BYTSCL does:
no, I�m just here. ;-)
I only had no time to answer. sorry.
this problem is solved! thx to you and all the other, who helped me, especially
Marc Schellens!
but I know, there�re many problems, I never dreamed of! *g*
but now I have some time to think about it. next exercise is in 3 weeks.
I hope it is enough time!
cheers,
steffen
|
|
|
Re: Function BYTSCL [message #24773 is a reply to message #24652] |
Wed, 11 April 2001 12:32  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Steffen Kernchen (steffen.kernchen@student.uni-magdeburg.de) writes:
> I�m just starting with IDL, so here is my first question: ;-)
>
> what function(s) can I use instead of BYTSCL?
> I have an array and I want to transform it to get a better contrast.
> But I should NOT use BYTSCL.... :(
Alright, enough time has passed that Seffen has
probably passed or failed the final. Here is
my take on what BYTSCL does:
FUNCTION Daves_Bytscl, array, Top=maxVal
minVal = 0.
IF N_Elements(maxVal) EQ 0 THEN maxVal = 255. ELSE maxVal = Float(maxVal)
minVec = Min(array, Max=maxVec)
sf = [((minVal * maxVec)-(maxVal * minVec)) / $
(maxVec - minVec), (maxVal - minVal) / (maxVec - minVec)]
RETURN, Byte(array*sf[1] + sf[0])
END
To test it:
IDL> array = Dist(150, 150)
IDL> Window, XSize=450, YSize=150
IDL> TV, array, 0
IDL> TV, Daves_BytScl(array), 1
IDL> TV, BytScl(array), 2
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|