Skip to main content
Search IntMath
Close

Lenna and the Math of Image Processing

By Murray Bourne, 13 Mar 2007

Every image that you see on the Internet has been compressed. The images have gone through a mathematical process that has reduced the file size without significantly affecting the image quality.

Lenna
Lenna

This photo of Lenna, a 70s model, is probably the most gawked-at image in computer- and math-nerd history. The photo has been used as a test image for many years, because of its different textures, lighting, skin tones and colours.

The photo has a JPG extension, indicating it has been compressed using the JPEG (Joint Photographic Experts Group) method. This method is lossy, which means there is a trade-off between the file size and the data that has been lost from the picture. The human eye is good at filling in the gaps of an image, so we don't notice mild amounts of compression. But especially on computer screens, it doesn't matter much at all if the image has been compressed. When we print images that we got from the Internet, we can usually notice compression artifacts (globby bits that were not on the original photo but arise when the image is compressed.)

Here is Lenna using a compression ratio of 99. The image is barely recognisable:
Lenna - 99

The mathematics behind JPEG images is the discrete cosine transform, which is related to the Fourier Transform. [See Fast Fourier Transform, which describes how digital audio is sampled.] The discrete cosine transform also involves matrices.

According to this Wikipedia article,

The human eye is good at seeing small differences in brightness over a relatively large area, but not so good at distinguishing the exact strength of a high frequency brightness variation. This fact allows one to get away with greatly reducing the amount of information in the high frequency components. This is done by simply dividing each component in the frequency domain by a constant for that component, and then rounding to the nearest integer. This is the main lossy operation in the whole process. As a result of this, it is typically the case that many of the higher frequency components are rounded to zero, and many of the rest become small positive or negative numbers, which take many fewer bits to store.

There is a similar concept in use for digital movies (the MPG format is also lossy) and music compression (think MP3 and MP4).

Footnote: Lenna's story is quite interesting. You can see more of Lenna and find out what magazine she was modeling for at www.lenna.org. (If artistic nudity offends, don't go any further.)

See the 3 Comments below.

3 Comments on “Lenna and the Math of Image Processing”

  1. Vinod says:

    1) Nice post. Nothing like hot playboy models to make math relevant.
    2) The links don't work πŸ™

  2. Murray says:

    < Blush >

    Forgot to check that last link. All the rest work.

    Actually, lenna.org does not really exist. It just redirects to Carnegie Mellon site.

    On (3) - actually, not really a math post, but with some imagination, we could certainly make it so.

  3. MathNerd says:

    Cool! Got any more like this?

Leave a comment




Comment Preview

HTML: You can use simple tags like <b>, <a href="...">, etc.

To enter math, you can can either:

  1. Use simple calculator-like input in the following format (surround your math in backticks, or qq on tablet or phone):
    `a^2 = sqrt(b^2 + c^2)`
    (See more on ASCIIMath syntax); or
  2. Use simple LaTeX in the following format. Surround your math with \( and \).
    \( \int g dx = \sqrt{\frac{a}{b}} \)
    (This is standard simple LaTeX.)

NOTE: You can mix both types of math entry in your comment.

top

Tips, tricks, lessons, and tutoring to help reduce test anxiety and move to the top of the class.