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] } ); } } }
/// <summary> /// Computes a numerical score measuring the association between /// the given <paramref name="input" /> vector and each class. /// </summary> /// <param name="input">The input vector.</param> /// <param name="result">An array where the result will be stored, /// avoiding unnecessary memory allocations.</param> /// <returns>System.Double[].</returns> public override double[] Scores(double[] input, double[] result) { if (this.weightedTree == null) { KDTreeNodeCollection <KDTreeNode <int> > neighbors = tree.Nearest(input, this.K); foreach (NodeDistance <KDTreeNode <int> > point in neighbors) { int label = point.Node.Value; double d = point.Distance; // Convert to similarity measure result[label] += 1.0 / (1.0 + d); } } else { KDTreeNodeCollection <KDTreeNode <Tuple <int, double> > > neighbors = weightedTree.Nearest(input, this.K); foreach (NodeDistance <KDTreeNode <Tuple <int, double> > > point in neighbors) { int label = point.Node.Value.Item1; double weight = point.Node.Value.Item2; double d = point.Distance; // Convert to similarity measure result[label] += (1.0 / (1.0 + d)) * weight; } } return(result); }
/// <summary> /// Returns the closest cluster to an input point. /// </summary> /// /// <param name="point">The input vector.</param> /// <returns> /// The index of the nearest cluster /// to the given data point. </returns> /// public int Nearest(double[] point) { KDTreeNodeCollection <int> result = tree.Nearest(point, 1); if (result.Count > 0) { return(result.Nearest.Value); } return(-1); }
/// <summary> /// Computes a numerical score measuring the association between /// the given <paramref name="input" /> vector and each class. /// </summary> /// <param name="input">The input vector.</param> /// <param name="result">An array where the result will be stored, /// avoiding unnecessary memory allocations.</param> /// <returns>System.Double[].</returns> public override double[] Scores(double[] input, double[] result) { KDTreeNodeCollection <KDTreeNode <int> > neighbors = tree.Nearest(input, this.K); foreach (NodeDistance <KDTreeNode <int> > point in neighbors) { int label = point.Node.Value; double d = point.Distance; // Convert to similarity measure result[label] += 1.0 / (1.0 + d); } return(result); }
/// <summary> /// Gets the top <see cref="KNearestNeighbors{T}.K"/> points that are the closest /// to a given <paramref name="input">reference point</paramref>. /// </summary> /// /// <param name="input">The query point whose neighbors will be found.</param> /// <param name="labels">The label for each neighboring point.</param> /// /// <returns> /// An array containing the top <see cref="KNearestNeighbors{T}.K"/> points that are /// at the closest possible distance to <paramref name="input"/>. /// </returns> /// public override double[][] GetNearestNeighbors(double[] input, out int[] labels) { KDTreeNodeCollection <int> neighbors = tree.Nearest(input, this.K); double[][] points = new double[neighbors.Count][]; labels = new int[points.Length]; int k = 0; foreach (KDTreeNodeDistance <int> point in neighbors) { points[k] = point.Node.Position; labels[k] = point.Node.Value; k++; } return(points); }
public void NearestTest3() { double[][] points = { new double[] { 1, 1 }, new double[] { 1, 2 }, new double[] { 1, 3 }, new double[] { 1, 4 }, new double[] { 1, 5 }, new double[] { 2, 1 }, new double[] { 2, 2 }, new double[] { 2, 3 }, new double[] { 2, 4 }, new double[] { 2, 5 }, new double[] { 3, 1 }, new double[] { 3, 2 }, new double[] { 3, 3 }, new double[] { 3, 4 }, new double[] { 3, 5 }, new double[] { 4, 1 }, new double[] { 4, 2 }, new double[] { 4, 3 }, new double[] { 4, 4 }, new double[] { 4, 5 }, new double[] { 5, 1 }, new double[] { 5, 2 }, new double[] { 5, 3 }, new double[] { 5, 4 }, new double[] { 5, 5 }, }; var tree = KDTree.FromData <int>(points); tree.Distance = Accord.Math.Distance.Manhattan; for (int i = 0; i < points.Length; i++) { var retrieval = tree.Nearest(points[i], 1); Assert.AreEqual(1, retrieval.Count); Assert.AreEqual(points[i][0], retrieval[0].Node.Position[0]); Assert.AreEqual(points[i][1], retrieval[0].Node.Position[1]); } KDTreeNodeCollection <int> result = tree.Nearest(new double[] { 3, 3 }, 5); double[][] expected = { new double[] { 2, 3 }, new double[] { 3, 2 },new double[] { 3, 3 }, new double[] { 3, 4 }, new double[] { 4, 3 }, }; Assert.AreEqual(expected.Length, result.Count); double[][] actual = (from node in result select node.Node.Position).ToArray(); for (int i = 0; i < expected.Length; i++) { Assert.IsTrue(actual.Contains(expected[i], new CustomComparer <double[]>((a, b) => a.IsEqual(b) ? 0 : 1))); } }
/// <summary> /// Computes the most likely label of a new given point. /// </summary> /// /// <param name="input">A point to be classified.</param> /// <param name="scores">The distance score for each possible class.</param> /// /// <returns>The most likely label for the given point.</returns> /// public override int Compute(double[] input, out double[] scores) { KDTreeNodeCollection <int> neighbors = tree.Nearest(input, this.K); scores = new double[ClassCount]; foreach (var point in neighbors) { int label = point.Node.Value; double d = point.Distance; // Convert to similarity measure scores[label] += 1.0 / (1.0 + d); } // Get the maximum weighted score int result; scores.Max(out result); return(result); }
//returns normal of the point, based on the neighbours in KDtree private static double[] GetNormal(double[] point, KDTreeNodeCollection <KDTreeNode> neighbors) { var covarianceMatrix = Matrix.Create(3, 3, 0.0); foreach (var node in neighbors) { var piX = node.Node.Position[0]; var piY = node.Node.Position[1]; var piZ = node.Node.Position[2]; var matrix = Matrix.Create(new[] { new[] { piX - point[0] }, new[] { piY - point[1] }, new[] { piZ - point[2] } }); var currC = matrix.DotWithTransposed(matrix); covarianceMatrix = currC.Add(covarianceMatrix); } var decomposition = new EigenvalueDecomposition(covarianceMatrix, true, true, true);//already sorted - descending order var normalX = decomposition.Eigenvectors[0, 2]; var normalY = decomposition.Eigenvectors[1, 2]; var normalZ = decomposition.Eigenvectors[2, 2]; return(new[] { normalX, normalY, normalZ }); }
/// <summary> /// Gets the top <see cref="BaseKNearestNeighbors{TModel, TInput, TDistance}.K"/> points that are the closest /// to a given <paramref name="input">reference point</paramref>. /// </summary> /// /// <param name="input">The query point whose neighbors will be found.</param> /// <param name="labels">The label for each neighboring point.</param> /// /// <returns> /// An array containing the top <see cref="BaseKNearestNeighbors{TModel, TInput, TDistance}.K"/> points that are /// at the closest possible distance to <paramref name="input"/>. /// </returns> /// public override double[][] GetNearestNeighbors(double[] input, out int[] labels) { double[][] points; if (weightedTree == null) { KDTreeNodeCollection <KDTreeNode <int> > neighbors = tree.Nearest(input, this.K); points = new double[neighbors.Count][]; labels = new int[neighbors.Count]; int k = 0; foreach (NodeDistance <KDTreeNode <int> > point in neighbors) { points[k] = point.Node.Position; labels[k] = point.Node.Value; k++; } } else { KDTreeNodeCollection <KDTreeNode <Tuple <int, double> > > neighbors = weightedTree.Nearest(input, this.K); points = new double[neighbors.Count][]; labels = new int[neighbors.Count]; int k = 0; foreach (NodeDistance <KDTreeNode <Tuple <int, double> > > point in neighbors) { points[k] = point.Node.Position; labels[k] = point.Node.Value.Item1; k++; } } return(points); }
public void FromDataTest() { // This is the same example found in Wikipedia page on // k-d trees: http://en.wikipedia.org/wiki/K-d_tree // Suppose we have the following set of points: double[][] points = { new double[] { 2, 3 }, new double[] { 5, 4 }, new double[] { 9, 6 }, new double[] { 4, 7 }, new double[] { 8, 1 }, new double[] { 7, 2 }, }; // To create a tree from a set of points, we use KDTree <int> tree = KDTree.FromData <int>(points); // Now we can manually navigate the tree KDTreeNode <int> node = tree.Root.Left.Right; // Or traverse it automatically foreach (KDTreeNode <int> n in tree) { double[] location = n.Position; Assert.AreEqual(2, location.Length); } // Given a query point, we can also query for other // points which are near this point within a radius double[] query = new double[] { 5, 3 }; // Locate all nearby points within an Euclidean distance of 1.5 // (answer should be a single point located at position (5,4)) List <KDTreeNodeDistance <int> > result = tree.Nearest(query, radius: 1.5); // We can also use alternate distance functions tree.Distance = Accord.Math.Distance.Manhattan; // And also query for a fixed number of neighbor points // (answer should be the points at (5,4), (7,2), (2,3)) KDTreeNodeCollection <int> neighbors = tree.Nearest(query, neighbors: 3); Assert.IsTrue(node.IsLeaf); Assert.IsFalse(tree.Root.IsLeaf); Assert.AreEqual(1, result.Count); Assert.AreEqual("(5,4)", result[0].Node.ToString()); Assert.AreEqual(3, neighbors.Count); Assert.AreEqual("(5,4)", neighbors[2].Node.ToString()); Assert.AreEqual("(7,2)", neighbors[1].Node.ToString()); Assert.AreEqual("(2,3)", neighbors[0].Node.ToString()); Assert.AreEqual(7, tree.Root.Position[0]); Assert.AreEqual(2, tree.Root.Position[1]); Assert.AreEqual(0, tree.Root.Axis); Assert.AreEqual(5, tree.Root.Left.Position[0]); Assert.AreEqual(4, tree.Root.Left.Position[1]); Assert.AreEqual(1, tree.Root.Left.Axis); Assert.AreEqual(9, tree.Root.Right.Position[0]); Assert.AreEqual(6, tree.Root.Right.Position[1]); Assert.AreEqual(1, tree.Root.Right.Axis); Assert.AreEqual(2, tree.Root.Left.Left.Position[0]); Assert.AreEqual(3, tree.Root.Left.Left.Position[1]); Assert.AreEqual(0, tree.Root.Left.Left.Axis); Assert.AreEqual(4, tree.Root.Left.Right.Position[0]); Assert.AreEqual(7, tree.Root.Left.Right.Position[1]); Assert.AreEqual(0, tree.Root.Left.Right.Axis); Assert.AreEqual(8, tree.Root.Right.Left.Position[0]); Assert.AreEqual(1, tree.Root.Right.Left.Position[1]); Assert.AreEqual(0, tree.Root.Right.Left.Axis); Assert.IsNull(tree.Root.Right.Right); }
public List <ImageRecord> QueryImage(string queryImagePath, out string messageToLog, SurfSettings surfSetting = null) { List <ImageRecord> rtnImageList = new List <ImageRecord>(); #region Diagnostic Region Stopwatch sw = new Stopwatch(); long _loadingTime, _modelImageDectionlong, _queryingTime, _treeQuery, _loopTime = 0; #endregion Diagnostic Region #region Get KD-Tree Index sw.Reset(); sw.Start(); //--------------Getting Indexed Records SurfAccordDataSet surfAccordDataset; bool isExist = CacheHelper.Get <SurfAccordDataSet>("SurfAccordDataSet", out surfAccordDataset); if (!isExist) { string repoFileStoragePath = Path.Combine(DirectoryHelper.SaveDirectoryPath, "SurfAccordDataSet.bin"); if (!File.Exists(repoFileStoragePath)) { string exMsg = string.Format("Can't get the Surf Index at {0}, please index first", repoFileStoragePath); throw new FileNotFoundException(exMsg); } using (FileStream s = File.OpenRead(repoFileStoragePath)) { //Polenter.Serialization.SharpSerializerBinarySettings bs = // new Polenter.Serialization.SharpSerializerBinarySettings(Polenter.Serialization.BinarySerializationMode.SizeOptimized); //Polenter.Serialization.SharpSerializer formatter = new Polenter.Serialization.SharpSerializer(bs); //formatter.Serialize(surfAccordDataset, s); System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); surfAccordDataset = (SurfAccordDataSet)formatter.Deserialize(s); s.Close(); } CacheHelper.Add <SurfAccordDataSet>(surfAccordDataset, "SurfAccordDataSet"); } if (surfAccordDataset == null) { throw new InvalidOperationException("Can't get the Surf Index, please index first"); } sw.Stop(); _loadingTime = sw.ElapsedMilliseconds; #endregion #region Surf Dectator Region double hessianThresh = 500; double uniquenessThreshold = 0.8; int goodMatchDistThreshold = 0; if (surfSetting != null) { hessianThresh = surfSetting.HessianThresh.Value; uniquenessThreshold = surfSetting.UniquenessThreshold.Value; goodMatchDistThreshold = surfSetting.GoodMatchThreshold.Value; } float hessianThreshold2 = (float)hessianThresh / 1000000; SpeededUpRobustFeaturesDetector surf = new SpeededUpRobustFeaturesDetector(hessianThreshold2); #endregion Surf Dectator Region #region Get Model Dectection and Validation sw.Reset(); sw.Start(); List <SpeededUpRobustFeaturePoint> modelImageSurfPoints; using (Bitmap modelImage = (Bitmap)Image.FromFile(queryImagePath)) { modelImageSurfPoints = surf.ProcessImage(modelImage); } if (modelImageSurfPoints == null || modelImageSurfPoints.Count < 4) { throw new InvalidOperationException("Insuffucient interesting point in query image, try another query image"); } sw.Stop(); _modelImageDectionlong = sw.ElapsedMilliseconds; #endregion #region Search Images sw.Reset(); sw.Start(); //------------Search Images Accord.MachineLearning.Structures.KDTree <int> tree = surfAccordDataset.IndexedTree; double[][] listofQueryDescriptors = modelImageSurfPoints.Select(ft => ft.Descriptor).ToArray(); double[] myscores = new double[listofQueryDescriptors.Length]; int[] labels = Enumerable.Repeat(-1, listofQueryDescriptors.Length).ToArray(); for (int i = 0; i < listofQueryDescriptors.Length; i++) { KDTreeNodeCollection <int> neighbors = tree.ApproximateNearest(listofQueryDescriptors[i], 2, 90d); //KDTreeNodeCollection<int> neighbors = tree.Nearest(listofQueryDescriptors[i], uniquenessThreshold, 2); Dictionary <int, double> keyValueStore = new Dictionary <int, double>(); double similarityDist = 0; foreach (KDTreeNodeDistance <int> point in neighbors) { int label = point.Node.Value; double d = point.Distance; // Convert to similarity measure if (keyValueStore.ContainsKey(label)) { similarityDist = keyValueStore[label]; similarityDist += 1.0 / (1.0 + d); keyValueStore[label] = similarityDist; } else { similarityDist = 1.0 / (1.0 + d); keyValueStore.Add(label, similarityDist); } } if (keyValueStore.Count > 0) { int maxIndex = keyValueStore.Aggregate((l, r) => l.Value > r.Value ? l : r).Key; labels[i] = maxIndex; double sumOfAllValues = keyValueStore.Values.Sum(); myscores[i] = keyValueStore[maxIndex] / sumOfAllValues; } } sw.Stop(); _queryingTime = sw.ElapsedMilliseconds; sw.Reset(); sw.Start(); List <SURFRecord1> listOfSurfImages = surfAccordDataset.SurfImageIndexRecord; //----------Create Interval Tree from ImageMetaData IntervalTreeLib.IntervalTree <SURFRecord1, int> intervalTree; bool isTreeExist = CacheHelper.Get <IntervalTreeLib.IntervalTree <SURFRecord1, int> >("SurfAccordIntervalTree", out intervalTree); if (!isTreeExist) { intervalTree = new IntervalTreeLib.IntervalTree <SURFRecord1, int>(); foreach (var record in listOfSurfImages) { intervalTree.AddInterval(record.IndexStart, record.IndexEnd, record); } CacheHelper.Add <IntervalTreeLib.IntervalTree <SURFRecord1, int> >(intervalTree, "SurfAccordIntervalTree"); } //--------------Matching Target image similarity for (int i = 0; i < listofQueryDescriptors.Length; i++) { int rowNum = labels[i]; if (rowNum == -1) { continue; } double dist = myscores[i]; SURFRecord1 rec = intervalTree.Get(rowNum, IntervalTreeLib.StubMode.ContainsStartThenEnd).FirstOrDefault(); rec.Distance++; } sw.Stop(); _loopTime = sw.ElapsedMilliseconds; #endregion string msg = String.Format("Loading: {0}, Model detection: {1}, Querying: {2}, Looping: {3}", _loadingTime, _modelImageDectionlong, _queryingTime, _loopTime); messageToLog = msg; rtnImageList = listOfSurfImages.Where(rec => rec.Distance > goodMatchDistThreshold) .OrderByDescending(rec => rec.Distance) .ToList <ImageRecord>(); return(rtnImageList); }
//reads LAZ, builds KD tree, reads LAZ again and sets color & normal and writes private void ReadWriteLaz() { var lazReader = new laszip_dll(); var compressed = true; var filePath = ResourceDirectoryPath + id + "-laz13.laz"; lazReader.laszip_open_reader(filePath, ref compressed); var numberOfPoints = lazReader.header.number_of_point_records; //var kdTree = new KDTree(3); var kdTree = new KdTree <double, object>(3, new KdTree.Math.DoubleMath(), AddDuplicateBehavior.Update); if (IncludeNormals) { Console.WriteLine("[#{0} {1:hh:mm:ss}] Reading LAZ and building KD tree...", id, DateTime.Now); for (var pointIndex = 0; pointIndex < numberOfPoints; pointIndex++) { var coordArray = new double[3]; lazReader.laszip_read_point(); lazReader.laszip_get_coordinates(coordArray); //Thread.Sleep(1); //kdTree.Add(coordArray); kdTree.Add(coordArray, null); //Console.WriteLine("Point {0} {1} {2}", coordArray[0], coordArray[1], coordArray[2]); } //Console.WriteLine("[DONE] "); Console.WriteLine("[#{0} {1:hh:mm:ss}] Balancing KD tree...", id, DateTime.Now); kdTree.Balance(); //Console.WriteLine("[DONE] "); } var img = GetOrthophotoImg(); Console.WriteLine("[#{0} {1:hh:mm:ss}] Reading and writing LAZ...", id, DateTime.Now); lazReader.laszip_seek_point(0L);//read from the beginning again lazReader.laszip_open_reader(filePath, ref compressed); var lazWriter = new laszip_dll(); lazWriter.header = lazReader.header; lazWriter.laszip_open_writer(ResourceDirectoryPath + "SloveniaLidarRGB" + id + ".laz", true); stw = new Stopwatch(); stw.Restart(); for (var pointIndex = 0; pointIndex < numberOfPoints; pointIndex++) { if (pointIndex % 100000 == 0) { double elaspedHours = stw.Elapsed.TotalHours; double finishedShare = (double)pointIndex / numberOfPoints; double totalHours = elaspedHours / finishedShare; double remainingHours = totalHours - elaspedHours; Console.WriteLine( "[#{0} {1:hh:mm:ss}] Finished " + (pointIndex / 1000) + "k / " + (numberOfPoints / 1000) + "k | " + Math.Round(remainingHours, 2) + " hours remaining", id, DateTime.Now); } var coordArray = new double[3]; lazReader.laszip_read_point(); lazReader.laszip_get_coordinates(coordArray); lazWriter.point = lazReader.point; int[] pxCoordinates = FindClosestPxCoordinates(coordArray[0], coordArray[1]); int i = (pxCoordinates[0] - _bottomLeftX) * 2; int j = img.Height - 1 - ((pxCoordinates[1] - _bottomLeftY) * 2); //j index of image goes from top to bottom Color color = img.GetPixel(i, j); //binary int value lazReader.point.rgb = new[] { (ushort)(color.R << 8), (ushort)(color.G << 8), (ushort)(color.B << 8), (ushort)0 }; if (IncludeNormals) { //var kNeighbours = kdTree.ApproximateNearest(coordArray, 20, 1000); var kNeighbours = kdTree.GetNearestNeighbours(coordArray, 20); var collection = new KDTreeNodeCollection <KDTreeNode>(20); for (int k = 0; k < 20; k++) { collection.Add(new KDTreeNode { Position = kNeighbours[k].Point }, 0); } var normal = GetNormal(coordArray, collection); lazReader.point.rgb[0] |= (byte)((normal[0] + 1.0) * 128.0); lazReader.point.rgb[1] |= (byte)((normal[1] + 1.0) * 128.0); lazReader.point.rgb[2] |= (byte)((normal[2] + 1.0) * 128.0); /*var xt = (float)normal[0];//xt in LAS is float * var yt = (float)normal[1]; * var zt = (float)normal[2]; * * var xtBytes = BitConverter.GetBytes(xt); * var ytBytes = BitConverter.GetBytes(yt); * var ztBytes = BitConverter.GetBytes(zt); * * var waveformPacket = lazWriter.point.wave_packet; * waveformPacket[17] = xtBytes[0]; * waveformPacket[18] = xtBytes[1]; * waveformPacket[19] = xtBytes[2]; * waveformPacket[20] = xtBytes[3]; * * waveformPacket[21] = ytBytes[0]; * waveformPacket[22] = ytBytes[1]; * waveformPacket[23] = ytBytes[2]; * waveformPacket[24] = ytBytes[3]; * * waveformPacket[25] = ztBytes[0]; * waveformPacket[26] = ztBytes[1]; * waveformPacket[27] = ztBytes[2]; * waveformPacket[28] = ztBytes[3];*/ } lazWriter.laszip_write_point(); } lazReader.laszip_close_reader(); lazWriter.laszip_close_writer(); //Console.WriteLine("[DONE]"); }//end readwrite function
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(); }