add_image_regions {AzureVision}R Documentation

Add and remove regions from images


Add and remove regions from images


add_image_regions(project, image_ids, regions)

remove_image_regions(project, image_ids, region_ids = NULL)

identify_regions(project, image)



A Custom Vision object detection project.


For add_image_regions and remove_image_regions, the IDs of the images for which to add or remove regions.


For add_image_regions, the regions to add. See 'Details' below.


For remove_image_regions, a vector of region IDs. This is an alternative to image ID for specifying the regions to remove; if this is provided, image_ids is not used.


For identify_regions, an image for which to identify possible regions in which an object exists. This can be the ID of an image that was previously uploaded to the project; if not, the image is uploaded. Otherwise, see add_images for how to specify an image to upload.


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:


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_images, add_tags

add_image_tags for classification projects


## Not run: 

img_ids <- add_images(myproj, c("catanddog.jpg", "cat.jpg", "dog.jpg"))

regions <- list(
        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)
        tag="cat", left=0.5, top=0.35, width=0.25, height=0.62
        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],
        tag="dog", left=0.5, top=0.12, width=0.4, height=0.7

## End(Not run)

[Package AzureVision version 1.0.2 Index]