Dear r-helpers,

I have two questions:

(1) The following produces a pdf with artifacts. How do I prevent them?

require(grDevices)
imSize <- 200
lambda <- 10
theta <- 15
sigma <- 40
x <- 1:imSize
x0 <- x / imSize -.5
freq = imSize/lambda                    # compute frequency from  
wavelength
xf = x0 * freq * 2 * pi                  # convert X to radians: 0 ->  
( 2*pi * frequency)
f <- function(x, y){r <- -((x^2 + y^2)/(sigma ^2)); exp(r)}
z <- outer(xf, xf, f)
f1 <- function(x, y){cos(.1 * x)}
z1 <- outer(xf, xf, f1)
pdf('gabor.pdf')
image(xf, xf, z * z1, col = gray(250:1000/1000), xlab = '', ylab =  
'', bty = 'n',
     axes = FALSE, asp = 1)
dev.off()

(2) I would like the output to be clipped to a circle, i.e., anything  
outside the circle tangent to the sides of the square should be  
transparent. How can I do that?

_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to