本文整理汇总了C#中CvMat.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# CvMat.ToArray方法的具体用法?C# CvMat.ToArray怎么用?C# CvMat.ToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvMat
的用法示例。
在下文中一共展示了CvMat.ToArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializableCvMat
public SerializableCvMat(CvMat mat)
{
this.Cols = mat.Cols;
this.Rows = mat.Rows;
this.ElemType = mat.ElemType;
this.Array = mat.ToArray();
}
示例2: CalculateReprojectionError
private double CalculateReprojectionError(List<Vector3> _imagePositions, int pointsCount, CvMat imagePoints, CvMat objectPoints, CvMat intrinsic, CvMat distortion, CvMat rotation_, CvMat translation_)
{
// openCV SSD taken from http://stackoverflow.com/questions/23781089/opencv-calibratecamera-2-reprojection-error-and-custom-computed-one-not-agree
CvMat imagePointsOut = PutImagePointsIntoCVMat(_imagePositions, pointsCount); // will be overwritten, but should be correct size. Hacky and slow imp
Cv.ProjectPoints2(objectPoints, rotation_, translation_, intrinsic, distortion, imagePointsOut);
var ar1 = imagePoints.ToArray();
var ar2 = imagePointsOut.ToArray();
double diff = 0.0f;
for (int i = 0; i < pointsCount; i++)
{
diff = diff + System.Math.Pow(System.Math.Abs(ar1[i].Val0 - ar2[i].Val0), 2.0) + System.Math.Pow(System.Math.Abs(ar1[i].Val1 - ar2[i].Val1), 2.0);
}
diff = System.Math.Sqrt(diff / pointsCount);
return diff;
}