R - 像素矩阵的图像? [英] R - image of a pixel matrix?
本文介绍了R - 像素矩阵的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你如何从R中的矩阵中制作图像?
How would you you make an image from a matrix in R?
矩阵值对应于图像上的像素强度(虽然我只对0,1值白色或黑色感兴趣。),而列和行编号对应到图像上的垂直和水平位置。
Matrix values would correspond to pixel intensity on image (although I am just interested in 0,1 values white or black at the moment.), while column and row numbers correspond to vertical and horizontal location on the image.
通过制作图像我的意思是在屏幕上显示它并将其保存为jpg。
By make an image I mean display it on the screen and save it as a jpg.
推荐答案
您可以使用图片在屏幕上最简单地显示它:
You can display it on the screen easiest using 'image':
m = matrix(runif(100),10,10)
par(mar=c(0, 0, 0, 0))
image(m, useRaster=TRUE, axes=FALSE)
您还可以查看光栅包...
You can also have a look at the raster package...
这篇关于R - 像素矩阵的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文