如何在 R 2.15 中读取.jpeg [英] how to read.jpeg in R 2.15

查看:25
本文介绍了如何在 R 2.15 中读取.jpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这看起来很琐碎,但我无法将 jpeg 或任何类型的图像读入 R 2.15.在 R 2.10 中,我可以使用 rimage 库或 ReadImage 库(例如 read.jpeg)来做到这一点,但在 R 2.15 及更高版本中似乎无法做到版本.对此有什么想法吗?

It seems very trivial but I can't read in jpeg, or any type of image into R 2.15. In R 2.10 I could do it using rimage library or ReadImage library - with read.jpeg for example - but there seems to be no way to do it in R 2.15 and later versions. Any thoughts on this?

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 包.

As pointed out in comments, try the jpeg package.

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,它可以从大量的格式中读取.绘图和操作的处理方式不同.

Another option is rgdal, which can read from a massive bestiary of formats. Plotting and manipulation are handled differently.

install.packages("rgdal") ## if necessary
library(rgdal)
img <- readGDAL(file.path(R.home(), "doc", "html", "logo.jpg"))

CRAN 上也有 readbitmap 包,它总是值得在包列表中进行基本搜索以找到您要查找的内容.

There is also the readbitmap package on CRAN, it's always worth a basic search of the packages list for what you are looking for.

这篇关于如何在 R 2.15 中读取.jpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆