How to convert JPEG to image matrix in R

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

I used

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

I want to get the image matrix "myjpg" in the gray scale. Is there an R team that does this.

thank

+4
source share
1 answer

You are looking for:

imagedata(myjpg, type="grey")
+9
source

All Articles