if (FALSE) {
sc <- screenshot()
if(sc != ""){
sc_image <- imager::load.image(sc)
w <- 100
h <- 80
pos_x <- 1
pos_y <- imager::height(sc_image) - h
needle <- crop_image(sc_image, pos_x, pos_y, w, h)
(locate_image(needle)) # center location
pos <- locate_image(needle, center = FALSE)
found <- crop_image(sc_image, pos[1], pos[2], w, h)
layout(c(1:3))
plot(sc_image)
plot(needle)
plot(found)
# usse `coner` to limit searching field
# `coner` can be used in Windows
pos <- locate_image(needle, corner = "bottom_left", center = FALSE)
}
}
Run the code above in your browser using DataLab