Exemple #1
0
        public void ReConfigureNativeTracking(int width, int height)
        {
            // Stop running the tracking on new video frames
            IsTracking = false;
            NativeHelpers.StopTracking();

            // Configure the native tracker
            NativeTracking.ConfigureNativeTracker();

            int numObjects = 0;
            if (GuidingStar != null) numObjects++;
            if (TargetStar != null) numObjects++;

            NativeTracking.InitNewTracker(width, height, numObjects, TargetStar != null && TargetStar.IsFullDisapearance);

            TrackedObjectId = -1;
            GuidingObjectId = -1;

            if (TargetStar != null)
            {
                TrackedObjectId = 0;
                TargetStarConfig = new TrackedObjectConfig()
                {
                    IsFixedAperture = TargetStar.IsFixed,
                    IsFullDisapearance = TargetStar.IsFullDisapearance,
                    TrackingType = TargetStar.IsFullDisapearance ? TrackingType.OccultedStar : TrackingType.GuidingStar,
                    ApertureStartingX = TargetStar.X,
                    ApertureStartingY = TargetStar.Y,
                    ApertureInPixels = TargetStar.FWHM * Settings.Default.TrackingApertureInFWHM
                };

                NativeTracking.ConfigureTrackedObject(TrackedObjectId, TargetStarConfig);
            }

            if (GuidingStar != null)
            {
                GuidingObjectId = TargetStar != null ? 1 : 0;
                GuidingStarConfig = new TrackedObjectConfig()
                {
                    IsFixedAperture = false,
                    TrackingType = TrackingType.GuidingStar,
                    ApertureStartingX = GuidingStar.X,
                    ApertureStartingY = GuidingStar.Y,
                    ApertureInPixels = GuidingStar.FWHM * Settings.Default.TrackingApertureInFWHM
                };

                NativeTracking.ConfigureTrackedObject(GuidingObjectId, GuidingStarConfig);
            }

            NativeTracking.InitialiseNewTracking();

            // Start running the tracking on new video frames
            int frequency = GetFrequencyFromTrackingFrequency((TrackingFrequency)Settings.Default.TrackingFrequency);

            NativeHelpers.StartTracking(TrackedObjectId, GuidingObjectId, frequency,
                TargetStarConfig != null ? (float)TargetStarConfig.ApertureInPixels : 0,
                GuidingStarConfig != null ? (float)GuidingStarConfig.ApertureInPixels : 0,
                Settings.Default.TrackingInnerRadiusOfAnnulus, Settings.Default.TrackingMinNumberPixelsInAnnulus);

            IsTracking = true;
        }
Exemple #2
0
 internal static void ConfigureTrackedObject(int objectId, TrackedObjectConfig obj)
 {
     TrackerConfigureObject(
         objectId,
         obj.IsFixedAperture,
         obj.TrackingType == TrackingType.OccultedStar,
         obj.ApertureStartingX,
         obj.ApertureStartingY,
         obj.ApertureInPixels);
 }