Description Usage Arguments Value Note Author(s) Examples
setObjPoly
pulls up a tcltk interface for the user to select an object from the image.
getObjPoly
returns the coordinates the user selected.
1 2 |
image |
an imageMatrix object |
A vector of x coordinates and y coordinates corresponding to the object selected in the image.
These two functions are used to hand-select an object in an image, so that metrics can be extracted. Thanks to http://www.sciviews.org/_rgui/tcltk/InteractiveTkrPlot.html, which outlines many key concepts used for these functions.
Solomon Messing <[last-name] at stanford dot edu>
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
mcattackad = new("imageMatrix", X = readPNG(system.file("extdata", "jm-sep25-promise1.png", package="ImageMetrics")), type = "rgba")
setObjPoly(mcattackad) ## opens tcltk interface
mcattackadpoly = getObjPoly(mcattackad) ## returns polygon corresponding to the object the user selected.
## create new image with only the object selected.
mcattackadface = new("imageMatrix", X = ObjSelect( image = mcattackad@X, poly= mcattackadpoly ), type = "rgb")
plot(mcattackadface)
## save the image to the current directory
getwd()
writePNG(mcattackadface@X, "obamaface.png")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.