The Computer Vision service provides developers with access to advanced algorithms that process images and return information, depending on the visual features you’re interested in. For example, Computer Vision can determine if an image contains adult content, or it can find all of the human faces in an image.
You can create a Computer Vision resource using the AzureRMR framework for interacting with Resource Manager. The available service tiers are
F0 (free, limited to 20 API calls per minute and 5k calls per month) and
S1 (up to 10 calls per second).
To communicate with the Computer Vision service, call the
computervision_endpoint function with the service URL and key. Rather than a key, you can also supply an OAuth token obtained with the AzureAuth package.
AzureVision supports all the Computer Vision API calls:
analyzeextracts visual features from the image. To obtain more detailed features, specify the
feature_typesarguments as appropriate.
describeattempts to provide a text description of the image.
detect_objectsdetects objects in the image.
area_of_interestattempts to find the “interesting” part of an image, meaning the most likely location of its subject.
tagreturns a set of words that are relevant to the content of the image. Not to be confused with the
add_image_tagsfunctions that are part of the Custom Vision API.
categorizeattempts to place the image into a list of predefined categories.
read_textperforms optical character recognition (OCR) on the image.
list_computervision_domainsreturns the predefined domain-specific models that can be queried by
analyzefor deeper analysis. Currently there are two domains: celebrities and landmarks.
make_thumbnailgenerates a thumbnail of the image.
These are the images we’ll use to illustrate how the package works.
||A portrait of Bill Gates|
||A picture of a city park|
||The text of the Gettysburg Address|
An image to send to the endpoint can be specified as a filename, a publicly accessible Internet URL, or a raw vector. For example, these calls are equivalent, assuming the underlying image is the same:
$categories name score 1 people_ 0.953125
analyze has optional arguments
domain, for choosing a domain-specific model with which to analyze the image; and
feature_types, to specify additional details to return.
$categories name score celebrities 1 people_ 0.953125 Bill Gates, 0.999981284141541, 276, 139, 211, 211
$faces age gender faceRectangle.left faceRectangle.top faceRectangle.width faceRectangle.height 1 50 Male 274 138 210 210 $objects rectangle.x rectangle.y rectangle.w rectangle.h object confidence 1 308 444 102 243 tie 0.652
$tags  "person" "man" "suit" "clothing" "wearing" "glasses" "holding" "standing" "looking"  "front" "posing" "business" "older" "dressed" "sign" "smiling" "old" "black"  "phone" "woman" "people" $captions text confidence 1 Bill Gates wearing a suit and tie 0.9933712
rectangle.x rectangle.y rectangle.w rectangle.h object confidence parent.object parent.confidence 1 624 278 132 351 building 0.637 <NA> NA 2 3 22 314 843 tree 0.655 plant 0.658 3 749 353 284 380 building 0.544 <NA> NA 4 1011 0 989 918 tree 0.719 plant 0.757
name confidence hint 1 grass 0.9999686 <NA> 2 tree 0.9996704 <NA> 3 outdoor 0.9990110 <NA> 4 flower 0.9853659 <NA> 5 park 0.8954747 <NA> 6 building 0.8255661 <NA>
[]  "Four score and seven years ago our fathers brought forth on this continent, a new nation,"  "conceived in Liberty, and dedicated to the proposition that all men are created equal."  "Now we are engaged in a great civil war, testing whether that nation, or any nation so"  "conceived and so dedicated, can long endure. We are met on a great battle-field of that war."  "We have come to dedicate a portion of that field, as a final resting place for those who here"  "gave their lives that that nation might live. It is altogether fitting and proper that we should"  "do this."  "But, in a larger sense, we can not dedicate—we can not consecrate —we can not hallow — this"  "ground. The brave men, living and dead, who struggled here, have consecrated it, far above"  "our poor power to add or detract. The world will little note, nor long remember what we say"  "here, but it can never forget what they did here. It is for us the living, rather, to be dedicated"  "here to the unfinished work which they who fought here have thus far so nobly advanced. It"  "is rather for us to be here dedicated to the great task remaining before us — that from these"  "honored dead we take increased devotion to that cause for which they gave the last full"  "measure of devotion— that we here highly resolve that these dead shall not have died in"  "vain— that this nation, under God, shall have a new birth of freedom— and that government"  "of the people, by the people, for the people, shall not perish from the earth."  "— Abraham Lincoln"