Skip to content
This repository has been archived by the owner on Jun 23, 2019. It is now read-only.

felixrieseberg/project-oxford

Repository files navigation

Project Oxford for Node.js

npm version

This package contains a set of intelligent APIs understanding images: It can detect and analyze people's faces, their age, gender, and similarity. It can identify people based on a set of images. It can understand what is displayed in a picture and crop it according to where the important features are. It can tell you whether an image contains adult content, what the main colors are, and which of your images belong in a group. If your image features text, it will tell you the language and return the text as a string. It's basically magic. For more details on the Project Oxford API, please visit projectoxford.ai.

This Node module implements Project Oxford's API for Faces, Vision, Text, and WebLM.

Usage

To install this package, run npm install --save project-oxford and obtain an API key. To obtain such a key, you will also need an (free) Microsoft Azure Account. Once you got your key, you can instantiate an Oxford client in your code:

var oxford = require('project-oxford'),
    client = new oxford.Client('7fb073s72bh72663y5ddh129m12e598d');

Now that you got your client running, you're ready to do some pretty smart stuff. Have a picture of a person and want a computed guess of their age and gender?

client.face.detect({
    path: 'myFolder/myFace.jpg',
    analyzesAge: true,
    analyzesGender: true
}).then(function (response) {
    console.log('The age is: ' + response[0].faceAttributes.age);
    console.log('The gender is: ' + response[0].faceAttributes.gender);
});

Have a picture of a person and want a computed guess about their emotions?

client.emotion.analyzeEmotion({
    path: './myFace.jpg',
}).then(function (response) {
    console.log(response);
});

Or, you can add the rectangle of the face yourself, in the form "left,top,width,height". Delimited multiple face rectangles with a “;”.

client.emotion.analyzeEmotion({
    path: './myFace.jpg',
    faceRectangles: '10, 10, 100, 100'
}).then(function (response) {
    console.log(response);
});

Creating a smart-cropped thumbnail:

client.vision.thumbnail({
    path: './photo.jpg',
    height: 150,
    width: 150,
    smartCropping: true,
    pipe: fs.createWriteStream('./photo2.jpg')
});

Running OCR on an image, returning the text on the image:

client.vision.ocr({
    path: './test/images/ocr.jpg',
    language: 'en'
}).then(function (response) {
    console.log(response.body);
});

For the full documentation, please see the API reference below.

Client

Kind: global class

new Client(key, hostOrRegion)

Creates a new Project Oxford Client using a given API key.

Param Type Description
key string Project Oxford API Key
hostOrRegion string Optional host address or region

Client.emotion : object

Kind: static namespace of Client

emotion~analyzeEmotion(options) ⇒ Promise

Analyze the emotions of one or more faces in an image.

Kind: inner method of emotion
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
options Object Options object
options.url string URL to the image file
options.path string URL to a local image file
options.data string Image as a binary buffer
options.faceRectangles Array.<Object> Array of face rectangles. Face rectangles are returned in the face.detect and vision.analyzeImage methods.

Client.face : object

Kind: static namespace of Client

face.faceList : object

Kind: static namespace of face

faceList.list() ⇒ Promise

Lists the faceListIds, and associated names and/or userData.

Kind: static method of faceList
Returns: Promise - - Promise resolving with the resulting JSON

faceList.create(faceListId, options) ⇒ Promise

Creates a new face list with a user-specified ID. A face list is a list of faces associated to be associated with a given person.

Kind: static method of faceList
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
faceListId string Numbers, en-us letters in lower case, '-', '_'. Max length: 64
options object Optional parameters
options.name string Name of the face List
options.userData string User-provided data associated with the face list.

faceList.update(faceListId, options) ⇒ Promise

Creates a new person group with a user-specified ID. A person group is one of the most important parameters for the Identification API. The Identification searches person faces in a specified person group.

Kind: static method of faceList
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
faceListId string Numbers, en-us letters in lower case, '-', '_'. Max length: 64
options object Optional parameters
options.name string Name of the face List
options.userData string User-provided data associated with the face list.

faceList.delete(faceListId) ⇒ Promise

Deletes an existing person group.

Kind: static method of faceList
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
faceListId string ID of face list to delete

faceList.get(faceListId) ⇒ Promise

Gets an existing face list.

Kind: static method of faceList
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
faceListId string ID of face list to retrieve

faceList.addFace(faceListId, options) ⇒ Promise

Gets an existing face list.

Kind: static method of faceList
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
faceListId string ID of face list to retrieve
options object Options object
options.url string URL to image to be used
options.path string Path to image to be used
options.data string Image as a binary buffer
options.name string Optional name for the face
options.userData string Optional user-data for the face
options.targetFace string Optional face rectangle to specify the target face to be added into the face list, in the format of "targetFace=left,top,width,height".

faceList.deleteFace(faceListId, persistedFaceId) ⇒ Promise

Delete a face from the face list. The face ID will be an ID returned in the addFace method, not from the detect method.

Kind: static method of faceList
Returns: Promise - - Promise; successful response is empty

Param Type Description
faceListId string ID of face list to retrieve
persistedFaceId string ID of face in the face list

face.personGroup : object

Kind: static namespace of face

personGroup.create(personGroupId, name, userData) ⇒ Promise

Creates a new person group with a user-specified ID. A person group is one of the most important parameters for the Identification API. The Identification searches person faces in a specified person group.

Kind: static method of personGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string Numbers, en-us letters in lower case, '-', '_'. Max length: 64
name string Person group display name. The maximum length is 128.
userData string User-provided data attached to the group. The size limit is 16KB.

personGroup.delete(personGroupId) ⇒ Promise

Deletes an existing person group.

Kind: static method of personGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string Name of person group to delete

personGroup.get(personGroupId) ⇒ Promise

Gets an existing person group.

Kind: static method of personGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string Name of person group to get

personGroup.trainingStatus(personGroupId) ⇒ Promise

Retrieves the training status of a person group. Training is triggered by the Train PersonGroup API. The training will process for a while on the server side. This API can query whether the training is completed or ongoing.

Kind: static method of personGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string Name of person group to get

personGroup.trainingStart(personGroupId) ⇒ Promise

Starts a person group training. Training is a necessary preparation process of a person group before identification. Each person group needs to be trained in order to call Identification. The training will process for a while on the server side even after this API has responded.

Kind: static method of personGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string Name of person group to get

personGroup.update(personGroupId, name, userData) ⇒ Promise

Updates an existing person group's display name and userData.

Kind: static method of personGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string Numbers, en-us letters in lower case, '-', '_'. Max length: 64
name string Person group display name. The maximum length is 128.
userData string User-provided data attached to the group. The size limit is 16KB.

personGroup.list(options) ⇒ Promise

List person groups’s pesonGroupId, name, and userData.

Kind: static method of personGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
options object List opentions
options.start string List person groups from the least personGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
options.top integer The number of person groups to list, ranging in [1, 1000]. Default is 1000.

face.person : object

Kind: static namespace of face

person.addFace(personGroupId, personId, options) ⇒ Promise

Adds a face to a person for identification. The maximum face count for each person is 248.

Kind: static method of person
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string The target person's person group.
personId string The target person that the face is added to.
options object The source specification.
options.url string URL to image to be used.
options.path string Path to image to be used.
options.data string Image as a binary buffer
options.userData string Optional. Attach user data to person's face. The maximum length is 1024.
options.targetFace object Optional. The rectangle of the face in the image.

person.deleteFace(personGroupId, personId, persistedFaceId) ⇒ Promise

Deletes a face from a person.

Kind: static method of person
Returns: Promise - - Promise; successful response is empty

Param Type Description
personGroupId string The target person's person group.
personId string The target person that the face is removed from.
persistedFaceId string The ID of the face to be deleted.

person.updateFace(personGroupId, personId, persistedFaceId, userData) ⇒ Promise

Updates a face for a person.

Kind: static method of person
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string The target person's person group.
personId string The target person that the face is updated on.
persistedFaceId string The ID of the face to be updated.
userData string Optional. Attach user data to person's face. The maximum length is 1024.

person.getFace(personGroupId, personId, persistedFaceId) ⇒ Promise

Get a face for a person.

Kind: static method of person
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string The target person's person group.
personId string The target person that the face is to get from.
persistedFaceId string The ID of the face to get.

person.create(personGroupId, name, userData) ⇒ Promise

Creates a new person in a specified person group for identification. The number of persons has a subscription limit. Free subscription amount is 1000 persons.

Kind: static method of person
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string The target person's person group.
name string Target person's display name. The maximum length is 128.
userData string Optional fields for user-provided data attached to a person. Size limit is 16KB.

person.delete(personGroupId, personId) ⇒ Promise

Deletes an existing person from a person group.

Kind: static method of person
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string The target person's person group.
personId string The target person to delete.

person.get(personGroupId, personId) ⇒ Promise

Gets an existing person from a person group.

Kind: static method of person
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string The target person's person group.
personId string The target person to get.

person.update(personGroupId, personId, name, userData) ⇒ Promise

Updates a person's information.

Kind: static method of person
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string The target person's person group.
personId string The target person's id.
name string Target person's display name. The maximum length is 128.
userData string Optional fields for user-provided data attached to a person. Size limit is 16KB.

person.list(personGroupId) ⇒ Promise

Lists all persons in a person group, with the person information.

Kind: static method of person
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
personGroupId string The target person's person group.
options.start string List persons from the least personId greater than the "start". It contains no more than 64 characters. Default is empty.
options.top Number Optional count of persons to return. Valid range is [1,1000]. (Default: 1000)

face.largePersonGroup : object

Kind: static namespace of face

largePersonGroup.create(largePersonGroupId, name, userData) ⇒ Promise

Create a new large person group with user-specified largePersonGroupId, name, and optional userData. A large person group is the container of the uploaded person data, including face images and face recognition feature, and up to 1,000,000 people. The Identify() method searches person faces in a specified large person group.

Kind: static method of largePersonGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string Numbers, en-us letters in lower case, '-', '_'. Max length: 64
name string Person group display name. The maximum length is 128.
userData string User-provided data attached to the group. The size limit is 16KB.

largePersonGroup.delete(largePersonGroupId) ⇒ Promise

Deletes an existing large person group.

Kind: static method of largePersonGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string ID of large person group to delete

largePersonGroup.get(largePersonGroupId) ⇒ Promise

Gets an existing large person group.

Kind: static method of largePersonGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string ID of large person group to get

largePersonGroup.trainingStatus(largePersonGroupId) ⇒ Promise

To check large person group training status completed or still ongoing. LargePersonGroup Training is an asynchronous operation triggered by LargePersonGroup - Train API. Training time depends on the number of person entries, and their faces in a large person group. It could be in seconds, or up to half an hour for 1,000,000 persons.

Kind: static method of largePersonGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string ID of large person group to get

largePersonGroup.trainingStart(largePersonGroupId) ⇒ Promise

Submit a large person group training task. Training is a crucial step that only a trained large person group can be used by Face - Identify. The training task is an asynchronous task. Training time depends on the number of person entries, and their faces in a large person group. It could be in several seconds, or up to half a hour for 1,000,000 persons. To check training completion, please use LargePersonGroup - Get Training Status.

Kind: static method of largePersonGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string ID of large person group to get

largePersonGroup.update(largePersonGroupId, name, userData) ⇒ Promise

Update an existing large person group's name and userData. The properties keep unchanged if they are not in request body.

Kind: static method of largePersonGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string ID of large person group to update
name string Person group display name. The maximum length is 128.
userData string User-provided data attached to the group. The size limit is 16KB.

largePersonGroup.list(options) ⇒ Promise

List all existing large person groups’s largePesonGroupId, name, and userData.

Kind: static method of largePersonGroup
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
options object List opentions
options.start string List large person groups from the least largePersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
options.top integer The number of large person groups to list, ranging in [1, 1000]. Default is 1000.

face.largePersonGroupPerson : object

Kind: static namespace of face

largePersonGroupPerson.addFace(largePersonGroupId, personId, options) ⇒ Promise

Add a face image to a person into a large person group for face identification or verification. Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from different persons are processed in parallel.

Kind: static method of largePersonGroupPerson
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string largePersonGroupId of the target large person group.
personId string The target person that the face is added to.
options object The source specification.
options.url string URL to image to be used.
options.path string Path to image to be used.
options.data string Image as a binary buffer
options.userData string Optional. Attach user data to person's face. The maximum length is 1024.
options.targetFace object Optional. The rectangle of the face in the image.

largePersonGroupPerson.deleteFace(largePersonGroupId, personId, persistedFaceId) ⇒ Promise

Delete a face from a person in a large person group. Face data and image related to this face entry will be also deleted. Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from different persons are processed in parallel.

Kind: static method of largePersonGroupPerson
Returns: Promise - - Promise; successful response is empty

Param Type Description
largePersonGroupId string largePersonGroupId of the target large person group.
personId string The target person that the face is removed from.
persistedFaceId string The ID of the face to be deleted.

largePersonGroupPerson.updateFace(largePersonGroupId, personId, persistedFaceId, userData) ⇒ Promise

Update a person persisted face's userData field.

Kind: static method of largePersonGroupPerson
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string largePersonGroupId of the target large person group.
personId string The target person that the face is updated on.
persistedFaceId string The ID of the face to be updated.
userData string Optional. Attach user data to person's face. The maximum length is 1024.

largePersonGroupPerson.getFace(largePersonGroupId, personId, persistedFaceId) ⇒ Promise

Retrieve person face information. The persisted person face is specified by its largePersonGroupId, personId and persistedFaceId.

Kind: static method of largePersonGroupPerson
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string largePersonGroupId of the target large person group.
personId string The target person that the face is to get from.
persistedFaceId string The ID of the face to get.

largePersonGroupPerson.create(largePersonGroupId, name, userData) ⇒ Promise

Create a new person in a specified large person group. To add face to this person, please call LargePersonGroup PersonFace - Add. The number of persons has a subscription limit. Free subscription amount is 1000 persons.

Kind: static method of largePersonGroupPerson
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string largePersonGroupId of the target large person group.
name string Target person's display name. The maximum length is 128.
userData string Optional fields for user-provided data attached to a person. Size limit is 16KB.

largePersonGroupPerson.delete(largePersonGroupId, personId) ⇒ Promise

Delete an existing person from a large person group. All stored person data, and face images in the person entry will be deleted.

Kind: static method of largePersonGroupPerson
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string largePersonGroupId of the target large person group.
personId string The target person to delete.

largePersonGroupPerson.get(largePersonGroupId, personId) ⇒ Promise

Retrieve a person's name and userData, and the persisted faceIds representing the registered person face image.

Kind: static method of largePersonGroupPerson
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string largePersonGroupId of the target large person group.
personId string The target person to get.

largePersonGroupPerson.update(largePersonGroupId, personId, name, userData) ⇒ Promise

Updates a person's information.

Kind: static method of largePersonGroupPerson
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string largePersonGroupId of the target large person group.
personId string The target person's id.
name string Target person's display name. The maximum length is 128.
userData string Optional fields for user-provided data attached to a person. Size limit is 16KB.

largePersonGroupPerson.list(largePersonGroupId) ⇒ Promise

List all persons’ information in the specified large person group, including personId, name, userData and persistedFaceIds of registered person faces.

Kind: static method of largePersonGroupPerson
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
largePersonGroupId string The target person's person group.
options.start string List persons from the least personId greater than the "start". It contains no more than 64 characters. Default is empty.
options.top Number Optional count of persons to return. Valid range is [1,1000]. (Default: 1000)

face~detect(options) ⇒ Promise

Call the Face Detected API Detects human faces in an image and returns face locations, face landmarks, and optional attributes including head-pose, gender, and age. Detection is an essential API that provides faceId to other APIs like Identification, Verification, and Find Similar.

Kind: inner method of face
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
options object Options object
options.url string URL to image to be used
options.path string Path to image to be used
options.data string Image as a binary buffer
options.returnFaceId boolean Include face ID in response?
options.analyzesAccessories boolean Analyze accessories?
options.analyzesAge boolean Analyze age?
options.analyzesBlur boolean Analyze blur?
options.analyzesEmotion boolean Analyze emotions?
options.analyzesExposure boolean Analyze expose?
options.analyzesFaceLandmarks boolean Analyze face landmarks?
options.analyzesFacialHair boolean Analyze facial hair?
options.analyzesGender boolean Analyze gender?
options.analyzesGlasses boolean Analyze glasses?
options.analyzesHair boolean Analyze hair?
options.analyzesHeadPose boolean Analyze headpose?
options.analyzesMakeup boolean Analyze makeup?
options.analyzesNoise boolean Analyze noise?
options.analyzesOcclusion boolean Analyze occlusion?
options.analyzesSmile boolean Analyze smile?

face~similar(sourceFace, options) ⇒ Promise

Detect similar faces using faceIds (as returned from the detect API), or faceListId (as returned from the facelist API).

Kind: inner method of face
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
sourceFace string String of faceId for the source face
options object Options object
options.candidateFaces Array.<string> Array of faceIds to use as candidates
options.candidateFaceListId string Id of face list, created via FaceList.create
options.maxCandidates Number Optional max number for top candidates (default is 20, max is 20)
options.mode string Optional face searching mode. It can be "matchPerson" or "matchFace" (default is "matchPerson")

face~grouping(faces) ⇒ Promise

Divides candidate faces into groups based on face similarity using faceIds. The output is one or more disjointed face groups and a MessyGroup. A face group contains the faces that have similar looking, often of the same person. There will be one or more face groups ranked by group size, i.e. number of face. Faces belonging to the same person might be split into several groups in the result. The MessyGroup is a special face group that each face is not similar to any other faces in original candidate faces. The messyGroup will not appear in the result if all faces found their similar counterparts. The candidate face list has a limit of 100 faces.

Kind: inner method of face
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
faces Array.<string> Array of faceIds to use

face~identify(faces, options) ⇒ Promise

1-to-many identification to find the closest matches of the specific query person face(s) from a person group or large person group. For each face in the faceIds array, Face Identify will compute similarities between the query face and all the faces in the person group (given by personGroupId) or large person group (given by largePersonGroupId), and return candidate person(s) for that face ranked by similarity confidence. The person group/large person group should be trained to make it ready for identification.

Kind: inner method of face
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
faces Array.<string> Array of faceIds to use
options object Identify options
options.personGroupId string Id of person group from which faces will be identified (personGroupId and largePersonGroupId should not be provided at the same time)
options.largePersonGroupId string Id of large person group from which faces will be identified (personGroupId and largePersonGroupId should not be provided at the same time)
options.maxNumOfCandidatesReturned Number Optional max number of candidates per face (default=1, max=5)
options.confidenceThreshold Number Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm).

face~verify(faces) ⇒ Promise

Analyzes two faces and determine whether they are from the same person. Verification works well for frontal and near-frontal faces. For the scenarios that are sensitive to accuracy please use with own judgment.

Kind: inner method of face
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
faces Array.<string> | object An array containing two faceIds to use, or an object with the fields faceId, personId, and personGroupId

Client.text : object

Kind: static namespace of Client

text~proof(text, preContextText, postContextText, market) ⇒ Promise

Proofs a word or phrase. Offers Microsoft Office Word-like spelling corrections. Longer phrases can be checked, and the result will include casing corrections while avoiding aggressive corrections.

Kind: inner method of text
Returns: Promise - - A promise in which the resulting JSON is returned.

Param Type Description
text string Word or phrase to spell check.
preContextText string Optional context of one or more words preceding the target word/phrase.
postContextText string Optional context of one or more words following the target word/phrase.
market string Optional market

text~spellCheck(text, preContextText, postContextText, market) ⇒ Promise

Spell checks a word or phrase. Spell checks offers search-engine-like corrections. Short phrases (up to 9 tokens) will be checked, and the result will be optimized for search queries, both in terms of performance and relevance.

Kind: inner method of text
Returns: Promise - - A promise in which the resulting JSON is returned.

Param Type Description
text string Word or phrase to spell check.
preContextText string Optional context of one or more words preceding the target word/phrase.
postContextText string Optional context of one or more words following the target word/phrase.
market string Optional market

Client.vision : object

Kind: static namespace of Client

vision.result

Kind: static property of vision

result.get(operation) ⇒ Promise

Checks the result of a text recognition request. When an operation is deemed completed, the status of the returned object should be 'Succeeded' (or, possibly, 'Failed'.) The recognitionResult contains the result when the operation is complete.

Kind: static method of result
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
operation Object Object holding the result URL

vision.models : object

Kind: static namespace of vision

models.list() ⇒ Promise

Lists the domain-specific image analysis models.

Kind: static method of models
Returns: Promise - - Promise resolving with the resulting JSON

models.analyzeImage(model, options) ⇒ Promise

Analyze an image using a domain-specific image classifier.

Kind: static method of models
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
model string Name of the model
options Object Options object location of the source image
options.url string Url to image to be analyzed
options.path string Path to image to be analyzed

vision~analyzeImage(options) ⇒ Promise

This operation does a deep analysis on the given image and then extracts a set of rich visual features based on the image content.

Kind: inner method of vision
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
options Object Options object describing features to extract
options.url string Url to image to be analyzed
options.path string Path to image to be analyzed
options.data string Buffer of image to be analyzed
options.ImageType boolean Detects if image is clipart or a line drawing.
options.Color boolean Determines the accent color, dominant color, if image is black&white.
options.Faces boolean Detects if faces are present. If present, generate coordinates, gender and age.
options.Adult boolean Detects if image is pornographic in nature (nudity or sex act). Sexually suggestive content is also detected.
options.Categories boolean Image categorization; taxonomy defined in documentation.
options.Tags boolean Tags the image with a detailed list of words related to the image content.
options.Description boolean Describes the image content with a complete English sentence.

vision~thumbnail(options) ⇒ Promise

Generate a thumbnail image to the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart crop coordinates based on the ROI. Smart cropping is designed to help when you specify an aspect ratio that differs from the input image.

Kind: inner method of vision
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
options Object Options object describing features to extract
options.url string Url to image to be thumbnailed
options.path string Path to image to be thumbnailed
options.data string Buffer of image to be analyzed
options.width number Width of the thumb in pixels
options.height number Height of the thumb in pixels
options.smartCropping boolean Should SmartCropping be enabled?
options.pipe Object We'll pipe the returned image to this object

vision~ocr(options) ⇒ Promise

Optical Character Recognition (OCR) detects text in an image and extracts the recognized characters into a machine-usable character stream.

Kind: inner method of vision
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
options Object Options object describing features to extract
options.url string Url to image to be analyzed
options.path string Path to image to be analyzed
options.data string Buffer of image to be analyzed
options.language string BCP-47 language code of the text to be detected in the image. Default value is "unk", then the service will auto detect the language of the text in the image.
options.detectOrientation string Detect orientation of text in the image

vision~recognizeText(options) ⇒ Promise

Recognize text, including hand-written text.

Kind: inner method of vision
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
options Object Options object describing features to extract
options.url string Url to image to be analyzed
options.path string Path to image to be analyzed
options.data string Buffer of image to be analyzed
options.handwriting string Whether the image is of hand-written text. Default is false.

Client.weblm : object

Kind: static namespace of Client

weblm~listModels() ⇒ Promise

List available language models for the service currently.

Kind: inner method of weblm
Returns: Promise - - Promise resolving with the resulting JSON

weblm~breakIntoWords(model, text, options) ⇒ Promise

Breaks text in to consituent words

Kind: inner method of weblm
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
model string Name of model. Currently one of title/anchor/query/body
text string Text to break. E.g. onetwothree
options Object Options object
options.order Number Optional N-gram order. Default is 5
options.maxCandidates Number Optional maximum candidate count. Default is 5

weblm~generateWords(model, words, options) ⇒ Promise

Generates a list of candidate of words that would follow the a given sequence of one or more words

Kind: inner method of weblm
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
model string Name of model. Currently one of title/anchor/query/body
words string Text to break. E.g. 'hello world wide'
options Object Options object
options.order Number Optional N-gram order. Default is 5
options.maxCandidates Number Optional maximum candidate count. Default is 5

weblm~getJointProbabilities(model, phrases, order) ⇒ Promise

Generates a list of candidate of words that would follow the a given sequence of one or more words

Kind: inner method of weblm
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
model string Name of model. Currently one of title/anchor/query/body
phrases Array.<string> One or more phrases for which to look up the probalities of the word sequences
order Number Optional N-gram order. Default is 5

weblm~getConditionalProbabilities(model, queries, order) ⇒ Promise

Generates a list of candidate of words that would follow the a given sequence of one or more words

Kind: inner method of weblm
Returns: Promise - - Promise resolving with the resulting JSON

Param Type Description
model string Name of model. Currently one of title/anchor/query/body
queries Array One of more objects consisting of 'words'/'word' pairs, where the conditional probability of 'word' in the context of 'words' is computed.
order Number Optional N-gram order. Default is 5

License

Licensed as MIT - please see LICENSE for details.