Exemplo n.º 1
0
        public void KDTree()
        {
            kdt = new KDTreeCluster(PointRaDecPrediction);
            kdt.SetupNode(kdt.tree.Root.Left.Right);
            int numberbar = 0;

            for (int i = 0; i < RaDec.Length; i++)
            {
                KDTreeNodeCollection <KDTreeNode <int> > kdtfilter = kdt.FindWithNeighbors(RaDec[i], 1);
                numberbar          = ((i * 100) / RaDec.Length);
                TyTask.progreebar3 = numberbar;
                if (kdtfilter.Minimum != 0)
                {
                    kdt.Add(
                        new TypeKDTree()
                    {
                        Distand = kdtfilter.Minimum,
                        Nearest = kdtfilter.Nearest.Position,
                        Father  = RaDec[i]
                    }

                        );
                }
            }
        }
Exemplo n.º 2
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();
        }