Steve on Image Processing

July 16th, 2011

Jähne test pattern

Earlier this week I posted a summary of posts from the beginning of this blog, including my January 13, 2006 post on generating test images. Today I want to revisit one of the examples from that old post.

In my 2006 post I showed this test image, consisting of concentric rings with increasing frequency as you move away from the center of the image:

Since then I have seen this type of image referred to as the Jähne test pattern. This week I decided to go looking for the source of this reference, and I found a very similar image described in Practical Handbook on Image Processing for Scientific and Technical Applications, by Bernd Jähne, CRC Press, 1997. Here's a scan of Figure 10.23a, page 348, from that book:

The test image is constructed using equation (10.63):

where is the vector offset from the image center, is therefore the distance from the image center, and is the maximum value of in the image.

Today I'm going to ignore the second term (tanh) and just focus on the first term, and I'm going to substitute for . The instantaneous frequency of the sinusoid is given by:

The maximum instantaneous frequency, which occurs when , is therefore . For a discrete signal defined on a grid with unit spacing, the maximum representable frequency is , which corresponds to a period of 2 units.

OK, let's try it.

km = pi;
[x,y] = meshgrid(-200:200);
r = hypot(x,y);
rm = max(r(:));

g = sin( (km * r.^2) / (2 * rm) );
imshow(g,[])

I used the autoscaling syntax of imshow because the values of g range from -1 to 1. We can scale and shift g to get it into the range [0,1]. Then we don't need the second input to imshow, and the image will write out correctly if we use imwrite.

g = (g + 1)/2;
imshow(g)

Just for fun, let's push the maximum instantaneous frequency way past reasonable and look at the resulting aliasing artifacts.

km = 4*pi;
g = sin( (km * r.^2) / (2 * rm) );
g = (g + 1) / 2;
imshow(g)

I spent really much too long playing with this image yesterday, so I'm going to subject you to one or two more posts about it. For one thing, having the instantaneous frequency vary directly with distance from the image means we can explore interesting effects using bandpass filters. For another, I want to come back to the tanh term in the equation from Jähne's book. I'm a bit puzzled by it.


Get the MATLAB code

Published with MATLAB® 7.12

9 Responses to “Jähne test pattern”

  1. Paulo Silva replied on :

    Just for extra fun, wonder how many patterns are really there and not just pareidolia :)

    for n=1:200;
    km = n*pi;
    g = sin( (km * r.^2) / (2 * rm) );
    g = (g + 1) / 2;
    imshow(g)
    drawnow
    end

    It blows my mind!

  2. Simon replied on :

    I’ve encountered this test pattern too in an Image Processing and Image Communications course, where it was called a zoneplate. There’s a wiki article about a device called a zoneplate used to focus light into rings: http://en.wikipedia.org/wiki/Zone_plate

  3. Cris Luengo replied on :

    This type of test image is not only interesting to explore bandpass filters. Check out the difference between

    imfilter(g,fspecial('average',9));
    imfilter(g,fspecial('disk',4));
    imfilter(g,fspecial('gaussian',13,2));
    

    It’s a great demonstration of the Gaussian being so much better at low-pass filtering than the uniform averaging filters.

  4. Bharath replied on :

    In those images where the frequency is high…. is there any method to highlight those black strips in different color (only in the region of high density of black strips…. How to do this????

  5. Asmat Khan replied on :

    Great Steve. I was just working on finding a test pattern to compare the my proposed orientation filed with that of ground truth. For ground truth we use this pattern. A fellow Georgia Tech graduate
    Asmat Khan

  6. Steve replied on :

    Everyone—I apologize for the delay in your comments appearing. Normally I get an e-mail when I need to moderate a blog comment. Either there was e-mail glitch or I accidentally deleted some messages in my inbox, because I did not realize these comments had been posted until I logged in today to put up a new post.

  7. Steve replied on :

    Simon—Thanks for the Wikipedia reference. In Jähne’s book he says this pattern is known as the Fresnel zone plate.

  8. Steve replied on :

    Cris—Thanks for the suggested examples!

  9. Steve replied on :

    Bharath—You could use a high-pass filter to identify the regions of the image containing the high-frequency patterns. Threshold the output of the filter to make a region mask, and then alter the colors of the pixels within that mask.


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.