C# Class WatsonServices.Services.VisualRecognitionService

Inheritance: WatsonLearningService, IVisualRecognitionService
Show file Open project: watson-developer-cloud/visual-recognition-aspnet

Public Methods

Method Description
ClassifyAsync ( string url, AcceptLanguage acceptLanguage = AcceptLanguage.EN, double threshold = null, ICollection owners = null ) : Task

Classifies an image based on a given set of classifiers, or all classifiers if no classifiers are specified.

ClassifyAsync ( string filename, byte fileContents, AcceptLanguage acceptLanguage = AcceptLanguage.EN, double threshold = null, ICollection owners = null ) : Task

Classifies an image based on a given set of classifiers, or all classifiers if no classifiers are specified.

CreateClassifierAsync ( string classifierName, string negativeExamplesZipFile ) : Task

Creates a custom image classifier using a sets of positive and negative examples of the classifier.

DeleteClassifierAsync ( Classifier classifier ) : Task

Deletes a custom classifier

DeleteClassifierAsync ( string classifierId ) : Task

Deletes a custom classifier

GetClassifierAsync ( string classifierId ) : Task

Retrieves a specific classifier's information from the Watson service including name, id, owner, and created time

GetClassifiersAsync ( bool verbose = false ) : Task

Retrieves a list of available classifiers from the Watson service.

GetImageSceneTextAsync ( string url ) : Task
GetImageSceneTextAsync ( string imageFileName, byte imageFileContents ) : Task
RecognizeFacesAsync ( string url ) : Task
RecognizeFacesAsync ( string imageFileName, byte imageFileContents, string url = null ) : Task
RecognizeFacesAsync ( string imageFilePath, string url = null ) : Task
VisualRecognitionService ( WatsonVisionCombinedCredentials credentials ) : Newtonsoft.Json

Private Methods

Method Description
CreateFileUploadRequest ( ) : System.Net.Http.MultipartFormDataContent
GetHttpContentFromImage ( string filename, byte fileContents ) : HttpContent
GetHttpContentFromNegativeExamples ( string filename, byte fileContents ) : HttpContent
GetHttpContentFromParameters ( ClassifyParameters parameters ) : HttpContent
GetHttpContentFromPositiveExamples ( ClassPositiveExamples positiveExamples ) : HttpContent
IWatsonFileService ( string fileExt ) : bool
VrClient ( ) : HttpClient

This method provides a pre-configured HttpClient for connecting to the Watson REST API.

Method Details

ClassifyAsync() public method

Classifies an image based on a given set of classifiers, or all classifiers if no classifiers are specified.
public ClassifyAsync ( string url, AcceptLanguage acceptLanguage = AcceptLanguage.EN, double threshold = null, ICollection owners = null ) : Task
url string The URL of an image (.jpg, or .png). Redirects are followed, so you can use shortened /// URLs. The resolved URL is returned in the response. Maximum image size is 2 MB.
acceptLanguage AcceptLanguage (Optional) Specifies the language of the output. You can specify en for English, /// es for Spanish, ar for Arabic, or ja for Japanese. Classifiers for which no /// translation is available are ommitted. Default value is English.
threshold double (Optional) A floating value that specifies the minimum score a class must have to be /// displayed in the response. Setting the threshold to 0.0 will return all values, /// regardless of their classification score.
owners ICollection (Optional) A Collection with the value(s) ClassifierOwner.IBM and/or ClassifierOwner.Me /// to specify which classifiers to run.
return Task

ClassifyAsync() public method

Classifies an image based on a given set of classifiers, or all classifiers if no classifiers are specified.
public ClassifyAsync ( string filename, byte fileContents, AcceptLanguage acceptLanguage = AcceptLanguage.EN, double threshold = null, ICollection owners = null ) : Task
filename string The name of the image file to be classified
fileContents byte A byte-array containing the contents of the image file to be classified
acceptLanguage AcceptLanguage (Optional) Specifies the language of the output. You can specify en for English, /// es for Spanish, ar for Arabic, or ja for Japanese. Classifiers for which no /// translation is available are ommitted. Default value is English.
threshold double (Optional) A floating value that specifies the minimum score a class must have to be /// displayed in the response. Setting the threshold to 0.0 will return all values, /// regardless of their classification score.
owners ICollection (Optional) A Collection with the value(s) ClassifierOwner.IBM and/or ClassifierOwner.Me /// to specify which classifiers to run.
return Task

CreateClassifierAsync() public method

Creates a custom image classifier using a sets of positive and negative examples of the classifier.
public CreateClassifierAsync ( string classifierName, string negativeExamplesZipFile ) : Task
classifierName string Name of the new classifier
negativeExamplesZipFile string Path to a zip file containing negative examples
return Task

DeleteClassifierAsync() public method

Deletes a custom classifier
public DeleteClassifierAsync ( Classifier classifier ) : Task
classifier WatsonServices.Models.VisualRecognition.Classifier A Classifier object representing the classifier to be deleted
return Task

DeleteClassifierAsync() public method

Deletes a custom classifier
public DeleteClassifierAsync ( string classifierId ) : Task
classifierId string A string object representing the classifier id of the classifier to be deleted
return Task

GetClassifierAsync() public method

Retrieves a specific classifier's information from the Watson service including name, id, owner, and created time
public GetClassifierAsync ( string classifierId ) : Task
classifierId string The Id string of the classifier to be retrieved
return Task

GetClassifiersAsync() public method

Retrieves a list of available classifiers from the Watson service.
public GetClassifiersAsync ( bool verbose = false ) : Task
verbose bool
return Task

GetImageSceneTextAsync() public method

public GetImageSceneTextAsync ( string url ) : Task
url string
return Task

GetImageSceneTextAsync() public method

public GetImageSceneTextAsync ( string imageFileName, byte imageFileContents ) : Task
imageFileName string
imageFileContents byte
return Task

RecognizeFacesAsync() public method

public RecognizeFacesAsync ( string url ) : Task
url string
return Task

RecognizeFacesAsync() public method

public RecognizeFacesAsync ( string imageFileName, byte imageFileContents, string url = null ) : Task
imageFileName string
imageFileContents byte
url string
return Task

RecognizeFacesAsync() public method

public RecognizeFacesAsync ( string imageFilePath, string url = null ) : Task
imageFilePath string
url string
return Task

VisualRecognitionService() public method

public VisualRecognitionService ( WatsonVisionCombinedCredentials credentials ) : Newtonsoft.Json
credentials WatsonServices.Models.WatsonVisionCombinedCredentials
return Newtonsoft.Json