Description Usage Arguments Value Note Author(s) Examples
ObjSelect
selects an object with the polygon provided from an image.
1 |
image |
the "@X" array of an imageMatrix object |
poly |
an a polygon represented as a vector of concatenated x coordinates and y coordinates |
A matrix or three dimensional array representing only the object in the image. All pixels not in the polygon are set to NA.
This function relies on the maps package's point-in-polygon c-code for rapid selection
Solomon Messing <[last-name] at stanford dot edu>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | data(Campaign2008)
## User clicks around an object via tcktk device to define a polygon:
clinton = new("imageMatrix", X = readPNG(system.file("extdata", "Clinton.png", package="ImageMetrics")), type = "rgba")
# Select object using polygon:
clintonfacearray = ObjSelect( image = clinton@X, poly= clintonpoly )
# create new image with only the object selected.
clintonface = new("imageMatrix", X = clintonfacearray, type = "rgb")
## Not run:
plot(clintonface)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.