| pick.pts | R Documentation |
Uses the active graphics device for interactive digitization of shape and position data.
pick.pts(img, n = 1000, review = TRUE, smoothing = NULL, smooth = NULL)
img |
character, a one-dimension vector of image file paths. |
n |
numeric, the max number of points to digitize for each frame (i.e., image file) in |
review |
logical. If 'TRUE', the user inputs 'return/enter' after points have been added for each frame. If 'FALSE', the function advances to the next frame without review after the last point has been added. |
smoothing |
character, the smoothing method: either 'loess' or 'spline' for line smoothing or 'outline' for contours. See details. |
smooth |
numeric; if |
Users interact with each frame using the locator function. Although the maximum number of points for each frame is determined by n, the user may advance to the next frame by double-clicking on the last point. If review=TRUE, the user is asked to review the points and, if satisfied, a "return"/"enter" key stroke will advance the graphics device to the next frame. After double clicking in the last frame and a "return"/"enter" key stroke if review=TRUE, the results are returned. If smooth=NULL, only the clicked points are returned. If smooth="spline" or smooth="loess", interpolated smoothed points are returned.
Smoothed points for outlines are produced with coo_smooth. Lines are smoothed with smooth.spline with smooth passed to the spar parameter or with smooth.spline with smooth passed to the spar
A list of one or two data tables, always pts with the picked points and, optionally, smooth.pts containing the the smoothed points if smoothing is chosen. Each contains the following columns:
'frame', the frame file name
'frame.n', the frame number
'pt', the point number
x,y coordinates of the selected points
locator, loess, smooth.spline
## Not run:
#download example avi video
f <- "https://github.com/ckenaley/exampledata/blob/master/sunfish_pect.avi?raw=true"
download.file(f,"sunfish.avi")
#extract images with ffmpeg operations and reduce them to 600 px wide with a filter
filt.red <- " -vf scale=600:-1 " #filter
dir.create(paste0(tempdir(),"/out"))
vid.to.images2(vid.path="sunfish.avi",filt = filt.red,out.dir = paste0(tempdir(),"/out"))
y <- list.files(paste0(tempdir(),"/out"),full.names = TRUE)[1:3]
pick.pts(y,review=F)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.