Making SIRDS with Java

I made a Java Applet that you can use in a web page to produce a Single Image Random Dot Stereogram (SIRD).

If you want a more iteractive approach, try here

Basic Use

  1. Make a text file of rows and columns of 0's and 1's that describe the background (0) and foreground (1) of the image you want. Here is an example of the contents of a text file called "triangle.txt"

    17 12
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0
    0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0
    0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0
    0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

    Note that the first line has two numbers that describe the number of columns and rows.

    To get started, stick with simple shapes or perhaps a logo or a simgle letter. If you are impatient, try downloading some files I've made (Using GraphicConverter and saving the file as ASCII):

    If you are typing this by hand you may wish to multiply the result using Bit Bash]

    At the very minimum you need to download the following and place them in a directory where you will making your own files and web pages:

  2. Make a web page as you normally would, but at the location you want the SIRD, add the following HTML that calls the Java Applet :

    <APPLET code="sirds.class" width=17 height=12>
    <PARAM name ="infile" value="triangle.txt">
    </APPLET>

    Natuarally, the files "triangle.txt" and "sirds.class" need to be in the same directory as the sample HTML file to work properly.

Fancy Options

  1. To see the image directly without the the 3D dot stereogram add the "2D" parameter within the <APPLET> and the </APPLET> tags:

    <APPLET code="sirds.class" width=17 height=12>
    <PARAM name ="infile" value="triangle.txt">
    <PARAM name="2D" value="1">
    </APPLET>

  2. To see different color schemes add this within the <APPLET> and the </APPLET> tags:

    <APPLET code="sirds.class" width=17 height=12>
    <PARAM name ="infile" value="triangle.txt">
    <PARAM name="color" value="1">
    </APPLET>

    (The value can be 1 to 4. 1=blues 2=violets 3=yellow/green 4=woody green/reds)

  3. To play with the screen resolution that effects the veiwing distance as well as the media (for instance printers can have a dot resolution much more dense than monitors) you can change the DPI (dots per inch) value :
    <PARAM name="DPI" value="72">

  4. To double or triple the size of the dots and the image:
    <PARAM name="factor" value="2">

    This automatically reduces the DPI setting to compensate

  5. To add a blank border around the image helps people see the stereogram. Add this within the <APPLET> and the </APPLET> tags:

    <APPLET code="sirds.class" width=117 height=112>
    <PARAM name ="infile" value="triangle.txt">
    <PARAM name="border" value="50">
    </APPLET>

    Note that since the border adds 50 pixels to all sides, the width and the height were increased by 100. If you are using the factor parmeter, then the width and height also need to be increased

  6. 0 and 1 are not the only values to try: a negative value will make a "hole" in the background, and a 2 would make the shape appear closer to the veiwer. This is where the artistics side comes in. See the notes in the SIRD FAQ
Click here to see some samples

HOW IT WORKS: Principles of 3D Imagery



All single-image 3D systems (eg red-green glasses 3D) work on the principle that the left and right eyes see different features on the image plane which the brain interprets as a 3D object (see diagram above). The glasses ensure that each eye sees only one of the two images (with red/green specs, the eye with the RED filter only sees the GREEN image). Other technologies for the same effect include polarized images/glasses (used for a few films), and flashing left/right dark/clear LCD specs with corresponding alternate left and right images on a computer screen.

BUT with autostereograms any point for the right eye is ALSO seen by the left eye as shown below. An interpretation must then be made for that, so an extra point X is introduced, as a corresponding point for the right eye. This dependence must continue and be repeated across the entire display.

For the purpose of generating SIRDS it is usual to assume the geometry below, where the eyes 'move' along the image.