Пример #1
0
        public IEnumerator GetTrailShelfDescription(int category)
        {
            // output message to user.
            yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("Παρακαλώ περιμένετε")));

            float startOCRt = Time.realtimeSinceStartup;

            //ocr annotation.
            yield return(StartCoroutine(OCRAnnotator.PerformAnnotation(camTexture)));

            annotationText = OCRAnnotator.GetAnnotationResults <string>();

            float endOCRt = Time.realtimeSinceStartup;

            OCRtime = CalculateTimeDifference(startOCRt, endOCRt);

            // Perform majority voting
            MajorityVoting majVoting = new MajorityVoting();

            if (!string.IsNullOrEmpty(annotationText))
            {
                float startMajt = Time.realtimeSinceStartup;

                List <string> OCR_List = GenericUtils.SplitStringToList(annotationText);
                yield return(StartCoroutine(majVoting.PerformMajorityVoting(OCR_List)));

                float endMajt = Time.realtimeSinceStartup;
                Majoritytime = CalculateTimeDifference(startMajt, endMajt);

                switch (category)
                {
                case (int)Enums.MasoutisCategories.trail:
                    process_result = majVoting.masoutis_item.category_2;
                    yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("διάδρομος, " + process_result)));

                    break;

                case (int)Enums.MasoutisCategories.shelf:
                    process_result = majVoting.masoutis_item.category_4;
                    yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("ράφι, " + process_result)));

                    break;

                case (int)Enums.MasoutisCategories.other:
                    yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("άλλο, " + "μη αναγνωρίσιμο")));

                    break;

                default:
                    break;
                }
            }
            else
            {
                switch (category)
                {
                case (int)Enums.MasoutisCategories.trail:
                    process_result = "Δεν αναγνωρίστηκαν διαθέσιμες λέξεις";
                    yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("διάδρομος, " + process_result)));

                    break;

                case (int)Enums.MasoutisCategories.shelf:
                    process_result = "Δεν αναγνωρίστηκαν διαθέσιμες λέξεις";
                    yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("ράφι, " + process_result)));

                    break;

                case (int)Enums.MasoutisCategories.other:
                    yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("άλλο, " + "μη αναγνωρίσιμο")));

                    break;

                default:
                    break;
                }
                if (ApplicationView.MajorityFinalText != null)
                {
                    ApplicationView.MajorityFinalText.text = "Δεν αναγνωρίστηκαν διαθέσιμες λέξεις";
                }
                if (ApplicationView.MajorityValidText != null)
                {
                    ApplicationView.MajorityValidText.text = "κενό";
                }

                yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("Δεν αναγνωρίστηκαν διαθέσιμες λέξεις")));
            }
        }
Пример #2
0
    public IEnumerator TestMajorityVoring()
    {
        MajorityVoting maj = new MajorityVoting();

        yield return(maj.PerformMajorityVoting(words));
    }
        /// <summary>
        /// This methods based on the category given as input, finds the description of the trail, shelf, inner shelf
        /// database based on the Majority Voting algorithm of the homonymous class.
        /// </summary>
        /// <param name="category"> int </param>
        /// <returns>IEnumarator object</returns>
        public async void GetTrailShelfDescription(int category, Texture2D camTex)
        {
            // output message to user.
            UAP_AccessibilityManager.Say("Αναγνώριση ραφιού-διαδρόμου");
            resultTextPanel.text = "Αναγνώριση ραφιού-διαδρόμου";
            float startOCRt = Time.realtimeSinceStartup;

            //ocr annotation.
            annotationText = await annotator.PerformAnnotation(camTex);

            float endOCRt = Time.realtimeSinceStartup;

            OCRtime = CalculateTimeDifference(startOCRt, endOCRt);

            if (!string.IsNullOrEmpty(annotationText) && annotationText != "GCFAILED")
            {
                float startMajt = Time.realtimeSinceStartup;

                List <string> OCR_List = SplitStringToList(annotationText);
                majVoting.PerformMajorityVoting(OCR_List);

                OCR_List = null;
                float endMajt = Time.realtimeSinceStartup;
                Majoritytime = CalculateTimeDifference(startMajt, endMajt);

                if (!verboseMode)
                {
                    switch (category)
                    {
                    case (int)Enums.MasoutisCategories.trail:
                        text_result = majVoting.masoutis_item.category_2;
                        break;

                    case (int)Enums.MasoutisCategories.shelf:
                        text_result = majVoting.masoutis_item.category_4;
                        break;

                    case (int)Enums.MasoutisCategories.other:
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    text_result = "διάδρομος " + majVoting.masoutis_item.category_2 + ", " +
                                  "ράφι " + majVoting.masoutis_item.category_3 + ", " +
                                  "υποκατηγορία ραφιού " + majVoting.masoutis_item.category_4;
                }
            }
            else if (annotationText == "GCFAILED")
            {
                text_result = "Η σύνδεση στο δίκτυο είναι απενεργοποιημένη.";
            }
            else
            {
                switch (category)
                {
                case (int)Enums.MasoutisCategories.trail:
                    text_result = "Δεν αναγνωρίστηκαν λέξεις";
                    break;

                case (int)Enums.MasoutisCategories.shelf:
                    text_result = "Δεν αναγνωρίστηκαν λέξεις";
                    break;

                case (int)Enums.MasoutisCategories.other:
                    break;

                default:
                    break;
                }
                if (MajorityFinalText != null)
                {
                    MajorityFinalText = "Δεν αναγνωρίστηκαν διαθέσιμες λέξεις";
                }
                if (MajorityValidText != null)
                {
                    MajorityValidText = "κενό";
                }
            }
            shelfAnnotationDone = true;
        }