[R] Weird feature in rimage

From: Alberto Monteiro <albmont_at_centroin.com.br>
Date: Mon, 10 Mar 2008 09:59:31 -0200


I just noticed a weird feature in rimage. It seems that, when reading an image, the line/colums are transposed.

See this reproducible example. The final image should be black - but (as expected) not an absolute black (mean(z) is 0.015, sd(z) is 0.055 but max(z) is 1).

Alberto Monteiro

# reproducible example
#
# load image of a cat
#

library(rimage)
x <- read.jpeg(system.file("data", "cat.jpg", package="rimage"))
#
# save the same image of the cat
# weird feature: dimensions are transposed (!)
#

jpeg("newcat.jpg", width=(dim(x)[2]), height=(dim(x)[1])) par(mar=rep(0, 4))
plot(x)
dev.off()
#
# load second image of the cat - should be similar but not equal
# (jpeg is a lossy format)
#

y <- read.jpeg("newcat.jpg")
#
# Construct the differences
#

z.mat <- abs(x - y)
z <- imagematrix(z.mat)
#
# Watch the differences
#

plot(z)
#
# Analyse the differences
#

mean(z)
sd(z)
max(z)



R-help_at_r-project.org 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. Received on Mon 10 Mar 2008 - 12:28:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 10 Mar 2008 - 12:30:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive