# NOT RUN {
# remove background by transparency
img_path <- system.file("extdata/chrysochroa_NPL.png",
package = "colordistance")
img_array <- png::readPNG(img_path)
img_filtered <- removeBackground(img_array)
# remove background by color
img_path <- dir(system.file("extdata/Heliconius",
package = "colordistance"),
recursive = TRUE, full.names = TRUE)[1]
img_array <- jpeg::readJPEG(img_path)
img_filtered <- removeBackground(img_array,
lower = rep(0.8, 3), upper = rep(1, 3))
# }
Run the code above in your browser using DataLab