This document visualizes K-means clustering on the colors of a particular image design to determine the most important colors needed.
##Execute Run the defined Function to get tables and Images
iv <- 1:12
pt <- proc.time()
w <- as.numeric()
for (i in iv) {
g <- get_plots("Mur4.jpeg",i)
grid.arrange(g[[1]], nrow=1)
ggsave(paste("Mur_Segm_",i,".png",sep=""), g[[1]])
cat("\n")
cat("## Num Colors: ", i, "\n")
print(
tagList(
datatable(g[[2]]) %>%
formatStyle("hex",
backgroundColor = styleEqual(g[[2]]$hex, g[[2]]$hex)
)
)
)
cat("\n")
w[i] <- g[[3]]
}
## Saving 7 x 5 in image
## Saving 7 x 5 in image
## Saving 7 x 5 in image
## Saving 7 x 5 in image
## Saving 7 x 5 in image
## Saving 7 x 5 in image
## Saving 7 x 5 in image
## Saving 7 x 5 in image
## Saving 7 x 5 in image
## Saving 7 x 5 in image
## Saving 7 x 5 in image
## Saving 7 x 5 in image
wdf <- data.frame(k=iv, wss = w)
gg <- ggplot(wdf, aes(x=k, y=wss)) +
geom_line() +
geom_point()
gg