Toggle Navigation
Digital Imaging: Imagine the Possibilities
Teledyne Logo
hidden

Bob’s Imaging Fundamentals #1: Look-Up Tables

LUT! Up in the sky, it's a bird! It's a plane! No! It’s an image processing technique!

LUT is short for “Look-Up-Table,” which is basically an indexed list of numbers. LUT are usually used in Machine Vision for changing pixel values in a specific predefined way. But before we get to the how’s ‘n why’s, let’s take a lut… I mean look, at what a LUT looks like (try and say that ten times fast!). For this example, we will assume an 8 bit-per-pixel monochrome image (i.e. pixel values can be anything from 0 and 255). For our first LUT, we will try a simple luminance inversion, in other words, dark pixels become light and light pixels become dark.

Changes to the look-up table result in contrast changes in these two pictures of a Spiderman toy
Spiderman becomes Anti-Spiderman by changing values in the look-up table.

 

The way it works is, you go through your image one pixel at a time using each pixel’s value as an ‘input-index’ to your look-up-table. Once you have found the correct position in the table for a given pixel, you replace the original pixel’s value with the corresponding ‘new pixel value’. So, if the original pixel’s value were ‘251’ the new pixel’s value would become ‘4’. Obviously, there is not much interest in using a lookup table for performing a luminance inversion because LUT require lots of memory read/write operations, and they take time (by the way, the easiest way to do inversion is: NewPixel = 255 – OldPixel).

One particularly good use of LUT is in avoiding complex and/or time consuming calculations. For example, say you wish to derive a new pixel value from the old one, based on some really cool mathematical formula that you have come up with. And, the calculations do not change from one image to the next and do not depend on surrounding pixels. What you could do is pre-calculate the results of all 256 possible pixel values in your image and put them in a LUT. That way, instead of having to run time consuming calculations for each pixel in the image, you could simply ‘look up’ the result in your ‘table’ based on the pixel’s initial value. However, before you decide to go and replace all your calculations with LUT, it’s a good idea to make sure LUT are actually quicker than calculations, for your particular application.

 


About this article: Bob’s Imaging Fundamentals is an article series based on the work of Bob Howison. Originally titled Bob’s Brain Snacks, these articles were intended to help employees and partners get up to speed with the fundamental concepts of image processing. They became such a popular reference that we’ve decided to bring them to the Possibility Hub. As technology goes further, faster, and new industries discover the power of digital imaging, it’s important to remember the basics.

Bob’s Brain Snacks are recommended for anyone interested in learning about imaging technology. Sharpen your mind and try one!