Esempio n. 1
0
        private List <TypeRaDec> CreateData2GridView(double[][] centerradac, double[][] RaDec, List <TypeKDTree> prediction, IDictionary <string, string> radec)
        {
            double ra   = Angle.FromHms(radec["OBJCTRA"]).Degs;
            double dec  = Angle.FromDms(radec["OBJCTDEC"]).Degs;
            var    list = new List <TypeRaDec>();

            for (int i = 0; i < centerradac.Length; i++)
            {
                //Console.WriteLine("[{0},{1}],", Math.Abs( centerradac[i][0] - 4096),Math.Abs( centerradac[i][1]- 4096));
                double[] xy = MethodStaticFomula.StandardCoordi(centerradac[i][0], centerradac[i][1], ra, dec);
                if (i < prediction.Count)
                {
                    list.Add(
                        new TypeRaDec()
                    {
                        X       = prediction[i].Nearest[0],
                        Y       = prediction[i].Nearest[1],
                        Ra      = RaDec[i][0],
                        Dec     = RaDec[i][1],
                        Distand = prediction[i].Distand
                    });
                }
            }



            return(list);
        }
Esempio n. 2
0
        public EmguCv(string file)
        {
            FitFiles = new FitsFile(file);
            MethodTranfrom Method = new MethodTranfrom(FitFiles.GenerateImage());

            this.fomula = new MethodStaticFomula();
            this.jpg    = Genarate2Jpg(Method.GetRaw()); // Create JPGE

            //this.raw = this.raw8bit.Mat.ToImage<Bgr, byte>();
            //this.raw8bit = Method.Convert1628(); // Create Raw
        }
Esempio n. 3
0
        private void PlatConstan()
        {
            int k = 0;

            double[] radecl = MethodStaticFomula.StandardCoordi(ra: RaDec[0][0], dec: RaDec[0][1], radec[0], radec[1]);
            PointRaDecPrediction = new double[result.Item5.Count][];
            test = new MathRaDec(predictresultxy);
            foreach (int[] i in result.Item5)
            {
                double[] re            = test.Tranfrom2invert(i);
                double[] resultPredict = MethodStaticFomula.InvertStandardCoordi(re[0], re[1], radec[0], radec[1]);
                PointRaDecPrediction[k] = resultPredict;
                k++;
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            progressBar1.Minimum = 0;
            progressBar1.Maximum = 100;


            Tuple <Image <Bgr, byte>, Image <Gray, byte>, IDictionary <string, string>, Image <Gray, byte>, VectorOfVectorOfPoint, List <int[]>, double[][]> result = this.objemgucv.SegmentionWatershed(10, false, TypeImage.JPG, centerRa2000GuessRads);

            double[] resultcvt = Convert2180(centerRa2000GuessRads.RARadCen, centerRa2000GuessRads.DecRadCen);

            database = (IFindFluent <GaiaInfo11, GaiaInfo11>)mongoLib.GeocenterSpherestring(resultcvt[0], resultcvt[1], 0.00396);
            //t = (IFindFluent<GaiaInfo11, GaiaInfo11>)mongoLib.GeocenterSpherestring(0, 0, 0.01);
            double[][] predictresultxy = mongoLib.XY2RaDec(data: result.Item6, radec: result.Item3);
            double[][] dbresultxy      = mongoLib.RaDec2XY(database, result.Item3);
            double[][] RaDec           = mongoLib.GetRaDec(data: database);
            imageBox5.Image = result.Item4;

            //label2.Text = Convert.ToString(centerRa2000GuessRads.NumPlate);


            //Setup kdt
            KDTreeCluster kdt = new KDTreeCluster(predictresultxy);

            kdt.SetupNode(kdt.tree.Root.Left.Right);
            int numberbar = 0;



            for (int i = 0; i < dbresultxy.Length; i++)
            {
                KDTreeNodeCollection <KDTreeNode <int> > kdtfilter = kdt.FindWithNeighbors(dbresultxy[i], 1);
                numberbar          = ((i * 100) / dbresultxy.Length) + 2;
                progressBar1.Value = numberbar;
                label2.Text        = String.Format("{0}%", numberbar.ToString());
                if (kdtfilter.Minimum != 0)
                {
                    kdt.Add(
                        new TypeKDTree()
                    {
                        Distand = kdtfilter.Minimum,
                        Nearest = kdtfilter.Nearest.Position,
                        Father  = dbresultxy[i]
                    }

                        );
                }
            }


            //MethodStaticFomula.ErrorArcSec(mensq);
            label1.Text = Convert.ToString(kdt.Count);



            //plot graph
            ZedGrahp(kdt.Query(), dbresultxy);



            double[] maimaxmean = kdt.MinMaxMean;
            Console.WriteLine("[INFO][MAX]{0}, [MIN{1}, [MEAN]{2}, [COUNT]{3}]", maimaxmean[0], maimaxmean[1], maimaxmean[2], kdt.Count);
            List <TypeKDTree> sigma1 = MethodStaticFomula.CreateSigma(kdt.Query(), maimaxmean[2]);

            kdt.Show();
            Console.WriteLine("[INFO][X][RMS][{0}]", MethodStaticFomula.RMS(sigma1, 0));
            Console.WriteLine("[INFO][Y][RMS][{0}]", MethodStaticFomula.RMS(sigma1, 1));
            //data
            data = CreateData2GridView(dbresultxy, RaDec, kdt.Query(), result.Item3);
            dataGridView1.DataSource = data;



            //---debug---
            //
            //string json = JsonConvert.SerializeObject(this.jsonPlan);
            //string databasejson = JsonConvert.SerializeObject(dbresult);
            //Console.WriteLine(databasejson);
            //JsonAstro.Save(@"C:\Users\specter\Desktop\Mongo\MongoDBControll\Json\plant.json", json);
            //JsonAstro.Save(@"C:\Users\specter\Desktop\Mongo\MongoDBControll\Json\db.json", databasejson);

            GC.Collect();
        }