Example #1
0
 public void TestLoggedPositionData()
 {
     Stream fileStream = new FileStream(@"C:\Temp\temp.location", FileMode.Open);
     PositionReader reader = new PositionReader(fileStream);
     using (Stream outputStream = new FileStream(@"C:\Temp\export.xyz", FileMode.Create))
     using(StreamWriter writer = new StreamWriter(outputStream))
     {
         for (int i = 0; i < reader.Count; i++)
         {
             Tuple<PositionData,long> data = reader.ReadPositionAt(i);
             writer.WriteLine(String.Format("{0},{1},{2}", data.Item1.X, data.Item1.Y, data.Item1.Z));
         }
     }
 }
        public SpatialReference(KinectReader kinectReader, PositionReader positionReader)
        {
            this.kinectReader = kinectReader;
            this.positionReader = positionReader;

            string wkt = "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.0174532925199433]]";
            this.wgs84 = (ICoordinateSystem)ProjNet.Converters.WellKnownText.CoordinateSystemWktReader.Parse(wkt);

            //hardcoded UTM 55S - should parameterize
            string toWKT = "PROJCS[\"WGS 72BE / UTM zone 55S\",GEOGCS[\"WGS 72BE\",DATUM[\"WGS_1972_Transit_Broadcast_Ephemeris\",SPHEROID[\"WGS 72\",6378135,298.26,AUTHORITY[\"EPSG\",\"7043\"]],TOWGS84[0,0,1.9,0,0,0.814,-0.38],AUTHORITY[\"EPSG\",\"6324\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4324\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",147],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"32555\"]]";

            this.toCs = (ICoordinateSystem)ProjNet.Converters.WellKnownText.CoordinateSystemWktReader.Parse(toWKT);

            CoordinateTransformationFactory ctfac = new CoordinateTransformationFactory();

            this.toGridtrans = ctfac.CreateFromCoordinateSystems(wgs84, toCs);
        }
Example #3
0
        public void TestRealWorld()
        {
            Stream fileStream = new FileStream(@"C:\Temp\2011_1_22_20_39.kinect", FileMode.Open);
            KinectReader kinectReader = new KinectReader(fileStream, 640, 480);

            Stream positionFileStream = new FileStream(@"C:\Temp\2011_1_22_20_39.location", FileMode.Open);
            PositionReader positionReader = new PositionReader(positionFileStream);

            SpatialReference reference = new SpatialReference(kinectReader, positionReader);

            KinectExporter exporter = new KinectExporter(null);
            using (Stream outputStream = new FileStream(@"C:\Temp\export.ply", FileMode.Create))
            {
                var points = reference.GetRealWorldPointCloudAt(33);

                for (int i = 34; i <50; i++)
                {
                    points.AddRange(reference.GetRealWorldPointCloudAt(i));
                }
                exporter.ExportPointsToPLY(points, outputStream);
            }
        }