如何将JPEG转换为R中的图像矩阵 [英] how to convert a JPEG to an image matrix in R

查看:126
本文介绍了如何将JPEG转换为R中的图像矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将JPEG图像转换为矩阵。我想在矩阵上运行SVD。

I need to convert a JPEG image to a matrix. I want to run SVD on the matrix.

我用过了

library(jpeg)
library(biOps)
myjpg <- readJpeg("Snapshot_1.jpg")
> dim(myjpg)
[1] 398 506   3

我想得到一个图像矩阵最好是灰度级的myjpg。是否有R命令可以做到这一点。

I want to get an image matrix of "myjpg" in grey scale preferably. Is there an R command which does that.

谢谢

推荐答案

您正在寻找:

imagedata(myjpg, type="grey")

这篇关于如何将JPEG转换为R中的图像矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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