autostereogram: Creates autostereogram based on a depth map and a pattern. If...

Description Usage Arguments Value Examples

Description

Creates autostereogram based on a depth map and a pattern. If no pattern is provided, a random-dot autostereogram is created. The object returned is a cimg from the image package. Supported picture formats are PNG, JPEG and BMP.

Usage

1
autostereogram(depth.map, pattern, repetitions)

Arguments

depth.map

Depth map representing the 3D shape. Possible values are: a) Numeric matrix where lements with large value appear closer. b) Character containing path to greyscale .bmp .jpg or .png picture. The whiter a pixel is, the closer it appears.

pattern

Optional. Path to a picture (.bmp .jpg or .png) representing the pattern used to create the autostereogram. If not provided, a random dot autostereogram is generated.

repetitions

Optional. Number of times the pattern should be repeated horizontally. Default is round(width(depth.map)/100)

Value

cimg image

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Plot bivariate gaussian distribution
x <- seq(-2.5, 2.5, 0.02)
y <- seq(-2.5, 2.5, 0.05)
depth.map <- matrix(data=NA, nrow=length(x), ncol=length(y))
for(i in 1:length(x)) {
  for(j in 1:length(y)) {?
    depth.map[i,j] <-  (1/(2*pi)) * exp( -((x[i])^2 + (y[j])^2)/2 )
  }
}
gaussian <- autostereogram(depth.map)
plot(gaussian, axes=FALSE)

pierrecattin/Rstereo documentation built on May 14, 2019, 11:13 a.m.