Every-other-line truncation of Cassini images
Posted by Emily Lakdawalla
2010/10/19 12:34 CDT
If you have ever looked at Cassini images of icy moons, either on the raw images website or at the Planetary Data System, you may have noticed images that look like they are being eaten by weird black sawtooth pattern. Some images have just a little bit of this sawtooth:...while some look like they are in danger of being eaten up entirely: What the heck is going on?
Let's examine one of these images very closely.When you zoom in, the sawtooth pattern reveals itself as a black stripe coming in from the right-hand side of the image. The black stripe only appears on alternate lines -- that is, one line of the image makes it all the way to the right-hand edge, but the next line is partially covered by a black stripe, giving something of a "venetian blind" effect. Every black stripe is some multiple of 16 pixels long, but the black stripes are of variable length.
If you look at a lot of Cassini images, you may notice that the black stripes appear most often on images of icy moons. If you're sharp, you'll notice that the black stripes only seem to cover bits of icy moon, but not the black space behind them. And if you're extra sharp, you'll have noticed that the lines are longer when there are more bits of topography (usually craters) throwing dark black shadows in the image. What is going on? Are the aliens eating Cassini's photos of Saturn's icy moons in order to hide evidence of their bases?
(That last comment was, of course, just to poke fun at everybody who went to town on the "NASA is hiding something, it's a conspiracy" frenzy last week over my version of Cassini's April images of Titan and Dione.)
With a little research, you can find a description of why this black sawtooth pattern appears. In The Cassini-Huygens Mission: Orbiter Remote Sensing Investigations, edited by Chris Russell, Carolyn Porco and her coauthors explain. It's in a section that follows an explanation of how Cassini's cameras, called the Imaging Science Subsystem (ISS), captures images with gray levels recorded at a depth of up to 12 bits per pixel (4,096 different gray levels), but can reduce the bit depth to 8-bit (256 gray levels) before transmission to Earth. From pages 461-2:
3.9.2. Lossless CompressionSo what's going on is that the images are being recorded in a way that reduces their file size by a minimum of a factor of 2, without actually changing the values of the pixels in each image. In the particular file size reduction algorithm they selected, images where there isn't a lot of variation among the pixels ("images with low entropy") will be handled very well, without any data loss, and can be reconstructed perfectly on Earth.
oth converted (8-bit) and unconverted (12-bit) data can be losslessly compressed. The ISS lossless hardware compressor is based on Huffman encoding, a high-efficiency, numerical encoding scheme in which the length of the bit sequence used to encode a given number is chosen based on the frequency of occurrence of that number. In ISS lossless compression, each compressed image can be reconstructed on the ground with no loss to the information content of the image, provided the image entropy does not exceed the threshold where 2:1 compression is achieved. Scenes with low entropy will have compression ratios higher than 2:1; scenes with high entropy will never compress greater than 2:1, but the ends of lines will be truncated so that the total amount of data returned in a pair of lines of the image never exceeds the total number of bits for a single uncompressed line. The truncation scheme has been designed so that the truncation alternates -- i.e., every other line -- from one line to the next, on the right (large sample number) side of the image. If the data loss is great, it can in principle result in the complete loss of every other line. In either case, with this scheme information (though reduced in spatial resolution) can be retained across the image, even at the edges.
But where the pixel values vary a lot, the Huffman encoding scheme can't achieve a file size reduction of a factor of 2. Pixels vary a lot where there is bright terrain (icy surfaces) pockmarked with craters (making dark shadows) so this every-other-line truncation is almost never seen in pictures of Saturn or Titan, with their smooth atmospheric variations, but is noticeable on most of the images of the other moons where the moon totally fills the field of view. On these images, Cassini tries to stuff each pair of image lines into a box that can only fit a little bit more than one line of image data inside. If any image data spills over, it doesn't make it into the box, and never gets transmitted to Earth. When the computer on Earth unpacks the boxes of data that were transmitted from Cassini, there's something missing, the information that "spilled out of the box" back on the spacecraft. The computers on Earth can't have any way of knowing what went into those pixels when they were aboard Cassini, so they just write black space into those pixels.
These images have an ugly appearance when they are raw and unprocessed. But although those black pixels represent data that is lost and gone forever, all the other pixels in the image were recorded in such a way that they represent the original data -- they were losslessly encoded. So you can reconstruct what that part of the image originally looked like in reasonable fidelity, using the adjacent pixels that didn't get eaten up by the algorithm. (At least you can reconstruct them if you go into the Planetary Data System and get the high-quality science data. When you are working from the raw images website, the images have been lossily compressed in JPEG format so you cannot reconstruct them perfectly.)
A quick shortcut for reconstructing the missing data in Photoshop is as follows. Select the area of the image that is affected by the every-other-line truncation using the marquee tool. Go to the Filter menu -> Video -> De-interlace... A dialog box will ask you if you want to de-interlace the Odd or the Even fields, and if you want to create new fields by duplication or interpolation. Generally, you want Interpolation, but whether you want Odd or Even fields depends on whether the black lines are the odd or even lines in your selection. Try the default (Odd fields), and if you get an even worse looking black sawtooth pattern, Undo and try it again with the Even fields. Here's a blink comparison after the application of the Photoshop filter.(If someone knows how to do this using GIMP, I'd appreciate a tutorial -- leave it in the comments please!)
Or read more blog entries about: