这似乎很琐碎,但我不能在JPEG或成R 2.15任何类型的图像读取。 在该R 2.10我可以用做rimage
库或ReadImage
库-与read.jpeg例如-但似乎没有办法做到这一点R中2.15及更高版本。 在这个有什么想法?
library('ReadImages')
Error in library("ReadImages") : there is no package called ‘ReadImages’ >
install.packages('ReadImages') Installing package(s) into ‘C:/Program Files/R/R-2.15.1/library’ (as ‘lib’ is unspecified)
Warning in install.packages : package ‘ReadImages’ is not available (for R version 2.15.1)
正如在评论中指出,试试JPEG包。
install.packages("jpeg") ## if necessary
library(jpeg)
## get help
library(help = jpeg)
## get more help
?readJPEG
例如,从帮助:
# read a sample file (R logo)
img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg"))
另一种选择是rgdal,这可以从格式大规模的动物寓言阅读。 绘制和操作的处理方式不同。
install.packages("rgdal") ## if necessary
library(rgdal)
img <- readGDAL(file.path(R.home(), "doc", "html", "logo.jpg"))
还有在CRAN的readbitmap包,它总是值得你正在寻找一个基本的搜索软件包列表。
也:
## if not already installed
install.packages("jpeg")
library(jpeg)
?readJPEG()
img <- readJPEG("/Users/name/locationInFileDirectory/image.jpg", native = TRUE)
#this will display your image to test you read it correctly
if(exists("rasterImage")){
plot(1:2, type='n')
rasterImage(img,1,1,2,2)
}