add_image_regions {AzureVision} | R Documentation |
Add and remove regions from images
Description
Add and remove regions from images
Usage
add_image_regions(project, image_ids, regions)
remove_image_regions(project, image_ids, region_ids = NULL)
identify_regions(project, image)
Arguments
project |
A Custom Vision object detection project. |
image_ids |
For |
regions |
For |
region_ids |
For |
image |
For |
Details
add_image_regions
and remove_image_regions
let you specify the regions in an image that contain an object. You can use identify_regions
to have Custom Vision try to guess the regions for an image.
The regions to add should be specified as a list of data frames, with one data frame per image. Each data frame should have one row per region, and the following columns:
-
left
,top
,width
,height
: the location and dimensions of the region bounding box, normalised to be between 0 and 1. -
tag
: the name of the tag to associate with the region. Any other columns in the data frame will be ignored.
Value
For add_image_regions
, a data frame containing the details on the added regions.
For remove_image_regions
, the value of image_ids
invisibly, if this argument was provided; NULL otherwise.
For identify_regions
, a list with the following components: projectId
, the ID of the project; imageId
, the ID of the image; and proposals
, a data frame containing the coordinates of each identified region along with a confidence score.
See Also
add_image_tags
for classification projects
Examples
## Not run:
img_ids <- add_images(myproj, c("catanddog.jpg", "cat.jpg", "dog.jpg"))
regions <- list(
data.frame(
tag=c("cat", "dog"),
left=c(0.1, 0.5),
top=c(0.25, 0.28),
width=c(0.24, 0.21),
height=c(0.7, 0.6)
),
data.frame(
tag="cat", left=0.5, top=0.35, width=0.25, height=0.62
),
data.frame(
tag="dog", left=0.07, top=0.12, width=0.79, height=0.5
)
)
add_image_regions(myproj, img_ids, regions)
remove_image_regions(myproj, img_ids[3])
add_image_regions(myproj, img_ids[3],
list(data.frame(
tag="dog", left=0.5, top=0.12, width=0.4, height=0.7
))
)
## End(Not run)