Start with:
> x <- c(1:7,1)
> dim(x) <- c(2,4)
> x
[,1] [,2] [,3] [,4]
[1,] 1 3 5 7
[2,] 2 4 6 1
2 Rows of 4 Columns. Upper-left and lower-right elements of the matrix
are the same.
All to this point makes good sense.
> image(x)
However, this image shows 2 columns of 4 rows. The lower-left and
upper-right elements are the same. This does not make sense to me.
Did I miss some simple parameter to "fix" all of this naturally? Why
would the numeric matrix of "x" and the image of "x" have such a
different geometry?
I'd love to use R for some simple image processing, but I don't want to
spend my time "fixing" all my images.
Because Image Pro Plus wasn't doing a calculation the way we wanted, I
dumped 16-bit pixel data into Excel and used Excel to create CSVs. All
of this went much faster than figuring out the "surprise" that R didn't
display the images "correctly". Did I miss something simple?
I really don't want to do this:
ReadImageMatrix <- function(filename)
{
x <- as.matrix(read.csv(filename,header=FALSE))
x <- t(x)
return( x[,ncol(x):1] )
}
oldpar <- par(mfrow=c(2,2))
x <- ReadImageMatrix("1n.csv")
image(x, col=gray((0:255)/255), main="1N", axes=FALSE)
y <- ReadImageMatrix("2n.csv")
image(y, col=gray((0:255)/255), main="2N", axes=FALSE)
z <- ReadImageMatrix("3n.csv")
image(z, col=gray((0:255)/255), main="3N", axes=FALSE)
par(oldpar)
efg
--
Earl F. Glynn
Scientific Programmer
Stowers Institute for Medical Research
[[alternative HTML version deleted]]
______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html