pick.pts: 2D Manual digitization of image data

Description Usage Arguments Details Value See Also Examples

View source: R/image.R

Description

Uses the active graphics device for interactive digitization of shape and position data.

Usage

1
pick.pts(img, n = 1000, review = TRUE, smoothing = NULL, smooth = NULL)

Arguments

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 img. The number of points added to each frame may be less than this value. See details.

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 smoothing is set to 'loess', this values is passed to 'span' parameter of loess. If smoothing is set to 'spline', this value is ignored and the smooth points are determined by the default values of spline. See details.

Details

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

Value

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:

See Also

locator, loess, smooth.spline

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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)

ckenaley/trackter documentation built on Feb. 11, 2022, 6:43 a.m.