Lending you a hand with image processing – basic techniques 2

In my last post I illustrated some simple techniques to enhance and visualize a hand x-ray image. I showed how to use intensity values as if they were elevation to display the hand in pseudo-relief. I did this in 2 ways using the Matlab command surf: once keeping the elevation range of [0-255] obtained from intensity, and a second time creating a different elevation range (through trial and error) to try to further enhance the relief effect. In the case of the hand x-ray the relief was indeed enhanced but with that also unimportant details that are distracting possibly from the task (for the hypothetical specialist commissioning our image enhancement work) of interpreting the x-ray. Today I want to show you a case in which it would be useful to enhance dramatically the smaller details in an image. Below is a beautiful coin of the Roman Emperor Augustus I found here.

I imported again the coin in Matlab, and displayed in pseudo-relief using this code:

%% convert inported jpeg coin to intensity matrix
n=1:1:294; k=1:1:303;
coin(n,k)=0.2989 * augustus(n,k,1) + 0.5870* augustus(n,k,2) ...
          + 0.1140 * augustus(n,k,3); % creates intensity matrix for color

%% creates elevation matrix
elev=(coin+250)*2; % creates arbitrary elevation matrix (trial and error) 

%% display as 3D surface with phong lighting
% used evev for relief and coin for color intensity to be mapped to hot
% below
daspect([0.5 0.5 25]);
lighting phong;
material shiny;
h=lightangle(45,100);  % sets the position of the specified light.

%% some figure and house cleaning
set(figure1,'Position',[640 300 950 708]);
set(figure1,'Color',[0.9 0.9 0.9]);
set(figure1,'OuterPosition',[636 396 958 790]);
title('Bronze coin of Caesar Augustus','FontSize',14);
axis off
axis tight

% clear n k bronze-augustus;

Here’s the result:

Notice how every dent, scratch, and imperfection really stands out. This may be critical in some circumstances to recognize, for instance, a very specific coin from a similar one, or from a fake.

The astute reader will remember that in the last post  I wrote that the successful use of pseudo-color displays is difficult. Difficult but not impossible and this is, I think, a good example. The reason is I believe is in the choice of the heated-body colormap, which not only is right for the image of a coin, giving it a nice bronze look, but it is also inherently more perceptually uniform than the rainbow [1]. In a future post I will tackle the topic of perceptually balanced colormaps in great depth.


I added this new image with grayscale coin  side by side with heated body coin. Please see comment section for more details.

Which do you like best?

[ 1] Rogowitz, B.E. and Kalvin, A.D. (2001) – The “Which Blair project”: a quick visual method for evaluating perceptual color maps – Proceedings of the conference on Visualization (IEEE)


2 thoughts on “Lending you a hand with image processing – basic techniques 2

  1. Perhaps my color blindness is getting me here but the coloring doesn’t seem to be helping me. Are the features you are seeing coming from the color or the phong shading.

    • Hi Steve

      Thanks for the opportunity to expand on this.

      The short answer to your question is that the features are present in the original coin and greatly enhanced by the combination of relief and lighting but I think the color does help them stand out more.

      Here’s the long answer:
      Based on the percetual ratings results shown in figure 7a in the reference paper it seems that the heated body colormap outclasses the rainbow colormap. The same is true of Lab based grayscale. Additionally, if comapring grayscale to heated body, it appears that at the very high end portion of the Luminance range heated body outperforms grayscale, whereas the contrary is true in the intermediate to high portion of the range. So a direct comparison is a great idea and to do that I added another image with heated body pseudo-relief coin side by side with pseudo-relief grayscale coin. Note that this is a standard grayscale and not a lab based grayscale, although the differences are minimal and limited to the 0-15 Luminace range, where the standard grayscale is cubic rather than linear.

      Now I am combining phong lighting with color, on the assumption that both colorscales are perceptually balanced enough that the combination of color and shading will not cause artifacts.
      Provided this assumption is correct, when I look at the two coins I definitely prefer the heated body version.

      A caveaut: going back to the paper I noticed the authors state that “all observers had normal, or corrected-to normal vision”. Now that I think of it it is unclear if the statement refers to normal COLOR vision or normal vision in the sense of no shortsightedness, or perhaps both. Not knowing the answer I would say that because you are color blind your input would be very valuable.
      Let me know which you like best.

Leave a Reply