Ejemplo n.º 1
0
        private void Update()
        {
            // Update state in UI
            stateText.text = OPWrapper.state.ToString();

            // Try getting new frame
            if (OPWrapper.OPGetOutput(out _datum))  // true: has new frame data

            {
                long currentFrame = (long)_datum.frameNumber;
                Debug.Log($"Current frame: {currentFrame}");
                if (_currentSequence != null)
                {
                    if (currentFrame > _currentSequence.EndFrame)
                    {
                        if (sequences.Count > 0)
                        {
                            _currentSequence = sequences[0];
                            sequences.Remove(_currentSequence);
                        }
                        else
                        {
                            _currentSequence = null;
                        }
                    }
                }

                image.UpdateImage(_datum.cvInputData);
                int category = 0;

                if (_currentSequence != null && currentFrame >= _currentSequence.StartFrame && currentFrame <= _currentSequence.EndFrame)
                {
                    category = (int)_currentSequence.Category;
                }
                if (!isAnnotated)
                {
                    category = -1;
                }
                _output.Add(new Frame(_datum.poseKeypoints, category));
                if (_datum.poseKeypoints != null)
                {
                    if (!dimensions.ContainsKey(_datum.poseKeypoints.Count))
                    {
                        dimensions.Add(_datum.poseKeypoints.Count, currentFrame);
                    }
                }
            }

            //Debug.Log(stateText.text);
            if (OPWrapper.state.Equals(OPState.Ready) && !isAnnotated)
            {
                Debug.Log("finished");
                Stop();
            }
        }
        private void Update()
        {
            // Update state in UI
            stateText.text = OPWrapper.state.ToString();

            // Try getting new frame
            if (OPWrapper.OPGetOutput(out _datum))  // true: has new frame data
            {
                image.UpdateImage(_datum.cvInputData);

                if (_isProcessing)
                {
                    Frame newFrame = new Frame(_datum.poseKeypoints, 0);
                    timerScript.WriteFrame(newFrame);
                }
            }
        }