File Exchange Pick of the Week

Autostereogram

Jiro's pick this week is abSIRD by Daniel Armyr.

Here's a fun pick for the week. This function takes a matrix, representing a height-map, and visualizes it using an Autostereogram. To quote Daniel, "the algorithm used is abSIRD, published in 2004 by Lewey Geselowitz. It is a fast, in-place algorithm that is exquisitely simple to implement."

Can you see them? Hint: cross your eyes.

m = membrane(1, 250, 9, 2);
makeAbsird(m);
p = load('penny');

% Make it 4 times bigger (imresize from Image Processing Toolbox)
p2 = imresize(p.P, 4);

makeAbsird(p2);

What a great way to visualize 3D data!

I like this entry not only for the coolness factor, but also for how it is written. The code is robustly written with error checking and plenty of comments to describe the algorithm. I also like the published example code that he included with the entry. These files can be easily created using MATLAB's publishing capability, and it's a great way of showing how to use your code or explaining concepts. I especially like them when they are used with File Exchange entries.

Give this function a try (and cross your eyes) and let us know what you think here or leave a comment for Daniel.

Get the MATLAB code

Published with MATLAB® 7.14

8 Responses to “Autostereogram”

1. Tony Sturges replied on :

Do you really mean to cross your eyes? I’ve seen lots of these pictures on posters, but usually it requires that we relax our eyes so as to focus in the far distance. No matter how I try I cannot see either the membrane or the penny here. Strange.
t

2. Vince replied on :

I find that if I slowly uncross my eyes, the image comes out. It took a little bit of time to find the sweet spot, but it’s really interesting.

3. Jiro Doke replied on :

Tony, yes I really mean “cross your eyes”, at least that’s how I see it. I think there are different ways to do it. I usually cross my eyes to let the two images coming into my eyes overlap. But as Vince mentioned, if I let it overlap too much, then I have to slowly uncross.

4. Tony Sturges replied on :

Ah So. Of course, once we ” see it,” it is obvious :-) What I see is not quite what I was looking for, but that is the minor problem. I wear those modern glasses that are a fancy version of bifocals; continuously variable. After years of using them, my head automatically adjusts, so that when my brain thinks I’m looking at something across the street, my head tilts so that I am looking through the upper part of the lenses; in this case, I have to be aware of looking through the lower part of the lens to focus on the computer screen. so soon old, so late smart. Cool routine.
t

5. Michael Katz replied on :

Pretty cool.

6. Stephen Reinach replied on :

Very cool! Thanks for sharing.

7. Loren Shure replied on :

I’m in the no see category ;-(

–loren

8. Sarah replied on :

Pretty cool! I find the cross-eyed type a lot tougher than the eye-relaxing type though.

I made an app that lets you make these on an iPhone or iPad: http://itunes.apple.com/us/app/draw-3d!-paint-draw-sketch/id514612841?ls=1&mt=8

Brett & Jiro share their favorite user-contributed submissions from the File Exchange.

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