Esempio n. 1
0
    IEnumerator Recognize()
    {
        yield return(m_DelayUntilRecognition);

        Debug.Log("Starting recognition process");

        // Try to detect face in test image
        string[] testImageFiles = Directory.GetFiles(m_WebcamManager.GetRuntimeImagePath(), "*.jpg");

        for (int i = 0; i < testImageFiles.Length; i++)
        {
            Debug.Log(testImageFiles[i]);
            // Detect faces in the test image
            string detectFaces = "unknown";
            yield return(RequestManager.DetectFaces(m_Endpoint, m_ApiKey, testImageFiles[i], value => detectFaces = value));

            Debug.Log("Response from DetectFaces : " + detectFaces);
            FacesBasic.FacesDetectionResponse[] face = JsonHelper.getJsonArray <FacesBasic.FacesDetectionResponse>(detectFaces);

            // Identify faces in the test image
            string identifyFaces = "unknown";
            yield return(RequestManager.Identify(m_Endpoint, m_ApiKey, m_PersonGroup, face, value => identifyFaces = value));

            Debug.Log("Response from IdentifyFaces : " + identifyFaces);

            IdentifiedFaces.IdentifiedFacesResponse[] idFaces = JsonHelper.getJsonArray <IdentifiedFaces.IdentifiedFacesResponse>(identifyFaces);

            // TODO : Compare with list of known people to see if any known person is present
        }
    }