コード例 #1
0
        public void NextFrame(int frameNo, IAstroImage astroImage)
        {
            m_NativeTrackedObject.ForEach(x => x.NextFrame());

            uint[] pixels = astroImage.GetPixelmapPixels();

            IsTrackedSuccessfully = NativeTracking.TrackNextFrame(frameNo, pixels, m_NativeTrackedObject);
        }
コード例 #2
0
ファイル: StarFieldTracker.cs プロジェクト: aschweiz/tangra3
        public bool InitializeNewTracking(IAstroImage astroImage)
        {
            m_StarMapConfig = new StarMapInternalConfig(StarMapInternalConfig.Default);
            m_StarMapConfig.CustomMaxSignalValue    = astroImage.GetPixelmapPixels().Max();
            m_StarMapConfig.CustomOptimumStarsValue = 25;
            m_StarMapConfig.IsFITSFile = true;

            StarMap starMap = new StarMap();

            starMap.FindBestMap(
                m_StarMapConfig,
                (AstroImage)astroImage,
                Rectangle.Empty,
                new Rectangle(0, 0, astroImage.Width, astroImage.Height),
                AstrometryContext.Current.LimitByInclusion);

            if (starMap.Features.Count < 10)
            {
                MessageBox.Show("Cannot initialize object tracking as less than 10 stars can be identified in the field");
                return(false);
            }

            // Build a signature of the largest 10 features (pivots)
            m_PivotDistances.Clear();
            for (int i = 0; i < 10; i++)
            {
                m_PivotDistances.Add(new List <double>(UNINITIALIZED_DISTANCES));
            }

            double fwhmSum   = 0;
            int    fwhmCount = 0;

            starMap.Features.Sort((x, y) => y.PixelCount.CompareTo(x.PixelCount));
            for (int i = 0; i < 10; i++)
            {
                var feature_i = starMap.Features[i];
                for (int j = i + 1; j < 10; j++)
                {
                    var    feature_j = starMap.Features[j];
                    double distance  = feature_j.GetCenter().DistanceTo(feature_i.GetCenter());
                    m_PivotDistances[i][j] = distance;
                    m_PivotDistances[j][i] = distance;
                }

                int    x0  = feature_i.GetCenter().X;
                int    y0  = feature_i.GetCenter().Y;
                PSFFit fit = new PSFFit((int)x0, (int)y0);
                uint[,] data = ((AstroImage)astroImage).GetMeasurableAreaPixels((int)x0, (int)y0);
                fit.Fit(data);

                if (fit.IsSolved)
                {
                    fwhmSum += fit.FWHM;
                    fwhmCount++;
                }
            }

            m_FWHMAverage = (float)(fwhmSum / fwhmCount);

            for (int i = 0; i < m_TrackedObjects.Count; i++)
            {
                m_TrackedObjectsPivotDistancesX[i] = new List <double>();
                m_TrackedObjectsPivotDistancesY[i] = new List <double>();
                for (int j = 0; j < 10; j++)
                {
                    m_TrackedObjectsPivotDistancesX[i].Add(m_TrackedObjects[i].Center.XDouble - starMap.Features[j].GetCenter().XDouble);
                    m_TrackedObjectsPivotDistancesY[i].Add(m_TrackedObjects[i].Center.YDouble - starMap.Features[j].GetCenter().YDouble);
                }

                int    x0  = m_TrackedObjects[i].Center.X;
                int    y0  = m_TrackedObjects[i].Center.Y;
                PSFFit fit = new PSFFit((int)x0, (int)y0);
                uint[,] data = ((AstroImage)astroImage).GetMeasurableAreaPixels((int)x0, (int)y0);
                fit.Fit(data);

                if (fit.IsSolved)
                {
                    SetTargetFWHM(i, (float)fit.FWHM);
                }
            }

            m_TargetPivotDistancesListX.Clear();
            m_TargetPivotDistancesListY.Clear();

            return(true);
        }
コード例 #3
0
ファイル: StarFieldTracker.cs プロジェクト: hpavlov/tangra3
        public bool InitializeNewTracking(IAstroImage astroImage)
        {
            m_StarMapConfig = new StarMapInternalConfig(StarMapInternalConfig.Default);
            m_StarMapConfig.CustomMaxSignalValue = astroImage.GetPixelmapPixels().Max();
            m_StarMapConfig.CustomOptimumStarsValue = 25;
            m_StarMapConfig.IsFITSFile = true;

            StarMap starMap = new StarMap();
            starMap.FindBestMap(
                            m_StarMapConfig,
                            (AstroImage)astroImage,
                            Rectangle.Empty,
                            new Rectangle(0, 0, astroImage.Width, astroImage.Height),
                            AstrometryContext.Current.LimitByInclusion);

            if (starMap.Features.Count < 10)
            {
                MessageBox.Show("Cannot initialize object tracking as less than 10 stars can be identified in the field");
                return false;
            }

            // Build a signature of the largest 10 features (pivots)
            m_PivotDistances.Clear();
            for (int i = 0; i < 10; i++) m_PivotDistances.Add(new List<double>(UNINITIALIZED_DISTANCES));

            double fwhmSum = 0;
            int fwhmCount = 0;

            starMap.Features.Sort((x, y) => y.PixelCount.CompareTo(x.PixelCount));
            for (int i = 0; i < 10; i++)
            {
                var feature_i = starMap.Features[i];
                for (int j = i + 1; j < 10; j++)
                {
                    var feature_j = starMap.Features[j];
                    double distance = feature_j.GetCenter().DistanceTo(feature_i.GetCenter());
                    m_PivotDistances[i][j] = distance;
                    m_PivotDistances[j][i] = distance;
                }

                int x0 = feature_i.GetCenter().X;
                int y0 = feature_i.GetCenter().Y;
                PSFFit fit = new PSFFit((int) x0, (int) y0);
                uint[,] data = ((AstroImage) astroImage).GetMeasurableAreaPixels((int) x0, (int) y0);
                fit.Fit(data);

                if (fit.IsSolved)
                {
                    fwhmSum += fit.FWHM;
                    fwhmCount++;
                }
            }

            m_FWHMAverage = (float)(fwhmSum / fwhmCount);

            for (int i = 0; i < m_TrackedObjects.Count; i++)
            {
                m_TrackedObjectsPivotDistancesX[i] = new List<double>();
                m_TrackedObjectsPivotDistancesY[i] = new List<double>();
                for (int j = 0; j < 10; j++)
                {
                    m_TrackedObjectsPivotDistancesX[i].Add(m_TrackedObjects[i].Center.XDouble - starMap.Features[j].GetCenter().XDouble);
                    m_TrackedObjectsPivotDistancesY[i].Add(m_TrackedObjects[i].Center.YDouble - starMap.Features[j].GetCenter().YDouble);
                }

                int x0 = m_TrackedObjects[i].Center.X;
                int y0 = m_TrackedObjects[i].Center.Y;
                PSFFit fit = new PSFFit((int)x0, (int)y0);
                uint[,] data = ((AstroImage)astroImage).GetMeasurableAreaPixels((int)x0, (int)y0);
                fit.Fit(data);

                if (fit.IsSolved)
                {
                    SetTargetFWHM(i, (float)fit.FWHM);
                }
            }

            m_TargetPivotDistancesListX.Clear();
            m_TargetPivotDistancesListY.Clear();

            return true;
        }
コード例 #4
0
        public void NextFrame(int frameNo, IAstroImage astroImage)
        {
            m_NativeTrackedObject.ForEach(x => x.NextFrame());

            uint[] pixels = astroImage.GetPixelmapPixels();

            IsTrackedSuccessfully = NativeTracking.TrackNextFrame(frameNo, pixels, m_NativeTrackedObject);
        }