We strengthen our intuition Part 2/application library(ggplot2)
library(imager)
img <- load.image("C:/Users/ACER/Desktop/RIZA/ARTIST.png")
points <- which(img > 0, arr.ind = TRUE)
img_dims <- dim(img)
height <- img_dims[1]
width <- img_dims[2]
sampled_points <- points[sample(nrow(points), size = 100174), ]
sampled_points_df <- data.frame(sampled_points, stringsAsFactors = FALSE)
colnames(sampled_points_df) <- c("y", "x")
sampled_points_df[,2] <- width - sampled_points_df[,2]
ggplot(sampled_points_df, aes(x = x, y = y)) +…