Overlay data and colorize

From DavinciWiki
Jump to: navigation, search

Description

Overlay two data images using one to color the other.

This example overlays day time Themis IR with colorized night time Themis IR of the same region on Mars.

Procedure

Load in the two images:

dv> day_time = read("day_time.cub")
279x300x1 array of byte, bip format [83,700 bytes]

dv> night_time = read("night_time.cub")
279x300x1 array of byte, bip format [83,700 bytes]

Display the data

dv> display(day_time)

color overlay1.png

dv> display(night_time)

color overlay2.png

Colorize the night_time data

dv> night_time_col = colorize(night_time)
255,000,255 = 0.000000
000,000,255 = 51.000000
000,255,000 = 102.000000
255,255,000 = 153.000000
255,128,000 = 204.000000
255,000,000 = 255.000000
279x300x3 array of byte, bip format [251,100 bytes]

dv> display(night_time_col)

color overlay3.png

Create an overlay array. Add 50% of the color of the night_time_col to day_time. We chose a value of 50% arbitrarily, adding more will result in a picture with stronger color. We'll do another at 15% to show the difference.

Davinci will automatically copy the 1-band day_time image to each color band of night_time_col*0.5

dv> overlay = night_time_col*0.5 + day_time
279x300x3 array of float, bip format [1,004,400 bytes]

dv> overlay2 = night_time_col*0.15 + day_time
279x300x3 array of float, bip format [1,004,400 bytes]

Now, because the overlay array may have values exceeding 255 if turned directly into byte, causing some pixels to be oversaturated, we sstretch the array, rescaling it from 0 to 255.

dv> overlay = sstretch(overlay)
279x300x3 array of byte, bip format [251,100 bytes]

dv> overlay2 = sstretch(overlay2)
279x300x3 array of byte, bip format [251,100 bytes]

dv> display(overlay)

dv> display(overlay2)

color overlay4.png color overlay5.png


Additional Notes:

There are an infinite number of options for combining the color of one image to the black and white of another. This is merely one option. As you can tell, this procedure trades strength of shadow for strength of color.

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Functions Used

Personal tools