as.Roi | R Documentation |
Convert an Image
object into an Roi
object
as.Roi(img, ...) as.ROI(img, ...)
img |
object of class |
resize |
re-assign |
This adds the class
"Roi" to Image
objects and places the
dimensions of the image in the slot
named "loc
."
Roi
objects passed as an argument will be considered an error
unless resize = TRUE
.
Roi
object of the same dimensions as the
# Region of interest from sample image in EBImage package birds <- readImage(system.file("images", "sample-color.png", package="EBImage")) roi <- getROI(birds, 160, 255, w = 200, h = 240) # Examine effect on Image object attr(birds, "loc") # nothing here attr(as.Roi(birds), "loc") # returned an Roi # Examine effect on 'Roi' pp <- attr(roi, "loc") # original roi2 <- resize(roi, w = 400) pp2 <- attr(roi2, "loc") identical(pp, pp2) # re-sizing the image has no effect on 'loc' # Compare with resize = TRUE attr(roi, "loc") attr(as.Roi(roi, resize = TRUE), "loc")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.