Line 15: Line 15:
 
<math>2^{24} = 16,777,216</math> possible color representations.
 
<math>2^{24} = 16,777,216</math> possible color representations.
  
We all have heard of the various image formats used - for example, JPEG, GIF, TIFF, RAW, BMP. Of these, TIFF, RAW, and BMP are referred to as ''lossless''. This means that with the aforementioned compression algorithms, the original signal can be faithfully reconstructed exactly, bit-by-bit. Lossless image compression would be important for such applications such as medical imaging, where it is important that the resolution of the original image is maintained upon compression and decompression. As an example, a lossless compression is important to maintain high contrast and finer details in an MRI scan of brain tissue, so that an accurate diagnosis can be made!
+
We all have heard of the various image formats used - for example, JPEG, GIF, TIFF, RAW, PNG, BMP. Of these, TIFF (usually), RAW, PNG, and BMP are referred to as ''lossless''. This means that with the aforementioned compression algorithms, the original signal can be faithfully reconstructed exactly, bit-by-bit. Lossless image compression would be important for such applications such as medical imaging, where it is important that the resolution of the original image is maintained upon compression and decompression. As an example, a lossless compression is important to maintain high contrast and finer details in an MRI scan of brain tissue, so that an accurate diagnosis can be made!
  
A raw uncompressed digital image that is 10 MP and allocated 24 bits per pixel will be: <math>10^6 pixels * 24 bits/pixel * 1 MB / 8*10^6 bits = 30 MB</math>
+
A raw uncompressed digital image that is 10 MP and allocated 24 bits per pixel will be: <math>10^6 pixels * 24 bits/pixel * 1 MB / 8*10^6 bits = 30 MB</math> Typical lossless compression algorithms are able to achieve compression ratios of only about 2:1. They seek to reduce redundancies in the data by representing repeated data with less data (yet the representation is exact and no round-off is done). As an example, suppose a row of a black-and-white image is as follows, where W represents a white pixel and B represents a black pixel:
 +
BBBBWWBBBBBWBBBWWWWWWWWW
 +
A run-length encoding scheme might represent this as:
 +
4B2W5B1W3B9W
 +
This encoded representation would be interpreted as "4 B's, 2 W's, 5 B's, 1 W, 3 B's and 9 W's" -- this represents the original signal exact and in 12 characters instead of the original 24.
 +
 
 +
Lossless compression algorithsm, like JPEG, are used when a reduction in image quality can be tolerated - with the benefits being reduced file storage (more pictures on your digital camera's memory card) and quicker data transmission (quicker web page loading). Lossless compression algorithms can achieve compression ratios of 10:1 with little perceptible difference in quality and up to 50:1 with noticeable degradation in picture quality. These algorithms typically "exploit" the limitations of the human visual system and its inability to pick up minor changes in hue (we are more sensitive to changes in brightness than hue). Thus the spectrum of colors can be reduced.
 +
 
 +
JPEGs are notoriously bad at compressing image files that have large sections of one color surrounded by another color - e.g. black and white text, cartoons, solid squares, etc. This is because JPEG removes the high frequency components that are present in the sharp discontinuities in color (e.g. from black to white) and instead interpolate the rapid change with a more gradual one. In other words, in JPEGs sharp discontinuities in color

Revision as of 15:30, 22 September 2009

Lossy versus Lossless Images: What is the difference?

As "analog" 35 mm cameras (and the film used for it!) become more and obsolete, digital cameras and the storage and transmission of digital images are rapidly becoming the de facto standard for today's photography needs.

The resolution of a camera - e.g. 6 MP (Megapixel) or 10 MP - determines the number of pixels the camera uses to represent the "continuous" signal (e.g. a mountain, or your smiling significant other) that your digital camera is sampling.

Thus the digital camera samples the continuous signal, with a period $ T $ (shutter speed) and on for length $ tau $ (related to aperture -- how much light is absorbed):

$ X_s(t) = s_{tau}(t)x(t) $ (Note: image is two-dimensional signal)

A digital camera also quantizes the sampled values, because an infinite amount of storage space (i.e. bits) is not available to represent every pixel. A typical digital camera will allocate 24 bits per pixel, thus allowing $ 2^{24} = 16,777,216 $ possible color representations.

We all have heard of the various image formats used - for example, JPEG, GIF, TIFF, RAW, PNG, BMP. Of these, TIFF (usually), RAW, PNG, and BMP are referred to as lossless. This means that with the aforementioned compression algorithms, the original signal can be faithfully reconstructed exactly, bit-by-bit. Lossless image compression would be important for such applications such as medical imaging, where it is important that the resolution of the original image is maintained upon compression and decompression. As an example, a lossless compression is important to maintain high contrast and finer details in an MRI scan of brain tissue, so that an accurate diagnosis can be made!

A raw uncompressed digital image that is 10 MP and allocated 24 bits per pixel will be: $ 10^6 pixels * 24 bits/pixel * 1 MB / 8*10^6 bits = 30 MB $ Typical lossless compression algorithms are able to achieve compression ratios of only about 2:1. They seek to reduce redundancies in the data by representing repeated data with less data (yet the representation is exact and no round-off is done). As an example, suppose a row of a black-and-white image is as follows, where W represents a white pixel and B represents a black pixel: BBBBWWBBBBBWBBBWWWWWWWWW A run-length encoding scheme might represent this as: 4B2W5B1W3B9W This encoded representation would be interpreted as "4 B's, 2 W's, 5 B's, 1 W, 3 B's and 9 W's" -- this represents the original signal exact and in 12 characters instead of the original 24.

Lossless compression algorithsm, like JPEG, are used when a reduction in image quality can be tolerated - with the benefits being reduced file storage (more pictures on your digital camera's memory card) and quicker data transmission (quicker web page loading). Lossless compression algorithms can achieve compression ratios of 10:1 with little perceptible difference in quality and up to 50:1 with noticeable degradation in picture quality. These algorithms typically "exploit" the limitations of the human visual system and its inability to pick up minor changes in hue (we are more sensitive to changes in brightness than hue). Thus the spectrum of colors can be reduced.

JPEGs are notoriously bad at compressing image files that have large sections of one color surrounded by another color - e.g. black and white text, cartoons, solid squares, etc. This is because JPEG removes the high frequency components that are present in the sharp discontinuities in color (e.g. from black to white) and instead interpolate the rapid change with a more gradual one. In other words, in JPEGs sharp discontinuities in color

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood