Steve on Image Processing with MATLAB

Image processing concepts, algorithms, and MATLAB

MATLAB image display – from data values to pixel colors

Here's a quick quiz for you: How bright are these pixel values?

252  252  253  254  255
252  252  253  254  254
252  252  253  253  254
252  252  253  253  254
252  252  253  253  253

Some of you are now thinking, "Well, those almost white, with one white pixel in the upper right corner. But wait, this is probably a trick question ..."

Yes, it's a trick question.

These values are physical measurements with a unit of meters. They are digital elevation values from a dataset that I downloaded from the U.S. Geological Survey's National Map project.

The values are from a 3042x3042 matrix of elevation values near Mount Monadnock, New Hampshire. I can certainly look at the matrix as an image in MATLAB. Here I am showing the data values as shades of gray, with black and white corresponding to the minimum and maximum elevations.

The arrow points to the region corresponding to the table of values shown above. This region has an elevation above sea level of about 250-255 meters. Because the peak elevation, at the summit of Mount Monadnock, is about 963 meters, the region where the arrow points is dark instead of white.

But we could display this data as an image in MATLAB in a variety of ways without changing the data values. Here are a few samples.

So how does MATLAB associate the the value of a particular matrix element with a color displayed on the screen?

I'm going to explore this question over the next couple of weeks. Specific topics will include:

  • The two different pixel-color models in MATLAB. (Or maybe there are three. It depends on how you count them.)
  • How properties of the figure, axes, and image objects all affect pixel colors.
  • Additional pixel-color models in the Image Processing Toolbox.
  • The MATLAB image display functions and how they work.

Note: Long-time blog readers might remember that I originally wrote about this topic way back in 2006. The material is still relevant, and I want to refresh it based on the updated MATLAB Graphics system introduced in R2014b.

Published with MATLAB® R2015b

  • print
  • send email


要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。