Submitted by , posted on 31 August 2001



Image Description, by


I thought I'd send in something a little bit different. I've written a Java applet that combines a depth-map and a pattern to produce stereogram/"magic-eye" images. If you've never heard of them before, they are pictures that hide a 3D image which can been seen by focusing your eyes in a certain way. The algorithm for producing these is actually very simple to implement.

Here is a diagram of light-rays bouncing off a point on a object and into an observer's eyes, who is focused on that point:

      Object point
      /\
     /  \
    /    \
   /      \
  /        \
 /          \
/            \
Left eye     Right eye
The way you see is very complex, but basically both eyes are seeing the same image so your brain can tell how far away the object is based on you focus. Now, imagine placing a piece of paper between yours eyes and the object and colouring in where the light-rays intersect it:

      Object point
      /\
     /  \
    /    \
---x------x--- Paper
  /        \
 /          \
/            \
Left eye     Right eye
As long as your eyes are still focusing at the same point (*not* on the paper) your brain is fooled into thinking that the light coming from the two nearby points is actually from one point further away. Also, observe that if the object was to be moved closer, the intersections would be closer together. So, by placing matching pairs of points in an image and focusing differently, you can fool the brain into seeing a 3D image from a 2D one.

If you have trouble seeing stereograms, I'll give you some tips. Make sure your eyes are parallel to the horizontal edge of your monitor and you are positioned in the middle of it, otherwise the matching points won't align properly. Focus behind the screen to start with by going slightly cross-eyed and keep adjusting focus until another image begins to appear. If you don't have this much control on your focus (some people find that difficult), just stick your eyes against the monitor and slowly move your head back without trying to focus on the monitor. There's no reason why anyone can't see them, so just keep trying.

Also, viewing this image at a 1280x1024 resolution, I can see the stereogram easily at sitting distance from my monitor. If the image appears bigger on your screen, you will have to move further away to see it (which most people will find much harder).

If you want to try out some more stereograms and view the source code for producing them, along with some other applets, go to www.smiley-face.freeserve.co.uk/programming/



[prev]
Image of the Day Gallery
www.flipcode.com

[next]


 


Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.