Help Shape the Future of Space Exploration

Join The Planetary Society Now  arrow.png

Join our eNewsletter for updates & action alerts

    Please leave this field empty

Headshot of Emily Lakdawalla

Enceladus: A problem of contrast

Posted by Emily Lakdawalla

30-01-2013 19:00 CST

Topics: Enceladus, Cassini, pretty pictures, amateur image processing, Saturn's moons, explaining image processing, Saturn's rings

Four times a year, the Cassini mission releases a pile of science data to NASA's Planetary Data System. I'm a little late to the January release, and still haven't worked through all the neat images I found. In fact, the very first image I downloaded presented an interesting challenge to my image processing skill. Before I maunder on for too long, here's the result of my efforts. There is so much to see in this one image. We're looking at a crescent icy moon of Saturn. Along the terminator (the boundary between day and night) the angled light picks out some impact craters. Behind it, you see most of Saturn's ring system, from F through A, and part of B, foreshortened into a skinny set of bright and dark lines. You don't see all of the B ring, though, because Saturn's shadow is being cast onto the rings here, angling incredibly shallowly across the foreshortened rings.

Enceladus, plumes, and rings

NASA / JPL / SSI / Emily Lakdawalla

Enceladus, plumes, and rings
A crescent Enceladus sits below Saturn's rings in this photo taken by Cassini on January 4, 2012. The plumes have been artificially brightened to make them visible.

Below the moon, you see a few fuzzy dots: geysers. This is Enceladus, one of the four worlds in the universe where we have observed active, internally driven geology, and that's some of the froth of its internal sea or ocean, being spewed into the vacuum near Saturn.

So, why was this one challenging? I downloaded the archival data for this photo and about 300 others from the Rings Node and ran it all through IMG2PNG to convert it to a form that is easier for me to handle: a 16-bit PNG. I'll explain why the 16-bit thing is important a bit later. First, though, let me show you what the image looked like when I first opened it in Photoshop.

Image N1704329813_1, processing step 1
Image N1704329813_1, processing step 1

It's very dark. So the very first thing that anyone would do is to fix that, increasing the brightness and contrast. Essentially, you multiply every pixel in the image by a constant. It makes the whole image brighter, but as long as you don't "max out" any of the pixel values, it's a reversible change, so it remains true to the original data. Also, like nearly every single Cassini image ever, it's not "right side up" according to the conventions we have defined. So I flip it 180°, to put north up. Again, a reversible change, so, so far, there's been no real manipulation of data. It makes a quite pretty picture of a crescent moon poised below a foreshortened ring system.

Image N1704329813_1, processing step 2
Image N1704329813_1, processing step 2

But while I was figuring out how much to stretch the contrast, I stumbled upon something. Look what happens when you stretch the contrast by an insane amount:

Image N1704329813_1, processing step 3
Image N1704329813_1, processing step 3

There are three ugly things and two beautiful things about this picture. The ugly things: (1) I have wrecked a lot of the detail visible in the original image, saturating some of the sunlit surfaces so that they are completely white. This isn't a reversible change; if I darkened it again, all those pixels would still be the same value. I couldn't get the lost detail back. (2) I have amplified the blemishes, the hot pixels and cosmic ray hits that speckle the photo. (3) I have amplified the rhythmic linear horizontal banding that appears at a low level in all Cassini photos, an artifact having to do with some interference from spacecraft electronics. The beautiful things: (1) you can see the geysers. (2) You can see Enceladus' full globe just barely picked out against the background, Enceladus' night side appearing darker than whatever is behind it.

It's kind of amazing that either one of the two beautiful things is visible in the data. We can thank the 16-bit format. So now it's time for me to explain what that means.  Why 16 bits? When you look at black-and-white images on the Internet, you are almost always looking at an 8-bit photo. That means that each pixel's brightness is encoded with an 8-digit binary number, so the value of the pixel can range from ranging from 0 (black) to 2^8-1 or 255 (white). That's more gray values than the human eye can hope to distinguish all at once, but it's not enough to represent the full possible range of brightness and darkness in our experience. Our eyes can see well both in bright daylight and in dimly lit buildings, where the light is a factor of 1000 or more weaker. But we can't see in both kinds of lighting at once. Our eyes adjust to bright or to dim light, but when we're outdoors in bright sunlight it's hard for us to see what's going on through a window into a dimly lit building.

Many cameras can handle a wider contrast range at once than our eyes can. But that means they need more than 8 bits to record the different brightnesses and darknesses in a scene. In order to record things that are 1000 times dimmer than other things, you need to digitize the view on a scale that has more than 1000 divisions. It's common for spacecraft cameras these days to measure the universe using 12 or more data bits, meaning they can handle more than 4000 different gray levels. The operating systems on the computers that we use back on Earth like to deal in groups of 8 bits at a time, so if you want to deal with 12-bit data, you use instead a 16-bit image format.

So the information is there; but how to represent it in a way that the more limited human eye can discern? A lot of the time it's possible to stretch the contrast in a nonlinear fashion so that you can bring out details at both ends of the brightness range. But that just wasn't working for me here; the geysers were just too dim. Any attempt to bring them out washed out the detail visible on the sunlit crescent and rings, and also made that horizontal banding too obvious. I was going to have to treat the moon and the plumes separately.

First of all, I needed to clean up the low-contrast data. I had to do something to reduce the effects of the horizontal banding and the cosmic ray hits. Here is a really neat trick to remove the horizontal banding. I'm using Photoshop but if you don't have that, you can use the same technique in GIMP. The banding is visible in the space behind Enceladus. If I can make a layer that has just the bands, but no moons or anything else, I can subtract the values of those pixels from the original photo, canceling out the banding.

First I have to find a region in the background that doesn't have any major blemishes. I've outlined such a region below.

Image N1704329813_1, processing step 4
Image N1704329813_1, processing step 4

I'll use this to produce a sort of a model of the banding across the whole image. I copy and paste this representative rectangle into a new document. Then I change the width of the document to 1 pixel, keeping the height constant. That averages across each row. Then I change the width again to match the original width of the photo, in this case 1020 pixels. Here's the result, a model for the banding across the whole image:

Image N1704329813_1, processing step 5
Image N1704329813_1, processing step 5

I paste this model onto my original image and set its blending mode to "difference," meaning that I am subtracting the pixel values of the modeled banding from the pixel values of the original image. Here's the result. I have massively improved on the banding across the whole image. But wait -- something's wrong. You can't see the night side of Enceladus against the background anymore. What gives?

Image N1704329813_1, processing step 6
Image N1704329813_1, processing step 6

The problem is that I assumed that I needed to cancel out the background completely. But the background was actually lighter in value than the night side of Enceladus. When I subtracted out the banding, I made the background black and the night side of Enceladus blacker than black (which Photoshop can't do, so it just leaves the pixels black).

To avoid subtracting out too much from the background, I need to darken my banding model a little bit. I use the eyedropper to figure out what the darkest pixel value in my model is, and I find it to be a pixel value of 8 (out of 255). I make a new layer, color it a very dark gray with a pixel value of 8, and then set its blending mode to difference. Now my model of the banding won't cancel out the background entirely. Here's the result of applying my new model to the photo:

Image N1704329813_1, processing step 7
Image N1704329813_1, processing step 7

The difference is really subtle, and if your monitor is dark you may not notice it at all. In fact, I decided not to try to bring out the edge of Enceladus' disk against the background, because it was just too hard to see.

There's still a tiny bit of banding visible in Enceladus' plumes, which I could probably deal with by fiddling around with my model for the banding, but I didn't want to take the time here. Instead, I copied the area of the image containing the plumes and overlaid it on the version of the photo in which you can see the details of Enceladus' sunlit crescent and the rings.

Image N1704329813_1, processing step 8
Image N1704329813_1, processing step 8

Now it's a matter of blending this in to the background. This is a subjective process, and it's at this point that I'd say I've crossed the line from an image that shows Enceladus as Cassini saw it to an artistic product that is representational of reality but which has been artificially enhanced. Everything else up to this point -- brightening the image and removing the effects of banding -- are justifiable from a data processing point of view, but this step definitely isn't. The other artistic step I take here is to paint out the couple of blemishes caused by cosmic ray hits.

When all is said and done, here is my final version. Given all the steps it took to get here and the subjective nature of the plume-brightening part, someone else would likely produce a version of this one that looked slightly different. Maybe you should try! Here's the original image data.

Enceladus, plumes, and rings

NASA / JPL / SSI / Emily Lakdawalla

Enceladus, plumes, and rings
A crescent Enceladus sits below Saturn's rings in this photo taken by Cassini on January 4, 2012. The plumes have been artificially brightened to make them visible.

One fun little postscript: I checked JPL's solar system simulator while I was trying to figure out the relative positions of Enceladus, Saturn, and Cassini while this photo was being taken. And I discovered that what I had assumed was black space in the background is not black space at all; it's the night side of Saturn! See for yourself here.

See other posts from January 2013


Or read more blog entries about: Enceladus, Cassini, pretty pictures, amateur image processing, Saturn's moons, explaining image processing, Saturn's rings


David Barry: 01/31/2013 06:43 CST

I think there is a problem with IMG2PNG on Cassini images. It's been a while since I wrote my own code to convert them, but as I recall, Cassini's IMG's kind of look like they give pixel values on a scale of 0-65535 (16-bit), when really they only go 0-4095 (12-bit). So a naive conversion of the IMG file will give pixel values that need to be multiplied by 16. Both NASAView and my own code give a substantially brighter image than the one you start with. (Though I'm a little bit puzzled - if I run IMG2PNG on the file, I get something much darker, because of the factor of 16 issue I mentioned earlier.)

Gene Van Buren: 01/31/2013 11:05 CST

Maybe you already considered this, but it seemed to me that the first thing I would try would be to expand the range of lower brightness regions while shrinking the range of higher brightness (e.g. re-map 0-10% brightness onto 0-50%, and 10%-100% onto 50-100%). This way you don't shove all the bright stuff into saturation. Anyhow, I'm not an expert, so someone's welcome to set me straight on this.

Gerald: 01/31/2013 12:24 CST

@ Gene Van Buren: I tried your proposition with the 8-bit version. Two difficulties occured: First: without subtracting the horizontal stripes the stretching of the brightness map should begin above 0%, so the darker part of the geyseer remains black; second: the remaining stretch resulted in a halo around the bright parts of Enceladus. So, the idea works in principle, but Emily's results are much better than at least my nice tries with pure brightess mapping.

Emily Lakdawalla: 02/01/2013 12:07 CST

David - are you calibrating the images? I'm using IMG2PNG to calibrate them as well (using the -r switch). You have to have downloaded the CALIB data in order for this to work. IMG2PNG is a bit of a black box for me. I believe this one comes out so dark because of the high phase angle -- there's just a lot less light being scattered toward the camera than there would be if we were seeing Enceladus at a lower phase. Gene -- I do what you describe much of the time; this is what I was talking about when I was talking about attempting a nonlinear stretch. The problem is that the plumes are so dark (ironically, they'd be brighter if the phase were even higher, because they are strongly forward-scattering) that they are only a few DN above the background, so any stretch that makes them visible makes all the garbage visible as well. Just stretching contrast works best when you can remove the banding and other noisy stuff by setting all the darkest pixels to black, but if you try that with this image, you lose the geysers completely.

David Barry: 02/01/2013 07:20 CST

Ah no, I was using the raw images. My interest in the pictures doesn't extend to the finer details, so calibration looks like too much work for me to bother with. I still suspect, though now I'm less sure, that there's an issue with IMG2PNG -- the raw IMG shouldn't end up as dark as it does (perhaps there are some IMG2PNG switches that could fix it, I don't know). Also NASAView shows N1704329813_1_CALIB.IMG as a much brighter image than the one you started with. But I've never downloaded any of the CALIB data, so I don't really know what I'm talking about and should probably stop.

Gene Van Buren: 02/04/2013 11:20 CST

Thanks, Gerald, for giving it a shot, and Emily, for the follow up explanation!

Leave a Comment:

You must be logged in to submit a comment. Log in now.
Facebook Twitter Email RSS AddThis

Blog Search

Planetary Defense

An asteroid or comet headed for Earth is the only large-scale natural disaster we can prevent. Working together to fund our Shoemaker NEO Grants for astronomers, we can help save the world.


Featured Images

LightSail 2 and Prox-1
Bill Nye at LightSail 2 pre-ship review
LightSail 2 pre-ship review team photo
Swirling maelstrom
More Images

Featured Video

Class 9: Saturn, Uranus, and Neptune

Watch Now

Space in Images

Pretty pictures and
awe-inspiring science.

See More

Join The Planetary Society

Let’s explore the cosmos together!

Become a Member

Connect With Us

Facebook, Twitter, YouTube and more…
Continue the conversation with our online community!