R - 像素矩阵的图像? [英] R - image of a pixel matrix?

查看:33
本文介绍了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屋!

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