private void SavePointCloudColor(PointCloud pc) { PointCloudScannerSettings.FileNameOBJ = DateTime.Now.Year.ToString() + "." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + "." + DateTime.Now.Hour.ToString() + "." + DateTime.Now.Minute.ToString() + "." + DateTime.Now.Second.ToString() + "_DepthAndColor.obj"; // PointCloud pc = PointCloud.FromDepthColors(myColorPixels, this.DepthMetaData.FrameData, DepthMetaData.XResDefault, DepthMetaData.YResDefault); UtilsPointCloudIO.ToObjFile_ColorInVertex(pc, pathModels, PointCloudScannerSettings.FileNameOBJ); }
public bool ToObjFile(string fileNameWithPath) { if (GLSettings.ShowPointCloudAsTexture) { return(UtilsPointCloudIO.ToObjFile_Texture(this, fileNameWithPath)); } else { return(UtilsPointCloudIO.ToObjFile_ColorInVertex(this, fileNameWithPath)); } }
public void ToObjFile(string path, string fileName) { if (GLSettings.ShowPointCloudAsTexture) { UtilsPointCloudIO.ToObjFile_Texture(this, path, fileName); } else { UtilsPointCloudIO.ToObjFile_ColorInVertex(this, path, fileName); } }
public override bool SavePointCloud(string path, string fileName) { try { if (ColorMetaData == null || DepthMetaData == null) { return(false); } //List<int> listToBeRemoved = new List<int>(); PointCloud pc = MetaDataBase.ToPointCloud(this.ColorMetaData, this.DepthMetaData, this.BodyMetaData, this.coordinateMapper); List <Vector3> vList = new List <Vector3>(); List <Vector3> cList = new List <Vector3>();; if (PointCloudScannerSettings.ShowFaceScanEllipse) { for (int i = pc.Count - 1; i >= 0; i--) { bool add = true; if (pc.Vectors[i].X > 0 && pc.Vectors[i].X > faceX) { add = false; } else if (pc.Vectors[i].X < 0 && pc.Vectors[i].X < -faceX) { add = false; } else if (pc.Vectors[i].Y > 0 && pc.Vectors[i].Y > faceY) { add = false; } else if (pc.Vectors[i].Y < 0 && pc.Vectors[i].Y < -faceY) { add = false; } if (add) { vList.Add(pc.Vectors[i]); cList.Add(pc.Colors[i]); } } } PointCloud pcNew = new OpenTKExtension.PointCloud(vList, cList, null, null, null, null); //pc.RemovePoints(listToBeRemoved); return(UtilsPointCloudIO.ToObjFile_ColorInVertex(pcNew, path + "\\" + fileName)); } catch (Exception err) { System.Windows.Forms.MessageBox.Show("SW Error - error saving Point cloud: " + err.Message); return(false); } }
public void SaveDepthPoints() { if (this.DepthMetaData == null) { MessageBox.Show("No Depth Data to save - please capture, or open last saved depth data"); return; } //ushort[] rotatedPoints = DepthMetaData.RotateDepthFrame(this.DepthMetaData.FrameData, DepthMetaData.XResDefault, DepthMetaData.YResDefault); List <Vector3> listPoints = DepthMetaData.CreateListPoints_Depth(this.DepthMetaData.FrameData, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect); GLSettings.FileNamePointCloudLast1 = DateTime.Now.Year.ToString() + "." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + "." + DateTime.Now.Hour.ToString() + "." + DateTime.Now.Minute.ToString() + "." + DateTime.Now.Second.ToString() + "_PointCloud.xyz"; UtilsPointCloudIO.ToXYZFile(listPoints, GLSettings.FileNamePointCloudLast1, pathModels); }
private void SaveDepthPointsInterpolated() { if (listPointsInterpolated == null) { return; } //----------------------------------------------- //now interpolate last 10 frames to one frame and save PointCloudScannerSettings.InterpolateFrames = true; GLSettings.FileNamePointCloudLast1 = DateTime.Now.Year.ToString() + "." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Day.ToString() + "." + DateTime.Now.Hour.ToString() + "." + DateTime.Now.Minute.ToString() + "." + DateTime.Now.Second.ToString() + "_PointCloudInterpolated.xyz"; UtilsPointCloudIO.ToXYZFile(listPointsInterpolated, GLSettings.FileNamePointCloudLast1, pathModels); }
private void triangulate() { this.openGLUC1.RemoveAllPointClouds(); PointCloud pc = faceMatcher.Humanoid.ToPointCloud(); //pc.TriangulateVertices_Rednaxela(0.1f); this.openGLUC1.ShowPointCloud(pc); UtilsPointCloudIO.ToObjFile_ColorInVertex(pc, pathModels, "modelTriangulated.obj"); }
/// <summary> /// reads the PLY file ONLY with the special format used also in the write_PLY method /// </summary> /// <param name="path"></param> /// <param name="fileName"></param> /// <param name="depthData"></param> /// <returns></returns> public static void ReadDepthWithColor_OBJ(string path, string fileName, ref ushort[] depthData, ref byte[] colorPixelArray) { ushort[,] depth = null; byte[,] colorInfoR = null; byte[,] colorInfoG = null; byte[,] colorInfoB = null; byte[,] colorInfoA = null; UtilsPointCloudIO.ObjFileToArray(path, fileName, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect, ref depth, ref colorInfoR, ref colorInfoG, ref colorInfoB, ref colorInfoA); depthData = UtilsPointCloudIO.CreatePointArrayOneDim(depth, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect); colorPixelArray = CreateColorPixelArray(colorInfoR, colorInfoG, colorInfoB, colorInfoA); }
public override bool SavePointCloud(string fileName) { if (this.DepthMetaData.Vectors != null) { //PointCloud pcTest = PointCloud.FromVector3List(this.depthVectors); PointCloud pc = PointCloud.FromListVector3(this.DepthMetaData.Vectors); if (pc != null) { UtilsPointCloudIO.ToObjFile_ColorInVertex(pc, PathModels, fileName); } //UtilsPointCloudIO.ToObjFile(pc, PathModels, ImageExtensions.DateTimeString() + "PointCloud_" + this.scannerID.ToString() + ".obj"); //UtilsPointCloudIO.Write_OBJ_Test(pc, pcTest, pathModels, "ObjTest" + this.RealSenseCameraNumber.ToString() + "_" + DateTime.Now.ToFileTimeUtc() + ".obj"); } else { System.Windows.Forms.MessageBox.Show("Nothing to save"); } return(true); }
private void ReadXYZFile(string fileName) { this.FileNameLong = fileName; IOUtils.ExtractDirectoryAndNameFromFileName(this.FileNameLong, out this.Name, out this.Path); List <Vector3> colors = new List <Vector3>(); List <Vector3> normals = new List <Vector3>(); List <uint> indices = new List <uint>(); List <uint> indicesNormals = new List <uint>(); List <Vector2> textures = new List <Vector2>(); List <Vector3> vectors = UtilsPointCloudIO.FromXYZ_Vectors(fileName); for (uint i = 0; i < vectors.Count; i++) { indices.Add(i); colors.Add(new Vector3(1f, 1f, 1f)); } AssignData(vectors, colors, normals, indices, indicesNormals, textures); }
public PointCloud(string fileName) { string str = System.IO.Path.GetExtension(fileName).ToLower(); //this.Name = IOUtils.ExtractFileNameShort(fileName); //this.Name = IOUtils.ExtractFileNameWithoutExtension(this.Name); if (str == ".obj") { UtilsPointCloudIO.PointCloudFromObjectFile(this, fileName); } else { System.Windows.Forms.MessageBox.Show("SW Error - inconsistend use of constructor Model"); return; } if (GLSettings.PointCloudCentered) { if (!this.DisregardCenteredShowing) { this.ResetCentroid(true); } } if (GLSettings.BoundingBoxLeftStartsAt000) { if (this.DisregardCenteredShowing) { this.Translate_StartAt_Y0(); } //this.PointCloud.Translate_StartAtBoundingBox000(); } this.Name = IOUtils.ExtractFileNameWithoutExtension(this.Name); }
public void OpenSavedDepthData() { List <OpenTK.Vector3> listPoints = UtilsPointCloudIO.Read_XYZ_Vectors(pathModels, GLSettings.FileNamePointCloudLast1); this.DepthMetaData = new DepthMetaData(listPoints, false); }
public static PointCloud FromObjFile(string path, string fileOBJ) { return(UtilsPointCloudIO.FromObjFile(path + "\\" + fileOBJ)); }
public static PointCloud FromObjFile(string fileOBJ) { return(UtilsPointCloudIO.FromObjFile(fileOBJ)); }