contours {imager} | R Documentation |
Return contours of image/pixset
Description
This is just a light interface over contourLines. See help for contourLines for details. If the image has more than one colour channel, return a list with the contour lines in each channel. Does not work on 3D images.
Usage
contours(x, nlevels, ...)
Arguments
x |
an image or pixset |
nlevels |
number of contour levels. For pixsets this can only equal two. |
... |
extra parameters passed to contourLines |
Value
a list of contours
Author(s)
Simon Barthelme
See Also
highlight
Examples
boats.gs <- grayscale(boats)
ct <- contours(boats.gs,nlevels=3)
plot(boats.gs)
#Add contour lines
purrr::walk(ct,function(v) lines(v$x,v$y,col="red"))
#Contours of a pixel set
px <- boats.gs > .8
plot(boats.gs)
ct <- contours(px)
#Highlight pixset
purrr::walk(ct,function(v) lines(v$x,v$y,col="red"))
[Package imager version 1.0.2 Index]