//private static List<Vertex> verticesTarget; //private static List<Vertex> verticesSource; // private static List<Vertex> vectorsResult; public static double Test1_Translation(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult) { myVerticesTarget = Vertices.CreateSomePoints(); myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget); VertexUtils.TranslateVertices(myVerticesSource, 10, 3, 8); myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource); return(IterativeClosestPointTransform.Instance.MeanDistance); }
public static double Test5_CubeTranslation(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult) { myVerticesTarget = Vertices.CreateCube_Corners(50); myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget); VertexUtils.TranslateVertices(myVerticesSource, 0, -300, 0); myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource); return(IterativeClosestPointTransform.Instance.MeanDistance); }
public static double Test5_CubeRotateTranslate_ScaleInhomogenous(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult) { myVerticesTarget = Vertices.CreateCube_Corners(50); myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget); VertexUtils.TranslateVertices(myVerticesSource, 0, 0, 149); VertexUtils.ScaleByVector(myVerticesSource, new Vertex(1, 2, 3)); Matrix3d R = new Matrix3d(); R = R.RotateSome(); VertexUtils.RotateVertices(myVerticesSource, R); myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource); return(IterativeClosestPointTransform.Instance.MeanDistance); }
public void TransformPointCloud_SaveObjFile() { //open a file DepthMetaData DepthMetaData = new DepthMetaData(); byte[] colorInfo = null; DepthMetaData.ReadDepthWithColor_OBJ(path, "KinectFace1.obj", ref DepthMetaData.FrameData, ref colorInfo); List <Vector3d> myVectors = Vertices.ConvertToVector3DList_FromArray(DepthMetaData.FrameData, DepthMetaData.XResDefault, DepthMetaData.YResDefault); List <float[]> myColorsFloats = PointCloudUtils.CreateColorInfo(colorInfo, DepthMetaData.FrameData, DepthMetaData.XResDefault, DepthMetaData.YResDefault); List <Vertex> myVertexList = Model3D.CreateVertexList(myVectors, myColorsFloats); VertexUtils.ScaleByFactor(myVertexList, 0.9); VertexUtils.RotateVertices30Degrees(myVertexList); VertexUtils.TranslateVertices(myVertexList, 10, 3, 5); Model3D.Save_ListVertices_Obj(myVertexList, path, "transformed.obj"); }
public static double Test7_Face_KnownTransformation(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult) { string path = AppDomain.CurrentDomain.BaseDirectory + "TestData"; Model3D model3DTarget = new Model3D(path + "\\KinectFace1.obj"); myVerticesTarget = model3DTarget.VertexList; Vertices.GetVertexMax(myVerticesTarget); myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget); VertexUtils.ScaleByFactor(myVerticesSource, 0.9); Matrix3d R = new Matrix3d(); R = R.Rotation60Degrees(); VertexUtils.RotateVertices(myVerticesSource, R); VertexUtils.TranslateVertices(myVerticesSource, 0.3, 0.5, -0.4); myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource); return(IterativeClosestPointTransform.Instance.MeanDistance); }