Assets/Watson/Scripts/Services/VisualRecognition/VisualRecognition.cs
/// <summary>
/// Detects faces in a given image URL.
/// </summary>
/// <returns><c>true</c>, if faces was detected, <c>false</c> otherwise.</returns>
/// <param name="url">URL.</param>
/// <param name="callback">Callback.</param>
/// <param name="customData">Custom data.</param>
Detects faces in a given image URL.
Detects faces in a given image URL .
public bool DetectFaces(OnDetectFaces callback, string url, string customData = default(string))
        {
            if(string.IsNullOrEmpty(url))
                throw new ArgumentNullException("url");
            if(callback == null)
                throw new ArgumentNullException("callback");
            if(string.IsNullOrEmpty(mp_ApiKey))
                mp_ApiKey = Config.Instance.GetAPIKey(SERVICE_ID);
            if(string.IsNullOrEmpty(mp_ApiKey))
                throw new WatsonException("No API Key was found!");
            RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, SERVICE_DETECT_FACES);
            if(connector == null)
                return false;
            DetectFacesReq req = new DetectFacesReq();
            req.Callback = callback;
            req.Data = customData;
            req.OnResponse = OnDetectFacesResp;
            req.Timeout = REQUEST_TIMEOUT;
            req.Parameters["api_key"] = mp_ApiKey;
            req.Parameters["url"] = url;
            req.Parameters["version"] = VisualRecognitionVersion.Version;
            return connector.Send(req);
        }
public bool DetectFaces ( OnDetectFaces callback , string url , string customData = default ( string ) ) { if ( string . IsNullOrEmpty ( url ) ) throw new ArgumentNullException ( " " ) ; if ( callback == null ) throw new ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( mp_ApiKey ) ) mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ; if ( string . IsNullOrEmpty ( mp_ApiKey ) ) throw new WatsonException ( " " ) ; RESTConnector connector = RESTConnector . GetConnector ( SERVICE_ID , SERVICE_DETECT_FACES ) ; if ( connector == null ) return false ; DetectFacesReq req = new DetectFacesReq ( ) ; req . Callback = callback ; req . Data = customData ; req . OnResponse = OnDetectFacesResp ; req . Timeout = REQUEST_TIMEOUT ; req . Parameters [ " " ] = mp_ApiKey ; req . Parameters [ " " ] = url ; req . Parameters [ " " ] = VisualRecognitionVersion . Version ; return connector . Send ( req ) ; }
Detects faces in a given image URL.
Detects faces in a given image URL .
None
callback
OnDetectFaces
None
url
string
None
customData
string
None