在版本3.1.0中以R显示图像 [英] Displaying images in R in version 3.1.0
本文介绍了在版本3.1.0中以R显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了旧的stackoverflow帖子,例如这个使用现在已在R 3.1.0中弃用的ReadImages和biOps等软件包,并且不再可用。
I've ran into old stackoverflow posts like this one that use packages like ReadImages and biOps that are now deprecated in R 3.1.0, and are not available anymore.
有人可以告诉我如何显示图3.1 R 3.1.0? (特别是jpeg和png图像)
Can someone tell me how to display an image in R 3.1.0? (Specifically jpeg and png images)
推荐答案
正如Simon Urbanek在链接问题的评论,你可以这样做:
As pointed out by Simon Urbanek in the comments of the linked question, you can do this:
library("jpeg")
jj <- readJPEG("myfile.jpg",native=TRUE)
plot(0:1,0:1,type="n",ann=FALSE,axes=FALSE)
rasterImage(jj,0,0,1,1)
或(对于PNG)
library("png")
pp <- readPNG("myfile.png")
plot.new()
rasterImage(pp,0,0,1,1)
版本0.1.7 png
,0.1.8 jpeg
version 0.1.7 of png
, 0.1.8 of jpeg
这篇关于在版本3.1.0中以R显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文