setObjPoly: Interface to select objects within an image

Description Usage Arguments Value Note Author(s) Examples

Description

setObjPoly pulls up a tcltk interface for the user to select an object from the image. getObjPoly returns the coordinates the user selected.

Usage

1
2

Arguments

image

an imageMatrix object

Value

A vector of x coordinates and y coordinates corresponding to the object selected in the image.

Note

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.

Author(s)

Solomon Messing <[last-name] at stanford dot edu>

Examples

 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)

SolomonMg/ImageMetrics documentation built on May 27, 2019, 7:39 a.m.