コード例 #1
0
 private static double[,] ConvertToDoubleArray(MatOfPoint3f aCentroidMatrix)
 {
     double[,] array = new double[aCentroidMatrix.Rows, 3];
     for (int i = 0; i < aCentroidMatrix.Rows; i++)
     {
         array[i, 0] = aCentroidMatrix.ElementAt(i).X;
         array[i, 1] = aCentroidMatrix.ElementAt(i).Y;
         array[i, 2] = aCentroidMatrix.ElementAt(i).Z;
     }
     return(array);
 }
コード例 #2
0
        private static MatOfPoint3f Subtract(MatOfPoint3f orig, MatOfPoint3f aCentroidMatrix)
        {
            MatOfPoint3f answer = new MatOfPoint3f();

            for (int i = 0; i < orig.Rows; i++)
            {
                answer.Add(orig.ElementAt(i) - aCentroidMatrix.ElementAt(i));
            }
            return(answer);
        }
コード例 #3
0
        private static Mat Reshape(MatOfPoint3f points)
        {
            Mat answer = new Mat(points.Rows, 3, MatType.CV_32FC1);

            for (int i = 0; i < points.Rows; i++)
            {
                var point = points.ElementAt(i);
                answer.Set <float>(i, 0, point.X);
                answer.Set <float>(i, 1, point.Y);
                answer.Set <float>(i, 2, point.Z);
            }
            return(answer);
        }
コード例 #4
0
        private static Mat ConvertToFC1(MatOfPoint3f orig)
        {
            Point3f[] pts = new Point3f[orig.Cols * orig.Rows];
            orig.CopyTo(pts, 0);
            Mat m = new Mat(orig.Rows, 3, MatType.CV_32FC1);

            for (int i = 0; i < orig.Rows; i++)
            {
                var pt = orig.ElementAt(i);
                m.SetArray(0, 0, pt.X);
                m.SetArray(0, 1, pt.Y);
                m.SetArray(0, 2, pt.Z);
            }
            return(m);
        }