Subject: RDS information

From: [email-masked] (Paul Wilhelm Karl Rothemund)
Date: 6 May 93 02:32:22

Newsgroups: comp.graphics
Subject: Re: WANTED: Source for creating Random Dot Stereograms
References: <[email-masked]>

[email-masked] (Rick Kent) writes:

>   I am looking for source to create random dot stereograms.
>I remember the source being posted to the net awhile ago but
>at that time I wasn't very interested in them. I have checked 
>the FAQs but there wasn't any mention of them.

>   I would also appreciate it if you could point me in the 
>direction of any articles on the subject.

Random Dot Stereograms or RDS were created by Dr. Bela Julesz in, I think, 
the 1950's in order to prove that the brain did not need monocular clues
to fuse two images and solve the "false target problem" that arise so 
that we may see in 3d. Dr. Julesz wrote a book in 1971 called 
The Foundations of Cyclopean Perception which any good university library 
should have. It is THE definitive book on RDS and includes many RDS in color
as well as a pair of red green glasses in the back to view them. (The 
Foundations of Cyclopean Perception is out of print and I have been trying
to buy a copy for my own library so if anyone knows where I can buy one...)
Dr. Julesz went to great lengths to make the red green RDS anaglyphs in the
book look as good as possible so the green ink in the book even has metal 
flakes introduced into it to increase its luminance. 
 I took a class from Dr. Julesz last term (he was a joint professor at 
Caltech and Rutgers University but he has, as of this spring, left for 
Rutgers permanently.)

As for constructing RDS, thats easy. Black and white ones are the easiest, but
red/green ones require only a little more thought to decide what to do when
"collisions" of dots occur in the image. One needs to make two fields of random
black and white noise, let's call them A, and B. Two copies of the field A
of random noise are placed next to one another. These will be the two 
background fields that one fuse that (by diverging ones eyes) that will appear
to be in the plane of the paper (or screen or whatever.)  Then one "cuts" 
the desired shape that they want to see in depth out of the field B 
and places it on top the copies of field A. In the left copy of field A 
the cutout is placed an integral number of pixels off of the center 
line to the left and in the right copy of the if field A the cutout is placed 
the same integral number of pixels off of the center line to the right. 
That is, the cutouts are laid down so that they are both shifted toward the
outside of the stereogram by a few pixels. The "cutout" shape will appear to
be BEHIND the plane of the paper (if you see RDS by diverging your eyes.)
To make the shape POP OUT of the paper then the cutouts should be laid out
with a an equal shift towards the center of the RDS. That is in the left 
field A the cutout should be right of the center by x pixels and in the right
field A the cutout should be left of the center by x pixels. The greater the
shift x is the greater behind or in front of the page the cutout will seem.
To make RDS with multiple layers of depth simply superimpose more "cutouts" 
from additional random fields but with different "x pixel" shifts 
(disparities.) 

call this field A (obviously you would want it to be random X's and O's)
with a center at v (call it offset or 0 off) .
    v
OXOXOXOXOX
XOXOXOXOXO
OXOXOXOXOX
XOXOXOXOXO
OXOXOXOXOX
XOXOXOXOXO
OXOXOXOXOX
XOXOXOXOXO

and this field B, out of which I cut the 3x3 square next to it.
ABABABABAB
BABABABABA
ABABABABAB    BAB
BABABABABA    ABA
ABABABABAB    BAB
BABABABABA
ABABABABAB
BABABABABA

Then to see the square pop out of the random field A I copy it in with the 
offsets below to two side by side copies of field A. DON'T fuse my first
two examples and expect them to work. A one character width disparity at 
is too much for your brain to fuse the images of the cutouts (at this distance)

Offset towards the center and the cutout will pop up. 
   +1 off    -1 off
    v            v
OXOXOXOXOX   OXOXOXOXOX
XOXOXOXOXO   XOXOXOXOXO 
OXOXBABXOX   OXBABXOXOX
XOXOABAOXO   XOABAOXOXO 
OXOXBABXOX   OXBABXOXOX
XOXOXOXOXO   XOXOXOXOXO 
OXOXOXOXOX   OXOXOXOXOX
XOXOXOXOXO   XOXOXOXOXO 

Offset away from the center and the cutout will be below the page
   -1 off     +1 off
    v            v
OXOXOXOXOX   OXOXOXOXOX
XOXOXOXOXO   XOXOXOXOXO   
OXBABXOXOX   OXOXBABXOX
XOABAOXOXO   XOXOABAOXO   
OXBABXOXOX   OXOXBABXOX
XOXOXOXOXO   XOXOXOXOXO   
OXOXOXOXOX   OXOXOXOXOX
XOXOXOXOXO   XOXOXOXOXO   

Here are ones that you can fuse that have a 1/2 character offset.
(with respect to the center of the backgrounds) Fuse the \/ v's to see it.

The cutout pops up.

   +.5           -.5
    \/           \/
OXOXOXOXOXO  OXOXOXOXOXO
XOXOXOXOXOX  XOXOXOXOXOX
OXOXBABXOXO  OXOBABOXOXO
XOXOABAOXOX  XOXABAXOXOX
OXOXBABXOXO  OXOBABOXOXO
XOXOXOXOXOX  XOXOXOXOXOX
OXOXOXOXOXO  OXOXOXOXOXO
XOXOXOXOXOX  XOXOXOXOXOX

The cutout sinks below the page.

   -.5           +.5
    \/           \/
OXOXOXOXOXO  OXOXOXOXOXO
XOXOXOXOXOX  XOXOXOXOXOX
OXOBABOXOXO  OXOXBABXOXO
XOXABAXOXOX  XOXOABAOXOX
OXOBABOXOXO  OXOXBABXOXO
XOXOXOXOXOX  XOXOXOXOXOX
OXOXOXOXOXO  OXOXOXOXOXO
XOXOXOXOXOX  XOXOXOXOXOX

Even a .5 charater disparity is hard to fuse if the disparity is outwards 
as it is in the second example. For those sickos who view random
dot stereograms by converging (crossing ones eyes) the images that I
said pop in, pop out, and vice versa. I only say sickos because I am not
able to view RDS in this way. I just can't focus and converge at the same
time. If someone wants some sample programs I wrote for RDS I can mail
them to them (B/W or Color.) They unfortunately use some graphics specific
to X and they use a library for a CS class here but those things should be
easy to change. My email is [email-masked]. 

Paul Rothemund
Caltech 
MSC 712
Pasadena CA, 91126

>Thanx for your help,

>- Rick.
>_______________________________________________________________________________
>Richard Kent, Megatek Corp.  | "Forgive me for not knowing about El Salvador.
>9645 Scranton Road.          | Like it's not like I'm ever going to go to Spain
>San Diego, CA  92121         | or anything."      -- "Buffy the Vampire Slayer"
>[email-masked]            | 
>-- 

>_______________________________________________________________________________