Steve on Image Processing

January 27th, 2006

All about pixel colors

Tell me, quick: What are the colors of these pixel values?

252 249 246 243 237
255 255 250 246 243
253 254 248 245 243
250 249 245 243 239

The colors are white and near-white, right?

OK, sorry, that was a trick question. These values aren't taken from a picture at all. They are digital elevation values for locations near Boston. I downloaded the data file from the U.S. Geological Survey web site and read it into MATLAB using the Mapping Toolbox function usgsdem.

Still, you could certainly display the data set as an image using MATLAB. It might look like this:

Or maybe like this:

Which brings me back to my original question, which I'd like to rephrase: How does MATLAB associate the value of a particular matrix element with a color displayed on the screen?

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

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

A Blog Note

As an experiment, I plan to interleave postings about the pixel-color topic with postings about the spatial transformations topic that I mentioned earlier this week. I'm trying to find a compromise between taking the time to explore a specific topic in depth, and providing material that interests a variety of readers.

We'll see how it goes. As always, feedback is welcome. Please leave a comment!

9 Responses to “All about pixel colors”

  1. Geoff Dutton replied on :

    Hi Steve,
    [Maybe don't publish this...] I love the blog. Don’t know how uyou find time to do all that writing. I get paid to write and don’t have time for it myself, lately.

    Anyway, I wanted you to know that on IE 4.5 on my old Mac PPC, the two images of the DEM didn’t load. Then I tried iCab (one of the few PD browsers that works on system 9.x) and I can see everything no. So much for IE 4.5…
    -Geoff

  2. Steve replied on :

    Geoff – those images are in PNG format, which may not be recognized by very old browsers.

  3. sravan replied on :

    I would like to know more about finding maximum amd minimum intensity nalues using max(),min().

    please assist me thankyou

  4. Steve replied on :

    Sravan—To find the maximum value of an array A, do this:

    maxval = max(A(:));
    

    Are you looking for something else?

  5. Mr.Dean replied on :

    Where I read new articles?

  6. Steve Eddins replied on :

    Mr. Dean—http://blogs.mathworks.com/steve/

  7. krishna kishore replied on :

    Hi Steve ,
    To day only i have seen this blog .. its very good, I have worked on Matlab6.2 in 2003 when i was student , and i have done some motion picture detection kind of stuff. But at that time my concepts are not that much clear , but with lot of struggle i could manage to prove the concept which i thought. But now this blog is rezuvenating me to work once again in this field. Could you Please add the theory of image processing apart from MATLAB point of view (i.e., algorithms , transforms independent of language).
    Thanks for your contribution,
    Krishna Kishore

  8. Steve replied on :

    Krishna—Thanks for the kind words. I have written occasionally about image processing algorithms and concepts independent from MATLAB. Look in the blog archives or categories (see sidebar links on the right) for topics such as geometric transforms, connected component labeling, separable convolution, polygonal scan conversion, etc. If you really want to learn the theory of image processing, how about getting a book? I’d suggest Digital Image Processing by Gonzalez and Woods for the theory, or Digital Image Processing Using MATLAB by Gonzalez, Woods, and Eddins for light theory and heavy MATLAB.

  9. krishna kishore replied on :

    Hi Steve,
    In my college days itself (when i am doing my project ) , i have purchased two books
    1. Image Processing and algorithms (some thing like that) by ruffel richards and gonzalez
    2. Image Processing –> Anil K. Jain

    But I dont know at that time i could not correlate theory and corresponding implementation with these books . (I am not telling that these books are not good , but my level of understanding is not upto that level that could not correlate an equation into corresponding implementation). A simple example , always i used to think sqaure wave as square wave i never thought beyond that , when i studied some calculus books (which i rate highest) like Advanced engineering mathematics by Kreyszig , then i understood that it is composed of infinite number of sine wave components , then it cleared concept of dritchlet conditions, after that fourier transform after that why laplace why Z transform .. it keeps on …

    But image processing is some thing two / three dimensional (as per my little knowledge) It requires such type of vizualization and , I really felt such beauty of explantion in your blog thats why i am planning strictly to follow your blog.

    If my assumptions/interpretations of things or my attitude towards subject is not aligned properly please correct me.

    Krishna Kishore


MathWorks
Steve Eddins is a software development manager in the MATLAB and image processing areas at MathWorks. Steve coauthored Digital Image Processing Using MATLAB. He writes here about image processing concepts, algorithm implementations, and MATLAB.

These postings are the author's and don't necessarily represent the opinions of The MathWorks.