My goal is to plot with R a colored map of the human body, and will use here the simplified example of a smiley. I see two options but am stuck with both:
1) Extracting the different areas of the body using photoshop, and then plotting them on the top of each other:
R
link = "http://images.clipartpanda.com/clipart-smiley-face-9czEnApcE.jpeg"
download.file(link,basename(link))
jj <- readJPEG("clipart-smiley-face-9czEnApcE.jpeg",native=TRUE)
plot(1, type="n", axes=F, xlab="", ylab="")
rasterImage(jj,0.7,0.6,1,1)
I look for a way to do something like
rasterImage(jj,0.7,0.6,1,1, col="yellow")
But rasterImage works only with opaque pictures :/
2) Defining a polygon by interactively clicking on the picture, save that polygon to plot it later on the top of the original pic. That way I could simply create a map of the human body. But most maps are for countries and so rely on available geographical data.
Is there a way to "draw" in R lines and define polygons in an easy way?