jpeg: reading color from img

jpeg: reading color from img

jpeg: reading color from img

配色难题

##Reading color from the image

library(jpeg);library(reshape2)
picture <- readJPEG("~/Pictures/test.jpg")
longImage <- melt(picture)
rgbImage <- reshape(longImage, timevar='Var3',idvar=c('Var1','Var2'), direction='wide')
colorColumns<- rgbImage[, substr(colnames(rgbImage), 1, 5)== "value"]
Color_B = data.frame(sort(table(rgb(colorColumns)),decreasing=T))[[1]]
Author

Karobben

Posted on

2020-06-19

Updated on

2023-06-06

Licensed under

Comments