Exemplo n.º 1
0
    private void Update()
    {
        Time.timeScale = 0;
        currentTimeBetweenAnnotations += Time.deltaTime; //Add current delta time -> Could be higher than capture

        if (exportFinished && currentTimeBetweenAnnotations >= timeBetweenAnnotations)
        {
            if (segmentationDone)
            {
                Segmentation.Camera.Render();
                segmentationDone = false;
            }

            //Check if segmentation camera is still rendering
            if (Segmentation.Camera.FinishedRender)
            {
                segmentationDone = true;
            }
            else
            {
                return;
            }

            //Segmentation rendered all objects visible
            EditableObjects = new HashSet <AnnotationObject>(RenderedObjects); //COPY

            //Count pixels or optional export
            Segmentation.Run();

            //Annotations for each profile
            foreach (AnnotationProfile profile in profiles)
            {
                OutputCamera = profile.Camera;

                Logger.Log("[CONDITIONING]");
                if (profile.Conditioning())
                {
                    Logger.Log("[PRE-ANNOTATE]");
                    profile.PreAnnotate();

                    Logger.Log("[ANNOTATE]");
                    OutputCamera.Render();

                    Logger.Log("[VALIDATE]");
                    bool validated = profile.Validation();

                    Logger.Log("[POST-ANNOTATE]");
                    profile.PostAnnotate();

                    if (validated)
                    {
                        //Logger.Log("POST-CONDITIONING");

                        StartCoroutine(AwaitExport());
                        exportFinished = false;

                        currentTimeBetweenAnnotations = 0.0f;
                    }
                }
            }
        }

        EditableObjects = null;
        Time.timeScale  = timeScale;
    }