public static double Test5_CubeScale_Uniform(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult) { myVerticesTarget = Vertices.CreateCube_Corners(50); myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget); VertexUtils.ScaleByFactor(myVerticesSource, 0.2); myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource); return(IterativeClosestPointTransform.Instance.MeanDistance); }
public static double Test5_CubeRotateTranslate_ScaleUniform(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult) { myVerticesTarget = Vertices.CreateCube_Corners(50); myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget); VertexUtils.TranslateVertices(myVerticesSource, 220, -300, 127); VertexUtils.ScaleByFactor(myVerticesSource, 0.2); 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); }