user1946217
user1946217

Reputation: 1753

how to convert a JPEG to an image matrix in R

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

I had used

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

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

Thanks

Upvotes: 4

Views: 9123

Answers (1)

Jota
Jota

Reputation: 17611

You are looking for:

imagedata(myjpg, type="grey")

Upvotes: 10

Related Questions