Beispiel #1
0
        public DialogResult CheckAavRate(VideoFileFormat videoFileFormat)
        {
            int totalIntegratedFrames = 0;

            m_VideoController.SetPictureBoxCursor(Cursors.WaitCursor);
            m_VideoController.NotifyFileProgress(-1, m_EndTimeFrame - m_StartTimeFrame);
            try
            {
                for (int i = m_StartTimeFrame; i < m_EndTimeFrame; i++)
                {
                    FrameStateData frameState = m_VideoController.GetFrameStateData(i);

                    totalIntegratedFrames += frameState.NumberIntegratedFrames.Value;
                    m_VideoController.NotifyFileProgress(i, m_EndTimeFrame - m_StartTimeFrame);
                }
            }
            finally
            {
                m_VideoController.NotifyFileProgress(-1, 0);
                m_VideoController.SetPictureBoxCursor(Cursors.Default);
            }

            // The actual integration could even be of PAL or NTSC frames

            TimeSpan ts = new TimeSpan(Math.Abs(m_EndFrameTime.Ticks - m_StartFrameTime.Ticks) /*Taking ABS to handle backwards measuring*/);
            double   videoTimeInSecPAL  = totalIntegratedFrames / 25.0;
            double   videoTimeInSecNTSC = totalIntegratedFrames / 29.97;

            double timeDiscrepancy_PAL = Math.Abs((videoTimeInSecPAL - ts.TotalSeconds) * 1000);
            bool   isTimeOk_PAL        = (videoTimeInSecPAL > 0 && timeDiscrepancy_PAL < TangraConfig.Settings.Special.MaxAllowedTimestampShiftInMilliSecs);;

            double timeDiscrepancy_NTSC = Math.Abs((videoTimeInSecNTSC - ts.TotalSeconds) * 1000);
            bool   isTimeOk_NTSC        = (videoTimeInSecNTSC > 0 && timeDiscrepancy_NTSC < TangraConfig.Settings.Special.MaxAllowedTimestampShiftInMilliSecs);

            bool   isTimeOk        = isTimeOk_NTSC || isTimeOk_PAL;
            double timeDiscrepancy = Math.Min(timeDiscrepancy_PAL, timeDiscrepancy_NTSC);

            if (!isTimeOk)
            {
                if (MessageBox.Show(
                        string.Format(
                            "The time computed from the measured number of frames in this AAV video is off by {0} ms from the entered time. This may indicate " +
                            "incorrectly entered start or end time or an almanac update or a leap second event. Please enter the start and end times again. The export operation can " +
                            "only continute if the times match exactly.",
                            timeDiscrepancy.ToString("0.00")),
                        "Error",
                        MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1) == DialogResult.Retry)
                {
                    return(DialogResult.Retry);
                }

                return(DialogResult.Abort);
            }

            return(DialogResult.OK);
        }
Beispiel #2
0
        public DialogResult CheckAavRate()
        {
            int totalIntegratedFrames = 0;

            for (int i = m_StartTimeFrame; i < m_EndTimeFrame; i++)
            {
                FrameStateData frameState = m_VideoController.GetFrameStateData(i);

                totalIntegratedFrames += frameState.NumberIntegratedFrames.Value;
            }

            // The actual integration could even be of PAL or NTSC frames

            TimeSpan ts = new TimeSpan(Math.Abs(m_EndFrameTime.Ticks - m_StartFrameTime.Ticks) /*Taking ABS to handle backwards measuring*/);
            double   videoTimeInSecPAL  = totalIntegratedFrames / 25.0;
            double   videoTimeInSecNTSC = totalIntegratedFrames / 29.97;

            bool isTimeOk =
                (videoTimeInSecPAL > 0 && Math.Abs((videoTimeInSecPAL - ts.TotalSeconds) * 1000) < TangraConfig.Settings.Special.MaxAllowedTimestampShiftInMs) ||
                (videoTimeInSecNTSC > 0 && Math.Abs((videoTimeInSecNTSC - ts.TotalSeconds) * 1000) < TangraConfig.Settings.Special.MaxAllowedTimestampShiftInMs);

            if (!isTimeOk)
            {
                if (MessageBox.Show(
                        string.Format(
                            "The time computed from the measured number of frames in this AAV video is off by more than {0} ms from the entered time. This may indicate " +
                            "incorrectly entered start or end time or an almanac update or a leap second event. Please enter the start and end times again. The export operation can " +
                            "only continute if the times match exactly.",
                            (TangraConfig.Settings.Special.MaxAllowedTimestampShiftInMs).ToString("0.00")),
                        "Error",
                        MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1) == DialogResult.Retry)
                {
                    return(DialogResult.Retry);
                }

                return(DialogResult.Abort);
            }

            return(DialogResult.OK);
        }
Beispiel #3
0
        public FlyByMotionFitter.FrameTimeInfo GetFrameTimeInfo(int frameId)
        {
            if (m_VideoController.IsAstroAnalogueVideo && m_VideoController.HasTimestampOCR())
            {
                var exposure  = m_VideoController.AstroAnalogueVideoIntegratedAAVFrames * m_VideoController.FramePlayer.Video.MillisecondsPerFrame;
                var timestamp = m_VideoController.OCRTimestamp();
                if (timestamp != DateTime.MinValue)
                {
                    timestamp = AstrometryContext.Current.FieldSolveContext.UtcTime.Date.Add(timestamp.TimeOfDay);
                    timestamp = timestamp.AddMilliseconds(0.5 * exposure);
                    var nativeFormat = m_VideoController.GetVideoFormat(m_VideoController.GetVideoFileFormat());
                    if (nativeFormat == "PAL")
                    {
                        timestamp = timestamp.AddMilliseconds(-20);
                    }
                    else if (nativeFormat == "NTSC")
                    {
                        timestamp = timestamp.AddMilliseconds(-16.68);
                    }
                }

                return(new FlyByMotionFitter.FrameTimeInfo()
                {
                    CentralExposureTime = timestamp,
                    ExposureInMilliseconds = exposure
                });
            }

            var frameStateInfo = m_VideoController.GetFrameStateData(frameId);

            return(new FlyByMotionFitter.FrameTimeInfo()
            {
                CentralExposureTime = frameStateInfo.CentralExposureTime,
                ExposureInMilliseconds = frameStateInfo.ExposureInMilliseconds
            });
        }