User Tools

Site Tools


jvs:cigal:manual:chapter3:stereogram

CIGAL Reference Manual, Chapter 3 (Functions): STEREOGRAM

STEREOGRAM -- Convert a Z-value image into a 3-d stereogram

usage: newimage = stereogram(Zimage,RPT,flag,zscale)

        STEREOGRAM converts a Z-value map into a stereogram by calculating how
    the view from two different positions would distort the apparent Z-value
    surface, and then applying those distortions to a background image to
    create a 3-d stereo pair.  The Z-value map is specified by the ZIMAGE
    argument, which must be a 2-dimensional matrix.
    The background image is specified by the RPT argument.  It can be either
    an image or a number.  If it is an image, that image will be used to create
    the background. The image must have the same vertical (Y) dimension as the
    ZIMAGE. The horizontal (X) dimension of the RPT image is used as the stereo
    repeat interval.  If RPT is specified as a number, then that number is used
    as the stereo repeat interval and the background image is automatically
    generated as a random dot pattern (of dimension RPT x Ydim_of_ZIMAGE).
    The stereo repeat interval determines the size and appearance of the new
    image that is to be created. NEWIMAGE will have the same Y dimension as
    ZIMAGE and its X dimension will be the X dimension of ZIMAGE plus the
    repeat interval. This means that if the repeat interval is greater than or
    equal to ZIMAGE's X dimension, the output will contain two separate views --
    a standard stereo pair.  If the repeat interval is less than ZIMAGE's X dimension,
    the output will be an autostereogram in which two views of the 3-d object are
    superimposed in a repeated pattern of background images.

 The FLAG argument can be used to specify drawing options (combine by addition):
1  - place a dot at the bottom of each view (separated by the repeat    interval)
to help in fusing

2  - don't fill in holes created by shifting pixels. Pixels in-holes will
be assigned the values 1 or 2, depending on whether they are visible to
only the left or right eye, respectively.

4  - don't hide surfaces that would be masked by protruding objects
By default, FLAG is 0.

The ZSCALE argument is a scaling factor that is applied to every pixel in ZIMAGE.
It is normally 1.0 but can be changed to adjust the size of the entire object.

Note: To create a single stereo-image in which the two views are overlaid in different
colors you would use stereogram to first create two separate views (i.e., with a stereo
repeat interval equal to ZIMAGE's width) and then map the two views to the two different
colors and superimpose.

See Also:

CIGAL Home, CIGAL Manual, Functions List, Manual Help

jvs/cigal/manual/chapter3/stereogram.txt · Last modified: 2023/02/23 18:43 (external edit)