Image to DF to ggplot
Steve de Peijper
25 mei 2016
In this post we will convert an image to a dataframe to display the image with ggplot. In a later post we will compress the image.
library("png", lib.loc="C:/TFS/Rlib/")
require(ggplot2)
## Loading required package: ggplot2
This is the original image:
.
The work
plaatje = readPNG("c:/TFS/test.png")
x <- data.frame(1:100,1,1,1,1,1)
colnames(x) = c("t", "x","y", "r", "g", "b")
for (a in 1:3) {
teller = 1
for (i in 1:length(plaatje[,1,a])) { #Hoogte
for (j in 1:length(plaatje[i,,a])) { #Breedte
x[teller,c(1:3,3+a)] = c(teller,j,i,plaatje[i,j,a])
teller = teller + 1
}
}
}
ggplot(data=x, aes(x=x, y=y, fill=rgb(r,g,b))) +
geom_tile() +
scale_fill_identity()
kayseriescortu.com - alacam.org - xescortun.com
ReplyDeleteMMORPG OYUNLARI
ReplyDeleteinstagram takipçi satın al
Tiktok Jeton Hilesi
TİKTOK JETON HİLESİ
antalya saç ekimi
İNSTAGRAM TAKİPÇİ SATIN AL
instagram takipçi satin al
Mt2 pvp serverlar
İnstagram Takipçi Satın Al
YENİ PERDE MODELLERİ
ReplyDeleteNumara onay
Mobil Odeme Bozdurma
NFT NASIL ALİNİR
ankara evden eve nakliyat
TRAFİK SİGORTASİ
DEDEKTOR
SİTE KURMA
aşk kitapları