# 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
coin=zeros(294,303);
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
figure1=figure;
surf(elev,coin,'FaceColor','texturemap','EdgeColor','none');
% used evev for relief and coin for color intensity to be mapped to hot
% below
colormap(hot);
colorbar;
set(gca,'YDir','reverse');
daspect([0.5 0.5 25]);
view(-15,60);
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.

#### UPDATE

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)

http://www.research.ibm.com/visualanalysis/papers/WhichBlair-Viz01Rogowitz_Kalvin._final.pdf

## 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.