public static float Test6_Bunny_PCA(ref PointCloud mypointCloudTarget, ref PointCloud mypointCloudSource, ref PointCloud mypointCloudResult) { mypointCloudTarget = new PointCloud(path + "\\bunny.obj"); mypointCloudSource = PointCloud.CloneAll(mypointCloudTarget); Matrix3 R = new Matrix3(); //ICP converges with a rotation of //R = R.RotationXYZ(60, 60, 60); R = R.RotationXYZDegrees(124, 124, 124); PointCloud.Rotate(mypointCloudSource, R); PCA pca = new PCA(); mypointCloudResult = pca.AlignPointClouds_SVD(mypointCloudSource, mypointCloudTarget); if (pca.MeanDistance > 1e-5) { mypointCloudResult = pca.AlignPointClouds_SVD(mypointCloudResult, mypointCloudTarget); } //mypointCloudResult = pca.AlignPointClouds_SVD(mypointCloudResult, mypointCloudTarget); //mypointCloudResult = IterativeClosestPointTransform.Instance.PerformICP(mypointCloudResult, mypointCloudTarget); return(IterativeClosestPointTransform.Instance.MeanDistance); }
public PointCloud PerformICP(PointCloud mypointsSource, PointCloud myPointsTarget) { this.PTarget = myPointsTarget; this.PSource = mypointsSource; ResetToCenterOfMass(); if (this.ICPSettings.Prealign_PCA) { PCA pca = new PCA(); pca.MaxmimumIterations = 1; pca.AxesRotateEffect = false; this.PSource = pca.AlignPointClouds_SVD(this.PSource, this.PTarget); } if (ICPSettings.ICPVersion == ICP_VersionUsed.UsingStitchData) { return(PerformICP_Stitching()); } else if (ICPSettings.ICPVersion == ICP_VersionUsed.RandomPoints) { return(PerformICP()); } else { return(PerformICP()); } }
public static double Test7_Face_KnownTransformation_PCA_15000(ref PointCloudVertices myPCLTarget, ref PointCloudVertices myPCLSource, ref PointCloudVertices myPCLResult) { string path = AppDomain.CurrentDomain.BaseDirectory + "Models\\UnitTests"; Model model3DTarget = new Model(path + "\\KinectFace_1_15000.obj"); myPCLTarget = model3DTarget.PointCloudVertices; myPCLSource = PointCloudVertices.CloneVertices(myPCLTarget); PointCloudVertices.ScaleByFactor(myPCLSource, 0.9f); Matrix3d R = new Matrix3d(); R = R.RotationXYZDegrees(60, 60, 60); PointCloudVertices.Rotate(myPCLSource, R); PointCloudVertices.Translate(myPCLSource, 0.3f, 0.5f, -0.4f); PCA pca = new PCA(); myPCLResult = pca.AlignPointClouds_SVD(myPCLSource, myPCLTarget); myPCLSource = myPCLResult; myPCLResult = IterativeClosestPointTransform.Instance.PerformICP(myPCLSource, myPCLTarget); return(IterativeClosestPointTransform.Instance.MeanDistance); }
public static float Test7_Face_KnownTransformation_PCA_55000(ref PointCloud mypointCloudTarget, ref PointCloud mypointCloudSource, ref PointCloud mypointCloudResult) { string path = AppDomain.CurrentDomain.BaseDirectory + "PointClouds\\UnitTests"; mypointCloudTarget = new PointCloud(path + "\\KinectFace_1_55000.obj"); mypointCloudSource = PointCloud.CloneAll(mypointCloudTarget); PointCloud.ScaleByFactor(mypointCloudSource, 0.9f); Matrix3 R = new Matrix3(); R = R.RotationXYZDegrees(60, 60, 60); PointCloud.Rotate(mypointCloudSource, R); PointCloud.Translate(mypointCloudSource, 0.3f, 0.5f, -0.4f); PCA pca = new PCA(); mypointCloudResult = pca.AlignPointClouds_SVD(mypointCloudSource, mypointCloudTarget); mypointCloudSource = mypointCloudResult; mypointCloudResult = IterativeClosestPointTransform.Instance.PerformICP(mypointCloudSource, mypointCloudTarget); return(IterativeClosestPointTransform.Instance.MeanDistance); }