示例#1
0
        public ITrackedVideo GetData()
        {
            ITrackedVideo trackedVideo = ModelResolver.Resolve <ITrackedVideo>();

            trackedVideo.FileName     = FileName;
            trackedVideo.Result       = Result;
            trackedVideo.SmoothMotion = SmoothMotion;
            //trackedVideo.SmoothFactor = SmoothFactor;
            trackedVideo.FrameRate         = FrameRate;
            trackedVideo.CentroidSize      = CentroidSize;
            trackedVideo.PelvicArea1       = PelvicArea1;
            trackedVideo.PelvicArea2       = PelvicArea2;
            trackedVideo.PelvicArea3       = PelvicArea3;
            trackedVideo.PelvicArea4       = PelvicArea4;
            trackedVideo.UnitsToMilimeters = UnitsToMilimeters;
            trackedVideo.Message           = Message;

            if (ROI != null)
            {
                trackedVideo.ROI = ROI.GetRect();
            }

            if (Results != null)
            {
                Dictionary <int, SingleFrameExtendedResultXml> headPoints   = Results.GetData();
                Dictionary <int, ISingleFrameExtendedResults>  finalResults = new Dictionary <int, ISingleFrameExtendedResults>();

                foreach (var entry in headPoints)
                {
                    int key = entry.Key;
                    SingleFrameExtendedResultXml currentEntry = entry.Value;

                    if (currentEntry == null)
                    {
                        finalResults.Add(key, null);
                    }
                    else
                    {
                        finalResults.Add(key, currentEntry.GetData());
                    }
                }

                trackedVideo.Results = finalResults;
            }

            //if (WaistSizes != null)
            //{
            //    trackedVideo.WaistSizes = WaistSizes.GetData();
            //}

            if (MotionTrack != null)
            {
                trackedVideo.MotionTrack = MotionTrack.Select(x => x.GetPoint()).ToArray();
            }

            if (SmoothedMotionTrack != null)
            {
                trackedVideo.SmoothedMotionTrack = SmoothedMotionTrack.Select(x => x.GetPoint()).ToArray();
            }

            if (OrientationTrack != null)
            {
                trackedVideo.OrientationTrack = OrientationTrack.Select(x => x.GetVector()).ToArray();
            }

            if (Boundries != null)
            {
                trackedVideo.Boundries = Boundries.Select(x => x.GetBoundary()).ToArray();
            }

            if (Events != null)
            {
                trackedVideo.Events = Events.Select(x => x.GetData()).ToArray();
            }

            if (InteractingBoundries != null)
            {
                trackedVideo.InteractingBoundries = InteractingBoundries.GetData().ToDictionary(kvp => kvp.Key.GetBoundary(), kvp => kvp.Value.Select(x => x.GetData()).ToArray());
            }

            trackedVideo.MinInteractionDistance = MinInteractionDistance;
            trackedVideo.GapDistance            = GapDistance;
            trackedVideo.ThresholdValue         = ThresholdValue;
            trackedVideo.ThresholdValue2        = ThresholdValue2;
            trackedVideo.StartFrame             = StartFrame;
            trackedVideo.EndFrame          = EndFrame;
            trackedVideo.UnitsToMilimeters = UnitsToMilimeters;
            trackedVideo.WhiskerSettings   = WhiskerSettings.GetWhiskerVideoSettings();
            trackedVideo.UpdateTrack();
            return(trackedVideo);
        }