Title: | Image Annotation and Polygon Outlining using Free Drawing |
---|---|
Description: | Provides functions to create image annotations through polygon outlining. Annotator has the same function as 'graphics::locator()' but achieves its purpose through drawing, rather than multiple mouse clicks. It is based on the 'htmlwidgets' package and 'fabric.js' JavaScript library <http://fabricjs.com/>. |
Authors: | Mihai Valcu [aut, cre] |
Maintainer: | Mihai Valcu <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.0.3.1 |
Built: | 2025-02-08 02:51:23 UTC |
Source: | https://github.com/valcu/annotator |
This function creates an annotation using htmlwidgets. The widget can be rendered on HTML pages generated from Shiny or other applications.
annotate( im, resultId = "annot_id", brushWidth = 4, brushColor = "red", opacity = 0.5, fill = "grey" )
annotate( im, resultId = "annot_id", brushWidth = 4, brushColor = "red", opacity = 0.5, fill = "grey" )
im |
the input image. If missing, a transparent 800x600 png is used. |
resultId |
the id of the |
brushWidth |
default to 3 pixels. |
brushColor |
Any valid CSS color. For example "red", "rgba(255,93,0,1)", or "#1c4564". |
opacity |
default to 0.5. |
fill |
default to 'gray' |
An object generated by htmlwidgets::createWidget()
.
if (interactive()) { require(annotator) im = system.file("sample_images", "aves", "5.png", package = "annotator") annotate(im) }
if (interactive()) { require(annotator) im = system.file("sample_images", "aves", "5.png", package = "annotator") annotate(im) }
Image annotation using free drawing.
Mihai Valcu [email protected]
Widget output function for use in Shiny
annotatorOutput(outputId, width = "auto", height = "auto", ...)
annotatorOutput(outputId, width = "auto", height = "auto", ...)
outputId |
The name of the input. |
width |
in CSS units, default to "auto". |
height |
in CSS units, default to "auto". |
... |
further arguments to pass to |
An object generated by htmlwidgets::shinyWidgetOutput()
.
# Print the directory containing the code for all examples to see this function in use. system.file("examples", package = "annotator")
# Print the directory containing the code for all examples to see this function in use. system.file("examples", package = "annotator")
this is an 800x600 transparent png
empty_png()
empty_png()
Widget render function for use in Shiny
renderAnnotator(expr, env = parent.frame(), quoted = FALSE)
renderAnnotator(expr, env = parent.frame(), quoted = FALSE)
expr |
An annotator expression. |
env |
A environment. Default to |
quoted |
A boolean value. |
An object generated by htmlwidgets::shinyRenderWidget()
.
# Print the directory containing the code for all examples to see this function in use. system.file("examples", package = "annotator")
# Print the directory containing the code for all examples to see this function in use. system.file("examples", package = "annotator")
Launch Shiny example applications bundled in annotator.
runExample(example, ...)
runExample(example, ...)
example |
The name of the example to run. Available are: |
... |
further arguments to pass to |
No return value, called for its side effects.
## Only run this example in interactive R sessions if (interactive()) { annotator::runExample("01_hello") annotator::runExample("02_pipeline") # Print the directory containing the code for all examples system.file("examples", package = "annotator") }
## Only run this example in interactive R sessions if (interactive()) { annotator::runExample("01_hello") annotator::runExample("02_pipeline") # Print the directory containing the code for all examples system.file("examples", package = "annotator") }