I have a 2 part question, the first part was easy & is answered but I have one issue :
1) Load map in R and convert to Raster : Done
2) Tell R to only show a defined color band : NOT done
As you can see in my example map, it is a map of Namibia, and it is a single layer black and white map, with one blue dot. The RGB code of this blue dot is: Red == 14 , Green == 6, and Blue == 209
What I would like to do is tell R to Isolate this dot, and to leave out the rest, so in essence, when I plot the map, I have only the blue dot.
Here is my current code, and here is an example map.
rm(list=ls())
library(raster)
library(maps)
library(magick)
library(rgdal)
# working directory
setwd("Working here")
# load first image
Species_id<-1
Species_i <- image_read(paste("Species (", Species_id, ").png", sep=""))
Species_i_rotated<-image_rotate(Species_i,0)
image_write(Species_i_rotated, path = "Temporary.png", format = "png")
# create raster
Converted <- raster("Temporary.png", band=1)
#### This is where my problem needs solving
#This defines the threshold to classify where the dot on the image is present as 1
# While removing all the unwanted features
Converted<-Converted == 14 & Converted==6 & Converted==209
Converted[Converted==0]<-NA
plot(Converted) # I would like this to show only the blue dot.