コード例 #1
0
ファイル: Overlay.cs プロジェクト: griderd/StellarAnalysis
 public Overlay(SkyObject[] objects, int width, int height, PixelFormat pixelFormat)
 {
     this.objects = objects;
     thickness = (int)(((double)width) * (10.0f / 5465.0f));
     BuildOverlay(width, height, pixelFormat);
 }
コード例 #2
0
        /// <summary>
        /// Automatically identifies objects in the image based on their locations. Requires two objects to be identified manually.
        /// </summary>
        /// <param name="unidentified">A list of objects that could not be identified.</param>
        /// <returns>Returns true if there are enough starter IDs. Otherwise returns false.</returns>
        public bool AutoIdentify(out SkyObject[] unidentified)
        {
            List<SkyObject> unid = new List<SkyObject>();

            SkyObject a, b;
            a = b = null;

            for (int i = 0; i < objects.Count; i++)
            {
                if (objects[i].CatEntry != null)
                {
                    if (a == null)
                        a = objects[i];
                    else if (b == null)
                        b = objects[i];
                    else
                        break;
                }
            }

            if (b == null)
            {
                unidentified = null;
                return false;
            }

            PointVector pA = new PointVector(a.Location);
            PointVector pB = new PointVector(b.Location);
            PointVector pDiff = pA - pB;

            SkyVector sA = a.CatEntry.Position;
            SkyVector sB = b.CatEntry.Position;
            SkyVector sDiff = sA - sB;

            double xScaleLength = sDiff.RA.Degrees.Fractional / pDiff.X;
            double yScaleLength = sDiff.DE.Fractional / pDiff.Y;

            for (int i = 0; i < objects.Count; i++)
            {
                if (objects[i].CatEntry != null)
                    continue;

                PointVector pObj = new PointVector(objects[i].Location);
                PointVector pObjDiff = pA - pObj;

                double xScaleDiff = xScaleLength * pObjDiff.X;
                double yScaleDiff = yScaleLength * pObjDiff.Y;
                SkyVector scaleDiff = new SkyVector(new HourAngle(xScaleDiff), yScaleDiff);

                SkyVector objPos = sA - scaleDiff;

                // Try to find star in catalog
                CatalogEntry entry;
                if (Program.GC.GetStarAtPosition(objPos, 0.025f, 0.025f, out entry))
                {
                    objects[i].CatEntry = entry;
                }
                else
                {
                    objects[i].Position = objPos;
                    unid.Add(objects[i]);
                }
            }

            unidentified = unid.ToArray();
            return true;
        }
コード例 #3
0
        public void CountBlobs(int minWidth, int minHeight, int maxWidth, int maxHeight, bool coupled)
        {
            BlobCounter blobs = new BlobCounter();
            blobs.FilterBlobs = true;

            blobs.MinWidth = minWidth;
            blobs.MinHeight = minHeight;
            blobs.MaxWidth = maxWidth;
            blobs.MaxHeight = maxHeight;

            blobs.ProcessImage(image.DisplayImage);
            Blob[] objs = blobs.GetObjects(image.DisplayImage, false);

            for (int i = 0; i < objs.Length; i++)
            {
                SkyObject o = new SkyObject(objs[i]);
                objects.Add(o);
            }

            overlay = new Overlay(objects.ToArray(), image.Width, image.Height, image.PixelFormat);
            AddFilter(new Add(overlay.image.display));
        }
コード例 #4
0
 /// <summary>
 /// Adds an object to the list.
 /// </summary>
 /// <param name="obj"></param>
 public void AddObject(SkyObject obj)
 {
     objects.Add(obj);
 }
コード例 #5
0
 public bool RemoveObject(SkyObject obj)
 {
     return objects.Remove(obj);
 }
コード例 #6
0
 public frmAddIdentity(SkyObject obj)
 {
     InitializeComponent();
     Obj = obj;
 }