コード例 #1
0
    // display identity results
    private void ShowIdentityResult()
    {
        // Clear current list
        ClearIdentityResult();

        // Create the new list
        if (faces != null)
        {
            // Get face images
            CloudFaceManager.MatchFaceImages(texCamShot, ref faces);

            // Show recognized persons
            for (int i = 0; i < faces.Length; i++)
            {
                Face face = faces[i];

                if (face.candidate != null && face.candidate.person != null)
                {
                    InstantiateUserItem(i, face, face.candidate.person);
                }
            }

            // Show unrecognized faces
            for (int i = 0; i < faces.Length; i++)
            {
                Face face = faces[i];

                if (face.candidate == null || face.candidate.person == null)
                {
                    InstantiateUserItem(i, face, null);
                }
            }
        }
    }
コード例 #2
0
    // display identity results
    private void ShowIdentityResult()
    {
//        StringBuilder sbResult = new StringBuilder();
//
//        if (faces != null && faces.Length > 0)
//        {
//            for (int i = 0; i < faces.Length; i++)
//            {
//                Face face = faces[i];
//                string faceColorName = FaceDetectionUtils.FaceColorNames[i % FaceDetectionUtils.FaceColors.Length];
//
//                string res = FaceDetectionUtils.FaceToString(face, faceColorName);
//
//                sbResult.Append(string.Format("<color={0}>{1}</color>", faceColorName, res));
//            }
//        }
//
//        string result = sbResult.ToString();
//
//        if (resultText)
//        {
//            resultText.text = result;
//        }
//        else
//        {
//            Debug.Log(result);
//        }

        // clear current list
        ClearIdentityResult();

        // create the new list
        if (faces != null)
        {
            // get face images
            CloudFaceManager.MatchFaceImages(texCamShot, ref faces);

            // show recognized persons
            for (int i = 0; i < faces.Length; i++)
            {
                Face face = faces[i];

                if (face.candidate != null && face.candidate.person != null)
                {
                    InstantiateUserItem(i, face, face.candidate.person);
                }
            }

            // show unrecognized faces
            for (int i = 0; i < faces.Length; i++)
            {
                Face face = faces[i];

                if (face.candidate == null || face.candidate.person == null)
                {
                    InstantiateUserItem(i, face, null);
                }
            }
        }
    }