Re: read_tiff - simple question [message #14505 is a reply to message #14502] |
Sun, 28 February 1999 00:00   |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Harald von der Osten-Woldenburg (hvdosten@ludwigsburg.netsurf.de) writes:
> thank you very much for your answer. Your code did it and you were right, the
> TIFF-file was a 3 x m x n array.
>
> Just the last question: How can I split the image into three 2-dim arrays and
> after working with them to create again a 3 x m x n array (TIFF-file) with
> these three new files?
You can easily separate a 24-bit image into the three
"channels" or "color planes" that make up the 24-bit image.
For example:
image24 = Read_Tiff('zeragon.tif')
red = Reform(image24[0,*,*])
green = Reform(image24[1,*,*])
blue = Reform(image24[2,*,*])
Now, suppose you want to brighten the red values up a bit.
You could do something like this:
red_brightened = Byte(red * 1.2) < 255B
To put the brightened red plane back into the 24-bit image
all you do is this:
image24[0,*,*] = red_brightened
Of course, you can do the same thing "in situ" as it were.
For example, the same brightening with the green channel:
image24[1,*,*] = Byte( (image24[1,*,*] * 1.2) ) < 255B
If you want to put the planes back together again in a
new 24-bit image, you could do something like this:
dims = Size(image24, /Dimensions)
new_image24 = BytArr(3, dims[1], dims[2])
new_image24[0,*,*] = red_brightened
new_image24[1,*,*] = green
new_image24[2, *,*] = image24[2,*,*]
Image subscripting. Ain't it wonderful! :-)
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
[Note: This follow-up was e-mailed to the cited author.]
|
|
|