Exemplo n.º 1
0
        public IEnumerator GetProductDescription()
        {
            // 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);

            if (!string.IsNullOrEmpty(annotationText))
            {
                string product_formatted;
                float  startMajt    = Time.realtimeSinceStartup;
                var    wordsOCR     = GenericUtils.SplitStringToList(annotationText);
                var    product_desc = MajorityVoting.GetProductDesciption(wordsOCR);
                product_formatted = FormatDescription(product_desc);
                float endMajt = Time.realtimeSinceStartup;
                Majoritytime = CalculateTimeDifference(startMajt, endMajt);
                SetResultLogs();
                yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText(product_formatted.ToLower())));
            }
        }
Exemplo n.º 2
0
        private string FormatDescription(string product)
        {
            var edit = GenericUtils.SplitStringToList(product);

            edit = MajorityVoting.KeepElementsWithLen(edit, 4);
            var description = GenericUtils.ListToString(edit);

            return(description);
        }
Exemplo n.º 3
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("Δεν αναγνωρίστηκαν διαθέσιμες λέξεις")));
            }
        }